This commit is contained in:
joylink_fanyuhong 2020-05-10 21:52:24 +08:00
commit 6b9dc0433b
3 changed files with 385 additions and 245 deletions

View File

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

View File

@ -11,7 +11,7 @@ import { parser } from '@/iscs/utils/parser';
import iscsData from '@/iscs/constant/iscsData';
import { mapGetters } from 'vuex';
import { exitFullscreen } from '@/utils/screen';
import { handlerIscsEvent } from '@/api/simulation';
// import { handlerIscsEvent } from '@/api/simulation';
// import { IscsOperation } from '@/scripts/ConstDic';
export default {
@ -132,7 +132,7 @@ export default {
},
openScreenDoor(flag, operate) {
if (flag) {
handlerIscsEvent(this.$route.query.group, {operate: operate, stationCode:this.stationCode});
// handlerIscsEvent(this.$route.query.group, {operate: operate, stationCode:this.stationCode});
}
},
//

View File

@ -14,7 +14,7 @@ import { mapGetters } from 'vuex';
import { exitFullscreen } from '@/utils/screen';
import { putJointTrainingSimulationUser } from '@/api/chat';
import { putJointTrainingSimulationUserNew} from '@/api/jointTraining';
import { handlerIscsEvent } from '@/api/simulation';
// import { handlerIscsEvent } from '@/api/simulation';
// import { IscsOperation } from '@/scripts/ConstDic';
export default {
@ -151,7 +151,7 @@ export default {
},
openScreenDoor(flag, operate) {
if (flag) {
handlerIscsEvent(this.$route.query.group, {operate: operate, stationCode:this.stationCode});
// handlerIscsEvent(this.$route.query.group, {operate: operate, stationCode:this.stationCode});
}
},
//