You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.4 KiB
68 lines
1.4 KiB
<!-- 文章展示 -->
|
|
<template>
|
|
<!-- <s-layout class="set-wrap" :title="state.title" :bgStyle="{ color: '#FFF' }"> -->
|
|
<headerTopsTips></headerTopsTips>
|
|
<uni-nav-bar left-icon="left" :title="state.title" backgroundColor="#e6eafa" @clickLeft="handlegoback" />
|
|
<view class="ss-p-30">
|
|
<mp-html class="richtext" :content="state.content" />
|
|
</view>
|
|
<!-- </s-layout> -->
|
|
</template>
|
|
|
|
<script setup>
|
|
import {
|
|
onLoad
|
|
} from '@dcloudio/uni-app';
|
|
import {
|
|
reactive
|
|
} from 'vue';
|
|
// import ArticleApi from '@/sheep/api/promotion/article';
|
|
import headerTopsTips from '@/pages/components/header_tops_tips.vue'
|
|
|
|
const state = reactive({
|
|
title: '',
|
|
content: '',
|
|
});
|
|
|
|
async function getRichTextContent(id, title) {
|
|
const {
|
|
code,
|
|
data
|
|
} = await ArticleApi.getArticle(id, title);
|
|
// console.log(code, 'code')
|
|
// console.log(data, 'data')
|
|
if (code !== 0) {
|
|
return;
|
|
}
|
|
state.content = data.content;
|
|
// 标题不一致时,修改标题
|
|
if (state.title !== data.title) {
|
|
state.title = data.title;
|
|
uni.setNavigationBarTitle({
|
|
title: state.title,
|
|
});
|
|
}
|
|
}
|
|
|
|
function handlegoback() {
|
|
uni.navigateBack()
|
|
}
|
|
onLoad((options) => {
|
|
// console.log(options, 'options')
|
|
if (options.title) {
|
|
state.title = options.title;
|
|
uni.setNavigationBarTitle({
|
|
title: state.title,
|
|
});
|
|
}
|
|
getRichTextContent(options.id, options.title);
|
|
});
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.set-title {
|
|
margin: 0 30rpx;
|
|
}
|
|
|
|
.richtext {}
|
|
</style> |