166 lines
4.6 KiB
JavaScript
166 lines
4.6 KiB
JavaScript
import Vue from 'vue'
|
|
import App from './equipmentCenter.vue'
|
|
import router from '@/router/equipmentCenter'
|
|
import store from '@/store/index'
|
|
import '@/plugins/element.js'
|
|
import vuescroll from 'vuescroll'
|
|
import i18n from '@/assets/i18n/i18n'
|
|
|
|
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 { autoLogin } from '@/assets/js/api/autoLogin-xingXuan'
|
|
|
|
|
|
if (COMPANY == 'xingxuan') {
|
|
if(window.location.href.indexOf('?project_id=') != -1) {
|
|
const projectId = window.location.href.split('?project_id=')[1].split('&')[0];
|
|
login(projectId)
|
|
}
|
|
|
|
function login(projectNumber) {
|
|
autoLogin({ projectNumber }).then(res => {
|
|
if (res.code != 200) return
|
|
parseLoginData(res.result);
|
|
})
|
|
}
|
|
|
|
function parseLoginData(data) {
|
|
window._paq.push(['trackEvent', '点击', '登录','登录账号'])
|
|
|
|
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 = [];
|
|
let projectModule = [];
|
|
if (moduleList.length == 0 && data.accountType != 1) {
|
|
Message.warning("当前账号还没分配权限");
|
|
return false;
|
|
}
|
|
moduleList.forEach((element) => {
|
|
if (element.moduleType == 1) {
|
|
companyModule.push(element);
|
|
}
|
|
if(element.moduleType == 5){
|
|
projectModule.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);
|
|
store.commit("setProjectManageMenuList",menu2)
|
|
store.commit("setIsShowBackIndex", false);
|
|
router.push("/registerAudit");
|
|
break;
|
|
case 2:
|
|
store.commit("setMenuList", companyModule);
|
|
store.commit("setProjectManageMenuList",companyModule)
|
|
store.commit("setIsShowBackIndex", false);
|
|
router.push(companyModule[0].modulePath);
|
|
break;
|
|
case 3:
|
|
store.commit("setMenuList", companyModule);
|
|
store.commit("setProjectManageMenuList",companyModule)
|
|
store.commit("setIsShowBackIndex", false);
|
|
router.push(companyModule[0].modulePath);
|
|
break;
|
|
case 4:
|
|
store.commit("setMenuList", companyModule);
|
|
store.commit("setProjectManageMenuList",companyModule)
|
|
store.commit("setIsShowBackIndex", false);
|
|
router.push(companyModule[0].modulePath);
|
|
break;
|
|
case 7:
|
|
store.commit("setMenuList", companyModule);
|
|
store.commit("setProjectManageMenuList",companyModule)
|
|
store.commit("setIsShowBackIndex", false);
|
|
router.push(companyModule[0].modulePath);
|
|
break;
|
|
case 5:
|
|
// if (data.styleType == 1 || !data.styleType) {
|
|
// router.push("/projectIndex");
|
|
// } else {
|
|
// router.push("/projectV2/taskList");
|
|
// }
|
|
store.commit("setMenuList", projectModule);
|
|
store.commit("setProjectManageMenuList",projectModule)
|
|
store.commit("setIsShowBackIndex", false);
|
|
store.commit("setProjectSn", data.sn);
|
|
router.push(projectModule[0].modulePath);
|
|
break;
|
|
case 6:
|
|
// if (data.styleType == 1 || !data.styleType) {
|
|
// router.push("/projectIndex");
|
|
// } else {
|
|
// router.push("/projectV2/taskList");
|
|
// }
|
|
store.commit("setProjectSn", data.sn);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
Vue.config.productionTip = false
|
|
Vue.use(vuescroll, {
|
|
ops: {
|
|
bar: {
|
|
// background: "rgba(54, 51, 106, 0.6)",
|
|
background: "rgba(166, 166, 167, 0.6)",
|
|
// keepShow: false,
|
|
onlyShowBarOnScroll: false,
|
|
size: "5px",
|
|
minSize: 0.2
|
|
}
|
|
}
|
|
});
|
|
|
|
//监听 路由
|
|
router.beforeEach((to,form,next)=>{
|
|
if (COMPANY == 'xingxuan') return next()
|
|
if(store.state.userInfo){
|
|
next();
|
|
}else if(!store.state.userInfo && to.path!='/login'&& to.path!='/map_app'){
|
|
next({path:'login'});
|
|
}else{
|
|
next();
|
|
}
|
|
|
|
})
|
|
|
|
new Vue({
|
|
router,
|
|
store,
|
|
i18n,
|
|
render: h => h(App)
|
|
}).$mount('#app')
|
|
|
|
|