调整路径

This commit is contained in:
joylink_zyy 2020-05-10 21:45:11 +08:00
parent 5e142ae5b3
commit bcfba416d3

View File

@ -1,5 +1,12 @@
<template> <template>
<el-dialog v-dialogDrag :title="$t('global.personalDetails')" :visible.sync="visible" width="470px" :before-close="doClose" class="userInfo_box"> <el-dialog
v-dialogDrag
:title="$t('global.personalDetails')"
:visible.sync="visible"
width="470px"
:before-close="doClose"
class="userInfo_box"
>
<div> <div>
<div class="form_box"> <div class="form_box">
<div class="title">{{ $t('global.compellation') }}:</div> <div class="title">{{ $t('global.compellation') }}:</div>
@ -9,10 +16,26 @@
<i class="el-icon-edit" @click="switcherName" /> <i class="el-icon-edit" @click="switcherName" />
</div> </div>
<div v-show="!nameShow" class="flex_box"> <div v-show="!nameShow" class="flex_box">
<el-input v-model="editInfo.name" :placeholder="$t('global.enterName')" maxlength="20" size="mini" class="input_box" /> <el-input
v-model="editInfo.name"
:placeholder="$t('global.enterName')"
maxlength="20"
size="mini"
class="input_box"
/>
<div class="button_box"> <div class="button_box">
<el-button size="mini" class="button_box" :disabled="!editInfo.name" @click="saveName">{{ $t('global.save') }}</el-button> <el-button
<el-button size="mini" class="button_box" type="text" @click="switcherName">{{ $t('global.cancel') }}</el-button> size="mini"
class="button_box"
:disabled="!editInfo.name"
@click="saveName"
>{{ $t('global.save') }}</el-button>
<el-button
size="mini"
class="button_box"
type="text"
@click="switcherName"
>{{ $t('global.cancel') }}</el-button>
</div> </div>
</div> </div>
</div> </div>
@ -25,10 +48,26 @@
<i class="el-icon-edit" @click="switcherNickname" /> <i class="el-icon-edit" @click="switcherNickname" />
</div> </div>
<div v-show="!nickNameShow" class="flex_box"> <div v-show="!nickNameShow" class="flex_box">
<el-input v-model="editInfo.nickname" :placeholder="$t('global.enterNickname')" maxlength="20" size="mini" class="input_box" /> <el-input
v-model="editInfo.nickname"
:placeholder="$t('global.enterNickname')"
maxlength="20"
size="mini"
class="input_box"
/>
<div class="button_box"> <div class="button_box">
<el-button size="mini" class="button_box" :disabled="!editInfo.nickname" @click="saveNickName">{{ $t('global.save') }}</el-button> <el-button
<el-button size="mini" class="button_box" type="text" @click="switcherNickname">{{ $t('global.cancel') }}</el-button> size="mini"
class="button_box"
:disabled="!editInfo.nickname"
@click="saveNickName"
>{{ $t('global.save') }}</el-button>
<el-button
size="mini"
class="button_box"
type="text"
@click="switcherNickname"
>{{ $t('global.cancel') }}</el-button>
</div> </div>
</div> </div>
</div> </div>
@ -41,7 +80,13 @@
<i class="el-icon-edit" @click="switcherMobile" /> <i class="el-icon-edit" @click="switcherMobile" />
</div> </div>
<div v-show="!mobileShow" class="flex_box"> <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-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-select v-model="nationCode" size="mini" class="selectCountry">
<el-option <el-option
v-for="item in countryList" v-for="item in countryList"
@ -50,14 +95,37 @@
:value="item.value" :value="item.value"
/> />
</el-select> </el-select>
<el-input v-model="mobileCode" :placeholder="$t('global.verificationCode')" size="mini" class="code_box" style="margin-top: 10px;" /> <el-input
<el-button size="mini" style="margin-top: 10px; margin-right: 10px;" :disabled="mobileCodeTime != 0" @click="sendMobileCode"> 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') }} {{ $t('global.sendCode') }}
<span v-if="mobileCodeTime">{{ mobileCodeTime }}</span> <span
v-if="mobileCodeTime"
>{{ mobileCodeTime }}</span>
</el-button> </el-button>
<div class="button_box" style="margin-top: 10px;"> <div class="button_box" style="margin-top: 10px;">
<el-button size="mini" class="button_box" :disabled="!mobileCode" @click="saveMobile">{{ $t('global.save') }}</el-button> <el-button
<el-button size="mini" class="button_box" type="text" @click="switcherMobile">{{ $t('global.cancel') }}</el-button> size="mini"
class="button_box"
:disabled="!mobileCode"
@click="saveMobile"
>{{ $t('global.save') }}</el-button>
<el-button
size="mini"
class="button_box"
type="text"
@click="switcherMobile"
>{{ $t('global.cancel') }}</el-button>
</div> </div>
</div> </div>
</div> </div>
@ -70,15 +138,43 @@
<i class="el-icon-edit" @click="switcherEmail" /> <i class="el-icon-edit" @click="switcherEmail" />
</div> </div>
<div v-show="!emailShow" class="flex_box"> <div v-show="!emailShow" class="flex_box">
<el-input v-model="editInfo.email" :placeholder="$t('global.enterEmail')" size="mini" class="input_box" /> <el-input
<el-input v-model="emailCode" :placeholder="$t('global.verificationCode')" size="mini" class="code_box" style="margin-top: 10px;" /> v-model="editInfo.email"
<el-button size="mini" style="margin-top: 10px; margin-right: 10px;" :disabled="emailCodeTime != 0" @click="sendEmailCode"> :placeholder="$t('global.enterEmail')"
size="mini"
class="input_box"
/>
<el-input
v-model="emailCode"
: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="emailCodeTime != 0"
@click="sendEmailCode"
>
{{ $t('global.sendCode') }} {{ $t('global.sendCode') }}
<span v-if="emailCodeTime">{{ emailCodeTime }}</span> <span
v-if="emailCodeTime"
>{{ emailCodeTime }}</span>
</el-button> </el-button>
<div class="button_box" style="margin-top: 10px;"> <div class="button_box" style="margin-top: 10px;">
<el-button size="mini" class="button_box" :disabled="!emailCode" @click="saveEmail">{{ $t('global.save') }}</el-button> <el-button
<el-button size="mini" class="button_box" type="text" @click="switcherEmail">{{ $t('global.cancel') }}</el-button> size="mini"
class="button_box"
:disabled="!emailCode"
@click="saveEmail"
>{{ $t('global.save') }}</el-button>
<el-button
size="mini"
class="button_box"
type="text"
@click="switcherEmail"
>{{ $t('global.cancel') }}</el-button>
</div> </div>
</div> </div>
</div> </div>
@ -93,18 +189,47 @@
<div v-show="!passwordShow" class="flex_box"> <div v-show="!passwordShow" class="flex_box">
<div class="passWord_box"> <div class="passWord_box">
<span>{{ $t('global.newPassWord') }}:</span> <span>{{ $t('global.newPassWord') }}:</span>
<el-input v-model="newPassWord1" :placeholder="$t('global.enterPassWord')" maxlength="20" show-password size="mini" class="input_box" /> <el-input
v-model="newPassWord1"
:placeholder="$t('global.enterPassWord')"
maxlength="20"
show-password
size="mini"
class="input_box"
/>
</div> </div>
<div style="height: 28px; line-height: 28px; margin-bottom: 10px;"> <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-input
<el-button size="mini" style="margin-right: 10px;" :disabled="passWordCodeTime != 0" @click="sendPassWordCode"> 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') }} {{ $t('global.sendMobileCode') }}
<span v-if="passWordCodeTime">{{ passWordCodeTime }}</span> <span
v-if="passWordCodeTime"
>{{ passWordCodeTime }}</span>
</el-button> </el-button>
</div> </div>
<div class="button_box" style="width: 150px;"> <div class="button_box" style="width: 150px;">
<el-button size="mini" class="button_box" :disabled="!passWordCode" @click="savePassWord">{{ $t('global.save') }}</el-button> <el-button
<el-button size="mini" class="button_box" type="text" @click="switcherPassWord">{{ $t('global.cancel') }}</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>
</div> </div>
</div> </div>
@ -117,31 +242,39 @@
</template> </template>
<script> <script>
import md5 from 'js-md5'; import md5 from "js-md5";
import { getInfo } from '@/api/login'; import { getInfo } from "@/api/login";
import { getDesignToken, getToken } from '@/utils/auth'; // import { getToken } from "@/utils/auth"; // getDesignToken
import { getUserinfoName, getUserinfoNickname, getUserinfoMobile, getUserinfoMobileCode, getUserinfoEmailCode, getUserinfoEmail, getUserinfoPassword } from '@/api/management/user'; import {
import { setInterval, clearInterval } from 'timers'; getUserinfoName,
getUserinfoNickname,
getUserinfoMobile,
getUserinfoMobileCode,
getUserinfoEmailCode,
getUserinfoEmail,
getUserinfoPassword
} from "@/api/management/user";
import { setInterval, clearInterval } from "timers";
export default { export default {
data() { data() {
return { return {
visible: false, visible: false,
userInfo: { userInfo: {
name: '', name: "",
nickname: '', nickname: "",
mobile: '', mobile: "",
email: '', email: "",
passWord: '' passWord: ""
}, },
editInfo: { editInfo: {
name: '', name: "",
nickname: '', nickname: "",
mobile: '', mobile: "",
email: '', email: "",
passWord: '' passWord: ""
}, },
nationCode: '86', nationCode: "86",
nameShow: true, nameShow: true,
nickNameShow: true, nickNameShow: true,
mobileShow: true, mobileShow: true,
@ -162,17 +295,17 @@ export default {
mobileTime: null, mobileTime: null,
passWordTime: null, passWordTime: null,
countryList: [ countryList: [
{ name: this.$t('global.china'), value: '86' }, { name: this.$t("global.china"), value: "86" },
{ name: this.$t('global.australia'), value: '61' }, { name: this.$t("global.australia"), value: "61" },
{ name: this.$t('global.england'), value: '44' }, { name: this.$t("global.england"), value: "44" },
{ name: this.$t('global.hongKong'), value: '852' }, { name: this.$t("global.hongKong"), value: "852" },
{ name: this.$t('global.Japanese'), value: '81' }, { name: this.$t("global.Japanese"), value: "81" },
{ name: this.$t('global.macao'), value: '853' }, { name: this.$t("global.macao"), value: "853" },
{ name: this.$t('global.singapore'), value: '65' }, { name: this.$t("global.singapore"), value: "65" },
{ name: this.$t('global.taiwan'), value: '886' }, { name: this.$t("global.taiwan"), value: "886" },
{ name: this.$t('global.america'), value: '1' } { name: this.$t("global.america"), value: "1" }
], ],
nationCodeInit: '86' // nationCodeInit: "86" //
}; };
}, },
computed: { computed: {
@ -184,28 +317,33 @@ export default {
geTel(tel) { geTel(tel) {
const reg = /^(\d{3})\d{4}(\d{4})$/; const reg = /^(\d{3})\d{4}(\d{4})$/;
if (tel) { if (tel) {
return tel.replace(reg, '$1****$2'); return tel.replace(reg, "$1****$2");
} else { } else {
return ''; return "";
} }
}, },
doShow() { doShow() {
this.visible = true; this.visible = true;
const token = getToken() || getDesignToken(); // const token = getToken() || getDesignToken();
getInfo(token).then(response => { const token = getToken();
getInfo(token)
.then(response => {
const user = response.data; const user = response.data;
this.userInfo = { this.userInfo = {
name: user.name, name: user.name,
nickname: user.nickname, nickname: user.nickname,
mobile: user.mobile, mobile: user.mobile,
email: user.email, email: user.email,
passWord: '' passWord: ""
}; };
this.oldPassWord = user.password; this.oldPassWord = user.password;
this.nationCode = user.nationCode ? user.nationCode : '86'; this.nationCode = user.nationCode ? user.nationCode : "86";
this.nationCodeInit = user.nationCode ? user.nationCode : '86'; this.nationCodeInit = user.nationCode
}).catch(error => { ? user.nationCode
console.log(error, '请求个人信息失败'); : "86";
})
.catch(error => {
console.log(error, "请求个人信息失败");
}); });
}, },
doClose() { doClose() {
@ -221,9 +359,9 @@ export default {
await getUserinfoName(this.info.id, this.editInfo.name); await getUserinfoName(this.info.id, this.editInfo.name);
this.userInfo.name = this.editInfo.name; this.userInfo.name = this.editInfo.name;
this.nameShow = !this.nameShow; this.nameShow = !this.nameShow;
this.$store.commit('SET_NAME', this.editInfo.name); this.$store.commit("SET_NAME", this.editInfo.name);
} catch (error) { } catch (error) {
console.log(error, '错误'); console.log(error, "错误");
} }
} }
}, },
@ -235,12 +373,15 @@ export default {
async saveNickName() { async saveNickName() {
if (this.editInfo.nickname) { if (this.editInfo.nickname) {
try { try {
await getUserinfoNickname(this.info.id, this.editInfo.nickname); await getUserinfoNickname(
this.info.id,
this.editInfo.nickname
);
this.userInfo.nickname = this.editInfo.nickname; this.userInfo.nickname = this.editInfo.nickname;
this.nickNameShow = !this.nickNameShow; this.nickNameShow = !this.nickNameShow;
this.$store.commit('SET_NICKNAME', this.editInfo.nickname); this.$store.commit("SET_NICKNAME", this.editInfo.nickname);
} catch (error) { } catch (error) {
console.log(error, '错误'); console.log(error, "错误");
} }
} }
}, },
@ -263,12 +404,12 @@ export default {
this.mobileShow = !this.mobileShow; this.mobileShow = !this.mobileShow;
this.mobileCode = null; this.mobileCode = null;
} catch (error) { } catch (error) {
this.$message.info(this.$t('global.codeError')); this.$message.info(this.$t("global.codeError"));
} }
} }
}, },
async sendMobileCode() { async sendMobileCode() {
const random = Math.floor((Math.random() * 10000) + 1); const random = Math.floor(Math.random() * 10000 + 1);
const timeCount = Date.parse(new Date()) / 1000; const timeCount = Date.parse(new Date()) / 1000;
const pass = `${timeCount}${this.nationCode}${this.editInfo.mobile}${random}`; const pass = `${timeCount}${this.nationCode}${this.editInfo.mobile}${random}`;
const param = { const param = {
@ -290,7 +431,7 @@ export default {
}, 1000); }, 1000);
await getUserinfoMobileCode(param); await getUserinfoMobileCode(param);
} catch (error) { } catch (error) {
this.$message.info(this.$t('global.codeFaile')); this.$message.info(this.$t("global.codeFaile"));
} }
}, },
@ -310,7 +451,7 @@ export default {
this.emailShow = !this.emailShow; this.emailShow = !this.emailShow;
this.emailCode = null; this.emailCode = null;
} catch (error) { } catch (error) {
this.$message.info(this.$t('global.codeError')); this.$message.info(this.$t("global.codeError"));
} }
} }
}, },
@ -327,7 +468,7 @@ export default {
}, 1000); }, 1000);
await getUserinfoEmailCode(this.editInfo.email); await getUserinfoEmailCode(this.editInfo.email);
} catch (error) { } catch (error) {
this.$message.info(this.$t('global.codeFaile')); this.$message.info(this.$t("global.codeFaile"));
} }
}, },
@ -336,7 +477,7 @@ export default {
}, },
async savePassWord() { async savePassWord() {
if (this.newPassWord1.length <= 5) { if (this.newPassWord1.length <= 5) {
this.$message.info(this.$t('global.passWordLength')); this.$message.info(this.$t("global.passWordLength"));
} else { } else {
this.uploadPassword(); this.uploadPassword();
} }
@ -351,18 +492,18 @@ export default {
try { try {
await getUserinfoPassword(this.info.id, param); await getUserinfoPassword(this.info.id, param);
this.passwordShow = !this.passwordShow; this.passwordShow = !this.passwordShow;
this.newPassWord1 = ''; this.newPassWord1 = "";
this.passWordCode = null; this.passWordCode = null;
} catch (error) { } catch (error) {
console.log(error, 11); console.log(error, 11);
} }
} else { } else {
this.$message.info(this.$t('global.passWordSome')); this.$message.info(this.$t("global.passWordSome"));
} }
}, },
async sendPassWordCode() { async sendPassWordCode() {
if (this.userInfo.mobile) { if (this.userInfo.mobile) {
const random = Math.floor((Math.random() * 10000) + 1); const random = Math.floor(Math.random() * 10000 + 1);
const timeCount = Date.parse(new Date()) / 1000; const timeCount = Date.parse(new Date()) / 1000;
const pass = `${timeCount}${this.nationCodeInit}${this.userInfo.mobile}${random}`; const pass = `${timeCount}${this.nationCodeInit}${this.userInfo.mobile}${random}`;
const param = { const param = {
@ -384,11 +525,11 @@ export default {
}, 1000); }, 1000);
await getUserinfoMobileCode(param); await getUserinfoMobileCode(param);
} catch (error) { } catch (error) {
this.$message.info(this.$t('global.codeFaile')); this.$message.info(this.$t("global.codeFaile"));
} }
} else { } else {
this.passwordShow = !this.passwordShow; this.passwordShow = !this.passwordShow;
this.$message.info(this.$t('global.enterMobileNumber')); this.$message.info(this.$t("global.enterMobileNumber"));
} }
} }
} }
@ -396,12 +537,12 @@ export default {
</script> </script>
<style rel="stylesheet/scss" lang="scss" scope> <style rel="stylesheet/scss" lang="scss" scope>
.flex_box{ .flex_box {
display: flex; display: flex;
align-items: center; align-items: center;
flex-wrap: wrap; flex-wrap: wrap;
} }
.form_box{ .form_box {
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
margin-bottom: 10px; margin-bottom: 10px;
@ -409,12 +550,12 @@ export default {
// align-items: center; // align-items: center;
// flex-wrap: wrap; // flex-wrap: wrap;
.selectCountry{ .selectCountry {
width: 90px; width: 90px;
height: 28px; height: 28px;
line-height: 28px; line-height: 28px;
} }
.title{ .title {
width: 80px; width: 80px;
text-align: left; text-align: left;
font-size: 14px; font-size: 14px;
@ -422,48 +563,47 @@ export default {
line-height: 28px; line-height: 28px;
float: left; float: left;
} }
.content{ .content {
width: calc(100% - 80px); width: calc(100% - 80px);
float: left; float: left;
margin: 0; margin: 0;
.el-icon-edit{ .el-icon-edit {
cursor: pointer; cursor: pointer;
} }
} }
.show_box{ .show_box {
height: 28px; height: 28px;
line-height: 28px; line-height: 28px;
} }
.input_box{ .input_box {
font-size: 14px; font-size: 14px;
width: 200px; width: 200px;
margin-right: 10px; margin-right: 10px;
flex: none; flex: none;
line-height: 0; line-height: 0;
} }
.code_box{ .code_box {
font-size: 14px; font-size: 14px;
width: 150px; width: 150px;
margin-right: 15px; margin-right: 15px;
flex: none; flex: none;
line-height: 0; line-height: 0;
} }
.button_box{ .button_box {
line-height: 0; line-height: 0;
height: 28px; height: 28px;
} }
.passWord_box{ .passWord_box {
height: 28px; height: 28px;
line-height: 28px; line-height: 28px;
margin-bottom: 10px; margin-bottom: 10px;
} }
}
}
</style> </style>
<style rel="stylesheet/scss" lang="scss"> <style rel="stylesheet/scss" lang="scss">
.userInfo_box{ .userInfo_box {
.el-dialog__body{ .el-dialog__body {
padding: 0 20px; padding: 0 20px;
} }
} }