2023-03-17 10:46:11 +08:00
|
|
|
import Vue from "vue";
|
|
|
|
|
import App from "./index.vue";
|
|
|
|
|
import router from "@/router/index";
|
|
|
|
|
import VueMatomo from "vue-matomo";
|
|
|
|
|
import store from "@/store";
|
|
|
|
|
import "@/plugins/element.js";
|
|
|
|
|
import vuescroll from "vuescroll";
|
|
|
|
|
import uploader from "vue-simple-uploader";
|
|
|
|
|
import i18n from "@/assets/i18n/i18n";
|
|
|
|
|
import preview from "vue-photo-preview";
|
|
|
|
|
import "vue-photo-preview/dist/skin.css";
|
|
|
|
|
import * as filters from "@/filters/index.js";
|
|
|
|
|
import "@/assets/iconfont/iconfont.css";
|
|
|
|
|
import "@/assets/style/layout.less";
|
|
|
|
|
import "@/assets/style/button.less";
|
|
|
|
|
import "@/assets/style/table.less";
|
|
|
|
|
import "@/assets/style/dialog.less";
|
|
|
|
|
import "@/assets/style/pagination.less";
|
|
|
|
|
import axios from "axios";
|
|
|
|
|
import { Message } from "element-ui";
|
|
|
|
|
import Pagination from "@/components/Pagination";
|
|
|
|
|
import { resetForm } from "@/util";
|
|
|
|
|
import { autoLogin } from "@/assets/js/api/autoLogin-xingXuan";
|
|
|
|
|
import { decode, encode } from "js-base64";
|
|
|
|
|
import {
|
|
|
|
|
loginApi,
|
|
|
|
|
companyLoginApi,
|
|
|
|
|
projectLoginApi,
|
|
|
|
|
} from "@/assets/js/api/loginSign";
|
|
|
|
|
import SlideVerify from "vue-monoplasty-slide-verify"; //滑动验证
|
|
|
|
|
import VueAwesomeSwiper from "vue-awesome-swiper";
|
|
|
|
|
import scroll from "vue-seamless-scroll";
|
|
|
|
|
Vue.use(scroll);
|
|
|
|
|
import VueQuillEditor from "vue-quill-editor";
|
2023-01-04 14:27:14 +08:00
|
|
|
|
2023-03-17 10:46:11 +08:00
|
|
|
import "quill/dist/quill.core.css";
|
|
|
|
|
|
|
|
|
|
import "quill/dist/quill.snow.css";
|
|
|
|
|
|
|
|
|
|
import "quill/dist/quill.bubble.css";
|
|
|
|
|
|
|
|
|
|
Vue.use(VueQuillEditor); // 注册富文本编辑器
|
2022-09-19 14:47:57 +08:00
|
|
|
Vue.use(SlideVerify);
|
2022-10-17 17:46:04 +08:00
|
|
|
Vue.use(VueAwesomeSwiper);
|
2022-06-08 14:51:11 +08:00
|
|
|
|
|
|
|
|
// 全局组件挂载
|
2023-03-17 10:46:11 +08:00
|
|
|
Vue.component("Pagination", Pagination);
|
2022-06-08 14:51:11 +08:00
|
|
|
|
|
|
|
|
// 全局方法挂载
|
2023-03-17 10:46:11 +08:00
|
|
|
Vue.prototype.resetForm = resetForm;
|
2022-08-18 09:13:41 +08:00
|
|
|
|
2023-06-19 18:22:36 +08:00
|
|
|
|
2023-03-17 10:46:11 +08:00
|
|
|
if (COMPANY == "xingxuan") {
|
|
|
|
|
if (window.location.href.indexOf("?project_id=") != -1) {
|
|
|
|
|
const projectId = window.location.href
|
|
|
|
|
.split("?project_id=")[1]
|
|
|
|
|
.split("&")[0];
|
|
|
|
|
login(projectId);
|
2022-06-08 14:51:11 +08:00
|
|
|
}
|
|
|
|
|
|
2022-06-09 18:11:53 +08:00
|
|
|
function login(projectNumber) {
|
2023-03-17 10:46:11 +08:00
|
|
|
autoLogin({ projectNumber }).then((res) => {
|
|
|
|
|
if (res.code != 200) return;
|
2022-06-09 18:11:53 +08:00
|
|
|
parseLoginData(res.result);
|
2023-03-17 10:46:11 +08:00
|
|
|
});
|
2022-06-08 14:51:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function parseLoginData(data) {
|
2023-03-17 10:46:11 +08:00
|
|
|
window._paq.push(["trackEvent", "点击", "登录", "登录账号"]);
|
2022-06-08 14:51:11 +08:00
|
|
|
|
|
|
|
|
axios.defaults.headers.common["Authorization"] =
|
|
|
|
|
"Bearer" + " " + data.token;
|
|
|
|
|
axios.defaults.headers.common["operateId"] = data.userId;
|
|
|
|
|
store.commit("setUserInfo", data);
|
|
|
|
|
var moduleList = data.menuAuthority.moduleList
|
|
|
|
|
? data.menuAuthority.moduleList
|
|
|
|
|
: [];
|
|
|
|
|
var companyModule = [];
|
|
|
|
|
if (moduleList.length == 0 && data.accountType != 1) {
|
|
|
|
|
Message.warning("当前账号还没分配权限");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
moduleList.forEach((element) => {
|
|
|
|
|
if (element.moduleType == 1) {
|
|
|
|
|
companyModule.push(element);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
var menu2 = [
|
|
|
|
|
{
|
|
|
|
|
menuName: "企业管理",
|
|
|
|
|
id: 9199,
|
|
|
|
|
path: "/registerAudit",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
menuName: "模块菜单管理",
|
|
|
|
|
id: 9299,
|
|
|
|
|
path: "/moduleMenuManage",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
menuName: "app版本管理",
|
|
|
|
|
id: 9297,
|
|
|
|
|
path: "/operateManage",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
menuName: "塔吊模型管理",
|
|
|
|
|
id: 9298,
|
|
|
|
|
path: "/brand",
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
switch (data.accountType) {
|
|
|
|
|
case 1:
|
|
|
|
|
store.commit("setMenuList", menu2);
|
2023-03-17 10:46:11 +08:00
|
|
|
store.commit("setProjectManageMenuList", menu2);
|
2022-06-08 14:51:11 +08:00
|
|
|
store.commit("setIsShowBackIndex", false);
|
|
|
|
|
router.push("/registerAudit");
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
case 3:
|
|
|
|
|
case 4:
|
|
|
|
|
case 7:
|
|
|
|
|
store.commit("setMenuList", companyModule);
|
2023-03-17 10:46:11 +08:00
|
|
|
store.commit("setProjectManageMenuList", companyModule);
|
2022-06-08 14:51:11 +08:00
|
|
|
store.commit("setIsShowBackIndex", false);
|
2023-03-17 10:46:11 +08:00
|
|
|
console.log("跳转路由", companyModule[0].modulePath);
|
2022-06-08 14:51:11 +08:00
|
|
|
router.push(companyModule[0].modulePath);
|
2023-03-17 10:46:11 +08:00
|
|
|
|
2022-06-08 14:51:11 +08:00
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
store.commit("setProjectSn", data.sn);
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
store.commit("setProjectSn", data.sn);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-09 14:01:25 +08:00
|
|
|
function handler(data, sn) {
|
2023-03-17 10:46:11 +08:00
|
|
|
console.log(data + sn, "dllmhjc");
|
|
|
|
|
console.log(sn, "dllmhjc -- sn");
|
2022-12-14 18:31:34 +08:00
|
|
|
|
2023-03-17 10:46:11 +08:00
|
|
|
window._paq.push(["trackEvent", "点击", "登录", "登录账号"]);
|
|
|
|
|
axios.defaults.headers.common["Authorization"] = "Bearer" + " " + data.token;
|
|
|
|
|
axios.defaults.headers.common["operateId"] = data.userId;
|
2022-12-14 18:31:34 +08:00
|
|
|
store.commit("setProjectSn", sn);
|
|
|
|
|
|
2023-03-17 10:46:11 +08:00
|
|
|
store.commit("setUserInfo", data);
|
|
|
|
|
var moduleList = data.menuAuthority.moduleList
|
|
|
|
|
? data.menuAuthority.moduleList
|
|
|
|
|
: [];
|
|
|
|
|
var companyModule = [];
|
2022-08-18 09:13:41 +08:00
|
|
|
if (moduleList.length == 0 && data.accountType != 1) {
|
2023-03-17 10:46:11 +08:00
|
|
|
return false;
|
2022-08-18 09:13:41 +08:00
|
|
|
}
|
2023-03-17 10:46:11 +08:00
|
|
|
moduleList.forEach((element) => {
|
2022-08-18 09:13:41 +08:00
|
|
|
if (element.moduleType == 1) {
|
2023-03-17 10:46:11 +08:00
|
|
|
companyModule.push(element);
|
2022-08-18 09:13:41 +08:00
|
|
|
}
|
2023-03-17 10:46:11 +08:00
|
|
|
});
|
2022-08-18 10:16:28 +08:00
|
|
|
var 菜单 = [
|
2023-03-17 10:46:11 +08:00
|
|
|
{ menuName: "企业管理", id: 9199, path: "/registerAudit" },
|
|
|
|
|
{ menuName: "模块菜单管理", id: 9299, path: "/moduleMenuManage" },
|
|
|
|
|
{ menuName: "app版本管理", id: 9297, path: "/operateManage" },
|
|
|
|
|
{ menuName: "塔吊模型管理", id: 9298, path: "/brand" },
|
|
|
|
|
];
|
2022-08-18 09:13:41 +08:00
|
|
|
switch (data.accountType) {
|
|
|
|
|
case 1:
|
2023-03-17 10:46:11 +08:00
|
|
|
store.commit("setMenuList", 菜单);
|
|
|
|
|
store.commit("setProjectManageMenuList", 菜单);
|
|
|
|
|
store.commit("setIsShowBackIndex", false);
|
|
|
|
|
router.push("/registerAudit");
|
|
|
|
|
break;
|
2022-08-18 09:13:41 +08:00
|
|
|
case 2:
|
|
|
|
|
case 3:
|
|
|
|
|
case 4:
|
|
|
|
|
case 7:
|
2023-03-17 10:46:11 +08:00
|
|
|
store.commit("setMenuList", companyModule);
|
|
|
|
|
store.commit("setProjectManageMenuList", companyModule);
|
|
|
|
|
store.commit("setIsShowBackIndex", false);
|
|
|
|
|
router.push(companyModule[0].modulePath);
|
|
|
|
|
store.commit("setProjectSn", sn);
|
|
|
|
|
break;
|
2022-08-18 09:13:41 +08:00
|
|
|
case 5:
|
|
|
|
|
case 6:
|
2023-03-17 10:46:11 +08:00
|
|
|
if (PROJECT_TYPE != "zjsj") {
|
|
|
|
|
//看看项目看板内有没有菜单
|
|
|
|
|
let arr = data.menuAuthority.moduleList;
|
|
|
|
|
let arr2 = [];
|
|
|
|
|
arr.forEach((element) => {
|
|
|
|
|
if (element.moduleType == 4) {
|
|
|
|
|
arr2.push(element);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
console.log("arr2", arr2);
|
|
|
|
|
// 如果数组为空表示该用户没有权限访问
|
|
|
|
|
if (!arr2.length) {
|
|
|
|
|
router.push("/projectIndex");
|
|
|
|
|
} else {
|
|
|
|
|
router.push(arr2[0].modulePath);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-11-07 16:08:38 +08:00
|
|
|
if (data.styleType == 1 || !data.styleType) {
|
2023-03-17 10:46:11 +08:00
|
|
|
router.push("/projectIndex");
|
2022-11-07 16:08:38 +08:00
|
|
|
} else if (data.styleType == 2) {
|
2023-03-17 10:46:11 +08:00
|
|
|
router.push("/projectV2/taskList");
|
2022-11-07 16:08:38 +08:00
|
|
|
} else {
|
2023-03-17 10:46:11 +08:00
|
|
|
router.push("/projectV3/taskList");
|
2022-11-07 16:08:38 +08:00
|
|
|
}
|
2023-03-17 10:46:11 +08:00
|
|
|
store.commit("setProjectSn", data.sn);
|
|
|
|
|
break;
|
2022-08-18 09:13:41 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// this.selectMp3FileList()
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-17 10:46:11 +08:00
|
|
|
let url = "";
|
|
|
|
|
console.log(COMPANY);
|
|
|
|
|
if (COMPANY == "longguang") {
|
|
|
|
|
url = "http://matomo.logan.com.cn";
|
2022-06-08 14:51:11 +08:00
|
|
|
}
|
2022-08-18 09:13:41 +08:00
|
|
|
Vue.use(VueMatomo, {
|
2022-06-08 14:51:11 +08:00
|
|
|
// url http://matomo-sit.logan.com.cn/index.php测试地址
|
2023-03-17 10:46:11 +08:00
|
|
|
host: "http://matomo.logan.com.cn", //生产
|
2022-06-08 14:51:11 +08:00
|
|
|
// host:'http://matomo-sit.logan.com.cn', //测试
|
|
|
|
|
// host:url,
|
2022-08-18 09:13:41 +08:00
|
|
|
siteId: 47,
|
|
|
|
|
router: router,
|
|
|
|
|
requireConsent: false,
|
|
|
|
|
enbleLinkTracking: true,
|
|
|
|
|
trackInitialView: true,
|
|
|
|
|
disableCookies: false,
|
2022-06-08 14:51:11 +08:00
|
|
|
requireCookieConsent: false,
|
|
|
|
|
enableHeartBeatTimer: true,
|
|
|
|
|
heartBeatTimerInterval: 15,
|
2023-03-17 10:46:11 +08:00
|
|
|
userId: "",
|
|
|
|
|
trackerFileName: "matomo",
|
2022-06-08 14:51:11 +08:00
|
|
|
trackerUrl: undefined,
|
|
|
|
|
trackerScriptUrl: undefined,
|
|
|
|
|
debug: true,
|
2023-03-17 10:46:11 +08:00
|
|
|
});
|
|
|
|
|
Vue.use(preview);
|
2022-06-08 14:51:11 +08:00
|
|
|
Vue.use(uploader);
|
2023-03-17 10:46:11 +08:00
|
|
|
Vue.prototype.$EventBus = new Vue();
|
|
|
|
|
Object.keys(filters).forEach((key) => {
|
|
|
|
|
Vue.filter(key, filters[key]);
|
|
|
|
|
});
|
2022-06-08 14:51:11 +08:00
|
|
|
|
2023-03-17 10:46:11 +08:00
|
|
|
Vue.config.productionTip = false;
|
2022-06-08 14:51:11 +08:00
|
|
|
Vue.use(vuescroll, {
|
|
|
|
|
ops: {
|
|
|
|
|
bar: {
|
|
|
|
|
background: "rgba(166, 166, 167, 0.6)",
|
|
|
|
|
onlyShowBarOnScroll: false,
|
|
|
|
|
size: "5px",
|
2023-03-17 10:46:11 +08:00
|
|
|
minSize: 0.2,
|
|
|
|
|
},
|
|
|
|
|
},
|
2022-06-08 14:51:11 +08:00
|
|
|
});
|
2022-09-02 15:21:58 +08:00
|
|
|
|
2022-06-08 14:51:11 +08:00
|
|
|
// 加载缩略图
|
2023-03-17 10:46:11 +08:00
|
|
|
Vue.prototype.downloadImgMin = function(row) {
|
|
|
|
|
let fileUrl = store.state.FILEURL + row.fileUrl;
|
|
|
|
|
return fileUrl;
|
2022-06-08 14:51:11 +08:00
|
|
|
};
|
2022-08-18 09:13:41 +08:00
|
|
|
//获取文件下载路径
|
2023-03-17 10:46:11 +08:00
|
|
|
Vue.prototype.getDownloadFilePath = function(row) {
|
|
|
|
|
let fileUrl = store.state.FILEURL + row.fileUrl;
|
|
|
|
|
return fileUrl;
|
2022-08-18 09:13:41 +08:00
|
|
|
};
|
|
|
|
|
//文件查看大图
|
2023-03-17 10:46:11 +08:00
|
|
|
Vue.prototype.getViewFilePath = function(row) {
|
|
|
|
|
let fileUrl = store.state.FILEURL + row.fileUrl;
|
|
|
|
|
return fileUrl;
|
2022-08-18 09:13:41 +08:00
|
|
|
};
|
2023-03-17 10:46:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-18 10:16:28 +08:00
|
|
|
//路由监听
|
2022-08-18 09:13:41 +08:00
|
|
|
router.beforeEach((to, form, next) => {
|
2023-05-15 21:48:02 +08:00
|
|
|
const whitepage = ["/authentication", "/test", "/videoLearning",'/pages/projectEnd/safetyEducation/authentication','/companyAdmin/docManage'];
|
2023-03-17 10:46:11 +08:00
|
|
|
|
|
|
|
|
console.log('白名单跳转生效了嘛==============11111111111 :',to);
|
|
|
|
|
|
|
|
|
|
if (whitepage.includes(to.path)) {
|
|
|
|
|
console.log('白名单跳转生效了嘛==============');
|
|
|
|
|
return next();
|
|
|
|
|
}
|
|
|
|
|
const direction = to.query.direction;
|
|
|
|
|
console.log("跳转", direction);
|
2022-08-18 09:13:41 +08:00
|
|
|
if (direction) {
|
2023-03-17 10:46:11 +08:00
|
|
|
const info = JSON.parse(decode(direction));
|
|
|
|
|
const account = { account: info.acount, password: info.pwd };
|
2022-08-18 10:16:28 +08:00
|
|
|
|
2023-03-17 10:46:11 +08:00
|
|
|
const tentative = (res) => {
|
|
|
|
|
console.log("res-----", res);
|
|
|
|
|
handler(res.result, info.projectSn);
|
|
|
|
|
return next({ path: to.path });
|
|
|
|
|
};
|
2022-08-18 09:13:41 +08:00
|
|
|
|
|
|
|
|
if (LOGINTYPE == 1) {
|
2023-03-17 10:46:11 +08:00
|
|
|
loginApi(account).then(tentative);
|
2022-08-18 09:13:41 +08:00
|
|
|
} else if (LOGINTYPE == 2) {
|
2023-03-17 10:46:11 +08:00
|
|
|
companyLoginApi(account).then(tentative);
|
2022-08-18 09:13:41 +08:00
|
|
|
} else if (LOGINTYPE == 3) {
|
2023-03-17 10:46:11 +08:00
|
|
|
projectLoginApi(account).then(tentative);
|
2022-08-18 09:13:41 +08:00
|
|
|
}
|
2023-03-17 10:46:11 +08:00
|
|
|
} else {
|
|
|
|
|
if (COMPANY == "xingxuan") return next();
|
2022-08-18 09:13:41 +08:00
|
|
|
if (store.state.userInfo) {
|
|
|
|
|
next();
|
2023-03-17 10:46:11 +08:00
|
|
|
} else if (
|
|
|
|
|
!store.state.userInfo &&
|
|
|
|
|
to.path != "/login" &&
|
|
|
|
|
to.path != "/" &&
|
|
|
|
|
to.path != "/sign" &&
|
|
|
|
|
!isDockingToWoer &&
|
|
|
|
|
to.path != "/authorization"
|
|
|
|
|
) {
|
|
|
|
|
next({ path: "/" });
|
2022-08-18 09:13:41 +08:00
|
|
|
} else {
|
|
|
|
|
next();
|
|
|
|
|
}
|
2022-06-08 14:51:11 +08:00
|
|
|
}
|
2023-03-17 10:46:11 +08:00
|
|
|
});
|
2022-06-08 14:51:11 +08:00
|
|
|
|
|
|
|
|
// Vue.prototype.$EventBus = new Vue()
|
|
|
|
|
|
|
|
|
|
new Vue({
|
|
|
|
|
router,
|
|
|
|
|
store,
|
|
|
|
|
i18n,
|
2023-03-17 10:46:11 +08:00
|
|
|
render: (h) => h(App),
|
|
|
|
|
}).$mount("#app");
|