118 lines
2.4 KiB
Vue
118 lines
2.4 KiB
Vue
<template>
|
|
<view style="padding: 12rpx 16rpx;">
|
|
<view class="xwD_title">
|
|
{{detailList.title}}
|
|
</view>
|
|
<view style="display: flex;">
|
|
<text class="xwD_time">
|
|
{{detailList.pub_time}}
|
|
</text>
|
|
<text class="xwD_time xwD_place">
|
|
{{detailList.pub_name}}
|
|
</text>
|
|
</view>
|
|
<view class="xwD_content">
|
|
<u-parse :content="detailList.content" @preview="preview" @navigate="navigate"></u-parse>
|
|
</view>
|
|
<view style="margin:0 20rpx;">
|
|
<u-overlay :show="!isLoad">
|
|
<login @success="reOnLoad()" @fail="failToLoad()"></login>
|
|
</u-overlay>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
dateFormatXwDetail
|
|
} from '../../utills/date.js'
|
|
import login from 'pages/my/login/login'
|
|
export default {
|
|
components: {
|
|
login
|
|
},
|
|
data() {
|
|
return {
|
|
id: '',
|
|
detailList: [],
|
|
isLoad: true
|
|
}
|
|
},
|
|
onLoad(option) {
|
|
this.id = option.id
|
|
this.getNewsDetail()
|
|
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
|
|
this.isLoad = false
|
|
// uni.navigateTo({
|
|
// url: '../../pages/my/login/login'
|
|
// })
|
|
return
|
|
}
|
|
this.isLoad = true
|
|
},
|
|
methods: {
|
|
//获取行业新闻详情
|
|
getNewsDetail() {
|
|
this.$apiServe.getNewsDetail(this.id).then(res => {
|
|
// console.log('新闻详情页', res.data.data)
|
|
if (res.data.data) {
|
|
let detail = res.data.data
|
|
detail.pub_time = dateFormatXwDetail(detail.pub_time)
|
|
this.detailList = res.data.data
|
|
} else {
|
|
this.$toast.warn('没有更多详情了')
|
|
}
|
|
}).finally(_ => {})
|
|
},
|
|
reOnLoad() {
|
|
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
|
|
this.$toast.warn('登录失败请重试')
|
|
this.isLoad = false
|
|
// uni.navigateTo({
|
|
// url: '../../pages/my/login/login'
|
|
// })
|
|
return
|
|
}
|
|
this.isLoad = true
|
|
this.getNewsDetail()
|
|
},
|
|
failToLoad() {
|
|
this.$toast.warn('登录失败请重试')
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
page {
|
|
background-color: #fff;
|
|
}
|
|
|
|
.xwD_title {
|
|
font-size: 38rpx;
|
|
font-family: PingFangSC-Medium, PingFang SC;
|
|
font-weight: bold;
|
|
color: #3E3E3E;
|
|
line-height: 53rpx;
|
|
letter-spacing: 1rpx;
|
|
}
|
|
|
|
.xwD_time {
|
|
font-size: 24rpx;
|
|
font-family: PingFangSC-Regular, PingFang SC;
|
|
font-weight: 400;
|
|
color: #969696;
|
|
line-height: 33rpx;
|
|
margin-top: 6rpx;
|
|
}
|
|
|
|
.xwD_place {
|
|
padding-left: 20rpx;
|
|
}
|
|
|
|
.xwD_content {
|
|
margin-top: 38rpx;
|
|
// border: none;
|
|
}
|
|
</style>
|