127 lines
3.8 KiB
Vue
127 lines
3.8 KiB
Vue
<template>
|
|
<view class="">
|
|
<u-navbar title="设置" :border-bottom="false" :background="bgc" title-color='#333' back-icon-color="#333"
|
|
title-size='36' height='38'></u-navbar>
|
|
<view class="zhengce">
|
|
<view class="" @click="btnxq(1)">
|
|
隐私政策 <image src="https://api.ccttiot.com/smartmeter/img/static/uKpBiM6T9kj4BddzJtDc" mode=""></image>
|
|
</view>
|
|
<view class="" @click="btnxq(2)">
|
|
用户协议 <image src="https://api.ccttiot.com/smartmeter/img/static/uKpBiM6T9kj4BddzJtDc" mode=""></image>
|
|
</view>
|
|
<view class="" @click="btnxq(3)">
|
|
关于我们 <image src="https://api.ccttiot.com/smartmeter/img/static/uKpBiM6T9kj4BddzJtDc" mode=""></image>
|
|
</view>
|
|
<view class="" v-if="logoflag == true" style="border: 0;" @click="btnxq(5)">
|
|
立即登录 <image src="https://api.ccttiot.com/smartmeter/img/static/uKpBiM6T9kj4BddzJtDc" mode=""></image>
|
|
</view>
|
|
<view class="" v-if="logoflag == false" style="border: 0;" @click="btnxq(4)">
|
|
退出登录 <image src="https://api.ccttiot.com/smartmeter/img/static/uKpBiM6T9kj4BddzJtDc" mode=""></image>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
bgc: {
|
|
backgroundColor: "#fff",
|
|
},
|
|
logoflag:true
|
|
}
|
|
},
|
|
onShow() {
|
|
this.getinfo()
|
|
},
|
|
methods: {
|
|
// 获取用户信息
|
|
getinfo() {
|
|
this.$u.get(`/system/user/profile`).then((res) => {
|
|
if (res.code == 200) {
|
|
uni.setStorageSync('user',res.data)
|
|
uni.setStorageSync('userId',res.data.userId)
|
|
this.logoflag = false
|
|
}else if(res.code == 401){
|
|
this.logoflag = true
|
|
}
|
|
})
|
|
},
|
|
// 跳转到详情
|
|
btnxq(num){
|
|
if(num == 1){
|
|
uni.navigateTo({
|
|
url:'/page_user/yinsixq?tit=' + '隐私政策' + '&id=' + 2
|
|
})
|
|
}else if(num == 2){
|
|
uni.navigateTo({
|
|
url:'/page_user/yinsixq?tit=' + '用户协议' + '&id=' + 1
|
|
})
|
|
}else if(num == 3){
|
|
uni.navigateTo({
|
|
url:'/page_user/yinsixq?tit=' + '关于我们' + '&id=' + 3
|
|
})
|
|
}else if(num == 4){
|
|
uni.showModal({
|
|
title: '提示',
|
|
content: '您确定要退出登录吗?',
|
|
success: function (res) {
|
|
if (res.confirm) {
|
|
uni.clearStorage().then(() => {
|
|
// 成功清空所有本地存储
|
|
console.log('所有本地存储数据已清空')
|
|
}).catch((error) => {
|
|
// 处理错误
|
|
console.error('清空本地存储失败', error)
|
|
})
|
|
uni.reLaunch({
|
|
url:'/pages/login/login'
|
|
})
|
|
} else if (res.cancel) {
|
|
|
|
}
|
|
}
|
|
})
|
|
}else if(num == 5){
|
|
uni.reLaunch({
|
|
url:'/pages/login/login'
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
page {
|
|
background-color: #fff;
|
|
}
|
|
.zhengce{
|
|
width: 670rpx;
|
|
height: 420rpx;
|
|
margin: auto;
|
|
background: #FFFFFF;
|
|
box-shadow: 0rpx 10rpx 64rpx 0rpx rgba(0,0,0,0.08);
|
|
margin-top: 28rpx;
|
|
border-radius: 20rpx;
|
|
padding-left: 30rpx;
|
|
padding-right: 30rpx;
|
|
box-sizing: border-box;
|
|
view{
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
border-bottom: 1px solid #D8D8D8;
|
|
padding-bottom: 28rpx;
|
|
box-sizing: border-box;
|
|
padding-top: 28rpx;
|
|
font-size: 36rpx;
|
|
color: #3D3D3D;
|
|
image{
|
|
width: 18rpx;
|
|
height: 32rpx;
|
|
}
|
|
}
|
|
}
|
|
</style> |