|
@@ -8,10 +8,13 @@
|
|
|
<script>
|
|
|
import ThemePicker from "@/components/ThemePicker";
|
|
|
|
|
|
-import { authToken } from "@/api/login";
|
|
|
+import { authToken, authTokenThree, authLogin } from "@/api/login";
|
|
|
+import { initDingH5RemoteDebug } from "dingtalk-h5-remote-debug";
|
|
|
import { openAuth } from "dingtalk-design-libs/biz/openAuth";
|
|
|
import { setToken } from "@/utils/auth";
|
|
|
import * as dd from "dingtalk-jsapi"; // 在此引入
|
|
|
+
|
|
|
+initDingH5RemoteDebug();
|
|
|
export default {
|
|
|
name: "App",
|
|
|
components: { ThemePicker },
|
|
@@ -22,46 +25,60 @@ export default {
|
|
|
// 储存
|
|
|
this.$store.commit("app/SET_IS_MOBILE_ENV", isMobileEnv);
|
|
|
// 取值-同步
|
|
|
- console.log("是否是移动端=", this.$store.state.app.isMobileEnv);
|
|
|
+ // console.log("是否是移动端=", this.$store.state.app.isMobileEnv);
|
|
|
+ // console.log("页面链接=", window.location.href);
|
|
|
+ // console.log("页面corpId=", this.getUrlParam("corpId"));
|
|
|
+ if (this.getUrlParam("corpId")) {
|
|
|
+ // 存储corpId
|
|
|
+ this.$store.commit("app/SET_CORPID", this.getUrlParam("corpId"));
|
|
|
+ }
|
|
|
if (dd.env.platform !== "notInDingTalk") {
|
|
|
dd.ready(function () {
|
|
|
- // 钉钉免登录认证
|
|
|
- // dd.getAuthCode({
|
|
|
- // corpId: "ding4ab75ecd53106cde4ac5d6980864d335",
|
|
|
- // success: (res) => {
|
|
|
- // console.log("res=", res);
|
|
|
- // avoidLogin(res.code).then((res) => {
|
|
|
- // console.log("===avoidLogin_res=",res)
|
|
|
- // });
|
|
|
- // },
|
|
|
- // fail: (err) => {
|
|
|
- // console.log("err=", err);
|
|
|
- // },
|
|
|
- // complete: () => {},
|
|
|
- // });
|
|
|
- // 唤起授权
|
|
|
+ // 钉钉免登录认证-第三方企业
|
|
|
+ let corpId = that.$store.state.app.corpId || "ding870ccf3c4d8fc1bc";
|
|
|
+ // 唤起授权--统一授权套件SDK
|
|
|
openAuth({
|
|
|
- clientId: "dingwlimimzllguvqf8x", // 应用ID(唯一标识)
|
|
|
- corpId: "ding4ab75ecd53106cde4ac5d6980864d335", // 当前组织的corpId
|
|
|
+ clientId: "suiteyjd6ikxpg8629ydr", // 应用ID(唯一标识)
|
|
|
+ corpId: corpId, // 当前组织的corpId
|
|
|
rpcScope: "Contact.User.Read", //通讯录
|
|
|
fieldScope: "Contact.User.mobile", //手机号
|
|
|
type: 0, // 0 标识授权个人信息;1 标识授权组织信息
|
|
|
}).then((res) => {
|
|
|
// 处理返回数据
|
|
|
- console.log("免登res=", res);
|
|
|
- authToken(res.result.authCode).then((res) => {
|
|
|
- let userInfo = res.sysUser;
|
|
|
- setToken(res.token);
|
|
|
- that.$store.commit("SET_TOKEN", res.token);
|
|
|
- console.log("----钉钉环境----");
|
|
|
+ // console.log("免登res=", res);
|
|
|
+ // authToken(res.result.authCode).then((res) => {
|
|
|
+ // let userInfo = res.sysUser;
|
|
|
+ // setToken(res.token);
|
|
|
+ // that.$store.commit("SET_TOKEN", res.token);
|
|
|
+ // console.log("----钉钉环境----");
|
|
|
+ // that.toTargetPage();
|
|
|
+ // });
|
|
|
+ authLogin({ code: res.code, corpId: corpId }).then((res) => {
|
|
|
+ // console.log("===authLogin_res=", res);
|
|
|
+ // let userInfo = res.sysUser;
|
|
|
+ setToken(res.msg);
|
|
|
+ that.$store.commit("SET_TOKEN", res.msg);
|
|
|
that.toTargetPage();
|
|
|
-
|
|
|
- // userInfo.nick
|
|
|
- // userInfo.mobile
|
|
|
- // userInfo.avatarUrl
|
|
|
- // openId unionId
|
|
|
});
|
|
|
});
|
|
|
+ // console.log("corpId===", corpId);
|
|
|
+ // dd.getAuthCode({
|
|
|
+ // corpId: corpId,
|
|
|
+ // success: (res) => {
|
|
|
+ // // console.log("authTokenThree-res=", res);
|
|
|
+ // authLogin({ code: res.code, corpId: corpId }).then((res) => {
|
|
|
+ // // console.log("===authLogin_res=", res);
|
|
|
+ // // let userInfo = res.sysUser;
|
|
|
+ // setToken(res.msg);
|
|
|
+ // that.$store.commit("SET_TOKEN", res.msg);
|
|
|
+ // that.toTargetPage();
|
|
|
+ // });
|
|
|
+ // },
|
|
|
+ // fail: (err) => {
|
|
|
+ // // console.log("err=", err);
|
|
|
+ // },
|
|
|
+ // complete: () => {},
|
|
|
+ // });
|
|
|
});
|
|
|
}
|
|
|
},
|
|
@@ -97,12 +114,22 @@ export default {
|
|
|
path: that.redirect || "/mobile/resume/index",
|
|
|
});
|
|
|
} else {
|
|
|
+ // that.$router.push({
|
|
|
+ // path: that.redirect || "/",
|
|
|
+ // query: { type: "admin", title: "智能简历" },
|
|
|
+ // });
|
|
|
that.$router.push({
|
|
|
- path: that.redirect || "/",
|
|
|
- query: { type: "admin", title: "智能简历" },
|
|
|
+ path: that.redirect || "/system/resume/index",
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
+ // 解析地址栏二维码值
|
|
|
+ getUrlParam(name) {
|
|
|
+ let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
|
|
|
+ let r = window.location.search.substr(1).match(reg); //匹配目标参数
|
|
|
+ if (r != null) return decodeURI(r[2]); //返回参数值
|
|
|
+ return null;
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|