wangdong 6 months ago
commit 2e04ef9cb2
  1. 96
      pages/news1/text.vue

@ -1,58 +1,70 @@
<template> <template>
<view> <view>
<!-- <view class="con">{{ content }}</view> --> <!-- <view class="con">{{ content }}</view> -->
<view class="con" v-html="content"> <view class="con" >
<!-- <rich-text style="white-space: normal;" :nodes="content"></rich-text> --> <rich-text style="white-space: normal;" :nodes="content"></rich-text>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import * as help from '@/api/help' import * as help from '@/api/help'
export default { export default {
data() { data() {
return { return {
pageFlag: 1, pageFlag: 1,
content: '' content: '',
}; uniqueKey: 0
}, };
onShow() { },
this.getTextData() onShow() {
}, this.getTextData()
onLoad(params) { },
let that = this onLoad(params) {
that.pageFlag = params.pageFlag let that = this
uni.setNavigationBarTitle({ that.pageFlag = params.pageFlag
title: that.pageFlag == 1 ? '用户服务协议' : that.pageFlag == 2 ? '隐私政策' : '关于我们' uni.setNavigationBarTitle({
}) title: that.pageFlag == 1 ? '用户服务协议' : that.pageFlag == 2 ? '隐私政策' : '关于我们'
},
methods: {
async getTextData() {
uni.showLoading({
title: "加载中"
}) })
let typeVal = this.pageFlag == 1 ? 'user' : this.pageFlag == 2 ? 'policy' : 'about' },
let { watch: {
status, richContent() {
data this.uniqueKey = this.generateUniqueKey();
} = await help.getAgreement({ type: typeVal });
if (status == 200) {
uni.hideLoading();
this.content = data.detail.content
} }
}, },
methods: {
generateUniqueKey() {
return Date.now() + Math.random();
},
async getTextData() {
uni.showLoading({
title: "加载中"
})
let typeVal = this.pageFlag == 1 ? 'user' : this.pageFlag == 2 ? 'policy' : 'about'
let {
status,
data
} = await help.getAgreement({
type: typeVal
});
if (status == 200) {
uni.hideLoading();
this.content = data.detail.content
}
},
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.con {
font-size: 28rpx;
padding: 20rpx 40rpx;
line-height: 28px;
.con { span {
font-size: 28rpx; white-space: normal !important
padding: 20rpx 40rpx; }
line-height: 28px;
span{
white-space: normal !important
} }
} </style>
</style>

Loading…
Cancel
Save