2024-10-27 00:26:19 +08:00
|
|
|
|
<!-- 纯富文本展示页 -->
|
|
|
|
|
<template>
|
|
|
|
|
<view>
|
|
|
|
|
<u-parse :html="content"></u-parse>
|
2024-10-31 21:24:54 +08:00
|
|
|
|
<Loading :show="loading" />
|
2024-10-27 00:26:19 +08:00
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2024-10-31 21:24:54 +08:00
|
|
|
|
export default {
|
2024-10-27 00:26:19 +08:00
|
|
|
|
data(){
|
|
|
|
|
return{
|
2024-10-31 21:24:54 +08:00
|
|
|
|
content: '',
|
|
|
|
|
loading: true,// 加载
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods:{
|
|
|
|
|
async getArticle(moduleName,labelName){
|
|
|
|
|
try{
|
|
|
|
|
this.loading = true;
|
|
|
|
|
let articleRes = await this.$api.getArticleList({
|
|
|
|
|
labelName: labelName,
|
|
|
|
|
moduleName: moduleName,
|
|
|
|
|
size: 1,
|
|
|
|
|
current: 1,
|
|
|
|
|
});
|
|
|
|
|
if(articleRes?.success){
|
|
|
|
|
this.content = articleRes.data?.records[0].text;
|
|
|
|
|
// 下面实际是为了增加浏览量,因为直接根据id查询结果是错误的,只能通过这种方式实现,具体逻辑不好理解,想知道为什么可以问后端
|
|
|
|
|
this.$api.getSingleArticle(articleRes.data?.records[0].id);
|
|
|
|
|
}
|
|
|
|
|
}catch(e){
|
|
|
|
|
}finally{
|
|
|
|
|
this.loading = false;
|
|
|
|
|
}
|
2024-10-27 00:26:19 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onLoad(options) {
|
|
|
|
|
uni.setNavigationBarTitle({
|
|
|
|
|
title: options.title
|
2024-10-31 21:24:54 +08:00
|
|
|
|
});
|
|
|
|
|
this.getArticle(options.moduleName,options.title);
|
|
|
|
|
},
|
2024-10-27 00:26:19 +08:00
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
</style>
|