feat(反馈): 修改反馈详情页跳转链接并支持反馈类型

重构文章详情页以支持反馈类型,添加获取反馈详情和标记已读功能
This commit is contained in:
砂糖
2025-11-07 10:45:43 +08:00
parent 884b1bb311
commit 750f66441b
2 changed files with 262 additions and 198 deletions

View File

@@ -13,7 +13,8 @@
<!-- 用户信息 --> <!-- 用户信息 -->
<view class="user-info"> <view class="user-info">
<image v-if="article.avatar" class="user-avatar" :src="article.avatar || '/static/default-avatar.png'" mode="cover"></image> <image v-if="article.avatar" class="user-avatar" :src="article.avatar || '/static/default-avatar.png'"
mode="cover"></image>
<view class="user-meta"> <view class="user-meta">
<view class="user-name"> <view class="user-name">
{{ article.author || '未知用户' }} {{ article.author || '未知用户' }}
@@ -41,7 +42,13 @@
</template> </template>
<script> <script>
import { getNotice } from '@/api/oa/notice'; import {
getNotice
} from '@/api/oa/notice';
import {
getFeedback,
toRead
} from "@/api/oa/feedback";
export default { export default {
data() { data() {
@@ -51,9 +58,15 @@ export default {
}; };
}, },
onLoad(options) { onLoad(options) {
const { type, id } = options; const {
type,
id
} = options;
if (!type || !id) { if (!type || !id) {
uni.showToast({ title: '参数错误', icon: 'none' }); uni.showToast({
title: '参数错误',
icon: 'none'
});
setTimeout(() => uni.navigateBack(), 1000); setTimeout(() => uni.navigateBack(), 1000);
return; return;
} }
@@ -72,23 +85,62 @@ export default {
title: res.data.noticeTitle, title: res.data.noticeTitle,
content: res.data.noticeContent, content: res.data.noticeContent,
}; };
uni.setNavigationBarTitle({
title: '通知详情'
})
this.loading = false; this.loading = false;
}) })
.catch(err => { .catch(err => {
console.error('获取文章失败', err); console.error('获取文章失败', err);
this.article = null; this.article = null;
this.loading = false; this.loading = false;
uni.showToast({ title: '加载失败', icon: 'none' }); uni.showToast({
title: '加载失败',
icon: 'none'
});
});
break;
case 'feedback':
getFeedback(id)
.then(res => {
if (res.data) {
this.article = res.data;
uni.setNavigationBarTitle({
title: '反馈详情'
})
// 标记为已读
toRead(this.article);
} else {
uni.showToast({
title: '未找到消息',
icon: 'none'
});
}
})
.catch(err => {
uni.showToast({
title: err.message || '获取消息失败',
icon: 'none'
});
})
.finally(() => {
this.loading = false;
}); });
break; break;
default: default:
uni.showToast({ title: '未知类型', icon: 'none' }); uni.showToast({
title: '未知类型',
icon: 'none'
});
setTimeout(() => uni.navigateBack(), 1000); setTimeout(() => uni.navigateBack(), 1000);
break; break;
} }
}, },
reload() { reload() {
const { type, id } = this.$options.onLoad.options; const {
type,
id
} = this.$options.onLoad.options;
this.fetchData(type, id); this.fetchData(type, id);
}, },
navigateBack() { navigateBack() {
@@ -110,6 +162,7 @@ export default {
align-items: center; align-items: center;
padding: 50px 0; padding: 50px 0;
} }
.loading-text { .loading-text {
margin-top: 10px; margin-top: 10px;
color: #666; color: #666;
@@ -122,11 +175,13 @@ export default {
align-items: center; align-items: center;
padding: 50px 0; padding: 50px 0;
} }
.error-text { .error-text {
margin: 15px 0; margin: 15px 0;
color: #ff4d4f; color: #ff4d4f;
font-size: 16px; font-size: 16px;
} }
.retry-btn { .retry-btn {
background-color: #007aff; background-color: #007aff;
color: #fff; color: #fff;
@@ -152,15 +207,18 @@ export default {
align-items: center; align-items: center;
margin-bottom: 16px; margin-bottom: 16px;
} }
.user-avatar { .user-avatar {
width: 40px; width: 40px;
height: 40px; height: 40px;
border-radius: 50%; border-radius: 50%;
margin-right: 10px; margin-right: 10px;
} }
.user-meta { .user-meta {
flex: 1; flex: 1;
} }
.user-name { .user-name {
display: flex; display: flex;
align-items: center; align-items: center;
@@ -168,6 +226,7 @@ export default {
color: #333; color: #333;
margin-bottom: 4px; margin-bottom: 4px;
} }
.user-level { .user-level {
background-color: #dff0d8; background-color: #dff0d8;
color: #5cb85c; color: #5cb85c;
@@ -176,10 +235,12 @@ export default {
border-radius: 3px; border-radius: 3px;
margin-left: 6px; margin-left: 6px;
} }
.user-time-area { .user-time-area {
font-size: 12px; font-size: 12px;
color: #999; color: #999;
} }
.follow-btn { .follow-btn {
font-size: 12px; font-size: 12px;
color: #5cb85c; color: #5cb85c;
@@ -193,6 +254,7 @@ export default {
color: #333; color: #333;
line-height: 1.8; line-height: 1.8;
} }
.mp-html img { .mp-html img {
max-width: 100%; max-width: 100%;
height: auto; height: auto;
@@ -207,6 +269,7 @@ export default {
padding: 10px 0; padding: 10px 0;
border-top: 1px solid #eee; border-top: 1px solid #eee;
} }
.interact-item { .interact-item {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -214,6 +277,7 @@ export default {
font-size: 12px; font-size: 12px;
color: #999; color: #999;
} }
.interact-count { .interact-count {
margin-top: 4px; margin-top: 4px;
} }

View File

@@ -219,7 +219,7 @@
// 跳转到详情页 // 跳转到详情页
navigateToDetail(msg) { navigateToDetail(msg) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/workbench/feedback/detail?feedbackId=${msg.feedbackId}` url: `/pages/workbench/article/article?id=${msg.feedbackId}&type=feedback`
}); });
}, },