2023-12-27 13:25:58 +00:00
|
|
|
<!-- 文章展示 -->
|
2022-11-22 07:45:36 +00:00
|
|
|
<template>
|
|
|
|
<s-layout class="set-wrap" :title="state.title" :bgStyle="{ color: '#FFF' }">
|
2023-12-27 13:25:58 +00:00
|
|
|
<view class="ss-p-30">
|
|
|
|
<mp-html class="richtext" :content="state.content" />
|
|
|
|
</view>
|
2022-11-22 07:45:36 +00:00
|
|
|
</s-layout>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
import { onLoad } from '@dcloudio/uni-app';
|
|
|
|
import { reactive } from 'vue';
|
2023-12-27 13:25:58 +00:00
|
|
|
import ArticleApi from '@/sheep/api/promotion/article';
|
2022-11-22 07:45:36 +00:00
|
|
|
|
|
|
|
const state = reactive({
|
|
|
|
title: '',
|
|
|
|
content: '',
|
|
|
|
});
|
|
|
|
|
2023-12-27 13:25:58 +00:00
|
|
|
async function getRichTextContent(id, title) {
|
|
|
|
const { code, data } = await ArticleApi.getArticle(id, title);
|
|
|
|
if (code !== 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
state.content = data.content;
|
|
|
|
// 标题不一致时,修改标题
|
|
|
|
if (state.title !== data.title) {
|
|
|
|
state.title = data.title;
|
|
|
|
uni.setNavigationBarTitle({
|
|
|
|
title: state.title,
|
|
|
|
});
|
2022-11-22 07:45:36 +00:00
|
|
|
}
|
|
|
|
}
|
2023-12-27 13:25:58 +00:00
|
|
|
|
2022-11-22 07:45:36 +00:00
|
|
|
onLoad((options) => {
|
|
|
|
if (options.title) {
|
|
|
|
state.title = options.title;
|
|
|
|
uni.setNavigationBarTitle({
|
|
|
|
title: state.title,
|
|
|
|
});
|
|
|
|
}
|
2023-12-27 13:25:58 +00:00
|
|
|
getRichTextContent(options.id, options.title);
|
2022-11-22 07:45:36 +00:00
|
|
|
});
|
2023-12-27 13:25:58 +00:00
|
|
|
|
2022-11-22 07:45:36 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.set-title {
|
|
|
|
margin: 0 30rpx;
|
|
|
|
}
|
|
|
|
|
|
|
|
.richtext {
|
|
|
|
}
|
|
|
|
</style>
|