<!-- ============================= 隐私政策/用户服务条款 ============================= --> <template> <view class="u-content"> <u-parse :html="content"></u-parse> <u-toast ref="uToast" /> </view> </template> <script> export default { data() { return { content: '' }; }, onLoad(query) { const termsType = query?.termsType; if (termsType) { const termsTypeObj = { 1: '用户服务条款', 2: '隐私政策' }; uni.setNavigationBarTitle({ title: termsTypeObj[Number(termsType)] }); this.getSysterms(Number(termsType)); } }, methods: { /** * @description: 获取系统参数 * @param {*} termsType * @return {*} */ async getSysterms(termsType) { try { const { code, data } = await this.$u.api.getSysterms({ termsType }); if (code === 200) { this.content = data?.content; } } catch (error) { this.showToast('系统错误!', 'error'); } }, /** * @description: 显示提示 * @param {*} title * @param {*} type * @return {*} */ showToast(title = '操作失败', type = 'info') { this.$refs.uToast.show({ title, type }); } } }; </script> <style lang="scss" scoped> .u-content { padding: 20rpx; } </style>