|
@@ -67,16 +67,19 @@
|
|
|
<img
|
|
|
src="@/assets/img/ding.png"
|
|
|
alt
|
|
|
- width="40"
|
|
|
+ width="30"
|
|
|
style="cursor:pointer"
|
|
|
@click="isDingLogin = !isDingLogin"
|
|
|
/>
|
|
|
- <span style="color:#6d6d6d">第三方登录</span>
|
|
|
+ <span style="color:#6d6d6d;font-size:12px">第三方登录</span>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div class="login-container ding-login-container" v-show="isDingLogin">
|
|
|
- <p style="font-weight:bold;font-size:18px">钉钉扫码登录</p>
|
|
|
+ <p style="margin-right:10px">
|
|
|
+ <img src="@/assets/img/ding.png" width="30" style="margin-right:10px"/>
|
|
|
+ <span style="font-weight:bold;font-size:18px;vertical-align:super">钉钉扫码登录</span>
|
|
|
+ </p>
|
|
|
<div id="login_container"></div>
|
|
|
<p
|
|
|
style="font-weight:bold;font-size:16px;margin-bottom:20px;cursor:pointer"
|
|
@@ -86,7 +89,13 @@
|
|
|
</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <BaseRegister v-else :ticket="curTicket" :user="newUser" :smsCode="curSmsCode" :dingLoginCode="dingLoginCode"></BaseRegister>
|
|
|
+ <BaseRegister
|
|
|
+ v-else
|
|
|
+ :ticket="curTicket"
|
|
|
+ :user="newUser"
|
|
|
+ :smsCode="curSmsCode"
|
|
|
+ :dingLoginCode="dingLoginCode"
|
|
|
+ ></BaseRegister>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script type="text/ecmascript-6">
|
|
@@ -101,7 +110,7 @@ export default {
|
|
|
return {
|
|
|
dingLoginCode: "",
|
|
|
isDingLogin: true,
|
|
|
- isBindDing:false,
|
|
|
+ isBindDing: false,
|
|
|
timer: 10,
|
|
|
curTicket: "",
|
|
|
curSmsCode: "",
|
|
@@ -154,19 +163,21 @@ export default {
|
|
|
// 获取钉钉扫码登录后返回的CODE
|
|
|
this.dingLoginCode = this.getQueryVariable("code");
|
|
|
if (!this.dingLoginCode) return;
|
|
|
- dingLogin(this.dingLoginCode).then(res => {
|
|
|
- let status = res.result.data.status
|
|
|
- // 如果返回为1 则代表未绑定手机号 需要去进行手机号绑定
|
|
|
- if(status === 1){
|
|
|
- this.isDingLogin = false
|
|
|
- this.isBindDing = true
|
|
|
- }else{
|
|
|
- // 其余返回则为用户身份信息 直接进行登录操作
|
|
|
- this.onLoginSuccess(res.result.data)
|
|
|
- }
|
|
|
- }).catch(err => {
|
|
|
- this.$message.error(err)
|
|
|
- })
|
|
|
+ dingLogin(this.dingLoginCode)
|
|
|
+ .then(res => {
|
|
|
+ let status = res.result.data.status;
|
|
|
+ // 如果返回为1 则代表未绑定手机号 需要去进行手机号绑定
|
|
|
+ if (status === 1) {
|
|
|
+ this.isDingLogin = false;
|
|
|
+ this.isBindDing = true;
|
|
|
+ } else {
|
|
|
+ // 其余返回则为用户身份信息 直接进行登录操作
|
|
|
+ this.onLoginSuccess(res.result.data);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ this.$message.error(err);
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
getQueryVariable(variable) {
|
|
@@ -259,12 +270,22 @@ export default {
|
|
|
this.$message.success("新用户请完善信息!");
|
|
|
this.curSmsCode = smsCode;
|
|
|
this.curPhone = cellphone;
|
|
|
-
|
|
|
this.curTicket = res.result.data.ticket;
|
|
|
this.newUser = res.result.data.user;
|
|
|
this.isShowRegister = true;
|
|
|
} else {
|
|
|
- this.onLoginSuccess(res.result.data)
|
|
|
+ if (res.result.data.access) {
|
|
|
+ this.onLoginSuccess(res.result.data);
|
|
|
+ } else {
|
|
|
+ this.$alert(
|
|
|
+ "当前用户未授权,请联系管理员( QQ 504620824 ) 进行授权 ,提供手机号、企业/个人用户等信息",
|
|
|
+ "提示",
|
|
|
+ {
|
|
|
+ confirmButtonText: "确定"
|
|
|
+ }
|
|
|
+ );
|
|
|
+ this.isLoginLoading = false;
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
@@ -272,27 +293,25 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- onLoginSuccess(data){
|
|
|
- console.log(data)
|
|
|
- let tokenInfo = this.$jwtDecode(data.jwt.access_token);
|
|
|
- localStorage.setItem("token", data.jwt.access_token);
|
|
|
- localStorage.setItem("tokenInfo", JSON.stringify(tokenInfo));
|
|
|
- localStorage.setItem("user", JSON.stringify(data.user));
|
|
|
- this.$message.success("登录成功!");
|
|
|
- this.isBindDing && this.onBindDing()
|
|
|
- this.$store.commit("login", "true");
|
|
|
- this.$router.push({
|
|
|
- path: tokenInfo.role.includes("root")
|
|
|
- ? "/orgs/Orgs"
|
|
|
- : "/member/Member"
|
|
|
- });
|
|
|
- this.isLoginLoading = false;
|
|
|
+ onLoginSuccess(data) {
|
|
|
+ console.log(data);
|
|
|
+ let tokenInfo = this.$jwtDecode(data.jwt.access_token);
|
|
|
+ localStorage.setItem("token", data.jwt.access_token);
|
|
|
+ localStorage.setItem("tokenInfo", JSON.stringify(tokenInfo));
|
|
|
+ localStorage.setItem("user", JSON.stringify(data.user));
|
|
|
+ this.$message.success("登录成功!");
|
|
|
+ this.isBindDing && this.onBindDing();
|
|
|
+ this.$store.commit("login", "true");
|
|
|
+ this.$router.push({
|
|
|
+ path: tokenInfo.role.includes("root") ? "/orgs/Orgs" : "/member/Member"
|
|
|
+ });
|
|
|
+ this.isLoginLoading = false;
|
|
|
},
|
|
|
|
|
|
- onBindDing(){
|
|
|
- bindDing(this.dingLoginCode).then(res => {
|
|
|
- if(!res.error) this.$message.success('绑定成功!')
|
|
|
- })
|
|
|
+ onBindDing() {
|
|
|
+ bindDing(this.dingLoginCode).then(res => {
|
|
|
+ if (!res.error) this.$message.success("绑定成功!");
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
/** 初始化登录随机UUID */
|
|
@@ -359,10 +378,8 @@ export default {
|
|
|
cursor: pointer;
|
|
|
}
|
|
|
|
|
|
-.login_qrcode_content {
|
|
|
- width: 300px !important;
|
|
|
- height: 300px !important;
|
|
|
- margin-top: 50px !important;
|
|
|
+.el-message-box {
|
|
|
+ width: 500px;
|
|
|
}
|
|
|
</style>
|
|
|
|
|
@@ -386,13 +403,14 @@ export default {
|
|
|
flex-direction: column;
|
|
|
justify-content: center;
|
|
|
align-items: center;
|
|
|
+ background: #fff !important;
|
|
|
}
|
|
|
.login-container {
|
|
|
border-radius: 10px;
|
|
|
margin: 0px auto;
|
|
|
width: 350px;
|
|
|
- padding: 30px 35px 15px 35px;
|
|
|
- background: #fff;
|
|
|
+ padding: 30px 35px 0px 35px;
|
|
|
+ background: #ffffff;
|
|
|
border: 1px solid #eaeaea;
|
|
|
text-align: left;
|
|
|
box-shadow: 0 0 20px 2px rgba(0, 0, 0, 0.1);
|