TalentService-mobile/pages/article/richDetail.vue
2024-11-12 17:34:05 +08:00

46 lines
1.1 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!-- 纯富文本展示页 -->
<template>
<view>
<u-parse :html="content"></u-parse>
<Loading :show="loading" />
</view>
</template>
<script>
export default {
data(){
return{
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;
}
}
},
async onLoad(options) {
if(options.title) await uni.setNavigationBarTitle({title: options.title});
this.getArticle(options.moduleName,options.title);
},
}
</script>
<style scoped lang="scss">
</style>