kitchendDevice/pageTwo/setting/setting.vue

155 lines
3.2 KiB
Vue

<template>
<view class="content">
<!-- <view class="caritem" @click="navTo('/pageTwo/setting/phone')">
<view class="text">{{$t('infoMobile')}}</view>
<view class="text_r">
<text>{{userinfo.tel?userinfo.tel:''}}</text>
<uni-icons type="forward" size="20" color="#666"></uni-icons>
</view>
</view>
<view class="caritem" @click="navTo('/pageTwo/setting/email')">
<view class="text">{{$t('infoEmail')}}</view>
<view class="text_r">
<text>{{userinfo.email}}</text>
<uni-icons type="forward" size="20" color="#666"></uni-icons>
</view>
</view> -->
<view class="caritem" @click="navTo('/pageTwo/setting/password')">
<view class="text">{{$t('titleSetPassword')}}</view>
<uni-icons type="forward" size="20" color="#666"></uni-icons>
</view>
<!-- <view class="btn mb-15" @click="handleOutLogin">删除账号</view> -->
</view>
</template>
<script>
import {
mapState
} from "vuex";
export default {
data() {
return {
isEdit: false,
headimg: null,
nickname: ""
};
},
computed: {
...mapState(["user"]),
userinfo() {
return this.user
}
},
onLoad() {
let that = this
uni.setNavigationBarTitle({
title: that.$t('titleSet')
})
},
methods: {
handleOutLogin() {
let that = this
uni.showModal({
title: that.$t('msgTitle'),
confirmText: that.$t('btnDelete'),
content: that.$t('verifyDeleteAccount'),
success: function(res) {
if (res.confirm) {
that.$model.getdeleteAccount({}).then((res) => {
if (res.code != 0) return
that.$tools.msg(that.$t('msgDelete'));
uni.setStorageSync('token', null)
uni.setStorageSync('aan_id', null)
uni.clearStorageSync()
setTimeout(() => {
uni.reLaunch({
url: "/pageTwo/login/login"
})
}, 3000);
})
} else if (res.cancel) {
that.$tools.msg(that.$t('msgCancel'));
}
},
})
},
// 修改昵称
handleBlur() {
let that = this
return that.$model.getAccountNickname({
nickname: that.nickname,
}).then(res => {
if (res.code != 0) return
that.user.nickname = that.nickname
that.$store.commit('changeAccountNumber', {
nickname: that.nickname
})
that.isEdit = false
})
},
navTo(url) {
uni.navigateTo({
url
})
},
}
}
</script>
<style lang="scss" scoped>
.content {
background-color: #F3F4F6;
padding: 30rpx;
min-height: 100vh;
font-size: 14px;
}
.image {
width: 80rpx;
height: 80rpx;
border-radius: 50%;
}
.text_r {
width: 70%;
display: flex;
align-items: center;
justify-content: flex-end;
text {
text-align: right;
width: calc(100% - 60rpx);
display: inline-block;
}
input {
width: 80%;
border-bottom: 1px solid #dfdfdf;
}
}
.btn {
width: auto;
background: #999;
margin: 100rpx 30rpx 0 30rpx;
}
.caritem {
height: 100rpx;
line-height: 100rpx;
background-color: #fff;
border-radius: 20rpx;
padding: 0 20rpx;
margin-bottom: 30rpx;
display: flex;
align-items: center;
justify-content: space-between;
width: calc(100% - 40rpx);
.uni-icons {
width: 60rpx;
text-align: right;
}
}
</style>