|
@@ -0,0 +1,37 @@
|
|
|
+/**
|
|
|
+ * 各个公司企业微信的配置, 更具域名来解析
|
|
|
+ * @path 完整域名
|
|
|
+ * @appId 企业微信的appId
|
|
|
+ */
|
|
|
+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",
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+const fixedPath = `/api/corpWXAuth`; // 授权回调页面 (需要拼接)
|
|
|
+
|
|
|
+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 authorizationCallback = agentId
|
|
|
+ ? `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${encodeURI(tokenUrl)}&response_type=code&scope=snsapi_base&state=STATE&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,
|
|
|
+ };
|
|
|
+}
|