BUG: 【帮助】暂时去掉菜单里的帮助

This commit is contained in:
fan 2023-01-05 11:26:38 +08:00
parent e89d160b1c
commit a080fdd0c0
3 changed files with 3 additions and 841 deletions

View File

@ -1,127 +0,0 @@
<template>
<el-dropdown class="avatar-container" trigger="hover" :show-timeout="100" style="height:58px">
<div class="avatar-wrapper">
<span style="color: white;">
{{ username }}
</span>
<i class="el-icon-caret-bottom" style="color: #909399;" />
</div>
<el-dropdown-menu slot="dropdown" class="user-dropdown">
<el-dropdown-item>
<span style="display:block;" @click="handleDetail">{{ $t('global.personalDetails') }}</span>
</el-dropdown-item>
<el-dropdown-item v-if="isNotCompanyAdmin && isCGY && isSameProject">
<span style="display:block;" @click="handleStatistics">数据统计</span>
</el-dropdown-item>
<el-dropdown-item>
<span style="display:block;" @click="logout">{{ $t('global.exit') }}</span>
</el-dropdown-item>
</el-dropdown-menu>
<user-info ref="userInfo" />
</el-dropdown>
</template>
<script>
import userInfo from './userInfo';
import { UrlConfig } from '@/scripts/ConstDic';
import { getSessionStorage } from '@/utils/auth';
export default {
name: 'Logout',
components: {
userInfo
},
data() {
return {
};
},
computed: {
username() {
return this.$store.state.user.nickname;
},
companyAdmin() {
return this.$store.state.user.companyAdmin;
},
isNotCompanyAdmin() {
return this.$store.state.user.companyAdmin == false;
},
isSameProject() {
return this.$store.state.user.companyProjectList.includes(getSessionStorage('project').toUpperCase());
},
isCGY() {
return getSessionStorage('project') === 'cgy';
}
},
mounted() {
},
methods: {
logout() {
this.$store.dispatch('LogOut').then(() => {
location.reload(); // vue-router bug
});
},
selfPermission() {
this.$router.push({ path: `${UrlConfig.permission.prefix}/manage`});
},
handleDetail() {
this.$refs.userInfo.doShow();
},
handleStatistics() {
this.$router.push({ path: `/info/studentStatistics` });
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
$height: 58px;
.navbar {
height: $height;
line-height: $height;
padding-left: 30px;
border-radius: 0px !important;
.hamburger-container {
line-height: $height;
height: $height;
float: left;
padding: 0 10px;
}
.screenfull {
position: absolute;
right: 90px;
top: 16px;
color: red;
}
.avatar-container {
height: $height;
display: inline-block;
// position: absolute;
position: relative;
right: 0px;
// right: 35px;
.avatar-wrapper {
cursor: pointer;
position: relative;
height: $height;
.user-avatar {
width: 40px;
height: 40px;
border-radius: 10px;
}
.el-icon-caret-bottom {
position: absolute;
right: -20px;
top: 25px;
font-size: 12px;
}
}
}
}
</style>

View File

@ -91,9 +91,9 @@
</el-submenu>
</template>
</template>
<div v-if="helpShow" class="helpDiv" @click="goToHelp">
<span>帮助</span>
</div>
<!-- <div v-if="helpShow" class="helpDiv" @click="goToHelp">-->
<!-- <span>帮助</span>-->
<!-- </div>-->
<el-submenu v-if="!thirdLogin" :key="99" index="/info" :show-timeout="100">
<span slot="title">{{ username }}</span>
<el-menu-item :key="991" index="/info/personalInfo">个人信息</el-menu-item>

View File

@ -1,711 +0,0 @@
<template>
<div>
<div>
<div class="form_box">
<div class="title">{{ $t('global.compellation') }}:</div>
<div class="content_box_info">
<div v-show="nameShow" class="show_box">
<span>{{ userInfo.name }}</span>
<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"
/>
<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>
</div>
</div>
</div>
</div>
<div class="form_box">
<div class="title">{{ $t('global.nickName') }}:</div>
<div class="content_box_info">
<div v-show="nickNameShow" class="show_box">
<span>{{ userInfo.nickname }}</span>
<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"
/>
<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>
</div>
</div>
</div>
</div>
<div class="form_box">
<div class="title">{{ $t('global.mobile') }}:</div>
<div class="content_box_info">
<div v-show="mobileShow" class="show_box">
<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') }}
<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>
</div>
</div>
</div>
</div>
<div class="form_box">
<div class="title">{{ $t('global.email') }}:</div>
<div class="content_box_info">
<div v-show="emailShow" class="show_box">
<span>{{ userInfo.email }}</span>
<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"
>
{{ $t('global.sendCode') }}
<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>
</div>
</div>
</div>
</div>
<div class="form_box">
<div class="title">{{ $t('global.passWord') }}:</div>
<div class="content_box_info">
<div v-show="passwordShow" class="show_box">
<span>******</span>
<i class="el-icon-edit" @click="switcherPassWord" />
</div>
<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"
/>
</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"
>
{{ $t('global.sendMobileCode') }}
<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>
</div>
</div>
</div>
</div>
</div>
<div v-if="!wmOpenId" class="form_box">
<div class="title">绑定微信:</div>
<div class="content_box_info">
<el-button v-if="!binding&&!bindSuccess" type="primary" size="small" style="position: absolute;" @click="generateBindQrCode">生成微信二维码</el-button>
<div v-if="binding && !bindSuccess" class="login-code-box" @click="generateBindQrCode">
<qrcode-vue
v-loading="loadingCode"
:value="loginUrl"
:class-name="qrcodeClassName"
:size="150"
:element-loading-text="this.$t('login.clickRefresh')"
element-loading-spinner="el-icon-refresh"
element-loading-background="rgba(255, 255, 255, 0.9)"
/>
</div>
<div v-if="bindSuccess"><span>绑定微信成功</span></div>
</div>
</div>
</div>
</template>
<script>
import md5 from 'js-md5';
import { getInfo } from '@/api/login';
import { getToken } from '@/utils/auth'; // getDesignToken
import {
getUserinfoName,
getUserinfoNickname,
getUserinfoMobile,
getUserinfoMobileCode,
getUserinfoEmailCode,
getUserinfoEmail,
getUserinfoPassword,
getBindWxQrCodeUrl
} from '@/api/management/user';
import QrcodeVue from 'qrcode.vue';
import { setInterval, clearInterval } from 'timers';
import { checkLoginStatus } from '@/api/login';
import { getSessionStorage } from '@/utils/auth';
// import { getCompanyList } from '@/api/company';
export default {
components: { QrcodeVue },
data() {
return {
visible: false,
loginUrl: '',
loadingCode: false,
sessionId: '',
binding: false,
bindSuccess: false,
qrcodeClassName: 'login-qrcode',
checkTimeout: null,
userInfo: {
name: '',
nickname: '',
mobile: '',
email: '',
passWord: '',
companyId: ''
},
editInfo: {
name: '',
nickname: '',
mobile: '',
email: '',
passWord: '',
companyId: ''
},
nationCode: '86',
nameShow: true,
nickNameShow: true,
mobileShow: true,
emailShow: true,
passwordShow: true,
mobileCode: null,
emailCode: null,
passWordCode: null,
checkLogin: null,
oldPassWord: null,
newPassWord1: null,
mobileCodeTime: 0,
emailCodeTime: 0,
passWordCodeTime: 0,
emailTime: null,
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' }
],
nationCodeInit: '86', //
loginClient: 'LianKeTang',
project:'',
wmOpenId: '',
companyList: []
};
},
computed: {
info() {
return this.$store.state.user;
}
},
methods: {
geTel(tel) {
const reg = /^(\d{3})\d{4}(\d{4})$/;
if (tel) {
return tel.replace(reg, '$1****$2');
} else {
return '';
}
},
doShow() {
this.visible = true;
this.binding = false;
this.bindSuccess = false;
this.project = getSessionStorage('project');
// 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: '',
companyId: user.companyId
};
this.wmOpenId = user.wmOpenId || '';
this.oldPassWord = user.password;
this.nationCode = user.nationCode ? user.nationCode : '86';
this.nationCodeInit = user.nationCode
? user.nationCode
: '86';
})
.catch(error => {
console.log(error, '请求个人信息失败');
});
// getCompanyList().then(resp => {
// this.companyList = resp.data;
// }).catch((error) => {
// console.log(error, '');
// });
},
doClose() {
this.visible = false;
this.binding = false;
this.bindSuccess = false;
this.nameShow = true;
this.nickNameShow = true;
this.mobileShow = true;
this.emailShow = true;
this.passwordShow = true;
},
switcherName() {
this.editInfo.name = this.userInfo.name;
this.nameShow = !this.nameShow;
},
async saveName() {
if (this.editInfo.name) {
try {
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);
} catch (error) {
console.log(error, '错误');
}
}
},
async saveCompany() {
try {
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);
} catch (error) {
console.log(error, '错误');
}
},
switcherNickname() {
this.editInfo.nickname = this.userInfo.nickname;
this.nickNameShow = !this.nickNameShow;
},
async saveNickName() {
if (this.editInfo.nickname) {
try {
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);
} catch (error) {
console.log(error, '错误');
}
}
},
// handleCompany(companyId) {
// let name = '';
// this.companyList.forEach(item => {
// if (item.id == companyId) {
// name = item.name;
// }
// });
// return name;
// },
switcherMobile() {
// this.editInfo.mobile = this.userInfo.mobile;
this.mobileShow = !this.mobileShow;
},
async saveMobile() {
if (this.editInfo.mobile && this.mobileCode) {
try {
const params = {
mobile: this.editInfo.mobile,
nationCode: this.nationCode,
validCode: this.mobileCode
};
await getUserinfoMobile(this.info.id, params);
this.userInfo.mobile = this.editInfo.mobile;
this.nationCodeInit = this.nationCode;
this.mobileShow = !this.mobileShow;
this.mobileCode = null;
} catch (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,
rd: random,
time: timeCount,
token: md5(pass)
};
try {
this.mobileCodeTime = 30;
this.mobileTime = setInterval(() => {
this.mobileCodeTime--;
if (this.mobileCodeTime <= 0) {
this.mobileCodeTime = 0;
clearInterval(this.mobileTime);
this.mobileTime = null;
}
}, 1000);
await getUserinfoMobileCode(param);
} catch (error) {
this.$message.info(this.$t('global.codeFaile'));
}
},
switcherEmail() {
// this.editInfo.email = this.userInfo.email;
this.emailShow = !this.emailShow;
},
async saveEmail() {
if (this.editInfo.email && this.emailCode) {
try {
const params = {
email: this.editInfo.email,
validCode: this.emailCode
};
await getUserinfoEmail(this.info.id, params);
this.userInfo.email = this.editInfo.email;
this.emailShow = !this.emailShow;
this.emailCode = null;
} catch (error) {
this.$message.info(this.$t('global.codeError'));
}
}
},
async sendEmailCode() {
try {
this.emailCodeTime = 30;
this.emailTime = setInterval(() => {
this.emailCodeTime--;
if (this.emailCodeTime <= 0) {
this.emailCodeTime = 0;
clearInterval(this.emailTime);
this.emailTime = null;
}
}, 1000);
await getUserinfoEmailCode(this.editInfo.email);
} catch (error) {
this.$message.info(this.$t('global.codeFaile'));
}
},
switcherPassWord() {
this.passwordShow = !this.passwordShow;
},
async savePassWord() {
if (this.newPassWord1.length <= 5) {
this.$message.info(this.$t('global.passWordLength'));
} else {
this.uploadPassword();
}
},
async uploadPassword() {
if (this.newPassWord1) {
//
const param = {
password: md5(this.newPassWord1),
vfCode: this.passWordCode
};
try {
await getUserinfoPassword(this.info.id, param);
this.passwordShow = !this.passwordShow;
this.newPassWord1 = '';
this.passWordCode = null;
} catch (error) {
console.log(error, 11);
}
} else {
this.$message.info(this.$t('global.passWordSome'));
}
},
generateBindQrCode() { //
getBindWxQrCodeUrl().then(response => {
this.loadingCode = false;
this.loginUrl = response.data.url;
this.binding = true;
});
},
checkLoginStatus() {
const self = this;
//
if (!this.binding) {
return;
}
//
//
this.clearTimer(this.checkLogin);
this.checkLogin = setTimeout(() => {
checkLoginStatus(self.sessionId).then(response => {
//
if (response.data.status == '2') {
self.clearTimer(self.checkLogin);
self.bindSuccess = true;
} else {
self.checkLoginStatus();
}
}).catch(error => {
if (error.data && error.data.status === '1') {
self.scanSuccess = true;
}
self.checkLoginStatus();
});
}, 3000);
},
clearTimer(timer) {
if (timer) {
clearTimeout(timer);
timer = null;
}
},
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'));
}
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scope>
.flex_box {
display: flex;
align-items: center;
flex-wrap: wrap;
}
.form_box {
width: 100%;
overflow: hidden;
margin-bottom: 10px;
display: flex;
.selectCountry {
width: 90px;
height: 28px;
line-height: 28px;
}
.title {
width: 80px;
text-align: left;
font-size: 14px;
height: 28px;
line-height: 28px;
}
.content_box_info {
flex:1;
margin: 0;
.el-icon-edit {
cursor: pointer;
}
}
.show_box {
height: 28px;
line-height: 28px;
}
.input_box {
font-size: 14px;
width: 200px;
margin-right: 10px;
flex: none;
line-height: 0;
}
.code_box {
font-size: 14px;
width: 150px;
margin-right: 15px;
flex: none;
line-height: 0;
}
.button_box {
line-height: 0;
height: 28px;
}
.passWord_box {
height: 28px;
line-height: 28px;
margin-bottom: 10px;
}
.login-qrcode {
width: 150px;
}
}
</style>
<style rel="stylesheet/scss" lang="scss">
.userInfo_box {
.el-dialog__body {
padding: 0 20px;
}
}
</style>