You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
< template >
< view class = "page" >
< view class = "info" >
<!-- 标题 -- >
<!-- < view class = "info-title" >
{ { title } }
< / view > -- >
<!-- 内容 -- >
< view class = "info-content" >
< mp -html v-if ="id==1" :content="html1" :markdown="true" :lazy-load="true"/>
<mp-html v-if="id==2" :content="html2" :markdown="true" :lazy-load="true"/>
<mp-html v-if="id==3" :content="html3" :markdown="true" :lazy-load="true"/>
</view>
</view>
<!-- service 客服-->
<service ref="serviceId" @goservice="goservice"></service>
<!-- top 返回顶部-->
<top ref="topId" > < / top >
< / view >
< / template >
< script >
import top from "../components/top.vue" ;
import service from "../components/service.vue" ;
export default {
components : {
top , service
} ,
data ( ) {
return {
id : 1 , // 1、用户服务协议 2、隐私政策条款 3、用户注册协议
title : "用户授权协议" ,
html1 : ` ` ,
html2 : ` ` ,
html3 : ` ` ,
}
} ,
onShow ( ) {
} ,
onLoad ( options ) {
// 富文本不好二次赋值, 或者再ready中赋值
if ( options . id ) {
this . id = parseInt ( options . id ) ;
}
} ,
async onReady ( ) {
// 1、用户服务协议 2、隐私政策条款 3、用户注册协议
if ( this . id == 1 )
{
uni . setNavigationBarTitle ( {
title : "用户服务协议" ,
} ) ;
this . getxy ( ) ;
}
else if ( this . id == 2 )
{
uni . setNavigationBarTitle ( {
title : "隐私政策条款" ,
} ) ;
this . getxy ( ) ;
}
else {
uni . setNavigationBarTitle ( {
title : "用户注册协议" ,
} ) ;
}
} ,
onPageScroll ( e ) {
//调用子组件方法
this . $refs . topId . topData ( e . scrollTop ) ;
} ,
methods : {
async getxy ( ) {
if ( this . id ) {
try {
uni . showLoading ( {
title : '数据加载中...'
} ) ;
const { data : res } = await uni . $http . get ( '/yoga/api/privacyPolicy' ) ;
// Conten1:用户服务协议
// Conten2:隐私政策条款
// Conten3:用户注册协议
if ( res ) {
if ( this . id == 1 ) {
// 1、用户服务协议 2、隐私政策条款 3、用户注册协议
this . html1 = res . content1 ;
}
else if ( this . id == 2 ) {
// 1、用户服务协议 2、隐私政策条款 3、用户注册协议
this . html2 = res . content2 ;
}
else if ( this . id == 3 ) {
// 1、用户服务协议 2、隐私政策条款 3、用户注册协议
this . html3 = res . content3 ;
}
this . $forceUpdate ( ) ;
}
}
catch ( e ) {
console . log ( e )
}
}
} ,
goservice ( val ) {
console . log ( val ) ;
} ,
}
}
< / script >
< style lang = "scss" scoped >
. user {
background - color : # FFFFFF ;
min - height : calc ( 100 vh - var ( -- window - top ) ) ! important ;
}
. info {
position : relative ;
display : block ;
overflow : hidden ;
}
. info - content {
padding : 24 rpx 24 rpx 40 rpx 24 rpx ;
line - height : 2 ;
color : # 0 E1521 ;
font - size : 28 rpx ;
letter - spacing : 1 rpx ;
}
< / style >