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