hz-zhhq-app/pages/healthMsg/healthMsgDetail.vue

111 lines
2.1 KiB
Vue
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="hzIndex">
<hzHeader title="健康知识资讯详情"></hzHeader>
<view class="container hzContent">
<view class="title">{{item.title}}</view>
<view v-if="item.create_time" class="content">
<view class="time">{{'发布日期:'+formatDate(item.create_time)}}</view>
<view class="uni-common-mt" style="padding:20upx;">
<rich-text :nodes="item.content"></rich-text>
</view>
</view>
</view>
</view>
</template>
<script>
import {
getHealthMsgDetail
} from '@/common/api.js';
import {
callbackRequest,
alertTip,
compare,
formatDate
} from '@/common/util.js';
export default {
components: {},
data() {
return {
id: 0,
item: {},
formatDate: formatDate,
};
},
onLoad(options) {
this.id = options.id;
this.getHealthMsgDetail();
},
methods: {
getHealthMsgDetail() {
let params = {
method: getHealthMsgDetail, // 申请的审批
data: {
id: this.id
} //分三种情况
};
callbackRequest(params)
.then(res => {
if (res.data.returnCode == 1) {
this.item = res.data.returnData;
var content = this.item.content.replace(/\<img/gi, "<img style='max-width:100%'");
content = content.replace(/ /g, "  ");
//.replace(/\<p/gi, '<p class="p_class"')
this.item.content = content;
console.log(this.item)
} else {
alertTip(res.data.returnMsg);
}
})
},
}
};
</script>
<style lang="scss" scoped>
@import '@/static/css/common.scss';
img {
max-width: 100% !important
}
.container {
padding: 24upx;
}
.title {
background: linear-gradient(180deg, #FFFFFF 0%, #F4FAFF 100%);
border-radius: 10*2upx;
padding: 24upx;
font-weight: bold;
font-size: 16*2upx;
color: #0370CE;
line-height: 26*2upx;
}
.content {
background: #F4FAFF;
border-radius: 10*2upx;
padding: 24upx;
margin-top: 24upx;
.time {
font-size: 14*2upx;
color: #0370CE;
}
}
.p_class {
color: #666;
}
.uni-common-mt {
margin-top: 24upx;
}
.uni-common-mt>>>.ql-align-right {
text-align: right;
}
</style>