1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <template>
- <view>
- <uni-nav-bar :fixed="true" shadow left-icon="left" :title="title" :statusBar="true" @clickLeft="handleToBack" />
- <view class="content">
- <rich-text :nodes="content"></rich-text>
- <view class="footer">
- <image mode="widthFix" src="/static/common/footer.png" />
- </view>
- </view>
- </view>
- </template>
- <script setup>
- import { ref, reactive } from 'vue';
- import { onLoad, onShow } from '@dcloudio/uni-app';
- import request from '/common/request.js';
- const statusBarHeight = ref();
- const content = ref();
- const title = ref();
- const props = defineProps({
- id: Number | String
- });
- onLoad(() => {
- statusBarHeight.value = uni.getSystemInfoSync().statusBarHeight;
- getContent();
- });
- onShow(() => {
- uni.$emit('fastOrderNum', false);
- uni.$emit('receiveOrdernum', false);
- });
- const handleToBack = () => {
- const canNavBack = getCurrentPages();
- if (canNavBack && canNavBack.length > 1) uni.navigateBack();
- else history.back();
- };
- const getContent = () => {
- uni.showLoading();
- request({
- url: '/api/portal/getInfo',
- method: 'GET',
- data: {
- id: props.id
- },
- success: (res) => {
- if (res.data?.data?.post_content) {
- content.value = res.data?.data?.post_content;
- title.value = res.data?.data?.post_title;
- uni.setNavigationBarTitle({
- title: res.data?.data?.post_title
- });
- }
- },
- fail: () => {},
- complete: () => {
- uni.hideLoading();
- }
- });
- };
- </script>
- <style lang="scss" scoped>
- .content {
- padding: 60upx 20upx 20upx;
- p {
- margin: 20upx;
- }
- }
- </style>
|