增加公告详情

This commit is contained in:
TOP糯米 2023-03-26 21:18:39 +08:00
parent 33477e826e
commit 14fa445274
4 changed files with 104 additions and 20 deletions

View File

@ -24,7 +24,8 @@ const apis = {
showLoading: true, showLoading: true,
}, },
detail: { detail: {
url: "" url: "/wxapp/index/newinfobyid",
showLoading: true,
} }
} }
}, },

View File

@ -85,6 +85,12 @@
"style": { "style": {
"navigationBarTitleText": "订单详情" "navigationBarTitleText": "订单详情"
} }
},
{
"path": "pages/detail/detail",
"style": {
"navigationBarTitleText": "详情"
}
} }
], ],
"globalStyle": { "globalStyle": {

View File

@ -0,0 +1,89 @@
<template>
<app-layout :title="pageTitle">
<div class="message-container">
<view class="head">
<text class="title limit-line clamp-1">{{ info.title }}</text>
<text class="date">{{ info.date }}</text>
</view>
<view class="body">
<rich-text :nodes="info.content"></rich-text>
</view>
</div>
</app-layout>
</template>
<script>
import AppLayout from "@/components/layout/layout";
export default {
name: "detail-detail",
data() {
return {
pageTitle: "",
info: {
title: "",
date: "",
content: "",
},
};
},
components: {
AppLayout,
},
onLoad(e) {
if (!e.id || !e.type) {
return this.$utils.toast("参数错误").then(() => {
this.$utilst.toPage("", {}, "back");
});
}
if (e.type == "message") {
this.$request({
api: "system.notify.detail",
data: {
id: e.id,
},
}).then((response) => {
if (response.code == 1) {
this.info = {
title: response.data.title,
date: response.data.times,
content: response.data.message,
};
} else {
this.$utils.toast(response.msg);
}
});
}
},
onShow() {},
onReady() {},
onHide() {},
onReachBottom() {},
onPullDownRefresh() {},
methods: {},
};
</script>
<style lang="less" scoped>
.message-container {
width: 100%;
box-sizing: border-box;
padding: 40rpx;
.head {
width: 100%;
font-size: 30rpx;
font-weight: bold;
line-height: 30rpx;
.title {
color: #333333;
}
.date {
display: inline-block;
color: #999999;
margin-top: 24rpx;
}
}
.body {
margin-top: 40rpx;
}
}
</style>

View File

@ -19,25 +19,19 @@
> >
<swiper-item v-for="(item, index) in tabList" :key="index"> <swiper-item v-for="(item, index) in tabList" :key="index">
<view :class="['tab' + index]"> <view :class="['tab' + index]">
<view class="message-item" v-for="(v, k) in item.list" :key="k" @click="toDetail(v)"> <view class="message-item" v-for="(v, k) in item.list" :key="k" @click="toDetail(k, v)">
<text class="title limit-line clamp-1">{{ v.title }}</text> <text class="title limit-line clamp-1" :class="{ active: v.read == 0 }">{{ v.title }}</text>
<text class="date">{{ v.date }}</text> <text class="date">{{ v.date }}</text>
</view> </view>
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>
</view> </view>
<widget-modal v-show="showDetail" :title="detail.title" @close="showDetail = false">
<view class="message-box">
<rich-text :nodes="detail.content"></rich-text>
</view>
</widget-modal>
</app-layout> </app-layout>
</template> </template>
<script> <script>
import AppLayout from "@/components/layout/layout"; import AppLayout from "@/components/layout/layout";
import WidgetModal from "@/components/widgets/modal";
import { mapState } from "vuex"; import { mapState } from "vuex";
export default { export default {
name: "message", name: "message",
@ -49,16 +43,10 @@ export default {
tabIndex: 0, tabIndex: 0,
tabHeight: 0, tabHeight: 0,
tabList: [], tabList: [],
showDetail: false,
detail: {
title: "",
content: "",
},
}; };
}, },
components: { components: {
AppLayout, AppLayout,
WidgetModal,
}, },
computed: { computed: {
...mapState({ ...mapState({
@ -124,13 +112,13 @@ export default {
*/ */
loadList() { loadList() {
let currentTab = this.tabList[this.tabIndex]; let currentTab = this.tabList[this.tabIndex];
console.log(currentTab);
this.$models.system.notifyList(currentTab.id, currentTab.page).then((list) => { this.$models.system.notifyList(currentTab.id, currentTab.page).then((list) => {
if (list.length > 0) { if (list.length > 0) {
list.forEach((item) => { list.forEach((item) => {
currentTab.list.push({ currentTab.list.push({
id: item.id, id: item.id,
title: item.title, title: item.title,
read: item.see,
date: item.times, date: item.times,
content: item.message, content: item.message,
}); });
@ -147,10 +135,10 @@ export default {
/** /**
* 详情 * 详情
*/ */
toDetail(detail) { toDetail(index, detail) {
this.showDetail = true; let currentTab = this.tabList[this.tabIndex];
this.detail.title = detail.title; currentTab.list[index].read = 1;
this.detail.content = detail.content; this.$utils.toPage("/pages/detail/detail?type=message&id=" + detail.id);
}, },
}, },
}; };