优化第三方登录

dev
smallchill 6 years ago
parent 1f4af05d12
commit 46d3821ed8
  1. 11
      src/page/login/index.vue
  2. 15
      src/page/login/thirdlogin.vue
  3. 7
      src/views/wel/index.vue

@ -7,9 +7,7 @@
<div class="login-time"> <div class="login-time">
{{time}} {{time}}
</div> </div>
<img class="img" <img class="img" src="/img/logo.png" alt="">
src="/img/logo.png"
alt="">
<p class="title">{{ $t('login.info') }}</p> <p class="title">{{ $t('login.info') }}</p>
</div> </div>
<div class="login-border"> <div class="login-border">
@ -91,12 +89,13 @@
handleLogin() { handleLogin() {
const topUrl = getTopUrl(); const topUrl = getTopUrl();
const redirectUrl = "/oauth/redirect/"; const redirectUrl = "/oauth/redirect/";
if (topUrl.includes(redirectUrl)) { this.socialForm.source = getQueryString("source");
this.socialForm.code = getQueryString("code");
this.socialForm.state = getQueryString("state");
if (validatenull(this.socialForm.source) && topUrl.includes(redirectUrl)) {
let source = topUrl.split("?")[0]; let source = topUrl.split("?")[0];
source = source.split(redirectUrl)[1]; source = source.split(redirectUrl)[1];
this.socialForm.source = source; this.socialForm.source = source;
this.socialForm.code = getQueryString("code");
this.socialForm.state = getQueryString("state");
} }
if (!validatenull(this.socialForm.source) && !validatenull(this.socialForm.code) && !validatenull(this.socialForm.state)) { if (!validatenull(this.socialForm.source) && !validatenull(this.socialForm.code) && !validatenull(this.socialForm.state)) {
const loading = this.$loading({ const loading = this.$loading({

@ -1,7 +1,7 @@
<template> <template>
<div class="social-container"> <div class="social-container">
<div class="box" @click="handleClick('github')"> <div class="box" @click="handleClick('github')">
<span class="container" :style="{backgroundColor:'#6ba2d6'}"> <span class="container" :style="{backgroundColor:'#61676D'}">
<i icon-class="github" class="iconfont icongithub"></i> <i icon-class="github" class="iconfont icongithub"></i>
</span> </span>
<p class="title">{{$t('login.github')}}</p> <p class="title">{{$t('login.github')}}</p>
@ -12,6 +12,18 @@
</span> </span>
<p class="title">{{$t('login.gitee')}}</p> <p class="title">{{$t('login.gitee')}}</p>
</div> </div>
<div class="box" @click="handleClick('wechat_open')">
<span class="container" :style="{backgroundColor:'#8dc349'}">
<i icon-class="wechat" class="iconfont icon-weixin"/>
</span>
<p class="title">{{$t('login.wechat')}}</p>
</div>
<div class="box" @click="handleClick('qq')">
<span class="container" :style="{backgroundColor:'#6ba2d6'}">
<i icon-class="qq" class="iconfont icon-qq"/>
</span>
<p class="title">{{$t('login.qq')}}</p>
</div>
</div> </div>
</template> </template>
@ -23,7 +35,6 @@
methods: { methods: {
handleClick(source) { handleClick(source) {
window.location.href = `${website.authUrl}/${source}`; window.location.href = `${website.authUrl}/${source}`;
//openWindow(authUrl, source, 540, 540);
} }
} }
}; };

@ -27,7 +27,7 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleRegister"> </el-button> <el-button type="primary" :loading="loading" @click="handleRegister"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
</el-col> </el-col>
@ -463,6 +463,7 @@
password: '', password: '',
password2: '', password2: '',
}, },
loading: false,
tenantMode: true, tenantMode: true,
accountBox: false, accountBox: false,
activeNames: ['1', '2', '3', '5'], activeNames: ['1', '2', '3', '5'],
@ -501,14 +502,16 @@
this.$message.warning("两次密码输入不一致"); this.$message.warning("两次密码输入不一致");
return; return;
} }
this.loading = true;
registerGuest(this.form, this.userInfo.oauth_id).then(res => { registerGuest(this.form, this.userInfo.oauth_id).then(res => {
this.loading = false;
const data = res.data; const data = res.data;
if (data.success) { if (data.success) {
this.accountBox = false;
this.$alert("注册申请已提交,请耐心等待管理员通过!", '注册提示') this.$alert("注册申请已提交,请耐心等待管理员通过!", '注册提示')
} else { } else {
this.$message.error(data.msg || '提交失败'); this.$message.error(data.msg || '提交失败');
} }
this.accountBox = false;
}); });
}, },
getTenant() { getTenant() {

Loading…
Cancel
Save