flying-monkey/pagesB/plan-fault-product-detail/detail.vue

70 lines
1.9 KiB
Vue

<template>
<view>
<status-nav :navBarTitle="detailTitle" returnColor="#c2c2c2"></status-nav>
<container-subgroup>
<view slot="content" style="margin: 0 -30rpx;" class="fon28">
<view class="bacf pad-zy30 pad-sx20" style="margin-top: -10rpx;" v-if="dataObj">
<!-- 标题 -->
<view class="fon38 col0 tcenter">{{dataObj.title}}</view>
<!-- 时间 -->
<view class="col6 fon28 tcenter mar-sx20">{{dataObj.create_time}}</view>
<view class="fon30 line-h60">
<!-- 封面图 -->
<image :src="dataObj.cover_img" mode="widthFix" style="width: 100%;"></image>
<!-- 详情 -->
<!-- <rich-text :nodes="rich_text"></rich-text> -->
<view v-html="rich_text"></view>
</view>
</view>
</view>
</container-subgroup>
</view>
</template>
<script>
export default {
data() {
return {
detailTitle:'方案详情',
current:0,
dataObj:'',
rich_text:''//富文本
}
},
onLoad(op) {
if(op.index!=undefined) {
this.detailTitle = `${['方案详情','详情概述','产品详情'][op.index*1]}`;
this.current = op.index*1;
}
this.getDetail(op.id);
},
methods: {
// 查看详情
getDetail(id){
let urls = [
'/universal/api.solution/solution_info',
'/universal/api.question/question_info',
'/universal/api.new_product/new_product_info'
]
this.$requst.get(urls[this.current],{id}).then(res=>{
if(res.code==1) {
this.dataObj = res.data;
// 日期转换
if(this.dataObj.create_time.toString().search('-')==-1){
// 当返回为时间戳时
this.dataObj.create_time = this.$toolAll.tools.timestampToTime(this.dataObj.create_time);
}
// 封面图
this.dataObj.cover_img = this.dataObj.cover_img,
this.rich_text = this.$toolAll.tools.escape2Html(this.dataObj.content);
}
})
}
}
}
</script>
<style>
</style>