<template> <view class="page"> <u-navbar title="设置" :border-bottom="false" :background="bgc" back-icon-color="#fff" title-color='#fff' title-size='36' height='50'></u-navbar> <view class="card" v-if="!pwdflag"> <view class="li"> <view class="tit"> 绑定手机号 </view> <view class="info"> <view class="txt"> {{userinfo.phonenumber == undefined ? '--' : userinfo.phonenumber}} </view> <!-- <view class="iconfont icon-xiangyou1"></view> --> </view> </view> <view class="li" style="border-bottom: none;" @click="btnxg"> <view class="tit"> 修改密码 </view> <view class="info"> <view class="iconfont icon-xiangyou1"></view> </view> </view> </view> <view class="card" style="margin-top: 26rpx;" v-if="!pwdflag"> <view class="li" @click="btnwz(1)"> <view class="tit"> 用户协议 </view> <view class="info"> <view class="iconfont icon-xiangyou1"></view> </view> </view> <view class="li" @click="btnwz(2)"> <view class="tit"> 隐私政策 </view> <view class="info"> <view class="iconfont icon-xiangyou1"></view> </view> </view> <view class="li" style="border-bottom: #ccc solid 2rpx;" @click="btnwz(3)"> <view class="tit"> 个人信息收集清单 </view> <view class="info"> <view class="iconfont icon-xiangyou1"></view> </view> </view> <view class="li" style="border-bottom: #fff solid 2rpx;" @click="btnwz(4)"> <view class="tit"> 秘钥管理 </view> <view class="info"> <view class="iconfont icon-xiangyou1"></view> </view> </view> </view> <!-- 修改密码 --> <view class="zhangh" v-if="pwdflag"> <view class="" style="margin-top: 30rpx;"> <u-input v-model="oldmm" :type="onetype" :border="border" placeholder="请输入您的旧密码(首次修改可忽略)" :password-icon="passwordIcon" /> </view> <view class="" style="margin-top: 30rpx;"> <u-input v-model="newmm" :type="twotype" :border="bordertwo" placeholder="请输入您的新密码" :password-icon="passwordIcontwo" /> </view> <view class="" style="margin-top: 30rpx;"> <u-input v-model="qrmm" :type="thrtype" :border="borderthr" placeholder="请确认新密码" :password-icon="passwordIconthr" /> </view> <view class="mmdl" @click="btndl"> 确认修改 </view> <view class="mmdl" @click="pwdflag = false" style="background-color: #fff;border: 1px solid #efefef;color: #000;margin-top: 20rpx;"> 取消 </view> </view> </view> </template> <script> export default { data() { return { onetype: 'password', passwordIcon: true, border: true, twotype: 'password', passwordIcontwo: true, bordertwo: true, thrtype: 'password', passwordIconthr: true, borderthr: true, thrpwd:'password', twopwd:'password', oldmm:'', newmm:'', qrmm:'', pwdflag:false, bgc: { backgroundColor: "#8883f0", }, showloading: false, showfz: false, show: false, list: [{ value: '1', label: '房东模式' }, { value: '2', label: '用户模式' } ], mode:'房东模式', userinfo:{}, type:'' } }, onLoad() { this.getuserinfo() }, // 分享到好友(会话) onShareAppMessage: function () { return { title: '创想物联', path: '/pages/shouye/index' } }, // 分享到朋友圈 onShareTimeline: function () { return { title: '创想物联', query: '', path: '/pages/shouye/index' } }, methods: { onepwdpassword(){ this.onepwd = 'password' }, onepwdtext(){ this.onepwd = 'text' }, twopwdpassword(){ this.twopwd = 'password' }, twopwdtext(){ this.twopwd = 'text' }, thrpwdpassword(){ this.thrpwd = 'password' }, thrpwdtext(){ this.thrpwd = 'text' }, // 修改密码 btnxg(){ this.pwdflag = true }, btndl(){ if(this.qrmm == this.newmm){ let data = { oldPassword:this.oldmm, newPassword:this.newmm } this.$u.put('/app/user/updatePassword',data).then(res => { if(res.code == 200){ uni.showToast({ title: res.msg, icon: 'success', duration: 2000 }) setTimeout(()=>{ uni.navigateBack() },1000) }else{ uni.showToast({ title: res.msg, icon: 'none', duration: 2000 }) } }) }else{ uni.showToast({ title: '新密码不一致', icon: 'none', duration: 2000 }) } }, btnwz(num){ if(num == 1){ this.type = 'user' uni.navigateTo({ url:'/page_components/wentdetail?type=' + this.type }) }else if(num == 2){ this.type = 'privacy' uni.navigateTo({ url:'/page_components/wentdetail?type=' + this.type }) }else if(num == 3){ this.type = 'collection' uni.navigateTo({ url:'/page_components/wentdetail?type=' + this.type }) }else if(num == 4){ uni.navigateTo({ url:'/page_components/miyao' }) } }, // 点击更换用户模式 confirm(e){ // console.log(e); this.mode = e[0].label this.gettype() }, // 请求修改用户类型 gettype() { let type = '' if(this.mode == '房东模式'){ type = '01' }else if(this.mode == '用户模式'){ type = '00' } this.$u.put('/app/user/changeType?userType=' + type).then((res) => { if (res.code == 200) { console.log(res) this.getuserinfo() } }) }, getuserinfo() { this.$u.get("/app/user/userInfo").then((res) => { // this.$forceUpdate() if (res.code == 200) { this.userinfo=res.data uni.setStorageSync('userType', res.data.userType) this.userType = res.data.userType if (this.userType == '01') { this.mode='房东模式' } else if (this.userType == '00') { this.mode='用户模式' } } }); }, } } </script> <style lang="scss"> /deep/ .u-title{ padding-bottom: 22rpx; } /deep/ .uicon-nav-back{ padding-bottom: 22rpx; } page { background-color: #F7FAFE; } .zhangh{ width: 562rpx; text-align: center; margin: auto; margin-top: 50rpx; .tit{ font-size: 40rpx; color: #000; margin-bottom: 30rpx; } .mmdl{ width: 562rpx; height: 80rpx; background: #8883F0; border-radius: 52rpx 52rpx 52rpx 52rpx; font-weight: 500; font-size: 36rpx; color: #FFFFFF; line-height: 80rpx; margin-top: 50rpx; } } .page { width: 750rpx; .card { padding: 16rpx 38rpx; margin: 60rpx auto 0; width: 654rpx; // height: 734rpx; background: #FFFFFF; border-radius: 30rpx; box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(42, 130, 228, 0.1); opacity: 1; .li { display: flex; flex-wrap: nowrap; align-items: center; justify-content: space-between; height: 94rpx; border-bottom: #E5E5E5 solid 2rpx; .tit { font-size: 32rpx; font-family: HarmonyOS Sans SC, HarmonyOS Sans SC; font-weight: 400; color: #000000; } .info { display: flex; flex-wrap: nowrap; align-items: center; .txt { font-size: 32rpx; font-family: HarmonyOS Sans SC, HarmonyOS Sans SC; font-weight: 400; color: #95989D; } .icon-xiangyou1 { margin-left: 6rpx; color: #95989D; } } } } .fz { position: fixed; bottom: 0; width: 750rpx; height: 1152rpx; background: #F7FAFE; border-radius: 30rpx 30rpx 0 0; z-index: 10071; .fz_top { margin: 18rpx 0 auto; display: flex; flex-wrap: nowrap; justify-content: space-between; .icon-shanchu { margin-left: 40rpx; font-size: 50rpx; } .tit { font-size: 36rpx; font-family: Source Han Sans, Source Han Sans; font-weight: 400; color: #000000; } .txt { margin-right: 40rpx; font-size: 36rpx; font-family: Source Han Sans, Source Han Sans; font-weight: 400; color: #2A82E4; } } .card_cont { width: 750rpx; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; height: 1030rpx; overflow-y: auto; overflow-x: hidden; .cards { margin-top: 32rpx; display: flex; flex-wrap: nowrap; align-items: center; justify-content: space-between; padding: 0 40rpx; width: 682rpx; border-radius: 30rpx; height: 114rpx; background: #FFFFFF; box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(42, 130, 228, 0.1); .txt { font-size: 36rpx; font-family: Source Han Sans, Source Han Sans; font-weight: 400; color: #000000; } .num { font-size: 36rpx; font-family: Source Han Sans, Source Han Sans; font-weight: 400; color: #000000; } } } } } </style>