Browse Source

登录完善

seimin 3 years ago
parent
commit
14669be5a3
1 changed files with 16 additions and 3 deletions
  1. 16 3
      src/views/Login.vue

+ 16 - 3
src/views/Login.vue

@@ -78,7 +78,7 @@ export default {
78
         };
78
         };
79
         // alert("2--传code参数:");
79
         // alert("2--传code参数:");
80
         // alert(JSON.stringify(code));
80
         // alert(JSON.stringify(code));
81
-        that.$http.post("service/auth/wechatLoginEncrypt", code).then(function(res) {
81
+        that.$http.post("service/auth/wechatLoginEncrypt", code).then((res) => {
82
           if (res.data.state == 200) {
82
           if (res.data.state == 200) {
83
             // alert(3);
83
             // alert(3);
84
             // alert(JSON.stringify(res.data));
84
             // alert(JSON.stringify(res.data));
@@ -212,10 +212,23 @@ export default {
212
             .show();
212
             .show();
213
         }
213
         }
214
       });
214
       });
215
-    }
215
+    },
216
+    // 获取查询参数
217
+    getQueryString(name) {
218
+    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
219
+    var r = window.location.search.substr(1).match(reg);
220
+    if (r != null){
221
+        return unescape(r[2]);
222
+      }
223
+      return null;
224
+    },
216
   },
225
   },
217
   created() {
226
   created() {
218
-    this.isSSo = location.search.length > 0;
227
+    if(location.search.length > 0){
228
+      this.isSSo = Boolean(this.getQueryString('t'));
229
+    }else{
230
+      this.isSSo = false;
231
+    }
219
     if (this.isSSo) {
232
     if (this.isSSo) {
220
       this.zlogin();
233
       this.zlogin();
221
     }
234
     }