From 02e7cd190fd7e07417994a3728674c06f1d2b67b Mon Sep 17 00:00:00 2001 From: "liangliang.Li" Date: Thu, 9 Sep 2021 17:52:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E7=82=B9=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Header.vue | 9 ++---- src/components/page/ClientLogin.vue | 34 +++++++++++++++++---- src/components/page/Index.vue | 11 +++++-- src/components/page/Login.vue | 41 +++++++++++++++++++------- src/components/page/PersonalCenter.vue | 2 +- src/components/page/RegisterForm.vue | 2 +- src/router/index.js | 3 +- src/utils/api.js | 1 - 8 files changed, 73 insertions(+), 30 deletions(-) diff --git a/src/components/common/Header.vue b/src/components/common/Header.vue index c7f919d..c631bac 100644 --- a/src/components/common/Header.vue +++ b/src/components/common/Header.vue @@ -34,17 +34,12 @@ export default { this.userName = userName }) }, - // computed: { - // username() { - // let username = sessionStorage.getItem('kd_client_username'); - // return username ? username : this.name; - // } - // }, methods: { loginout() { this.$store.replaceState({}) sessionStorage.removeItem('kd_client_username'); - location.reload() + this.$router.push('/login') + // location.reload() }, toPersonalCenter(){ this.$router.push('/personalcenter') diff --git a/src/components/page/ClientLogin.vue b/src/components/page/ClientLogin.vue index 611632e..9b19883 100644 --- a/src/components/page/ClientLogin.vue +++ b/src/components/page/ClientLogin.vue @@ -127,8 +127,6 @@ export default { activeName: '0', isReg: false, loginForm: { - // username: '15794146134', - // password: '111aaa', username: '', password: '', }, @@ -164,13 +162,17 @@ export default { phoneTimer: null, newPassword: '', emailOpener: '', - phoneOpener: '' + phoneOpener: '', + urlData:'', + type:'', + accountName:'' }; }, components: { register }, mounted(){ + this.autoLogin() this.$once('hook:beforeDestroy', function () { clearInterval(this.phoneTimer) this.phoneTimer = null @@ -179,6 +181,29 @@ export default { }) }, methods: { + //根据type判断是否为校内登录,校内登录自动登录 + //0为校外登录,1为校内登录 + autoLogin(){ + let currentUrl = window.location.href + let A = currentUrl.split('?') + let B = A[1].split('&') + B.forEach(item => { + if(item.includes('account')){ + let account = item.split('=') + this.loginForm.username = account[1] + } + if(item.includes('type')){ + let type = item.split('=') + this.type = type[1] + console.log(this.type); + + } + }) + if(this.type == '1'){ + this.loginForm.password = 'Qw654321' + this.getSchool('loginForm') + } + }, backIndex(){ // this.$router.go(-1); this.$router.push('login'); @@ -224,9 +249,6 @@ export default { }); }, getRole(form) { - // this.userId = this.schoolList.find((n,k) => { - // return n.schoolId == this.schoolId - // }).userId let data = { userId: this.userId, schoolId: this.schoolId diff --git a/src/components/page/Index.vue b/src/components/page/Index.vue index a1a6106..1a68641 100644 --- a/src/components/page/Index.vue +++ b/src/components/page/Index.vue @@ -50,7 +50,9 @@ export default { }, mounted() { this.showChangePass() + }, + methods:{ setPassword(){ if(this.regForm.password !== this.regForm.rePassword){ return this.$message.warning('两次输入的密码不一致,请重新输入') @@ -67,7 +69,12 @@ export default { }, showChangePass(){ this.$get(this.api.isRequiredReset).then(res =>{ - if(res.message && sessionStorage.getItem('kd_client_username').includes('专家')) this.changeVisible = true + if(this.$store.state.userName.includes('专家')){ + + }else{ + if(res.message) this.changeVisible = true + } + }).catch(err=>{}) }, toFuture(){ @@ -76,7 +83,7 @@ export default { toNext(val) { this.$router.push(`ProjectIntro?isFuture=${val}`) }, - + } };