OnePsycho 5 年之前
父節點
當前提交
1e98efaabc
共有 3 個文件被更改,包括 77 次插入47 次删除
  1. 二進制
      dist.zip
  2. 14 2
      src/components/BaseRegister.vue
  3. 63 45
      src/views/login.vue

二進制
dist.zip


+ 14 - 2
src/components/BaseRegister.vue

@@ -109,7 +109,6 @@ export default {
     };
     };
   },
   },
   created() {
   created() {
-    console.log(this.user);
     this.registerForm = this.user;
     this.registerForm = this.user;
   },
   },
   methods: {
   methods: {
@@ -136,7 +135,20 @@ export default {
 
 
       if (cellphone && smsCode) {
       if (cellphone && smsCode) {
         phoneLogin({ cellphone: cellphone, smsCode: smsCode }).then(res => {
         phoneLogin({ cellphone: cellphone, smsCode: smsCode }).then(res => {
-          if (!res.error) this.onLoginSuccess(res.result.data);
+          if (!res.error) {
+            if (res.result.data.access) {
+              this.onLoginSuccess(res.result.data);
+            } else {
+              this.$alert(
+                "当前用户未授权,请联系管理员( QQ 504620824 ) 进行授权 ,提供手机号、企业/个人用户等信息",
+                "提示",
+                {
+                  confirmButtonText: "确定"
+                }
+              );
+              this.isLoginLoading = false;
+            }
+          }
         });
         });
       } else {
       } else {
         this.$message.error("手机号与验证码不能为空!");
         this.$message.error("手机号与验证码不能为空!");

+ 63 - 45
src/views/login.vue

@@ -67,16 +67,19 @@
             <img
             <img
               src="@/assets/img/ding.png"
               src="@/assets/img/ding.png"
               alt
               alt
-              width="40"
+              width="30"
               style="cursor:pointer"
               style="cursor:pointer"
               @click="isDingLogin = !isDingLogin"
               @click="isDingLogin = !isDingLogin"
             />
             />
-            <span style="color:#6d6d6d">第三方登录</span>
+            <span style="color:#6d6d6d;font-size:12px">第三方登录</span>
           </div>
           </div>
         </el-form-item>
         </el-form-item>
       </el-form>
       </el-form>
       <div class="login-container ding-login-container" v-show="isDingLogin">
       <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>
         <div id="login_container"></div>
         <p
         <p
           style="font-weight:bold;font-size:16px;margin-bottom:20px;cursor:pointer"
           style="font-weight:bold;font-size:16px;margin-bottom:20px;cursor:pointer"
@@ -86,7 +89,13 @@
         </p>
         </p>
       </div>
       </div>
     </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>
   </div>
 </template>
 </template>
 <script type="text/ecmascript-6">
 <script type="text/ecmascript-6">
@@ -101,7 +110,7 @@ export default {
     return {
     return {
       dingLoginCode: "",
       dingLoginCode: "",
       isDingLogin: true,
       isDingLogin: true,
-      isBindDing:false,
+      isBindDing: false,
       timer: 10,
       timer: 10,
       curTicket: "",
       curTicket: "",
       curSmsCode: "",
       curSmsCode: "",
@@ -154,19 +163,21 @@ export default {
       // 获取钉钉扫码登录后返回的CODE
       // 获取钉钉扫码登录后返回的CODE
       this.dingLoginCode = this.getQueryVariable("code");
       this.dingLoginCode = this.getQueryVariable("code");
       if (!this.dingLoginCode) return;
       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) {
     getQueryVariable(variable) {
@@ -259,12 +270,22 @@ export default {
             this.$message.success("新用户请完善信息!");
             this.$message.success("新用户请完善信息!");
             this.curSmsCode = smsCode;
             this.curSmsCode = smsCode;
             this.curPhone = cellphone;
             this.curPhone = cellphone;
-
             this.curTicket = res.result.data.ticket;
             this.curTicket = res.result.data.ticket;
             this.newUser = res.result.data.user;
             this.newUser = res.result.data.user;
             this.isShowRegister = true;
             this.isShowRegister = true;
           } else {
           } 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 {
       } 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 */
     /** 初始化登录随机UUID */
@@ -359,10 +378,8 @@ export default {
   cursor: pointer;
   cursor: pointer;
 }
 }
 
 
-.login_qrcode_content {
-  width: 300px !important;
-  height: 300px !important;
-  margin-top: 50px !important;
+.el-message-box {
+  width: 500px;
 }
 }
 </style>
 </style>
 
 
@@ -386,13 +403,14 @@ export default {
   flex-direction: column;
   flex-direction: column;
   justify-content: center;
   justify-content: center;
   align-items: center;
   align-items: center;
+  background: #fff !important;
 }
 }
 .login-container {
 .login-container {
   border-radius: 10px;
   border-radius: 10px;
   margin: 0px auto;
   margin: 0px auto;
   width: 350px;
   width: 350px;
-  padding: 30px 35px 15px 35px;
-  background: #fff;
+  padding: 30px 35px 0px 35px;
+  background: #ffffff;
   border: 1px solid #eaeaea;
   border: 1px solid #eaeaea;
   text-align: left;
   text-align: left;
   box-shadow: 0 0 20px 2px rgba(0, 0, 0, 0.1);
   box-shadow: 0 0 20px 2px rgba(0, 0, 0, 0.1);