|
@@ -2,7 +2,7 @@
|
|
|
<div class="all">
|
|
|
<div class="noData flex-box-v flex-center-center">
|
|
|
<div class="data-all">
|
|
|
- <img src="static/images/init.gif" class="appImg"/>
|
|
|
+ <img src="static/images/init.gif" class="appImg" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -18,147 +18,180 @@
|
|
|
7.考勤系统审批 (请假,出差,加班,补卡,外出) type=7 考勤审批ID
|
|
|
8.okr计划 (创建任务指派的,任务审批的) type=8 okr计划ID -->
|
|
|
<script>
|
|
|
-
|
|
|
-import {getToken} from '@/utils/auth'
|
|
|
+import { getToken } from "@/utils/auth";
|
|
|
+import router from "../../router";
|
|
|
export default {
|
|
|
- name:'wxInit',
|
|
|
+ name: "wxInit",
|
|
|
data() {
|
|
|
- return {
|
|
|
-
|
|
|
- };
|
|
|
+ return {};
|
|
|
},
|
|
|
created() {
|
|
|
- if(this.$isWx){
|
|
|
+ if (this.$isWx) {
|
|
|
this.init();
|
|
|
- }else{
|
|
|
- this.$router.replace({ name: 'home' });
|
|
|
+ } else {
|
|
|
+ this.$router.replace({ name: "home" });
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- init(){
|
|
|
+ init() {
|
|
|
var url = window.location.href;
|
|
|
- let request =this.getStr(url)
|
|
|
- let data={ name: 'home',query:{}};
|
|
|
- let site_info=this.$getCache('site_info')
|
|
|
- if(request&&request.type){
|
|
|
- if(request.type==1||request.type==2){ //微信账号有绑定平台账号
|
|
|
- if(request.code){
|
|
|
- this.$axios('POST', '/api/pro/wo/mp/code', { code: request.code }).then(res => {
|
|
|
- let data=res.data.data;
|
|
|
- if(data.account_id===0){ //微信未绑定
|
|
|
- data={ name: 'regWx',query:{wo_token:data.wo_token}};
|
|
|
- this.openUrl(data)
|
|
|
- }else{
|
|
|
- localStorage.setItem('a-token-temp', data.token); // 保存平台账号登录的token
|
|
|
- this.openUrl2(data.account_site,data.invitation_wait_count);
|
|
|
- }
|
|
|
+ let request = this.getStr(url);
|
|
|
+ let data = { name: "home", query: {} };
|
|
|
+ let site_info = this.$getCache("site_info");
|
|
|
+ console.log(request)
|
|
|
+ if (request && request.type && (request.type == 1 || request.type == 2)) {
|
|
|
+ if (request.type == 1 || request.type == 2) {
|
|
|
+ //微信账号有绑定平台账号
|
|
|
+ if (request.code) {
|
|
|
+ this.$axios("POST", "/api/pro/wo/mp/code", {
|
|
|
+ code: request.code
|
|
|
+ }).then(res => {
|
|
|
+ let data = res.data.data;
|
|
|
+ if (data.account_id !== 0) {
|
|
|
+ //微信已经绑定
|
|
|
+ localStorage.setItem("Wx-Token", data.wo_token); // 保存平台账号登录的token
|
|
|
+ }
|
|
|
+ data = { name: "regWx", query: { wo_token: data.wo_token } };
|
|
|
+ this.$router.push(data);
|
|
|
});
|
|
|
}
|
|
|
- return false
|
|
|
+ return false;
|
|
|
}
|
|
|
- if(!getToken()){
|
|
|
- this.$router.replace({ name: 'home' });
|
|
|
- return false
|
|
|
+ if (!getToken()) {
|
|
|
+ this.$router.replace({ name: "home" });
|
|
|
+ return false;
|
|
|
}
|
|
|
// alert(`传过来的企业ID${request.siteId}当前ID${site_info.id}`)
|
|
|
- if(request.siteId!=site_info.id){ //企业不一致
|
|
|
- this.$dialog.alert({
|
|
|
- title: '提示',
|
|
|
- message: '当前登录企业与消息企业不一致,请重新选择企业',
|
|
|
- }).then(() => {
|
|
|
- this.$router.replace({ name: 'login_company_list' }); // 选择企业
|
|
|
- });
|
|
|
- return false
|
|
|
+ if (request.siteId != site_info.id) {
|
|
|
+ //企业不一致
|
|
|
+ this.$dialog
|
|
|
+ .alert({
|
|
|
+ title: "提示",
|
|
|
+ message: "当前登录企业与消息企业不一致,请重新选择企业"
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.$router.replace({ name: "login_company_list" }); // 选择企业
|
|
|
+ });
|
|
|
+ return false;
|
|
|
}
|
|
|
- if(request.type==3){ //指派任务
|
|
|
- data={ name: 'taskFile',query:{task_id:request.id}};
|
|
|
- this.openUrl(data)
|
|
|
- }else if(request.type==4){//接受悬赏任务
|
|
|
- data={ name: 'task_hall',query:{}};
|
|
|
- this.openUrl(data)
|
|
|
- }else if(request.type==5){//现场管理问题整改
|
|
|
- if(site_info.sm&&site_info.sm.enable){
|
|
|
- data={ name: 'issueTaskDetail',query:{id:request.id}};
|
|
|
- this.openUrl(data)
|
|
|
- }else{
|
|
|
- this.openHome('现场管理模块未开通,请联系管理员开通使用。')
|
|
|
+ if (request.type == 3) {
|
|
|
+ //指派任务
|
|
|
+ data = { name: "taskFile", query: { task_id: request.id } };
|
|
|
+ this.openUrl(data);
|
|
|
+ } else if (request.type == 4) {
|
|
|
+ //接受悬赏任务
|
|
|
+ data = { name: "task_hall", query: {} };
|
|
|
+ this.openUrl(data);
|
|
|
+ } else if (request.type == 5) {
|
|
|
+ //现场管理问题整改
|
|
|
+ if (site_info.sm && site_info.sm.enable) {
|
|
|
+ data = { name: "issueTaskDetail", query: { id: request.id } };
|
|
|
+ this.openUrl(data);
|
|
|
+ } else {
|
|
|
+ this.openHome("现场管理模块未开通,请联系管理员开通使用。");
|
|
|
}
|
|
|
- }else if(request.type==6){//积分审批
|
|
|
- data={ name: 'approval_detail',query:{review_id:request.id}};
|
|
|
- this.openUrl(data)
|
|
|
- }else if(request.type==7){//考勤系统审批
|
|
|
- data={ name: 'RecordDetail',query:{id:request.id}};
|
|
|
- this.openUrl(data)
|
|
|
- }else if(request.type==8){//okr计划
|
|
|
- if(site_info.okr && site_info.okr.enable){
|
|
|
- this.getUnitList(()=>{
|
|
|
- data={ name: 'taskDetail',query:{id:request.id}};
|
|
|
- this.openUrl(data)
|
|
|
- })
|
|
|
- }else{
|
|
|
- this.openHome('OKR模块未开通,请联系管理员开通使用。')
|
|
|
+ } else if (request.type == 6) {
|
|
|
+ //积分审批
|
|
|
+ data = { name: "approval_detail", query: { review_id: request.id } };
|
|
|
+ this.openUrl(data);
|
|
|
+ } else if (request.type == 7) {
|
|
|
+ //考勤系统审批
|
|
|
+ data = { name: "RecordDetail", query: { id: request.id } };
|
|
|
+ this.openUrl(data);
|
|
|
+ } else if (request.type == 8) {
|
|
|
+ //okr计划
|
|
|
+ if (site_info.okr && site_info.okr.enable) {
|
|
|
+ this.getUnitList(() => {
|
|
|
+ data = { name: "taskDetail", query: { id: request.id } };
|
|
|
+ this.openUrl(data);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.openHome("OKR模块未开通,请联系管理员开通使用。");
|
|
|
}
|
|
|
}
|
|
|
+ } else if (request && request.type && request.type == 9) {
|
|
|
+ if (request.code) {
|
|
|
+ this.$axiosKc("POST", "https://oa.g107.com/api/pro/wo/mp/code", {
|
|
|
+ code: request.code
|
|
|
+ }).then(res => {
|
|
|
+ let data = res.data.data;
|
|
|
+ if (data.account_id === 0) {
|
|
|
+ //微信未绑定
|
|
|
+ data = { name: "regWx", query: { wo_token: data.wo_token } };
|
|
|
+ this.openUrl(data);
|
|
|
+ } else {
|
|
|
+ localStorage.setItem("wx_user_info", JSON.stringify(data));
|
|
|
+ localStorage.setItem("Wx-Token", data.wo_token); // 保存微信课程账号登录的token
|
|
|
+ this.$router.push('/courseHome')
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
- getUnitList(fun){
|
|
|
- this.$axiosUser('get', '/api/pro/okr/kr/unit_list').then(res => {
|
|
|
- let data=res.data.data;
|
|
|
- data.reverse()
|
|
|
- this.$setCache('unitList',data)
|
|
|
- fun()
|
|
|
- })
|
|
|
+ getUnitList(fun) {
|
|
|
+ this.$axiosUser("get", "/api/pro/okr/kr/unit_list").then(res => {
|
|
|
+ let data = res.data.data;
|
|
|
+ data.reverse();
|
|
|
+ this.$setCache("unitList", data);
|
|
|
+ fun();
|
|
|
+ });
|
|
|
},
|
|
|
getStr(urlStr) {
|
|
|
- if (typeof urlStr == 'undefined') {
|
|
|
- var url = decodeURI(location.search); //获取url中"?"符后的字符串
|
|
|
- } else {
|
|
|
- var url = '?' + urlStr.split('?')[1];
|
|
|
- }
|
|
|
- var theRequest = new Object();
|
|
|
- var strs;
|
|
|
- if (url.indexOf('?') != -1) {
|
|
|
- var str = url.substr(1);
|
|
|
- strs = str.split('&');
|
|
|
- for (var i = 0; i < strs.length; i++) {
|
|
|
- theRequest[strs[i].split('=')[0]] = decodeURI(strs[i].split('=')[1]);
|
|
|
- }
|
|
|
- }
|
|
|
- return theRequest;
|
|
|
+ if (typeof urlStr == "undefined") {
|
|
|
+ var url = decodeURI(location.search); //获取url中"?"符后的字符串
|
|
|
+ } else {
|
|
|
+ var url = "?" + urlStr.split("?")[1];
|
|
|
+ }
|
|
|
+ var theRequest = new Object();
|
|
|
+ var strs;
|
|
|
+ if (url.indexOf("?") != -1) {
|
|
|
+ var str = url.substr(1);
|
|
|
+ strs = str.split("&");
|
|
|
+ for (var i = 0; i < strs.length; i++) {
|
|
|
+ theRequest[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return theRequest;
|
|
|
},
|
|
|
- openUrl(data){
|
|
|
- data.query.isHome=true;
|
|
|
+ openUrl(data) {
|
|
|
+ data.query.isHome = true;
|
|
|
this.$router.replace(data);
|
|
|
},
|
|
|
openUrl2(account_site, invitation_wait_count) {
|
|
|
if (account_site.length > 0) {
|
|
|
// 公司数量
|
|
|
if (invitation_wait_count > 0) {
|
|
|
- this.$router.push({ name: 'registration_experience', query: { invite: 1, iscompany: 1 } }); // 选择行业
|
|
|
+ this.$router.push({
|
|
|
+ name: "registration_experience",
|
|
|
+ query: { invite: 1, iscompany: 1 }
|
|
|
+ }); // 选择行业
|
|
|
} else {
|
|
|
- this.$router.push({ name: 'login_company_list' }); // 选择企业
|
|
|
+ this.$router.push({ name: "login_company_list" }); // 选择企业
|
|
|
}
|
|
|
} else {
|
|
|
if (invitation_wait_count > 0) {
|
|
|
// 待邀请数量
|
|
|
- this.$router.push({ name: 'registration_experience', query: { invite: 1 } }); // 选择行业
|
|
|
+ this.$router.push({
|
|
|
+ name: "registration_experience",
|
|
|
+ query: { invite: 1 }
|
|
|
+ }); // 选择行业
|
|
|
} else {
|
|
|
- this.$router.replace({name:'create_company'}) //进入体验账号
|
|
|
+ this.$router.replace({ name: "create_company" }); //进入体验账号
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
openHome(msg) {
|
|
|
- this.$dialog.alert({
|
|
|
- title: '提示',
|
|
|
- message: msg,
|
|
|
- }).then(() => {
|
|
|
- this.$router.replace({ name: 'home' }); // 选择企业
|
|
|
- });
|
|
|
- },
|
|
|
- },
|
|
|
- activated() {
|
|
|
-
|
|
|
+ this.$dialog
|
|
|
+ .alert({
|
|
|
+ title: "提示",
|
|
|
+ message: msg
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.$router.replace({ name: "home" }); // 选择企业
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
+ activated() {}
|
|
|
};
|
|
|
</script>
|
|
|
|