关于我们:接入 100%

This commit is contained in:
YunaiV
2023-12-27 21:25:58 +08:00
parent 6a19833044
commit 1bd12a1a3b
6 changed files with 36 additions and 59 deletions
+20 -13
View File
@@ -1,31 +1,37 @@
<!-- 文章展示 -->
<template>
<s-layout class="set-wrap" :title="state.title" :bgStyle="{ color: '#FFF' }">
<view class="ss-p-30"><mp-html class="richtext" :content="state.content"></mp-html></view>
<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 sheep from '@/sheep';
import ArticleApi from '@/sheep/api/promotion/article';
const state = reactive({
title: '',
content: '',
});
async function getRichTextContent(id) {
const { error, data } = await sheep.$api.data.richtext(id);
if (error === 0) {
state.content = data.content;
if (state.title === '') {
state.title = data.title;
uni.setNavigationBarTitle({
title: state.title,
});
}
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,
});
}
}
onLoad((options) => {
if (options.title) {
state.title = options.title;
@@ -33,8 +39,9 @@
title: state.title,
});
}
getRichTextContent(options.id);
getRichTextContent(options.id, options.title);
});
</script>
<style lang="scss" scoped>