richText.vue 1.2 KB
<template>
	<view style="padding: 20rpx 25rpx;">
		<rich-text :nodes="info.content || ''"></rich-text>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info: {}
			}
		},
		onLoad(option) {
			this.getInfo(option.type)
		},
		methods: {
			getInfo(type) {
				uni.showLoading({
					title: '加载中',
					mask: true
				})
				
				let api = '';
				if(type === 'yszc') {
					api = '/config/policy';
					uni.setNavigationBarTitle({
						title: '隐私政策'
					});
				}else if(type === 'yhxy') {
					api = '/config/agreement';
					uni.setNavigationBarTitle({
						title: '用户协议'
					});
				}
				
				this.$service.P_get(api).then(res => {
					uni.hideLoading();
					if (res.code == 1) {
						this.info = res.data;
					}else {
						if (res.msg) {
							uni.showToast({
								icon: 'none',
								title: res.msg
							})
						} else {
							uni.showToast({
								icon: 'none',
								title: '获取数据失败'
							})
						}
					}
					
					
				}).catch(e => {
					uni.hideLoading()
					uni.showToast({
						icon: 'none',
						title: '获取数据失败,请检查您的网络连接'
					})
				})
			}
		}
	}
</script>

<style>

</style>