山水共长天一色 3 lat temu
rodzic
commit
4f6fbe3481

+ 13 - 4
fhKeeper/formulahousekeeper/timesheet/src/views/Login.vue

@@ -117,17 +117,24 @@
                 } else {
                     //检查环境,如果是钉钉有$CORPID$
                     var key = '?corpid=';
+                    var jumpkey = '&jumpto=';
                     var url = location.href;
+                    console.log('jumpto',location);
+                    // var url = "https://worktime.ttkuaiban.com/?corpid=$CORPID$&jumpto=/info/21#/index"
                     var that = this;
                     if (url.indexOf(key) > 0) {
-                        var corpId = url.substring(url.indexOf(key)+key.length,url.indexOf('#'));
+                        var corpId = url.substring(url.indexOf(key)+key.length,url.indexOf(jumpkey));
+                        var jumpurl = ''
+                        if(corpId == 'ding169917db7f1ee5f435c2f4657eb6378f'){
+                            jumpurl = url.substring(url.indexOf(jumpkey)+jumpkey.length,url.indexOf('#'));
+                        }
                         dd.ready(function() {
                             that.isDingchg()
                             dd.runtime.permission.requestAuthCode({
                                 corpId: corpId, // 企业id
                                 onSuccess: function (info) {
                                     var code = info.code // 通过该免登授权码可以获取用户身份
-                                    that.loginByCode(code, corpId);
+                                    that.loginByCode(code, corpId, jumpurl);
                                 }});
                         });
                     } 
@@ -226,7 +233,7 @@
                             });
                         })
             },
-            loginByCode(code, corpId) {
+            loginByCode(code, corpId, jumpurl) {
                 this.http.post("/dingding/getUserByCode", {code:code, corpid:corpId} , res => {
                             if (res.code == "ok") {
                                 var user = res.data;
@@ -242,7 +249,9 @@
                                 // } else {
                                 //     this.$router.push({ path: '/daily' });
                                 // }
-                                if(user.moduleList.length > 0) {
+                                if(jumpurl){
+                                    this.$router.push({ path: jumpurl })
+                                }else if(user.moduleList.length > 0) {
                                     this.$router.push({ path: user.moduleList[0].path })
                                 }
                             } else {