573 lines
14 KiB
Vue
573 lines
14 KiB
Vue
<template>
|
|
<view class="page">
|
|
<u-navbar :is-back="false" title="我的" :border-bottom="false" back-icon-color="000" :background="bgc" title-color='#fff' title-size='36'
|
|
height='36' id="navbar">
|
|
</u-navbar>
|
|
<image class="bj" src="https://api.ccttiot.com/smartmeter/img/static/uLeHF2hmWdyk8KT1ESFj" mode="aspectFill"></image>
|
|
<view class="box">
|
|
<view class="top">
|
|
<button type="primary reverse" open-type="chooseAvatar" @chooseavatar="getimage">
|
|
<image :src="info.avatar" mode=""></image>
|
|
</button>
|
|
<!-- <view class="pic">
|
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uhygDEgTWnL6P1uXlzVt" mode=""></image>
|
|
</view> -->
|
|
<!-- <view class="bianji" @click="btnbj">
|
|
编辑资料
|
|
</view> -->
|
|
<view class="bianji" style="background-color: transparent;">
|
|
|
|
</view>
|
|
</view>
|
|
<view class="name" @click="btnxingbie">
|
|
{{info.phonenumber == null ? '--' : info.phonenumber}}
|
|
<view class="nan" v-if="info.sex == 0">
|
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uGhxU4Yh34qZzY7s9ntg" mode=""></image>
|
|
</view>
|
|
<view class="nan" v-else>
|
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uF7rnOO2DtSm8fF6jmKK" mode=""></image>
|
|
</view>
|
|
</view>
|
|
<view class="qianm">
|
|
欢迎来到PICK ME UP
|
|
</view>
|
|
<view class="gongneng">
|
|
<!-- <view class="li">
|
|
<view class="one">
|
|
<image src="https://lxnapi.ccttiot.com/smartmeter/img/static/uDpdW1aK6GmY3pArseqW" mode=""></image> 积分兑换
|
|
</view>
|
|
<image class="jt" src="https://lxnapi.ccttiot.com/smartmeter/img/static/uo3VNhAA6YDvl6lt5kaY" mode=""></image>
|
|
</view>
|
|
<view class="li">
|
|
<view class="one">
|
|
<image src="https://lxnapi.ccttiot.com/smartmeter/img/static/uGJS2qdk4JKKLiPt7c9K" mode=""></image> 意见反馈
|
|
</view>
|
|
<image class="jt" src="https://lxnapi.ccttiot.com/smartmeter/img/static/uo3VNhAA6YDvl6lt5kaY" mode=""></image>
|
|
</view>
|
|
<view class="li">
|
|
<view class="one">
|
|
<image src="https://lxnapi.ccttiot.com/smartmeter/img/static/u2tbwMgaIqD7yVMLcE4G" mode=""></image> 我的黑名单
|
|
</view>
|
|
<image class="jt" src="https://lxnapi.ccttiot.com/smartmeter/img/static/uo3VNhAA6YDvl6lt5kaY" mode=""></image>
|
|
</view> -->
|
|
<view class="li" @click="btnpage(1)">
|
|
<view class="one">
|
|
<image src="https://lxnapi.ccttiot.com/smartmeter/img/static/uTHDjaexeftSQpdGsjSD" mode=""></image> 用户协议
|
|
</view>
|
|
<image class="jt" src="https://lxnapi.ccttiot.com/smartmeter/img/static/uo3VNhAA6YDvl6lt5kaY" mode=""></image>
|
|
</view>
|
|
<view class="li" @click="btnpage(2)">
|
|
<view class="one">
|
|
<image src="https://lxnapi.ccttiot.com/smartmeter/img/static/uHSoiXaQKLZF6yV6RzLp" mode=""></image> 隐私政策
|
|
</view>
|
|
<image class="jt" src="https://lxnapi.ccttiot.com/smartmeter/img/static/uo3VNhAA6YDvl6lt5kaY" mode=""></image>
|
|
</view>
|
|
<view class="li" @click="btnpage(3)">
|
|
<view class="one">
|
|
<image src="https://lxnapi.ccttiot.com/smartmeter/img/static/uQLSntg7FR7kPAn5h2MC" mode=""></image> 关于我们
|
|
</view>
|
|
<image class="jt" src="https://lxnapi.ccttiot.com/smartmeter/img/static/uo3VNhAA6YDvl6lt5kaY" mode=""></image>
|
|
</view>
|
|
<!-- <view class="li" @click="btnluru">
|
|
<view class="one">
|
|
<image src="https://lxnapi.ccttiot.com/smartmeter/img/static/uGJS2qdk4JKKLiPt7c9K" mode=""></image> 设备录入
|
|
</view>
|
|
<image class="jt" src="https://lxnapi.ccttiot.com/smartmeter/img/static/uo3VNhAA6YDvl6lt5kaY" mode=""></image>
|
|
</view> -->
|
|
<view class="li" @click="btntc" v-if="flag">
|
|
<view class="one">
|
|
<image src="https://lxnapi.ccttiot.com/smartmeter/img/static/u2tbwMgaIqD7yVMLcE4G" mode=""></image> 退出登录
|
|
</view>
|
|
<image class="jt" src="https://lxnapi.ccttiot.com/smartmeter/img/static/uo3VNhAA6YDvl6lt5kaY" mode=""></image>
|
|
</view>
|
|
</view>
|
|
<view class="gongzuotai" v-if="roles.length > 0" @click="btnshanghu">
|
|
工作台
|
|
</view>
|
|
|
|
<!-- 性别选择弹窗 -->
|
|
<uni-popup v-if="showGenderPicker" ref="genderPopup" type="bottom" :mask-click="true" @maskClick="showGenderPicker = false">
|
|
<view class="gender-picker">
|
|
<view class="picker-header">
|
|
<text class="picker-title">选择性别</text>
|
|
<uni-icons
|
|
type="close"
|
|
size="22"
|
|
color="#999"
|
|
@click="showGenderPicker = false"
|
|
></uni-icons>
|
|
</view>
|
|
|
|
<view class="gender-options">
|
|
<view
|
|
class="gender-option"
|
|
:class="{ active: tempGender === '男' }"
|
|
@click="selectGender('男')"
|
|
>
|
|
<image :src="tempGender === '男' ? 'https://api.ccttiot.com/smartmeter/img/static/uGhxU4Yh34qZzY7s9ntg' : 'https://api.ccttiot.com/smartmeter/img/static/uGhxU4Yh34qZzY7s9ntg'" class="gender-icon"/>
|
|
<text>男</text>
|
|
</view>
|
|
|
|
<view
|
|
class="gender-option"
|
|
:class="{ active: tempGender === '女' }"
|
|
@click="selectGender('女')"
|
|
>
|
|
<image
|
|
:src="tempGender === '女' ? 'https://api.ccttiot.com/smartmeter/img/static/uF7rnOO2DtSm8fF6jmKK' : 'https://api.ccttiot.com/smartmeter/img/static/uF7rnOO2DtSm8fF6jmKK'"
|
|
class="gender-icon"
|
|
/>
|
|
<text>女</text>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="anniu" style="display: flex;align-items: center;justify-content: space-between;">
|
|
<button class="confirm-btn" style="background-color: #ccc;color: #000;" @click="showGenderPicker = false">取消</button>
|
|
<button class="confirm-btn" @click="confirmGender">确定</button>
|
|
</view>
|
|
</view>
|
|
</uni-popup>
|
|
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
bgc: {
|
|
backgroundColor: "",
|
|
},
|
|
flag:false,
|
|
roles:[],
|
|
info:{},
|
|
token:'',
|
|
userImgs:'',
|
|
|
|
showGenderPicker: false,
|
|
currentGender: '',
|
|
tempGender: ''
|
|
}
|
|
},
|
|
onShow() {
|
|
this.getinfo()
|
|
this.gettoken()
|
|
},
|
|
methods: {
|
|
// 更改性别
|
|
btnxingbie(){
|
|
if(this.info.sex == 0){
|
|
this.tempGender = '男'
|
|
}else{
|
|
this.tempGender = '女'
|
|
}
|
|
this.showGenderPicker = true
|
|
},
|
|
selectGender(gender) {
|
|
this.tempGender = gender;
|
|
},
|
|
// 确认选择
|
|
confirmGender() {
|
|
if (this.tempGender) {
|
|
this.currentGender = this.tempGender;
|
|
this.showGenderPicker = false;
|
|
console.log('选择的性别:', this.currentGender);
|
|
let data = {
|
|
sex:this.currentGender == '男' ? 0 : 1
|
|
}
|
|
this.$u.put(`/app/user/editInfo`,data).then(res => {
|
|
if (res.code == 200) {
|
|
uni.showToast({
|
|
title: '修改成功',
|
|
icon: 'success',
|
|
duration:2000
|
|
})
|
|
this.getinfo()
|
|
}else if(res.code == 401){
|
|
uni.showModal({
|
|
title: '提示',
|
|
content: '您当前暂未登录,需前去登录吗?',
|
|
success: function (res) {
|
|
if (res.confirm) {
|
|
uni.reLaunch({
|
|
url:'/pages/login/login'
|
|
})
|
|
} else if (res.cancel) {
|
|
console.log('用户点击取消');
|
|
}
|
|
}
|
|
})
|
|
} else{
|
|
uni.showToast({
|
|
title: res.msg,
|
|
icon: 'none',
|
|
duration:2000
|
|
})
|
|
}
|
|
})
|
|
} else {
|
|
uni.showToast({
|
|
title: '请选择性别',
|
|
icon: 'none'
|
|
});
|
|
}
|
|
},
|
|
// 更换头像
|
|
getimage(e){
|
|
let that = this
|
|
let math = 'static/' + that.$u.guid(20)
|
|
wx.uploadFile({
|
|
url: 'https://up-z2.qiniup.com',
|
|
name: 'file',
|
|
filePath: e.detail.avatarUrl,
|
|
formData: {
|
|
token: that.token, //后端返回的token
|
|
key: 'smartmeter/img/' + math
|
|
},
|
|
success: function(res) {
|
|
let str = JSON.parse(res.data)
|
|
console.log(str);
|
|
that.userImgs = 'https://api.ccttiot.com/' + str.key
|
|
console.log(that.userImgs)
|
|
that.getxiugai()
|
|
}
|
|
})
|
|
},
|
|
// 修改个人信息
|
|
getxiugai(){
|
|
let data = {
|
|
// userId:this.info.userId,
|
|
avatar:this.userImgs
|
|
}
|
|
this.$u.put(`/app/user/editInfo`,data).then(res => {
|
|
if (res.code == 200) {
|
|
uni.showToast({
|
|
title: '修改成功',
|
|
icon: 'success',
|
|
duration:2000
|
|
})
|
|
this.getinfo()
|
|
}else if(res.code == 401){
|
|
uni.showModal({
|
|
title: '提示',
|
|
content: '您当前暂未登录,需前去登录吗?',
|
|
success: function (res) {
|
|
if (res.confirm) {
|
|
uni.reLaunch({
|
|
url:'/pages/login/login'
|
|
})
|
|
} else if (res.cancel) {
|
|
console.log('用户点击取消');
|
|
}
|
|
}
|
|
})
|
|
} else{
|
|
uni.showToast({
|
|
title: res.msg,
|
|
icon: 'none',
|
|
duration:2000
|
|
})
|
|
}
|
|
})
|
|
},
|
|
// 获取七牛云token
|
|
gettoken(){
|
|
this.$u.get(`/common/qiniuToken`).then(res => {
|
|
if (res.code == 200) {
|
|
this.token = res.data
|
|
}
|
|
})
|
|
},
|
|
|
|
getinfo(){
|
|
this.$u.get(`/getInfo`).then(res => {
|
|
if (res.code == 200) {
|
|
this.roles = res.roles
|
|
this.info = res.user
|
|
this.flag = true
|
|
}else if(res.code == 401){
|
|
this.flag = false
|
|
}
|
|
})
|
|
},
|
|
// 点击跳转各类协议
|
|
btnpage(num){
|
|
if(num == 1){ //用户协议
|
|
uni.navigateTo({
|
|
url:'/page_shanghu/about?tit=' + '用户协议' + '&type=1'
|
|
})
|
|
}else if(num == 2){ //隐私政策
|
|
uni.navigateTo({
|
|
url:'/page_shanghu/about?tit=' + '隐私政策' + '&type=2'
|
|
})
|
|
}else{ //关于我们
|
|
uni.navigateTo({
|
|
url:'/page_shanghu/about?tit=' + '关于我们' + '&type=3'
|
|
})
|
|
}
|
|
},
|
|
// 点击跳转到设备录入
|
|
btnluru(){
|
|
uni.navigateTo({
|
|
url:'/page_user/luru/index'
|
|
})
|
|
},
|
|
// 点击跳转到商户端
|
|
btnshanghu(){
|
|
uni.navigateTo({
|
|
url:'/page_shanghu/index'
|
|
})
|
|
},
|
|
// 点击跳转到编辑信息
|
|
btnbj(){
|
|
uni.navigateTo({
|
|
url:'/page_user/editxx'
|
|
})
|
|
},
|
|
// 点击退出登录
|
|
btntc(){
|
|
uni.showModal({
|
|
title: '提示',
|
|
content: '您确定要退出登录吗?',
|
|
success: function (res) {
|
|
if (res.confirm) {
|
|
uni.reLaunch({
|
|
url:'/pages/login/login'
|
|
})
|
|
} else if (res.cancel) {
|
|
console.log('用户点击取消');
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
page {
|
|
background-color: #fff;
|
|
}
|
|
.container {
|
|
padding: 30rpx;
|
|
}
|
|
|
|
.gender-btn {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
width: 200rpx;
|
|
height: 70rpx;
|
|
background-color: #f8f8f8;
|
|
border-radius: 35rpx;
|
|
padding: 0 30rpx;
|
|
font-size: 28rpx;
|
|
color: #333;
|
|
border: none;
|
|
|
|
&::after {
|
|
border: none;
|
|
}
|
|
}
|
|
|
|
.gender-picker {
|
|
background-color: #fff;
|
|
border-radius: 24rpx;
|
|
padding: 40rpx 30rpx;
|
|
width: 680rpx;
|
|
position: fixed;
|
|
top: 40%;
|
|
left: 50%;
|
|
transform: translateX(-50%);
|
|
z-index: 99;
|
|
}
|
|
|
|
.picker-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 40rpx;
|
|
|
|
.picker-title {
|
|
font-size: 32rpx;
|
|
font-weight: bold;
|
|
color: #333;
|
|
}
|
|
}
|
|
|
|
.gender-options {
|
|
display: flex;
|
|
justify-content: space-around;
|
|
margin-bottom: 50rpx;
|
|
|
|
.gender-option {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
width: 200rpx;
|
|
padding: 30rpx 0;
|
|
border-radius: 16rpx;
|
|
border: 1rpx solid #eee;
|
|
|
|
&.active {
|
|
border-color: #FF8998;
|
|
background-color: #ffebed;
|
|
}
|
|
|
|
.gender-icon {
|
|
width: 80rpx;
|
|
height: 80rpx;
|
|
margin-bottom: 20rpx;
|
|
}
|
|
|
|
text {
|
|
font-size: 28rpx;
|
|
color: #666;
|
|
}
|
|
}
|
|
}
|
|
|
|
.confirm-btn {
|
|
background-color: #FF8998;
|
|
color: white;
|
|
border-radius: 50rpx;
|
|
width: 48%;
|
|
height: 80rpx;
|
|
line-height: 80rpx;
|
|
font-size: 32rpx;
|
|
|
|
&:active {
|
|
background-color: #FF8998;
|
|
}
|
|
}
|
|
|
|
.gongzuotai{
|
|
width: 160rpx;
|
|
height: 80rpx;
|
|
position: fixed;
|
|
top: 200rpx;
|
|
right:20rpx;
|
|
background-color: #010000;
|
|
color: #fff;
|
|
border-radius: 30rpx;
|
|
text-align: center;
|
|
line-height: 80rpx;
|
|
}
|
|
.bj{
|
|
width: 750rpx;
|
|
height: 574rpx;
|
|
position: fixed;
|
|
z-index: -1;
|
|
top: 0;
|
|
left: 0;
|
|
filter: blur(2px);
|
|
}
|
|
.box{
|
|
width: 750rpx;
|
|
height: 1082rpx;
|
|
background: #010000;
|
|
position: fixed;
|
|
bottom: 0;
|
|
left: 0;
|
|
border-radius: 30rpx 30rpx 0 0;
|
|
padding: 0 62rpx;
|
|
box-sizing: border-box;
|
|
.gongneng{
|
|
width: 644rpx;
|
|
max-height: 494rpx;
|
|
background: #0E0C0C;
|
|
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
|
margin-top: 24rpx;
|
|
padding: 40rpx 46rpx;
|
|
padding-bottom: 10rpx !important;
|
|
box-sizing: border-box;
|
|
.li{
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
margin-bottom: 36rpx;
|
|
.one{
|
|
image{
|
|
width: 42rpx;
|
|
height: 42rpx;
|
|
margin-right: 28rpx;
|
|
}
|
|
display: flex;
|
|
align-items: center;
|
|
font-size: 28rpx;
|
|
color: #FFFFFF;
|
|
}
|
|
.jt{
|
|
width: 20rpx;
|
|
height: 20rpx;
|
|
}
|
|
}
|
|
}
|
|
.qianm{
|
|
font-size: 28rpx;
|
|
color: #9F9F9F;
|
|
margin-top: 24rpx;
|
|
}
|
|
.name{
|
|
font-size: 36rpx;
|
|
color: #FFFFFF;
|
|
display: flex;
|
|
align-items: center;
|
|
margin-top: 38rpx;
|
|
image{
|
|
width: 32rpx;
|
|
height: 32rpx;
|
|
margin-left: 8rpx;
|
|
}
|
|
.nan{
|
|
image{
|
|
width: 32rpx;
|
|
height: 32rpx;
|
|
}
|
|
}
|
|
}
|
|
|
|
.top{
|
|
display: flex;
|
|
justify-content: space-between;
|
|
button{
|
|
width: 150rpx;
|
|
height: 150rpx;
|
|
border-radius: 50%;
|
|
position: absolute;
|
|
top: -75rpx;
|
|
image{
|
|
width: 150rpx;
|
|
height: 150rpx;
|
|
border-radius: 50%;
|
|
position: absolute;
|
|
left: 0;
|
|
}
|
|
}
|
|
.pic{
|
|
image{
|
|
width: 150rpx;
|
|
height: 150rpx;
|
|
border-radius: 50%;
|
|
position: absolute;
|
|
top: -75rpx;
|
|
}
|
|
}
|
|
.bianji{
|
|
width: 150rpx;
|
|
height: 48rpx;
|
|
background: #FFE7EA;
|
|
border-radius: 31rpx 31rpx 31rpx 31rpx;
|
|
font-size: 26rpx;
|
|
color: #FF8998;
|
|
text-align: center;
|
|
padding-top: 6rpx;
|
|
box-sizing: border-box;
|
|
margin-top: 38rpx;
|
|
}
|
|
}
|
|
}
|
|
|
|
</style> |