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">
<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-name">
{{ article.author || '未知用户' }}
@@ -41,9 +42,15 @@
</template>
<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() {
return {
article: null,
@@ -51,9 +58,15 @@ export default {
};
},
onLoad(options) {
const { type, id } = options;
const {
type,
id
} = options;
if (!type || !id) {
uni.showToast({ title: '参数错误', icon: 'none' });
uni.showToast({
title: '参数错误',
icon: 'none'
});
setTimeout(() => uni.navigateBack(), 1000);
return;
}
@@ -72,149 +85,200 @@ export default {
title: res.data.noticeTitle,
content: res.data.noticeContent,
};
uni.setNavigationBarTitle({
title: '通知详情'
})
this.loading = false;
})
.catch(err => {
console.error('获取文章失败', err);
this.article = null;
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;
default:
uni.showToast({ title: '未知类型', icon: 'none' });
uni.showToast({
title: '未知类型',
icon: 'none'
});
setTimeout(() => uni.navigateBack(), 1000);
break;
}
},
reload() {
const { type, id } = this.$options.onLoad.options;
const {
type,
id
} = this.$options.onLoad.options;
this.fetchData(type, id);
},
navigateBack() {
uni.navigateBack();
}
}
};
};
</script>
<style scoped>
.article-container {
.article-container {
min-height: 100vh;
background-color: #fff;
}
}
.loading {
.loading {
display: flex;
flex-direction: column;
align-items: center;
padding: 50px 0;
}
.loading-text {
}
.loading-text {
margin-top: 10px;
color: #666;
font-size: 14px;
}
}
.error {
.error {
display: flex;
flex-direction: column;
align-items: center;
padding: 50px 0;
}
.error-text {
}
.error-text {
margin: 15px 0;
color: #ff4d4f;
font-size: 16px;
}
.retry-btn {
}
.retry-btn {
background-color: #007aff;
color: #fff;
border-radius: 4px;
padding: 8px 20px;
font-size: 14px;
}
}
.article-content {
.article-content {
padding: 16px;
}
}
.post-title {
.post-title {
font-size: 18px;
font-weight: bold;
color: #333;
margin-bottom: 12px;
line-height: 1.4;
}
}
.user-info {
.user-info {
display: flex;
align-items: center;
margin-bottom: 16px;
}
.user-avatar {
}
.user-avatar {
width: 40px;
height: 40px;
border-radius: 50%;
margin-right: 10px;
}
.user-meta {
}
.user-meta {
flex: 1;
}
.user-name {
}
.user-name {
display: flex;
align-items: center;
font-size: 14px;
color: #333;
margin-bottom: 4px;
}
.user-level {
}
.user-level {
background-color: #dff0d8;
color: #5cb85c;
font-size: 10px;
padding: 1px 4px;
border-radius: 3px;
margin-left: 6px;
}
.user-time-area {
}
.user-time-area {
font-size: 12px;
color: #999;
}
.follow-btn {
}
.follow-btn {
font-size: 12px;
color: #5cb85c;
background-color: #e8f5e9;
padding: 4px 8px;
border-radius: 12px;
}
}
.mp-html {
.mp-html {
font-size: 15px;
color: #333;
line-height: 1.8;
}
.mp-html img {
}
.mp-html img {
max-width: 100%;
height: auto;
margin: 10px 0;
border-radius: 8px;
}
}
.interact-area {
.interact-area {
display: flex;
justify-content: space-around;
margin-top: 20px;
padding: 10px 0;
border-top: 1px solid #eee;
}
.interact-item {
}
.interact-item {
display: flex;
flex-direction: column;
align-items: center;
font-size: 12px;
color: #999;
}
.interact-count {
}
.interact-count {
margin-top: 4px;
}
}
</style>

View File

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