Lijy 5 mēneši atpakaļ
vecāks
revīzija
46d05f4db6

+ 0 - 45
fhKeeper/formulahousekeeper/timesheet/src/common/js/appidConfiguration.js

@@ -1,45 +0,0 @@
-/**
- * 各个公司企业微信的配置, 根据域名来解析
- * @path 完整域名
- * @appId 企业微信的appId,针对私有化部署的情况appId就是corpId
- */
-const config = {
-  "worktime.ttkuaiban.com": {
-    // 工时管家
-    path: "https://worktime.ttkuaiban.com",
-    appId: "ww4e237fd6abb635af",
-    agentId: "",
-  },
-  "blue.blovelight.net": {
-    // 蓝光研发
-    path: "http://blue.blovelight.net:2021",
-    appId: "wwb12ec40df8c35139",
-    agentId: "1000075",
-  },
-  "privatewx.ttkuaiban.com": {
-    // 火石闪信-企业微信私有化
-    path: "http://privatewx.ttkuaiban.com",
-    appId: "wwf11426cf618e1703",
-    agentId: "1000069",
-  },
-};
-
-const fixedPath = `/api/corpWXAuth`; // 授权回调页面 (需要拼接)
-const fixedPathAgentId = `/api/corpInsideWXAuth`
-
-export function obtainCorrespondingConfigurationInformation() {
-  const hostname = window.location.hostname; // 获取域名和端口,(不包括http 和 https)
-  const row = config[hostname];
-  const agentId = row.agentId;
-  const appId = row.appId;
-  const tokenUrl = `${row.path}${fixedPath}`;
-  const tokenUrlAgentId = `${row.path}${fixedPathAgentId}`;
-  const authorizationCallback = agentId
-    ? `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${encodeURI(tokenUrlAgentId)}&response_type=code&scope=snsapi_base&state=0&agentid=${agentId}#wechat_redirect`
-    : `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${encodeURI(tokenUrl)}&response_type=code&scope=snsapi_base&state=1#wechat_redirect`;
-  return {
-    appId,
-    tokenUrl,
-    authorizationCallback,
-  };
-}

+ 3 - 7
fhKeeper/formulahousekeeper/timesheet/src/views/Login.vue

@@ -68,7 +68,6 @@
     import * as dd from 'dingtalk-jsapi';
     import "../permissions.js"
     import WxLogin from "../assets/js/wwLogin.js"
-    import { obtainCorrespondingConfigurationInformation } from '../common/js/appidConfiguration.js'
     export default {
         inject:['reloads'],
         data() {
@@ -361,12 +360,9 @@
             },
             tryAutoLogin() {
                 let href = window.location.href;
-                // var appId = "ww4e237fd6abb635af";//企业微信第三方的SUIT ID
-                // var url = "https://worktime.ttkuaiban.com/api/corpWXAuth";//授权回调页面
-                // var weixinUrl="https://open.weixin.qq.com/connect/oauth2/authorize?appid="+appId+"&redirect_uri="+encodeURI(url)+"&response_type=code&scope=snsapi_base&state=1#wechat_redirect";
-
-                const config = obtainCorrespondingConfigurationInformation()
-                var weixinUrl = config.authorizationCallback;
+                var appId = "ww4e237fd6abb635af";//企业微信第三方的SUIT ID
+                var url = "https://worktime.ttkuaiban.com/api/corpWXAuth";//授权回调页面
+                var weixinUrl="https://open.weixin.qq.com/connect/oauth2/authorize?appid="+appId+"&redirect_uri="+encodeURI(url)+"&response_type=code&scope=snsapi_base&state=1#wechat_redirect";
                 window.location.href = weixinUrl;
             },
             tryDingDingUrlRedirect() {

+ 0 - 45
fhKeeper/formulahousekeeper/timesheet_h5/src/utils/appidConfiguration.js

@@ -1,45 +0,0 @@
-/**
- * 各个公司企业微信的配置, 根据域名来解析
- * @path 完整域名
- * @appId 企业微信的appId,针对私有化部署的情况appId就是corpId
- */
-const config = {
-  "mobworktime.ttkuaiban.com": {
-    // 工时管家 
-    path: "http://mobworktime.ttkuaiban.com",
-    appId: "ww4e237fd6abb635af",
-    agentId: "",
-  },
-  "moblue.blovelight.net": {
-    // 蓝光研发 
-    path: "http://moblue.blovelight.net:2021",
-    appId: "wwb12ec40df8c35139",
-    agentId: "1000075",
-  },
-  "mobprivatewx.ttkuaiban.com": {
-    // 火石闪信-企业微信私有化 
-    path: "http://mobprivatewx.ttkuaiban.com",
-    appId: "wwf11426cf618e1703",
-    agentId: "1000069",
-  },
-};
-
-const fixedPath = `/api/corpWXAuth`; // 授权回调页面 (需要拼接)
-const fixedPathAgentId = `/api/corpInsideWXAuth`
-
-export function obtainCorrespondingConfigurationInformation() {
-  const hostname = window.location.hostname; // 获取域名和端口,(不包括http 和 https)
-  const row = config[hostname];
-  const agentId = row.agentId;
-  const appId = row.appId;
-  const tokenUrl = `${row.path}${fixedPath}`;
-  const tokenUrlAgentId = `${row.path}${fixedPathAgentId}`;
-  const authorizationCallback = agentId
-    ? `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${encodeURI(tokenUrlAgentId)}&response_type=code&scope=snsapi_base&state=0&agentid=${agentId}#wechat_redirect`
-    : `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${encodeURI(tokenUrl)}&response_type=code&scope=snsapi_base&state=1#wechat_redirect`;
-  return {
-    appId,
-    tokenUrl,
-    authorizationCallback,
-  };
-}

+ 6 - 8
fhKeeper/formulahousekeeper/timesheet_h5/src/views/login/index.vue

@@ -17,8 +17,7 @@
 
 <script>
     import { constants } from "crypto";
-    import * as dd from 'dingtalk-jsapi'; 
-    import { obtainCorrespondingConfigurationInformation } from '../../utils/appidConfiguration';
+    import * as dd from 'dingtalk-jsapi';
     export default {
         data() {
             return {
@@ -166,18 +165,17 @@
                 }
             },
             tryAutoLogin() {
-                const rowConfig = obtainCorrespondingConfigurationInformation()
                 var appId = "wx749c84daac654e1e";//工时管家公众号
                 var url = "http://mobworktime.ttkuaiban.com/api/wechat/loginByWXCode";//工时管家公众号授权回调页面
-                // if (this.isCorpWX) {
-                    // appId = "ww4e237fd6abb635af"; //企业微信第三方的SUIT ID
-                    // url = "http://worktime.ttkuaiban.com/api/corpWXAuth";//授权回调页面
-                // } 
+                if (this.isCorpWX) {
+                    appId = "ww4e237fd6abb635af"; //企业微信第三方的SUIT ID
+                    url = "http://worktime.ttkuaiban.com/api/corpWXAuth";//授权回调页面
+                } 
 
                 // var appId = "ww4e237fd6abb635af";//企业微信第三方的SUIT ID
                 // var url = "http://worktime.ttkuaiban.com/api/corpWXAuth";//授权回调页面
                 
-                var weixinUrl = this.isCorpWX ? rowConfig.authorizationCallback : "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+appId+"&redirect_uri="+encodeURI(url)+"&response_type=code&scope=snsapi_base&state=0#wechat_redirect";
+                var weixinUrl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+appId+"&redirect_uri="+encodeURI(url)+"&response_type=code&scope=snsapi_base&state=0#wechat_redirect";
                 window.location.href = weixinUrl;
             },
             tryDingDingUrlRedirect() {