Files
RentWeAppFront/pages/detail/guestbookDetail.vue

176 lines
3.8 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<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>