120 lines
2.4 KiB
Vue
120 lines
2.4 KiB
Vue
<template>
|
||
<view class="home-article" v-if="detail.id">
|
||
<view class="space-md"></view>
|
||
<view class="pd-lg">
|
||
<view class="article-title c-title">{{detail.title}}</view>
|
||
<view class="f-paragraph c-title mt-md">
|
||
发布时间:{{detail[options.type ==1 ? 'create_time':'create_time_text']}}</view>
|
||
</view>
|
||
<view class="mt-md pd-lg">
|
||
<parser :html="detail[options.type ==1 ? 'text':'content']" @linkpress="linkpress" show-with-animation
|
||
lazy-load>加载中...</parser>
|
||
</view>
|
||
<view class="space-footer"></view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import {
|
||
mapState,
|
||
} from "vuex"
|
||
import parser from "@/components/jyf-Parser/index"
|
||
export default {
|
||
components: {
|
||
parser
|
||
},
|
||
data() {
|
||
return {
|
||
options: {},
|
||
detail: {},
|
||
}
|
||
},
|
||
computed: mapState({
|
||
primaryColor: state => state.config.configInfo.primaryColor,
|
||
subColor: state => state.config.configInfo.subColor,
|
||
userInfo: state => state.user.userInfo,
|
||
}),
|
||
onLoad(options) {
|
||
let {
|
||
type = 1
|
||
} = options
|
||
options.type = type * 1
|
||
this.$util.showLoading()
|
||
this.options = options
|
||
uni.setNavigationBarTitle({
|
||
title: type == 1 ? '新闻动态' : '文章详情'
|
||
})
|
||
this.initIndex()
|
||
},
|
||
onShareAppMessage(e) {
|
||
let {
|
||
id: pid
|
||
} = this.userInfo
|
||
let {
|
||
id,
|
||
title,
|
||
} = this.detail
|
||
let {
|
||
type
|
||
} = this.options
|
||
let path = `/home/pages/article?id=${id}&pid=${pid}&type=${type}`
|
||
this.$util.log(path)
|
||
return {
|
||
title,
|
||
imageUrl: '',
|
||
path,
|
||
}
|
||
},
|
||
methods: {
|
||
initIndex() {
|
||
this.getDetail()
|
||
},
|
||
initRefresh() {
|
||
this.initIndex()
|
||
},
|
||
linkpress(res) {
|
||
console.log("linkpress", res);
|
||
// #ifdef APP-PLUS
|
||
this.$util.goUrl({
|
||
url: res.href,
|
||
openType: 'web'
|
||
})
|
||
// #endif
|
||
},
|
||
async getDetail() {
|
||
let {
|
||
id,
|
||
type = 1
|
||
} = this.options
|
||
let methodKey = type == 3 ? 'mine' : 'home'
|
||
let methodModel = type === 1 ? 'articleInfo' : type == 3 ? 'operateInfoInfo' : 'welfareColumnInfo'
|
||
this.detail = await this.$api[methodKey][methodModel](type === 1 ? {
|
||
article_id: id
|
||
} : {
|
||
id
|
||
});
|
||
this.$util.hideAll()
|
||
if (type !== 3) return
|
||
let {
|
||
number
|
||
} = this.$util.getPage(-1).tabList[1]
|
||
this.$util.getPage(-1).tabList[1].number = number - 1
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
|
||
<style lang="scss">
|
||
page {
|
||
background: #fff
|
||
}
|
||
|
||
.home-article {
|
||
.article-title {
|
||
font-size: 44rpx;
|
||
line-height: 65rpx;
|
||
}
|
||
}
|
||
</style>
|