party-rank-uniapp/src/pages/article/detail.vue

85 lines
1.6 KiB
Vue

<template>
<view class="page">
<view v-if="noData" class="full">
<u-empty mode="data" />
</view>
<block v-else>
<view class="title">{{ title }}</view>
<view class="content">
<rich-text :nodes="content" />
</view>
</block>
</view>
</template>
<script>
export default {
data() {
return {
noData: false,
title: '',
content: ''
}
},
onLoad(e) {
// 共性指标
if (e.type == 'common') {
uni.setNavigationBarTitle({
title: '共性指标'
})
this.$ajax.get('/api/article/common', { custom: { loading: true } }).then(res => {
if (res.status == 0 && res.data) {
this.title = res.data.title
this.content = res.data.content
} else {
this.noData = true
}
})
}
// 进阶指标
else if (e.type == 'cate') {
uni.setNavigationBarTitle({
title: '进阶指标'
})
this.$ajax.get('/api/article/cate', { custom: { loading: true } }).then(res => {
if (res.status == 0 && res.data) {
this.title = res.data.title
this.content = res.data.content
if (res.data.party_cate) {
uni.setNavigationBarTitle({
title: res.data.party_cate.name
})
}
} else {
this.noData = true
}
})
}
}
}
</script>
<style scoped>
.title {
font-size: 36rpx;
font-weight: bold;
text-align: center;
padding: 20rpx 0;
background-color: white;
}
.content {
margin-top: 30rpx;
background-color: white;
word-break: break-all;
overflow-wrap: break-word;
width: 100%;
line-height: 1.6;
}
.full {
position: absolute;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
}
</style>