留言板/留言板详情/消息中心/设置页面样式优化

This commit is contained in:
2025-12-27 17:22:45 +08:00
parent fb8a6cc27e
commit 7cd3dc373f
10 changed files with 461 additions and 24 deletions

View File

@@ -354,6 +354,22 @@
"navigationBarTitleText": "我的预约", "navigationBarTitleText": "我的预约",
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
},
{
"path": "pages/message/guestbook",
"style": {
"navigationStyle": "custom" ,// 隐藏系统导航栏
"navigationBarTitleText": "留言板",
"enablePullDownRefresh": false
}
},
{
"path": "pages/detail/guestbookDetail",
"style": {
"navigationStyle": "custom" ,// 隐藏系统导航栏
"navigationBarTitleText": "留言详情",
"enablePullDownRefresh": false
}
} }
], ],
"globalStyle": { "globalStyle": {

View File

@@ -309,7 +309,7 @@
}, },
onShow() { onShow() {
this.checkToken(); // this.checkToken();
}, },

View File

@@ -0,0 +1,176 @@
<template>
<view class="page-view">
<!-- 顶部导航栏 -->
<customNavbar title="留言详情" :is-transparent="navbarStyle.isTransparent" :bg-color="navbarStyle.bgColor"
:text-color="navbarStyle.textColor" :opacity="navbarStyle.opacity" :extra-icons="navbarStyle.extraIcons"
:show-home="false" />
<!-- 留言详情内容 -->
<view class="detail-container">
<view class="detail-card">
<!-- 反馈内容标题 -->
<view class="content-title">反馈内容</view>
<!-- 反馈内容文本 -->
<view class="content-text">
反馈内容反馈内容反馈内容反馈内容反馈内容反馈内容反馈内容反馈内容反馈内容反馈内容反馈内容...
</view>
<!-- 底部信息时间和状态 -->
<view class="bottom-info">
<text class="detail-time">2023年10-26 14:30</text>
<view class="status-tag">
<text class="status-dot"></text>
<text class="status-text">待处理</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
// 导航栏样式控制
navbarStyle: {
isTransparent: true,
bgColor: '#ffffff',
textColor: '#000000',
opacity: 0,
extraIcons: ['ellipsis', 'eye'] // 右侧额外图标
},
// 滚动距离
scrollTop: 0,
// 留言详情数据
messageDetail: {}
}
},
onPageScroll(e) {
this.scrollTop = e.scrollTop;
// 计算导航栏透明度和样式
this.updateNavbarStyle(e.scrollTop);
},
onLoad(options) {
// 从路由参数中获取留言ID
this.messageId = options.id;
// 调用接口获取留言详情
// this.getGuestbookDetail();
},
methods: {
// 调用接口获取留言详情
getGuestbookDetail() {
uni.request({
url: '/guestbook/detail',
method: 'GET',
data: {
id: this.messageId
},
success: (res) => {
if (res.statusCode === 200) {
// 成功获取留言详情,更新页面数据
this.messageDetail = res.data;
} else {
uni.showToast({
title: '获取留言详情失败',
icon: 'none'
});
}
}
});
},
// 根据滚动距离更新导航栏样式
updateNavbarStyle(scrollTop) {
// 定义滚动阈值,超过此值导航栏变为不透明
const threshold = 200;
// 计算透明度
let opacity = scrollTop / threshold;
opacity = Math.min(opacity, 1);
opacity = Math.max(opacity, 0);
// 更新导航栏样式
this.navbarStyle.opacity = opacity;
if (opacity > 0.5) {
this.navbarStyle.isTransparent = false;
} else {
this.navbarStyle.isTransparent = true;
}
},
}
}
</script>
<style scoped>
.page-view {
/* 给导航栏留空间 */
padding-top: 120rpx;
min-height: 100vh;
position: relative;
background: linear-gradient(0deg, #F3F1ED 43%, #F5E9DB 100%);
}
.detail-container {
padding: 30rpx 40rpx;
}
.detail-card {
background-color: #ffffff;
border-radius: 12rpx;
padding: 32rpx;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);
}
.content-title {
font-size: 30rpx;
font-weight: 500;
color: #2D2B2C;
margin-bottom: 24rpx;
}
.content-text {
font-size: 30rpx;
color: #585858;
line-height: 44rpx;
padding: 24rpx;
background-color: #f9f9f9;
border-radius: 8rpx;
margin-bottom: 24rpx;
word-break: break-all;
}
.bottom-info {
display: flex;
justify-content: space-between;
align-items: center;
padding-top: 20rpx;
}
.detail-time {
font-size: 30rpx;
color: #86868C;
}
.status-tag {
display: flex;
align-items: center;
}
.status-dot {
display: inline-block;
width: 31rpx;
height: 31rpx;
border-radius: 50%;
background-color: #fff;
border: 10rpx solid #6688FC;
margin-right: 10rpx;
}
.status-text {
font-size: 30rpx;
color: #6688FC;
margin-top: -5rpx;
}
</style>

View File

@@ -210,7 +210,7 @@
{ {
name: "留言板", name: "留言板",
src: "/static/index/留言板.png", src: "/static/index/留言板.png",
url: "pages/form/leaseCancel" url: "pages/message/guestbook"
} }
], ],
loadStatus: 'loadmore', loadStatus: 'loadmore',

209
pages/message/guestbook.vue Normal file
View File

@@ -0,0 +1,209 @@
<template>
<view class="page-view">
<!-- 顶部导航栏 -->
<customNavbar title="留言板" :is-transparent="navbarStyle.isTransparent" :bg-color="navbarStyle.bgColor"
:text-color="navbarStyle.textColor" :opacity="navbarStyle.opacity" :extra-icons="navbarStyle.extraIcons"
:show-home="false" />
<!-- 留言列表 -->
<scroll-view scroll-y="true" class="scroll-view">
<view class="message-item" v-for="(item, index) in messageList" :key="index" @click="navigateToDetail(item)">
<view class="message-header">
<text :class="['status-tag', item.status]">{{ item.statusText }}</text>
<text class="message-title">留言内容</text>
</view>
<view class="message-content">
<text class="content-text">{{ item.content }}</text>
</view>
<view class="message-footer">
<text class="message-time">留言时间{{ item.time }}</text>
</view>
</view>
</scroll-view>
<!-- 底部新增留言按钮 -->
<view class="add-btn-container">
<button class="add-btn" @click="addMessage">新增留言</button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
messageList: [{
id: 1,
status: 'processed',
statusText: '已处理',
content: '留言内容摘要留言内容摘要留言内容摘要留言内容摘要留言内容摘要留言内容摘要',
time: '2024-02-02'
},
{
id: 2,
status: 'processing',
statusText: '处理中',
content: '留言内容摘要留言内容摘要留言内容摘要留言内容摘要留言内容摘要留言内容摘要',
time: '2024-02-02'
},
{
id: 3,
status: 'pending',
statusText: '待处理',
content: '留言内容摘要留言内容摘要留言内容摘要留言内容摘要留言内容摘要留言内容摘要',
time: '2024-02-02'
}
],
// 导航栏样式控制
navbarStyle: {
isTransparent: true,
bgColor: '#ffffff',
textColor: '#000000',
opacity: 0,
extraIcons: ['ellipsis', 'eye'] // 右侧额外图标
},
// 滚动距离
scrollTop: 0
}
},
onPageScroll(e) {
this.scrollTop = e.scrollTop;
// 计算导航栏透明度和样式
this.updateNavbarStyle(e.scrollTop);
},
methods: {
// 点击留言项跳转到详情页
navigateToDetail(item) {
uni.navigateTo({
url: `/pages/detail/guestbookDetail?id=${item.id}`,
});
},
addMessage() {
// 新增留言逻辑
uni.showToast({
title: '新增留言',
icon: 'none'
});
},
// 根据滚动距离更新导航栏样式
updateNavbarStyle(scrollTop) {
// 定义滚动阈值,超过此值导航栏变为不透明
const threshold = 200;
// 计算透明度
let opacity = scrollTop / threshold;
opacity = Math.min(opacity, 1);
opacity = Math.max(opacity, 0);
// 更新导航栏样式
this.navbarStyle.opacity = opacity;
if (opacity > 0.5) {
this.navbarStyle.isTransparent = false;
} else {
this.navbarStyle.isTransparent = true;
}
},
}
}
</script>
<style scoped>
.page-view {
/* 给导航栏留空间 */
padding-top: 120rpx;
min-height: 100vh;
position: relative;
background: linear-gradient(0deg, #F3F1ED 43%, #F5E9DB 100%);
}
.scroll-view {
height: calc(100vh - 120rpx - 120rpx);
padding: 20rpx 0;
}
.message-item {
background-color: #ffffff;
border-radius: 10rpx;
padding: 32rpx;
padding-left: 95rpx;
width: 92%;
margin: auto;
margin-bottom: 20rpx;
}
.message-header {
display: flex;
align-items: center;
margin-bottom: 20rpx;
}
.status-tag {
font-size: 24rpx;
padding: 6rpx 16rpx;
border-radius: 21rpx;
margin-right: 20rpx;
color: #ffffff;
position: absolute;
left: 10rpx;
}
.status-tag.processed {
background: linear-gradient(90deg, #F34038 0%, #FF7C76 100%);
box-shadow: 0rpx 0rpx 7rpx 0rpx #FB392A;
}
.status-tag.processing {
background: linear-gradient(90deg, #FEAF04 0%, #FFC145 100%);
box-shadow: 0rpx 0rpx 7rpx 0rpx #FFBF41;
}
.status-tag.pending {
background: linear-gradient(90deg, #6688FC 0%, #809BFB 100%);
box-shadow: 0rpx 0rpx 7rpx 0rpx #7E99FB;
}
.message-title {
font-size: 30rpx;
font-weight: 500;
color: #2D2B2C;
}
.message-content {
margin-bottom: 20rpx;
}
.content-text {
font-size: 24rpx;
color: #86868C;
line-height: 44rpx;
}
.message-time {
font-size: 24rpx;
color: #ADADB1;
}
.add-btn-container {
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: 30rpx 40rpx;
background-color: #f5f5f5;
box-shadow: 0 -2rpx 12rpx rgba(0, 0, 0, 0.05);
}
.add-btn {
width: 100%;
height: 80rpx;
background: linear-gradient(90deg, #FF6F63 0%, #FB392A 100%);
border-radius: 10rpx;
color: #ffffff;
font-size: 32rpx;
border: none;
display: flex;
align-items: center;
justify-content: center;
}
</style>

View File

@@ -12,7 +12,8 @@
<scroll-view scroll-y class="message-list"> <scroll-view scroll-y class="message-list">
<view v-for="(msg,index) in messages" :key="index" class="msg-item u-flex u-row-between" @click="viewMessage(msg)"> <view v-for="(msg,index) in messages" :key="index" class="msg-item u-flex u-row-between" @click="viewMessage(msg)">
<view class="u-flex"> <view class="u-flex">
<u-icon :name="msg.icon" size="48" :color="msg.read ? '#ccc' : 'cornflowerblue'"></u-icon> <!-- <u-icon :name="msg.icon" size="48" :color="msg.read ? '#ccc' : 'cornflowerblue'"></u-icon> -->
<image :src="msg.icon"></image>
<view class="msg-content u-m-l-20"> <view class="msg-content u-m-l-20">
<view class="msg-title u-font-16">{{ msg.title }}</view> <view class="msg-title u-font-16">{{ msg.title }}</view>
<view class="msg-desc u-tips-color u-font-12 u-line-2">{{ msg.desc }}</view> <view class="msg-desc u-tips-color u-font-12 u-line-2">{{ msg.desc }}</view>
@@ -39,21 +40,21 @@ export default {
title: '账单提醒', title: '账单提醒',
desc: '您的本月房租账单已生成,请在到期日前完成支付。', desc: '您的本月房租账单已生成,请在到期日前完成支付。',
time: '2025-10-29 09:12', time: '2025-10-29 09:12',
icon: 'file-text', icon: '/static/icon/msg-1.png',
read: false read: false
}, },
{ {
title: '系统通知', title: '系统通知',
desc: '恭喜您成功升级为魔力会员,快来看看新增的特权吧!', desc: '恭喜您成功升级为魔力会员,快来看看新增的特权吧!',
time: '2025-10-28 18:46', time: '2025-10-28 18:46',
icon: 'bell', icon: '/static/icon/msg-2.png',
read: true read: true
}, },
{ {
title: '活动优惠', title: '活动优惠',
desc: '限时会员活动租惠卡用户房租95折快来参与', desc: '限时会员活动租惠卡用户房租95折快来参与',
time: '2025-10-27 14:03', time: '2025-10-27 14:03',
icon: 'gift', icon: '/static/icon/msg-3.png',
read: false read: false
} }
], ],
@@ -76,7 +77,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.message-page { .message-page {
background-color: #f7f8fa; background-color: #ffffff;
min-height: 100vh; min-height: 100vh;
} }
@@ -86,13 +87,16 @@ export default {
} }
.msg-item { .msg-item {
background: #fff; padding: 20rpx;
border-radius: 16rpx;
padding: 30rpx 20rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
align-items: flex-start; align-items: flex-start;
position: relative; position: relative;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04); border-bottom: 1px solid #E6E6E6;
image{
width: 88rpx;
height: 88rpx;
}
} }
.msg-content { .msg-content {
@@ -112,11 +116,15 @@ export default {
justify-content: space-between; justify-content: space-between;
} }
.msg-time{
position: absolute;
}
.unread-dot { .unread-dot {
width: 14rpx; width: 14rpx;
height: 14rpx; height: 14rpx;
background-color: #ff4d4f; background-color: #ff4d4f;
border-radius: 50%; border-radius: 50%;
margin-top: 10rpx; margin-top: 50rpx;
} }
</style> </style>

View File

@@ -2,7 +2,7 @@
<view> <view>
<u-navbar :is-back="true" title="设置" :border-bottom="false"> <u-navbar :is-back="true" title="设置" :border-bottom="false">
</u-navbar> </u-navbar>
<view> <view class="setting-content">
<u-cell-group> <u-cell-group>
<u-cell-item title="个人信息" @click="profile"></u-cell-item> <u-cell-item title="个人信息" @click="profile"></u-cell-item>
<u-cell-item title="修改密码" @click="changePassword"></u-cell-item> <u-cell-item title="修改密码" @click="changePassword"></u-cell-item>
@@ -10,7 +10,7 @@
</view> </view>
<view class="btn"> <view class="btn">
<u-button type="default" @click="logout" plain>退出登录</u-button> <u-button @click="logout" plain>退出登录</u-button>
</view> </view>
<view class="version">Version {{vuex_version}}</view> <view class="version">Version {{vuex_version}}</view>
@@ -28,7 +28,7 @@
}, },
methods: { methods: {
profile(){ profile() {
this.$u.route('/pages/profile/profile') this.$u.route('/pages/profile/profile')
}, },
logout() { logout() {
@@ -36,10 +36,10 @@
this.$u.vuex('vuex_token', ''); this.$u.vuex('vuex_token', '');
this.$u.vuex('vuex_user', {}); this.$u.vuex('vuex_user', {});
return uni.reLaunch({ return uni.reLaunch({
url:'../index/index' url: '../index/index'
}) })
}, },
changePassword(){ changePassword() {
this.$u.route('/pages/profile/password') this.$u.route('/pages/profile/password')
} }
} }
@@ -47,8 +47,36 @@
</script> </script>
<style lang="scss"> <style lang="scss">
.setting-content {
padding: 0rpx 20rpx;
border-radius: 10rpx;
background: #FFFFFF;
width: 94%;
margin: 20rpx auto;
&::v-deep .u-cell{
color: #222222 !important;
}
&::v-deep .u-cell_title{
font-size: 30rpx !important;
}
}
.btn { .btn {
margin: 20rpx; width: 94%;
margin: 30rpx auto;
&::v-deep .u-btn {
border-radius: 10rpx;
font-size: 36rpx !important;
color: #EA4047 !important;
border: 0 !important;
}
&::v-deep .u-hairline-border:after {
border: 0 !important;
}
} }
.version { .version {

BIN
static/icon/msg-1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
static/icon/msg-2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
static/icon/msg-3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB