优化第三方登录

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">
{{time}}
</div>
<img class="img"
src="/img/logo.png"
alt="">
<img class="img" src="/img/logo.png" alt="">
<p class="title">{{ $t('login.info') }}</p>
</div>
<div class="login-border">
@ -91,12 +89,13 @@
handleLogin() {
const topUrl = getTopUrl();
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];
source = source.split(redirectUrl)[1];
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)) {
const loading = this.$loading({

@ -1,7 +1,7 @@
<template>
<div class="social-container">
<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>
</span>
<p class="title">{{$t('login.github')}}</p>
@ -12,6 +12,18 @@
</span>
<p class="title">{{$t('login.gitee')}}</p>
</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>
</template>
@ -23,7 +35,6 @@
methods: {
handleClick(source) {
window.location.href = `${website.authUrl}/${source}`;
//openWindow(authUrl, source, 540, 540);
}
}
};

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

Loading…
Cancel
Save