|
@@ -8,8 +8,8 @@
|
|
|
<script>
|
|
|
import ThemePicker from "@/components/ThemePicker";
|
|
|
|
|
|
-import { authToken, authTokenThree, authLogin,cropLogin } from "@/api/login";
|
|
|
import { initDingH5RemoteDebug } from "dingtalk-h5-remote-debug";
|
|
|
+import { authToken, authTokenThree, authLogin, cropLogin } from "@/api/login";
|
|
|
import { openAuth } from "dingtalk-design-libs/biz/openAuth";
|
|
|
import { setToken } from "@/utils/auth";
|
|
|
import * as dd from "dingtalk-jsapi"; // 在此引入
|
|
@@ -18,64 +18,18 @@ initDingH5RemoteDebug();
|
|
|
export default {
|
|
|
name: "App",
|
|
|
components: { ThemePicker },
|
|
|
+ beforeCreate() {},
|
|
|
created() {
|
|
|
- let that = this;
|
|
|
// 判断是否是移动端
|
|
|
let isMobileEnv = this.isMobile();
|
|
|
// 储存
|
|
|
this.$store.commit("app/SET_IS_MOBILE_ENV", isMobileEnv);
|
|
|
- // 取值-同步
|
|
|
- // console.log("是否是移动端=", this.$store.state.app.isMobileEnv);
|
|
|
- // console.log("页面链接=", window.location.href);
|
|
|
- // console.log("页面corpId=", this.getUrlParam("corpId"));
|
|
|
+ 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 () {
|
|
|
- // 钉钉免登录认证-第三方企业
|
|
|
- let corpId = that.$store.state.app.corpId || "ding870ccf3c4d8fc1bc";
|
|
|
- // 唤起授权--统一授权套件SDK
|
|
|
- openAuth({
|
|
|
- clientId: "suiteyjd6ikxpg8629ydr", // 应用ID(唯一标识)
|
|
|
- corpId: corpId, // 当前组织的corpId
|
|
|
- rpcScope: "Contact.User.Read", //通讯录
|
|
|
- fieldScope: "Contact.User.mobile", //手机号
|
|
|
- type: 0, // 0 标识授权个人信息;1 标识授权组织信息
|
|
|
- }).then((res) => {
|
|
|
- // 处理返回数据
|
|
|
- console.log("统一授权套件SDK==res=", res);
|
|
|
- //cropLogin
|
|
|
- //authLogin
|
|
|
- authLogin({ code: res.result.authCode, 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();
|
|
|
- });
|
|
|
- });
|
|
|
- // 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: () => {},
|
|
|
- // });
|
|
|
- });
|
|
|
- }
|
|
|
},
|
|
|
metaInfo() {
|
|
|
return {
|
|
@@ -90,6 +44,13 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 解析地址栏二维码值
|
|
|
+ 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;
|
|
|
+ },
|
|
|
//判断是否是移动端
|
|
|
isMobile() {
|
|
|
return (
|
|
@@ -98,33 +59,6 @@ export default {
|
|
|
) !== null
|
|
|
);
|
|
|
},
|
|
|
- // 判断是否是移动端跳转
|
|
|
- toTargetPage() {
|
|
|
- let that = this;
|
|
|
- // 判断客户端环境
|
|
|
- let isMobileEnv = this.$store.state.app.isMobileEnv;
|
|
|
- console.log("app=====isMobileEnv=", isMobileEnv);
|
|
|
- if (isMobileEnv) {
|
|
|
- that.$router.replace({
|
|
|
- path: that.redirect || "/mobile/resume/index",
|
|
|
- });
|
|
|
- } else {
|
|
|
- // that.$router.push({
|
|
|
- // path: that.redirect || "/",
|
|
|
- // query: { type: "admin", title: "智能简历" },
|
|
|
- // });
|
|
|
- that.$router.push({
|
|
|
- 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>
|