desc: 调整个人信息

This commit is contained in:
zyy 2019-10-25 18:20:24 +08:00
parent 32d3983d70
commit 18ad9e1faa
4 changed files with 133 additions and 49 deletions

View File

@ -40,6 +40,7 @@ export default {
nickName: 'nickname',
mobile: 'mobile',
name: 'Name',
compellation: 'Name',
code: 'Code',
status: 'State',
remarks: 'Remarks',
@ -53,7 +54,7 @@ export default {
enterNickname: 'Please enter nickname',
enterName: 'Please enter name',
passWordLength: 'New password length cannot be less than 5 digits',
passWordSome: 'The new password is different twice',
passWordSome: 'Please fill in the password',
codeFaile: 'Failed to obtain captcha',
selectionTime: 'Selection of time',
permissionNumber: 'Number of permissions',
@ -71,6 +72,8 @@ export default {
total: 'Total',
index: 'Index',
startTime: 'Start',
sendMobileCode: 'Send phone code',
enterMobileNumber: 'Please bind mobile phone number',
endTime: 'End',
isForever: 'Timelimit',
remains: 'Remaining',
@ -97,6 +100,7 @@ export default {
trainingNotStart: "{name}'s room hasn't started yet",
inputRoomNumber: 'Please enter the room number.',
chooseRoom: 'Choose Room',
codeError: 'The captcha is incorrect',
month: ' month',
indexA: ' piece',
@ -178,5 +182,15 @@ export default {
examSystem: 'The exam system',
personalDetails: 'information',
trainingPlatformEntrance: 'Training platform entrance',
designPlatformEntrance: 'Design platform entrance'
designPlatformEntrance: 'Design platform entrance',
china: 'China',
australia: 'Australia',
england: 'England',
hongKong: 'Hong Kong',
japanese: 'Japanese',
macao: 'Macao',
singapore: 'Singapore',
taiwan: 'taiwan',
america: 'America'
};

View File

@ -40,6 +40,7 @@ export default {
nickName: '昵称',
mobile: '手机号',
name: '名称',
compellation: '姓名',
code: '编码',
status: '状态',
remarks: '说明',
@ -50,11 +51,14 @@ export default {
newPassWord: '新密码',
enterPassWord: '请输入新密码',
enterMobile: '请输入手机号',
enterMobileNumber: '请绑定手机号',
enterNickname: '请输入昵称',
enterName: '请输入名称',
passWordLength: '新密码长度不能低于5位',
passWordSome: '新密码两次不相同',
passWordSome: '请填写密码',
codeFaile: '获取验证码失败',
codeError: '验证码不正确',
sendMobileCode: '发送手机验证码',
selectionTime: '选择时间',
permissionNumber: '权限个数',
pleaseInputPermissionNumber: '请输入权限个数',
@ -178,5 +182,15 @@ export default {
examSystem: '考试系统',
personalDetails: '个人信息',
trainingPlatformEntrance: '实训平台入口',
designPlatformEntrance: '设计平台入口'
designPlatformEntrance: '设计平台入口',
china: '中国',
australia: '澳大利亚',
england: '英国',
hongKong: '香港',
Japanese: '日本',
macao: '澳门',
singapore: '新加坡',
taiwan: '台湾',
america: '美国'
};

View File

@ -2,7 +2,7 @@
<el-dialog v-dialogDrag :title="$t('global.personalDetails')" :visible.sync="visible" width="470px" :before-close="doClose" class="userInfo_box">
<div>
<div class="form_box">
<div class="title">{{ $t('global.name') }}:</div>
<div class="title">{{ $t('global.compellation') }}:</div>
<div class="content">
<div v-show="nameShow" class="show_box">
<span>{{ userInfo.name }}</span>
@ -37,11 +37,19 @@
<div class="title">{{ $t('global.mobile') }}:</div>
<div class="content">
<div v-show="mobileShow" class="show_box">
<span>{{ userInfo.mobile }}</span>
<span>{{ geTel(userInfo.mobile) }}</span>
<i class="el-icon-edit" @click="switcherMobile" />
</div>
<div v-show="!mobileShow" class="flex_box">
<el-input v-model="editInfo.mobile" :placeholder="$t('global.enterMobile')" maxlength="11" size="mini" class="input_box" />
<el-select v-model="nationCode" size="mini" class="selectCountry">
<el-option
v-for="item in countryList"
:key="item.value"
:label="item.name"
:value="item.value"
/>
</el-select>
<el-input v-model="mobileCode" :placeholder="$t('global.verificationCode')" size="mini" class="code_box" style="margin-top: 10px;" />
<el-button size="mini" style="margin-top: 10px; margin-right: 10px;" :disabled="mobileCodeTime != 0" @click="sendMobileCode">
{{ $t('global.sendCode') }}
@ -83,21 +91,19 @@
<i class="el-icon-edit" @click="switcherPassWord" />
</div>
<div v-show="!passwordShow" class="flex_box">
<!-- <div class="passWord_box">
<span>原密码:</span>
<el-input v-model="oldPassWord" placeholder="请输入原密码" maxlength="8" show-password size="mini" class="input_box" />
</div> -->
<div class="passWord_box">
<span>{{ $t('global.newPassWord') }}:</span>
<el-input v-model="newPassWord1" :placeholder="$t('global.enterPassWord')" maxlength="20" show-password size="mini" class="input_box" />
</div>
<div class="passWord_box">
<span>{{ $t('global.newPassWord') }}:</span>
<el-input v-model="newPassWord2" :placeholder="$t('global.enterPassWord')" maxlength="20" show-password size="mini" class="input_box" />
<div style="height: 28px; line-height: 28px; margin-bottom: 10px;">
<el-input v-model="passWordCode" :placeholder="$t('global.verificationCode')" size="mini" class="code_box" />
<el-button size="mini" style="margin-right: 10px;" :disabled="passWordCodeTime != 0" @click="sendPassWordCode">
{{ $t('global.sendMobileCode') }}
<span v-if="passWordCodeTime">{{ passWordCodeTime }}</span>
</el-button>
</div>
<span class="tip_box">{{ tip }}</span>
<div class="button_box" style="width: 150px;">
<el-button size="mini" class="button_box" @click="savePassWord">{{ $t('global.save') }}</el-button>
<el-button size="mini" class="button_box" :disabled="!passWordCode" @click="savePassWord">{{ $t('global.save') }}</el-button>
<el-button size="mini" class="button_box" type="text" @click="switcherPassWord">{{ $t('global.cancel') }}</el-button>
</div>
</div>
@ -143,17 +149,30 @@ export default {
passwordShow: true,
mobileCode: null,
emailCode: null,
passWordCode: null,
oldPassWord: null,
newPassWord1: null,
newPassWord2: null,
mobileCodeTime: 0,
emailCodeTime: 0,
passWordCodeTime: 0,
emailTime: null,
mobileTime: null,
tip: ''
passWordTime: null,
countryList: [
{ name: this.$t('global.china'), value: '86' },
{ name: this.$t('global.australia'), value: '61' },
{ name: this.$t('global.england'), value: '44' },
{ name: this.$t('global.hongKong'), value: '852' },
{ name: this.$t('global.Japanese'), value: '81' },
{ name: this.$t('global.macao'), value: '853' },
{ name: this.$t('global.singapore'), value: '65' },
{ name: this.$t('global.taiwan'), value: '886' },
{ name: this.$t('global.america'), value: '1' }
],
nationCodeInit: '86' //
};
},
computed: {
@ -162,6 +181,10 @@ export default {
}
},
methods: {
geTel(tel) {
const reg = /^(\d{3})\d{4}(\d{4})$/;
return tel.replace(reg, '$1****$2');
},
doShow() {
this.visible = true;
getInfo(getDesignToken()).then(response => {
@ -175,6 +198,7 @@ export default {
};
this.oldPassWord = user.password;
this.nationCode = user.nationCode ? user.nationCode : '86';
this.nationCodeInit = user.nationCode ? user.nationCode : '86';
}).catch(error => {
console.log(error, '请求个人信息失败');
});
@ -217,7 +241,7 @@ export default {
},
switcherMobile() {
this.editInfo.mobile = this.userInfo.mobile;
// this.editInfo.mobile = this.userInfo.mobile;
this.mobileShow = !this.mobileShow;
},
async saveMobile() {
@ -230,17 +254,24 @@ export default {
};
await getUserinfoMobile(this.info.id, params);
this.userInfo.mobile = this.editInfo.mobile;
this.nationCodeInit = this.nationCode;
this.mobileShow = !this.mobileShow;
this.mobileCode = '';
this.mobileCode = null;
} catch (error) {
console.log(error, '错误');
this.$message.info(this.$t('global.codeError'));
}
}
},
async sendMobileCode() {
const random = Math.floor((Math.random()*10000)+1);
const timeCount = Date.parse(new Date()) / 1000;
const pass = `${timeCount}${this.nationCode}${this.editInfo.mobile}${random}`;
const param = {
mobile: this.editInfo.mobile,
nationCode: this.nationCode
nationCode: this.nationCode,
rd: random,
time: timeCount,
token: md5(pass)
};
try {
this.mobileCodeTime = 30;
@ -254,12 +285,12 @@ export default {
}, 1000);
await getUserinfoMobileCode(param);
} catch (error) {
this.$messageBox(this.$t('global.codeFaile'));
this.$message.info(this.$t('global.codeFaile'));
}
},
switcherEmail() {
this.editInfo.email = this.userInfo.email;
// this.editInfo.email = this.userInfo.email;
this.emailShow = !this.emailShow;
},
async saveEmail() {
@ -272,9 +303,9 @@ export default {
await getUserinfoEmail(this.info.id, params);
this.userInfo.email = this.editInfo.email;
this.emailShow = !this.emailShow;
this.emailCode = '';
this.emailCode = null;
} catch (error) {
this.$messageBox('更新邮箱失败');
this.$message.info(this.$t('global.codeError'));
}
}
},
@ -291,42 +322,68 @@ export default {
}, 1000);
await getUserinfoEmailCode(this.editInfo.email);
} catch (error) {
this.$messageBox(this.$t('global.codeFaile'));
this.$message.info(this.$t('global.codeFaile'));
}
},
switcherPassWord() {
this.passwordShow = !this.passwordShow;
this.tip = '';
},
async savePassWord() {
this.tip = '';
if (this.newPassWord1.length <= 5 || this.newPassWord2.length <= 5) {
this.tip = this.$t('global.passWordLength');
if (this.newPassWord1.length <= 5) {
this.$message.info(this.$t('global.passWordLength'));
} else {
this.uploadPassword();
}
},
async uploadPassword() {
console.log(this.newPassWord1, this.newPassWord2);
if (this.newPassWord1 == this.newPassWord2) {
if (this.newPassWord1) {
//
const param = {
password: md5(this.newPassWord2)
password: md5(this.newPassWord1),
vfCode: this.passWordCode
};
if (this.oldPassWord) {
param['oldPassword'] = this.oldPassWord;
}
try {
await getUserinfoPassword(this.info.id, param);
this.passwordShow = !this.passwordShow;
this.newPassWord1 = '';
this.newPassWord2 = '';
this.passWordCode = null;
} catch (error) {
console.log(error, 11);
}
} else {
this.tip = this.$t('global.passWordSome');
this.$message.info(this.$t('global.passWordSome'));
}
},
async sendPassWordCode() {
if (this.userInfo.mobile) {
const random = Math.floor((Math.random()*10000)+1);
const timeCount = Date.parse(new Date()) / 1000;
const pass = `${timeCount}${this.nationCodeInit}${this.userInfo.mobile}${random}`;
const param = {
mobile: this.userInfo.mobile,
nationCode: this.nationCodeInit,
rd: random,
time: timeCount,
token: md5(pass)
};
try {
this.passWordCodeTime = 30;
this.passWordTime = setInterval(() => {
this.passWordCodeTime--;
if (this.passWordCodeTime <= 0) {
this.passWordCodeTime = 0;
clearInterval(this.mobileTime);
this.passWordTime = null;
}
}, 1000);
await getUserinfoMobileCode(param);
} catch (error) {
this.$message.info(this.$t('global.codeFaile'));
}
} else {
this.passwordShow = !this.passwordShow;
this.$message.info(this.$t('global.enterMobileNumber'));
}
}
}
@ -339,13 +396,6 @@ export default {
align-items: center;
flex-wrap: wrap;
}
.tip_box{
height: 20px;
display: block;
width: 100%;
line-height: 20px;
color: #e47f7f;
}
.form_box{
width: 100%;
overflow: hidden;
@ -353,8 +403,14 @@ export default {
// display: flex;
// align-items: center;
// flex-wrap: wrap;
.selectCountry{
width: 90px;
height: 28px;
line-height: 28px;
}
.title{
width: 60px;
width: 80px;
text-align: left;
font-size: 14px;
height: 28px;
@ -362,7 +418,7 @@ export default {
float: left;
}
.content{
width: calc(100% - 60px);
width: calc(100% - 80px);
float: left;
.el-icon-edit{
cursor: pointer;

View File

@ -3,9 +3,9 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 王兴杰
} else {
BASE_API = process.env.VUE_APP_BASE_API;