90 lines
1.6 KiB
Vue
90 lines
1.6 KiB
Vue
<template>
|
|
<view class="new-detail">
|
|
<view class="title">
|
|
{{title}}
|
|
</view>
|
|
<view class="info-box">
|
|
<text>{{time}}</text>
|
|
</view>
|
|
<view class="content">
|
|
<!-- {{content}} -->
|
|
<u-parse :html="content"></u-parse>
|
|
</view>
|
|
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
title:'',
|
|
time:'',
|
|
content:'',
|
|
type:'',
|
|
hasRead:false,
|
|
}
|
|
},
|
|
onLoad(option){
|
|
if (option?.obj) {
|
|
let data = JSON.parse(decodeURIComponent(option.obj));
|
|
// this.type = data.type;
|
|
this.id = data.id;
|
|
this.time = data.createTime;
|
|
this.title = data.noticeTitle;
|
|
this.hasRead = data.hasRead;
|
|
// this.content = data.message;
|
|
this.getDetail(data.noticeId);
|
|
// this.readNew(data.noticeId);
|
|
}
|
|
},
|
|
methods:{
|
|
getDetail(id){
|
|
this.$api.getNewDetetail(id).then((res)=>{
|
|
console.log("获取消息详情",res)
|
|
if(res.code == 200){
|
|
this.content = res.data.noticeContent;
|
|
if(!this.hasRead){
|
|
this.readNew(this.id);
|
|
}
|
|
}
|
|
}).catch(()=>{
|
|
})
|
|
},
|
|
readNew(id){
|
|
console.log("触发读消息")
|
|
this.$api.readNew({id:id}).then((res)=>{
|
|
console.log("阅读消息",res)
|
|
}).catch(()=>{
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.new-detail{
|
|
padding: 20rpx;
|
|
.title{
|
|
font-weight: bold;
|
|
font-size: 42rpx;
|
|
text-align: center;
|
|
}
|
|
.info-box{
|
|
margin: 20rpx 0;
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
align-items: center;
|
|
text{
|
|
color: #999;
|
|
font-size: 24rpx;
|
|
}
|
|
}
|
|
.content{
|
|
text-indent: 56rpx;
|
|
font-size: 30rpx;
|
|
color: #666;
|
|
}
|
|
}
|
|
|
|
</style> |