游客
This commit is contained in:
@@ -5,33 +5,92 @@
|
||||
<z-nav-bar title="个人资料"></z-nav-bar>
|
||||
<view class="tabulate">
|
||||
<view class="per_list">
|
||||
<text class="biaoti">账号</text>
|
||||
<text class="neirong">{{userMes.tel}}</text>
|
||||
<text class="biaoti">手机号</text>
|
||||
<text class="neirong">{{userMsage.tel}}</text>
|
||||
<text class="marPer" v-if="userMsage.tel==''" @click="phoneShow = true;OpenClear()"
|
||||
style="background-color: #ed901d;">点击绑定</text>
|
||||
</view>
|
||||
<view class="per_list">
|
||||
<text class="biaoti">邮箱</text>
|
||||
<text class="neirong">{{userMsage.email}}</text>
|
||||
<text class="marPer" v-if="userMsage.email!=''" @click="emailShow = true;OpenClear()"
|
||||
style="background-color: #ed901d;">点击绑定</text>
|
||||
</view>
|
||||
<view class="per_list per_list_arrow" @click="avatarShow = true">
|
||||
<text class="biaoti" style="margin-top: 40rpx;">头像</text>
|
||||
<text class="neirong" style="margin-top: 0;">
|
||||
<image :src="userMes.avatar" class="per_mes_img"></image>
|
||||
<image :src="userMsage.avatar" class="per_mes_img"></image>
|
||||
</text>
|
||||
</view>
|
||||
<view class="per_list per_list_arrow" @click="nicknameShow = true">
|
||||
<text class="biaoti">昵称</text>
|
||||
<text class="neirong">{{userMes.nickname}}</text>
|
||||
<text class="neirong">{{userMsage.nickname}}</text>
|
||||
</view>
|
||||
<view class="per_list per_list_arrow" @click="passwordShow = true">
|
||||
<text class="biaoti">修改密码</text>
|
||||
<text class="biaoti">密码</text>
|
||||
<text v-if="userMsage.YNpass!=''" class="neirong">点击修改</text>
|
||||
<text class="marPer" v-if="userMsage.YNpass!=''"
|
||||
style="background-color: #92c78c;margin-right: 40rpx;">已设定</text>
|
||||
<text v-if="userMsage.YNpass==''" class="neirong">去设置</text>
|
||||
<text class="marPer" v-if="userMsage.YNpass==''"
|
||||
style="background-color: #9d9d9d;margin-right: 40rpx;">未设定</text>
|
||||
|
||||
</view>
|
||||
<view class="per_list per_list_arrow" @click="ageShow = true">
|
||||
<text class="biaoti">年龄</text>
|
||||
<text class="neirong">{{userMes.age}}</text>
|
||||
<text class="neirong">{{userMsage.age}}</text>
|
||||
</view>
|
||||
<view class="per_list per_list_arrow" @click="sexShow = true">
|
||||
<text class="biaoti">性别</text>
|
||||
<text class="neirong" v-if="userMes.sex==1">男</text>
|
||||
<text class="neirong" v-if="userMes.sex==0">女</text>
|
||||
<text class="neirong" v-if="userMsage.sex==1">男</text>
|
||||
<text class="neirong" v-if="userMsage.sex==0">女</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 手机 -->
|
||||
<u-popup :show="phoneShow" :round="10" @close="phoneShow=false;">
|
||||
<view class="tanchu">
|
||||
<view class="dp_title">请输入手机号</view>
|
||||
<view style="display: flex;">
|
||||
<view class="quhao">
|
||||
<uni-data-select class="quhaoSel" placeholder="请选择区号" v-model="userMes.quCode"
|
||||
:localdata="quCodeList"></uni-data-select>
|
||||
</view> <u--input v-model="userMes.phone" placeholder="请输入手机号" border="surround" clearable>
|
||||
</u--input>
|
||||
|
||||
</view>
|
||||
<view style="display: flex;">
|
||||
<u--input v-model="userMes.phonecode" type="number" placeholder="请输入验证码" border="surround" clearable
|
||||
style="margin-top: 20rpx;">
|
||||
</u--input>
|
||||
<button class="emPHCode" @click="onSetCode('phone')">{{ PhoneEmailNote }}</button>
|
||||
</view>
|
||||
<u-button color="linear-gradient(to right, #72d386, #317e42)" text="确定" @click="chosePhone()"
|
||||
style="margin-top: 50rpx;"></u-button>
|
||||
<view @click="phoneShow=false" class="dp_canBtn">
|
||||
取消</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
|
||||
<!-- 邮箱 -->
|
||||
<u-popup :show="emailShow" :round="10" @close="emailShow=false;PhoneEmailNote = '获取验证码'">
|
||||
<view class="tanchu">
|
||||
<view class="dp_title">请输入邮箱</view>
|
||||
<u--input v-model="userMes.email" placeholder="请输入邮箱" border="surround" clearable>
|
||||
</u--input>
|
||||
<view style="display: flex;">
|
||||
<u--input v-model="userMes.emailcode" type="number" placeholder="请输入验证码" border="surround" clearable
|
||||
style="margin-top: 20rpx;">
|
||||
</u--input>
|
||||
<button class="emPHCode" @click="onSetCode('email')">{{ PhoneEmailNote }}</button>
|
||||
</view>
|
||||
<u-button color="linear-gradient(to right, #72d386, #317e42)" text="确定" @click="choseEmail()"
|
||||
style="margin-top: 50rpx;"></u-button>
|
||||
<view @click="emailShow=false" class="dp_canBtn">
|
||||
取消</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
|
||||
<!-- 头像 -->
|
||||
<u-popup :show="avatarShow" :round="10" @close="avatarShow=false">
|
||||
<view class="tanchu">
|
||||
@@ -91,15 +150,15 @@
|
||||
<u-popup :show="passwordShow" :round="10" @close="cancelPass">
|
||||
<view class="tanchu">
|
||||
<view class="dp_title">请修改密码</view>
|
||||
<u--input maxlength="8" v-model="userMes.password" placeholder="请输入新密码" :password="true" border="surround" clearable
|
||||
@input="inputMethod(userMes.password)">
|
||||
<u--input maxlength="8" v-model="userMiMa.password" placeholder="请输入新密码" :password="true"
|
||||
border="surround" clearable @input="inputMethod(userMiMa.password)">
|
||||
</u--input>
|
||||
<view class="" style="font-size: 28rpx; color: #999;">
|
||||
<p v-if="note != ''">{{note}}</p>
|
||||
<p v-html="str2" style="margin-top: 10rpx;"></p>
|
||||
</view>
|
||||
<u--input maxlength="8" v-model="userMes.Repassword" placeholder="请再确认密码" :password="true" border="surround" clearable
|
||||
style="margin-top: 20rpx;"></u--input>
|
||||
<p v-if="passNote != ''">{{passNote}}</p>
|
||||
<p v-html="passStr" style="margin-top: 10rpx;"></p>
|
||||
</view>
|
||||
<u--input maxlength="8" v-model="userMiMa.Repassword" placeholder="请再确认密码" :password="true"
|
||||
border="surround" clearable style="margin-top: 20rpx;"></u--input>
|
||||
<u-button color="linear-gradient(to right, #72d386, #317e42)" text="确定" @click="chosePassword()"
|
||||
style="margin-top: 50rpx;"></u-button>
|
||||
<view @click="cancelPass" class="dp_canBtn">取消</view>
|
||||
@@ -115,6 +174,7 @@
|
||||
<script>
|
||||
import musicPlay from '@/components/music.vue'
|
||||
import $http from '@/config/requestConfig.js';
|
||||
var clear;
|
||||
import {
|
||||
mapState
|
||||
} from 'vuex';
|
||||
@@ -131,21 +191,45 @@
|
||||
return {
|
||||
playData: {},
|
||||
userMes: {
|
||||
quCode: '',
|
||||
phone: '',
|
||||
email: '',
|
||||
id: '',
|
||||
age: '',
|
||||
sex: '',
|
||||
nickname: '',
|
||||
tel: '',
|
||||
password: '',
|
||||
Repassword: '',
|
||||
oldName: '', // 老的用户名
|
||||
},
|
||||
userMsage: {
|
||||
quCode: '',
|
||||
phonecode: '',
|
||||
phone: '',
|
||||
emailcode: '',
|
||||
email: '',
|
||||
id: '',
|
||||
age: '',
|
||||
sex: '',
|
||||
nickname: '',
|
||||
tel: '',
|
||||
YNpass: '',
|
||||
oldName: '', // 老的用户名
|
||||
},
|
||||
userMiMa: {
|
||||
id: '',
|
||||
password: '',
|
||||
Repassword: '',
|
||||
},
|
||||
readonly: false,
|
||||
phoneShow: false,
|
||||
emailShow: false,
|
||||
avatarShow: false,
|
||||
nicknameShow: false,
|
||||
ageShow: false,
|
||||
sexShow: false,
|
||||
passwordShow: false,
|
||||
fileAvatar: [],
|
||||
quCodeList: [], // 国家区域码
|
||||
sexList: [{
|
||||
title: '男',
|
||||
id: 1,
|
||||
@@ -155,9 +239,10 @@
|
||||
id: 0,
|
||||
}
|
||||
],
|
||||
note: '',
|
||||
str2: '',
|
||||
passwordOk:false, // 密码是否满足规则
|
||||
PhoneEmailNote: '获取验证码',
|
||||
passNote: '',
|
||||
passStr: '',
|
||||
passwordOk: false, // 密码是否满足规则
|
||||
};
|
||||
},
|
||||
//第一次加载
|
||||
@@ -173,6 +258,7 @@
|
||||
// 隐藏原生的tabbar
|
||||
uni.hideTabBar();
|
||||
this.getData();
|
||||
this.getCountyCode()
|
||||
},
|
||||
components: {
|
||||
musicPlay
|
||||
@@ -180,8 +266,37 @@
|
||||
//方法
|
||||
methods: {
|
||||
// 获取
|
||||
getCountyCode() {
|
||||
let that = this
|
||||
// 获取国家区域编码
|
||||
$http.request({
|
||||
url: "book/baseArea/getAllBaseArea",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data: {},
|
||||
header: { //默认 无 说明:请求头
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
})
|
||||
.then(res => {
|
||||
// console.log(res,'区域码')
|
||||
if (res.code == 0 && res.baseAreas.length > 0) {
|
||||
that.quCodeList = res.baseAreas.map(item => {
|
||||
let obj = {
|
||||
'text': item.title + ' (+' + item.code + ')',
|
||||
'value': item.code,
|
||||
}
|
||||
return obj
|
||||
})
|
||||
} else {
|
||||
that.quCodeList = []
|
||||
}
|
||||
}).catch(e => {
|
||||
console.log(e, 'e')
|
||||
});
|
||||
},
|
||||
getData() {
|
||||
let that = this
|
||||
|
||||
// 获取个人信息
|
||||
if (this.userInfo.id != undefined) {
|
||||
this.$http
|
||||
@@ -194,173 +309,371 @@
|
||||
that.userMes.tel = res.user.tel
|
||||
that.userMes.avatar = res.user.avatar
|
||||
that.userMes.oldName = that.userMes.nickname
|
||||
that.userMes.id = res.user.id
|
||||
|
||||
that.userMsage.age = res.user.age
|
||||
that.userMsage.email = res.user.email
|
||||
that.userMsage.sex = res.user.sex
|
||||
that.userMsage.nickname = res.user.nickname
|
||||
that.userMsage.tel = res.user.tel
|
||||
that.userMsage.avatar = res.user.avatar
|
||||
that.userMsage.YNpass = res.user.password
|
||||
that.userMiMa.id = res.user.id
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
},
|
||||
cancelPass(){
|
||||
this.passwordShow = false,
|
||||
this.userMes.password = '',
|
||||
this.userMes.Repassword = ''
|
||||
this.note = '',
|
||||
this.str2 = ''
|
||||
cancelPass() {
|
||||
this.passwordShow = false
|
||||
this.userMiMa.password = ''
|
||||
this.userMiMa.Repassword = ''
|
||||
this.passNote = ''
|
||||
this.passStr = ''
|
||||
},
|
||||
// 密码验证
|
||||
inputMethod(value) {
|
||||
this.passwordOk = false
|
||||
// console.log('输入的值为:', value)
|
||||
// console.log('输入的值为:', value)
|
||||
if (strongRegex.test(value)) {
|
||||
//console.log('强密码-----',value)
|
||||
this.str2 = "<span style='color:#18bc37'>密码强度很不错哦!</span>"
|
||||
// this.note = '请至少使用大小写字母、数字、符号两种类型组合的密码,长度为8位。'
|
||||
this.note = ''
|
||||
this.passStr = "<span style='color:#18bc37'>密码强度很不错哦!</span>"
|
||||
// this.passNote = '请至少使用大小写字母、数字、符号两种类型组合的密码,长度为8位。'
|
||||
this.passNote = ''
|
||||
this.passwordOk = true
|
||||
} else if (mediumRegex.test(value)) {
|
||||
//console.log('中等密码-----',value)
|
||||
this.note = '请至少使用大小写字母、数字、符号两种类型组合的密码,长度为8位。'
|
||||
this.str2 = "<span style='color:#2979ff'>密码强度中等!</span>"
|
||||
this.passNote = '请至少使用大小写字母、数字、符号两种类型组合的密码,长度为8位。'
|
||||
this.passStr = "<span style='color:#2979ff'>密码强度中等!</span>"
|
||||
this.passwordOk = true
|
||||
} else if (enoughRegex.test(value)) {
|
||||
//console.log('弱密码-----',value)
|
||||
this.str2 = "<span style='color:#f3a73f'>密码强度太弱!</span>"
|
||||
this.note = '请至少使用大小写字母、数字、符号两种类型组合的密码,长度为8位。'
|
||||
this.passStr = "<span style='color:#f3a73f'>密码强度太弱!</span>"
|
||||
this.passNote = '请至少使用大小写字母、数字、符号两种类型组合的密码,长度为8位。'
|
||||
} else {
|
||||
this.passwordOk = false
|
||||
this.note = '请至少使用大小写字母、数字、符号两种类型组合的密码,长度为8位。'
|
||||
this.str2 = ""
|
||||
this.passNote = '请至少使用大小写字母、数字、符号两种类型组合的密码,长度为8位。'
|
||||
this.passStr = ""
|
||||
//console.log('密码-----',value)
|
||||
}
|
||||
},
|
||||
// 头像
|
||||
choseAvatar(e) {
|
||||
let that = this
|
||||
if (that.fileAvatar.length == 0) {
|
||||
uni.showToast({
|
||||
title: "请选择图片",
|
||||
icon: 'none'
|
||||
});
|
||||
return
|
||||
}
|
||||
that.userMes.avatar = that.fileAvatar[0].url
|
||||
that.choseData()
|
||||
that.avatarShow = false
|
||||
that.fileAvatar.splice(0, 1)
|
||||
},
|
||||
// 年龄
|
||||
choseAge(e) {
|
||||
let that = this
|
||||
if (that.userMes.age <= 0) {
|
||||
uni.showToast({
|
||||
title: "年龄不能小于0",
|
||||
icon: 'none'
|
||||
});
|
||||
return
|
||||
}
|
||||
that.choseData()
|
||||
that.ageShow = false
|
||||
},
|
||||
|
||||
// 昵称
|
||||
choseNickname(e) {
|
||||
let that = this
|
||||
if (e && e != '') {
|
||||
|
||||
that.choseData()
|
||||
that.nicknameShow = false
|
||||
} else {
|
||||
that.userMes.nickname = that.userMes.oldName
|
||||
console.log(that.userMes.nickname)
|
||||
uni.showToast({
|
||||
title: '昵称不可为空',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
// 性别
|
||||
choseSex(e) {
|
||||
let that = this
|
||||
that.userMes.sex = e
|
||||
that.choseData()
|
||||
that.sexShow = false
|
||||
},
|
||||
|
||||
// 修改密码
|
||||
chosePassword() {
|
||||
if(!this.passwordOk){
|
||||
console.log('不满足密码格式',this.note)
|
||||
uni.showToast({
|
||||
title:this.note,
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
let that = this
|
||||
|
||||
if (that.userMes.Repassword == '' || that.userMes.password == '') {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "请输入密码!"
|
||||
});
|
||||
return
|
||||
}
|
||||
if (that.userMes.Repassword != that.userMes.password) {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "两次密码输入不一致!"
|
||||
});
|
||||
return
|
||||
}
|
||||
|
||||
that.choseData()
|
||||
that.passwordShow = false
|
||||
},
|
||||
|
||||
// 修改个人资料
|
||||
choseData() {
|
||||
let that = this
|
||||
$http.request({
|
||||
url: "book/user/update",
|
||||
method: "POST",
|
||||
data: that.userMes,
|
||||
header: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(function(res) {
|
||||
if (res.code == 0) {
|
||||
uni.showToast({
|
||||
title: "修改成功"
|
||||
});
|
||||
}
|
||||
}).catch(function(error) {
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
// 头像上传
|
||||
afterRead(e) {
|
||||
let that = this
|
||||
uni.uploadFile({
|
||||
url: this.$baseUrl + 'oss/fileoss',
|
||||
filePath: e.file[0].url,
|
||||
name: 'file',
|
||||
formData: {},
|
||||
success: (res) => {
|
||||
that.fileAvatar.push({
|
||||
url: JSON.parse(res.data).url
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 删除图片
|
||||
deletePic() {
|
||||
let that = this
|
||||
that.fileAvatar.splice(0, 1)
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
// 清除验证码
|
||||
OpenClear() {
|
||||
clearInterval(clear)
|
||||
this.PhoneEmailNote = '获取验证码';
|
||||
this.readonly = false;
|
||||
},
|
||||
|
||||
// 获取验证码
|
||||
emPHCode() {
|
||||
clear && clearInterval(clear);
|
||||
this.readonly = true
|
||||
this.PhoneEmailNote = '60S';
|
||||
var s = 60;
|
||||
clear = setInterval(() => {
|
||||
s--;
|
||||
this.PhoneEmailNote = s + 'S';
|
||||
if (s <= 0) {
|
||||
clearInterval(clear);
|
||||
this.PhoneEmailNote = '获取验证码';
|
||||
this.readonly = false;
|
||||
}
|
||||
}, 1000);
|
||||
},
|
||||
|
||||
|
||||
// 发送验证码
|
||||
onSetCode(e) {
|
||||
if (this.readonly) {
|
||||
return;
|
||||
}
|
||||
if (e == 'phone') {
|
||||
if (!this.userMes.phone) {
|
||||
uni.showToast({
|
||||
title: '请输入手机号',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (this.userMes.quCode == null || this.userMes.quCode == 86) {
|
||||
if (!this.$base.phoneRegular.test(this.userMes.phone)) {
|
||||
uni.showToast({
|
||||
title: '手机格式不正确',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.$http
|
||||
.get('book/user/sms/sendcode', {
|
||||
phone: this.userMes.phone,
|
||||
areaCode: this.userMes.quCode,
|
||||
type: 2000
|
||||
})
|
||||
.then(res => {
|
||||
uni.showToast({
|
||||
title: '验证码发送成功',
|
||||
icon: 'none'
|
||||
});
|
||||
this.emPHCode();
|
||||
});
|
||||
}
|
||||
if (e == 'email') {
|
||||
if (!this.userMes.email) {
|
||||
uni.showToast({
|
||||
title: '请输入邮箱',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!this.$base.mailRegular.test(this.userMes.email)) {
|
||||
uni.showToast({
|
||||
title: '邮箱格式不正确',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.$http
|
||||
.get('book/user/getMailCaptcha', {
|
||||
email: this.userMes.email
|
||||
})
|
||||
.then(res => {
|
||||
uni.showToast({
|
||||
title: '验证码发送成功',
|
||||
icon: 'none'
|
||||
});
|
||||
this.emPHCode();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 手机
|
||||
chosePhone(e) {
|
||||
this.userMes.code = this.userMes.phonecode
|
||||
if (this.userMes.email == '') {
|
||||
uni.showToast({
|
||||
title: '请输入手机号',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (this.userMes.code == '' || this.userMes.code == null) {
|
||||
uni.showToast({
|
||||
title: '请输入验证码',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
$http.request({
|
||||
url: "book/user/updateUserTel",
|
||||
method: "POST",
|
||||
data: this.userMes,
|
||||
header: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(function(res) {
|
||||
if (res.code == 0) {
|
||||
this.getData();
|
||||
this.phoneShow = false
|
||||
uni.showToast({
|
||||
title: "绑定手机号成功"
|
||||
});
|
||||
}
|
||||
}).catch(function(error) {
|
||||
console.log(error);
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
// 邮箱
|
||||
choseEmail(e) {
|
||||
this.userMes.code = this.userMes.emailcode
|
||||
if (this.userMes.email == '') {
|
||||
uni.showToast({
|
||||
title: '请输入邮箱',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (this.userMes.code == '' || this.userMes.code == null) {
|
||||
uni.showToast({
|
||||
title: '请输入验证码',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
$http.request({
|
||||
url: "book/user/updateUserEmail",
|
||||
method: "POST",
|
||||
data: this.userMes,
|
||||
header: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(function(res) {
|
||||
if (res.code == 0) {
|
||||
this.getData();
|
||||
this.emailShow = false
|
||||
uni.showToast({
|
||||
title: "绑定邮箱成功"
|
||||
});
|
||||
}
|
||||
}).catch(function(error) {
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
|
||||
// 头像
|
||||
choseAvatar(e) {
|
||||
let that = this
|
||||
if (that.fileAvatar.length == 0) {
|
||||
uni.showToast({
|
||||
title: "请选择图片",
|
||||
icon: 'none'
|
||||
});
|
||||
return
|
||||
}
|
||||
that.userMes.avatar = that.fileAvatar[0].url
|
||||
that.choseData()
|
||||
that.avatarShow = false
|
||||
that.fileAvatar.splice(0, 1)
|
||||
},
|
||||
// 年龄
|
||||
choseAge(e) {
|
||||
let that = this
|
||||
if (that.userMes.age <= 0) {
|
||||
uni.showToast({
|
||||
title: "年龄不能小于0",
|
||||
icon: 'none'
|
||||
});
|
||||
return
|
||||
}
|
||||
that.choseData()
|
||||
that.ageShow = false
|
||||
},
|
||||
|
||||
// 昵称
|
||||
choseNickname(e) {
|
||||
let that = this
|
||||
if (e && e != '') {
|
||||
that.choseData()
|
||||
that.nicknameShow = false
|
||||
} else {
|
||||
that.userMes.nickname = that.userMes.oldName
|
||||
console.log(that.userMes.nickname)
|
||||
uni.showToast({
|
||||
title: '昵称不可为空',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
// 性别
|
||||
choseSex(e) {
|
||||
let that = this
|
||||
that.userMes.sex = e
|
||||
that.choseData()
|
||||
that.sexShow = false
|
||||
},
|
||||
|
||||
// 修改密码
|
||||
chosePassword() {
|
||||
if (!this.passwordOk) {
|
||||
console.log('不满足密码格式', this.passNote)
|
||||
uni.showToast({
|
||||
title: this.passNote,
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
let that = this
|
||||
|
||||
if (that.userMiMa.Repassword == '' || that.userMiMa.password == '') {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "请输入密码!"
|
||||
});
|
||||
return
|
||||
}
|
||||
if (that.userMiMa.Repassword != that.userMiMa.password) {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "两次密码输入不一致!"
|
||||
});
|
||||
return
|
||||
}
|
||||
|
||||
$http.request({
|
||||
url: "book/user/updateUserPassword",
|
||||
method: "POST",
|
||||
data: that.userMiMa,
|
||||
header: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(function(res) {
|
||||
if (res.code == 0) {
|
||||
uni.showToast({
|
||||
title: "修改成功"
|
||||
});
|
||||
that.passwordShow = false
|
||||
}
|
||||
}).catch(function(error) {
|
||||
console.log(error);
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
// 修改个人资料
|
||||
choseData() {
|
||||
let that = this
|
||||
$http.request({
|
||||
url: "book/user/update",
|
||||
method: "POST",
|
||||
data: that.userMes,
|
||||
header: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(function(res) {
|
||||
if (res.code == 0) {
|
||||
that.getData();
|
||||
// that.$forceUpdate()
|
||||
uni.showToast({
|
||||
title: "修改成功"
|
||||
});
|
||||
}
|
||||
}).catch(function(error) {
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
// 头像上传
|
||||
afterRead(e) {
|
||||
let that = this
|
||||
uni.uploadFile({
|
||||
url: this.$baseUrl + 'oss/fileoss',
|
||||
filePath: e.file[0].url,
|
||||
name: 'file',
|
||||
formData: {},
|
||||
success: (res) => {
|
||||
that.fileAvatar.push({
|
||||
url: JSON.parse(res.data).url
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 删除图片
|
||||
deletePic() {
|
||||
let that = this
|
||||
that.fileAvatar.splice(0, 1)
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import '@/style/mixin.scss';
|
||||
@@ -409,6 +722,17 @@
|
||||
display: block;
|
||||
}
|
||||
|
||||
text.marPer {
|
||||
color: #fff;
|
||||
font-weight: normal;
|
||||
float: right;
|
||||
margin: 25rpx 0 0 0;
|
||||
display: block;
|
||||
border-radius: 10rpx;
|
||||
background-color: #eee;
|
||||
padding: 2rpx 10rpx;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -484,7 +808,40 @@
|
||||
margin-top: 25rpx;
|
||||
color: #888;
|
||||
}
|
||||
}
|
||||
|
||||
.submit {}
|
||||
.emPHCode {
|
||||
height: 80rpx;
|
||||
width: 200rpx;
|
||||
background-color: #f8f9fb;
|
||||
font-size: 28rpx;
|
||||
padding: 0 14rpx;
|
||||
color: #54a966;
|
||||
line-height: 80rpx;
|
||||
margin: 20rpx 0 0 20rpx;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.quhao {
|
||||
height: 60rpx;
|
||||
width: 240rpx;
|
||||
margin: 1rpx 15rpx 0 0;
|
||||
|
||||
.quhaoSel {
|
||||
|
||||
/deep/.uni-select {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
/deep/.uni-select__selector-item {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
/deep/.uni-stat__select {
|
||||
height: 60rpx;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user