浏览代码

登录完善

seimin 3 年之前
父节点
当前提交
14669be5a3
共有 1 个文件被更改,包括 16 次插入3 次删除
  1. 16 3
      src/views/Login.vue

+ 16 - 3
src/views/Login.vue

@@ -78,7 +78,7 @@ export default {
78 78
         };
79 79
         // alert("2--传code参数:");
80 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 82
           if (res.data.state == 200) {
83 83
             // alert(3);
84 84
             // alert(JSON.stringify(res.data));
@@ -212,10 +212,23 @@ export default {
212 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 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 232
     if (this.isSSo) {
220 233
       this.zlogin();
221 234
     }