SmartStorage/pages/noticeDetail/noticeDetail.vue

69 lines
1.5 KiB
Vue
Raw Normal View History

2024-03-13 17:55:34 +08:00
<template>
2024-04-20 17:39:08 +08:00
<view>
<view class="notice-data">
<view>公告标题{{ listData.noticeTitle }}</view>
<view>创建者{{ listData.createBy }}</view>
<view>创建时间{{ listData.createTime }}</view>
2024-07-31 09:55:39 +08:00
<view>公告内容
<view style="margin-top: 15rpx;" v-html="listData.noticeContent">
</view>
</view>
2024-04-20 17:39:08 +08:00
</view>
</view>
2024-03-13 17:55:34 +08:00
</template>
2024-04-20 17:39:08 +08:00
<script>
export default {
data() {
return {
listData: ""
};
},
methods: {
extractTextFromHTML(htmlString) {
return htmlString.replace(/<[^>]*>/g, "");
}
},
onLoad(params) {
let that = this;
2024-07-31 09:55:39 +08:00
that.listData = ''
2024-04-20 17:39:08 +08:00
console.log(params.noticeId);
// 初始化请求单个公告详情
that.$api.index
2024-07-31 09:55:39 +08:00
.singleNotice(params.noticeId)
2024-04-20 17:39:08 +08:00
.then(res => {
console.log(res);
if (res.data.code == 200) {
2024-07-31 09:55:39 +08:00
res.data.rows.forEach(item => {
if (item.noticeId == params.noticeId) that.listData = item
})
/* let centent = decodeURIComponent(
2024-04-20 17:39:08 +08:00
escape(atob(that.listData.noticeContent))
);
2024-04-25 11:13:22 +08:00
that.listData.noticeContent = this.extractTextFromHTML(centent).replace(/&nbsp;/ig, "");
2024-07-31 09:55:39 +08:00
console.log(that.listData.noticeContent); */
2024-04-20 17:39:08 +08:00
}
})
.catch(err => {
console.log(err);
});
}
};
2024-03-13 17:55:34 +08:00
</script>
2024-04-20 17:39:08 +08:00
<style lang="scss">
.notice-data {
width: 90%;
margin: 20rpx auto;
display: flex;
flex-direction: column;
2024-07-31 09:55:39 +08:00
overflow-x: auto;
2024-04-20 17:39:08 +08:00
view {
margin-bottom: 15rpx;
}
view:last-child {
margin-bottom: 0;
}
}
2024-03-13 17:55:34 +08:00
</style>
2024-04-20 17:39:08 +08:00