emis-sapp/pages/service/articledetail.vue
2024-08-31 13:19:52 +08:00

91 lines
2.0 KiB
Vue

<template>
<tpx-page>
<view class="dbody">
<u-text :text="info.title" size="36" :bold="true"></u-text>
<!-- <u-text :text="desc" size="32" color="#666" margin="30rpx 0"></u-text> -->
<view class="mt-30">
<u-row>
<u-avatar :src="info.fileUrl" size="80"></u-avatar>
<view class="pl-10">
<u-text :text="info.author || '-'" size="28"></u-text>
<u-text margin="6rpx 0 0 0" :text="`发布于${info.createTime}`" size="26" color="#999"></u-text>
</view>
</u-row>
</view>
<view class="mt-30">
<rich-text :nodes="info.content || '-'"></rich-text>
</view>
<view @click="handleLike()" class="mt-30">
<u-row custom-style="height:100rpx;" justify="end">
<u-row>
<u-icon name="thumb-up" size="38"
:color="`${info.isGiveLike==1?'#B12D29':'#999'}`"
/>
<u-text margin="0 0 0 10rpx" size="26" :text="info.clickCount || 0" color="#999"></u-text>
</u-row>
</u-row>
</view>
</view>
</tpx-page>
</template>
<script>
import * as apiService from "@/common/api"
export default {
props: {
// hasLeftWin: {
// type: Boolean
// }
},
data() {
return {
queryOption: {
artId: ''
},
info:{}
}
},
onLoad(queryOption) {
this.queryOption = queryOption
this.initData();
},
onUnload() {
},
methods: {
initData(){
this.getArtDetailData()
},
async getArtDetailData(){
let res = await apiService.queryArticleDetail({ id: this.queryOption.artId, _loading: true })
this.info = res.data || {}
},
async handleLike(item){
let res = await apiService.articleGiveLike({ articleId: this.info.id, _loading: true })
this.getArtDetailData()
},
}
}
</script>
<style lang="scss">
@import '@/common/uni-nvue.scss';
page {
background-color: #F6F6F6;
height: 100% !important;
padding-top: 20rpx;
}
</style>
<style scoped lang="scss">
.dbody {
background-color: #fff;
margin: 0 20rpx 20rpx 20rpx;
padding: 30rpx;
border-radius: 20rpx;
}
</style>