完成跨平台登录跳转功能
This commit is contained in:
parent
7ce0362dd2
commit
f4d6903d4a
@ -97,23 +97,8 @@ if (COMPANY == 'xingxuan') {
|
|||||||
router.push("/registerAudit");
|
router.push("/registerAudit");
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
store.commit("setMenuList", companyModule);
|
|
||||||
store.commit("setProjectManageMenuList", companyModule)
|
|
||||||
store.commit("setIsShowBackIndex", false);
|
|
||||||
router.push(companyModule[0].modulePath);
|
|
||||||
break;
|
|
||||||
case 3:
|
case 3:
|
||||||
store.commit("setMenuList", companyModule);
|
|
||||||
store.commit("setProjectManageMenuList", companyModule)
|
|
||||||
store.commit("setIsShowBackIndex", false);
|
|
||||||
router.push(companyModule[0].modulePath);
|
|
||||||
break;
|
|
||||||
case 4:
|
case 4:
|
||||||
store.commit("setMenuList", companyModule);
|
|
||||||
store.commit("setProjectManageMenuList", companyModule)
|
|
||||||
store.commit("setIsShowBackIndex", false);
|
|
||||||
router.push(companyModule[0].modulePath);
|
|
||||||
break;
|
|
||||||
case 7:
|
case 7:
|
||||||
store.commit("setMenuList", companyModule);
|
store.commit("setMenuList", companyModule);
|
||||||
store.commit("setProjectManageMenuList", companyModule)
|
store.commit("setProjectManageMenuList", companyModule)
|
||||||
@ -121,21 +106,9 @@ if (COMPANY == 'xingxuan') {
|
|||||||
router.push(companyModule[0].modulePath);
|
router.push(companyModule[0].modulePath);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
// if (data.styleType == 1 || !data.styleType) {
|
|
||||||
// debugger
|
|
||||||
// router.push("/projectIndex");
|
|
||||||
// } else {
|
|
||||||
// router.push("/projectV2/taskList");
|
|
||||||
// }
|
|
||||||
store.commit("setProjectSn", data.sn);
|
store.commit("setProjectSn", data.sn);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
// if (data.styleType == 1 || !data.styleType) {
|
|
||||||
// debugger
|
|
||||||
// router.push("/projectIndex");
|
|
||||||
// } else {
|
|
||||||
// router.push("/projectV2/taskList");
|
|
||||||
// }
|
|
||||||
store.commit("setProjectSn", data.sn);
|
store.commit("setProjectSn", data.sn);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -143,16 +116,12 @@ if (COMPANY == 'xingxuan') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function parseLoginData(data) {
|
function 沙悟净(data, sn) {
|
||||||
console.log(data, 'dllmhjc');
|
console.log(data, 'dllmhjc');
|
||||||
window._paq.push(['trackEvent', '点击', '登录', '登录账号'])
|
window._paq.push(['trackEvent', '点击', '登录', '登录账号'])
|
||||||
axios.defaults.headers.common['Authorization'] = 'Bearer' + ' ' + data.token
|
axios.defaults.headers.common['Authorization'] = 'Bearer' + ' ' + data.token
|
||||||
axios.defaults.headers.common['operateId'] = data.userId
|
axios.defaults.headers.common['operateId'] = data.userId
|
||||||
store.commit('setUserInfo', data)
|
store.commit('setUserInfo', data)
|
||||||
const sn = data.sn
|
|
||||||
const xxx = JSON.parse(sessionStorage.getItem('vuex'))
|
|
||||||
xxx.projectSn = sn
|
|
||||||
console.log(data, 'sssssssssssssssssssssssssssss', xxx);
|
|
||||||
var moduleList = data.menuAuthority.moduleList ? data.menuAuthority.moduleList : []
|
var moduleList = data.menuAuthority.moduleList ? data.menuAuthority.moduleList : []
|
||||||
var companyModule = []
|
var companyModule = []
|
||||||
if (moduleList.length == 0 && data.accountType != 1) {
|
if (moduleList.length == 0 && data.accountType != 1) {
|
||||||
@ -163,71 +132,30 @@ function parseLoginData(data) {
|
|||||||
companyModule.push(element)
|
companyModule.push(element)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
var menu2 = [
|
var 菜单 = [
|
||||||
{
|
{ menuName: '企业管理', id: 9199, path: '/registerAudit' },
|
||||||
menuName: '企业管理',
|
{ menuName: '模块菜单管理', id: 9299, path: '/moduleMenuManage' },
|
||||||
id: 9199,
|
{ menuName: 'app版本管理', id: 9297, path: '/operateManage' },
|
||||||
path: '/registerAudit'
|
{ menuName: '塔吊模型管理', id: 9298, path: '/brand' }
|
||||||
},
|
|
||||||
{
|
|
||||||
menuName: '模块菜单管理',
|
|
||||||
id: 9299,
|
|
||||||
path: '/moduleMenuManage'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
menuName: 'app版本管理',
|
|
||||||
id: 9297,
|
|
||||||
path: '/operateManage'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
menuName: '塔吊模型管理',
|
|
||||||
id: 9298,
|
|
||||||
path: '/brand'
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
switch (data.accountType) {
|
switch (data.accountType) {
|
||||||
case 1:
|
case 1:
|
||||||
store.commit('setMenuList', menu2)
|
store.commit('setMenuList', 菜单)
|
||||||
store.commit('setProjectManageMenuList', menu2)
|
store.commit('setProjectManageMenuList', 菜单)
|
||||||
console.log('-----------', menu2)
|
|
||||||
store.commit('setIsShowBackIndex', false)
|
store.commit('setIsShowBackIndex', false)
|
||||||
router.push('/registerAudit')
|
router.push('/registerAudit')
|
||||||
break
|
break
|
||||||
case 2:
|
case 2:
|
||||||
store.commit('setMenuList', companyModule)
|
|
||||||
store.commit('setProjectManageMenuList', companyModule)
|
|
||||||
store.commit('setIsShowBackIndex', false)
|
|
||||||
router.push(companyModule[0].modulePath)
|
|
||||||
break
|
|
||||||
case 3:
|
case 3:
|
||||||
store.commit('setMenuList', companyModule)
|
|
||||||
store.commit('setProjectManageMenuList', companyModule)
|
|
||||||
store.commit('setIsShowBackIndex', false)
|
|
||||||
router.push(companyModule[0].modulePath)
|
|
||||||
break
|
|
||||||
case 4:
|
case 4:
|
||||||
store.commit('setMenuList', companyModule)
|
|
||||||
store.commit('setProjectManageMenuList', companyModule)
|
|
||||||
store.commit('setIsShowBackIndex', false)
|
|
||||||
router.push(companyModule[0].modulePath)
|
|
||||||
break
|
|
||||||
case 7:
|
case 7:
|
||||||
store.commit('setMenuList', companyModule)
|
store.commit('setMenuList', companyModule)
|
||||||
store.commit('setProjectManageMenuList', companyModule)
|
store.commit('setProjectManageMenuList', companyModule)
|
||||||
store.commit('setIsShowBackIndex', false)
|
store.commit('setIsShowBackIndex', false)
|
||||||
router.push(companyModule[0].modulePath)
|
router.push(companyModule[0].modulePath)
|
||||||
|
store.commit('setProjectSn', sn)
|
||||||
break
|
break
|
||||||
case 5:
|
case 5:
|
||||||
// styleType == 3 衢州版
|
|
||||||
if (data.styleType == 1 || !data.styleType) {
|
|
||||||
router.push('/projectIndex')
|
|
||||||
} else if (data.styleType == 2) {
|
|
||||||
router.push('/projectV2/taskList')
|
|
||||||
} else {
|
|
||||||
router.push('/projectV3/taskList')
|
|
||||||
}
|
|
||||||
store.commit('setProjectSn', data.sn)
|
|
||||||
break
|
|
||||||
case 6:
|
case 6:
|
||||||
if (data.styleType == 1 || !data.styleType) {
|
if (data.styleType == 1 || !data.styleType) {
|
||||||
router.push('/projectIndex')
|
router.push('/projectIndex')
|
||||||
@ -261,7 +189,6 @@ Vue.use(VueMatomo, {
|
|||||||
requireCookieConsent: false,
|
requireCookieConsent: false,
|
||||||
enableHeartBeatTimer: true,
|
enableHeartBeatTimer: true,
|
||||||
heartBeatTimerInterval: 15,
|
heartBeatTimerInterval: 15,
|
||||||
// trackerFileName: 'piwik',
|
|
||||||
userId: '',
|
userId: '',
|
||||||
trackerFileName: 'matomo',
|
trackerFileName: 'matomo',
|
||||||
trackerUrl: undefined,
|
trackerUrl: undefined,
|
||||||
@ -279,9 +206,7 @@ Vue.config.productionTip = false
|
|||||||
Vue.use(vuescroll, {
|
Vue.use(vuescroll, {
|
||||||
ops: {
|
ops: {
|
||||||
bar: {
|
bar: {
|
||||||
// background: "rgba(54, 51, 106, 0.6)",
|
|
||||||
background: "rgba(166, 166, 167, 0.6)",
|
background: "rgba(166, 166, 167, 0.6)",
|
||||||
// keepShow: false,
|
|
||||||
onlyShowBarOnScroll: false,
|
onlyShowBarOnScroll: false,
|
||||||
size: "5px",
|
size: "5px",
|
||||||
minSize: 0.2
|
minSize: 0.2
|
||||||
@ -292,65 +217,38 @@ Vue.use(vuescroll, {
|
|||||||
// 加载缩略图
|
// 加载缩略图
|
||||||
Vue.prototype.downloadImgMin = function (row) {
|
Vue.prototype.downloadImgMin = function (row) {
|
||||||
let fileUrl = store.state.FILEURL + row.fileUrl
|
let fileUrl = store.state.FILEURL + row.fileUrl
|
||||||
|
|
||||||
// let isOSS = row.isOSS
|
|
||||||
// if (isOSS == 1) { //阿里云OSS对象存储
|
|
||||||
// fileUrl = "https://" + sessionStorage.getItem("viewDomain") + fileUrl + "?x-oss-process=image/resize,m_fill,h_150,w_150/rotate,0";
|
|
||||||
// } else { //本地磁盘存储
|
|
||||||
// let index = fileUrl.lastIndexOf(".");
|
|
||||||
// fileUrl = "api" + fileUrl.substr(0, index) + "_min" + fileUrl.substr(index);
|
|
||||||
// }
|
|
||||||
return fileUrl
|
return fileUrl
|
||||||
|
|
||||||
};
|
};
|
||||||
/**
|
|
||||||
* 当然,你还可以在这里封装并挂载更多的全局函数在这里,示例同上
|
|
||||||
*/
|
|
||||||
//获取文件下载路径
|
//获取文件下载路径
|
||||||
Vue.prototype.getDownloadFilePath = function (row) {
|
Vue.prototype.getDownloadFilePath = function (row) {
|
||||||
let fileUrl = store.state.FILEURL + row.fileUrl
|
let fileUrl = store.state.FILEURL + row.fileUrl
|
||||||
// let isOSS = row.isOSS
|
|
||||||
// if (isOSS == 1) { //阿里云OSS对象存储
|
|
||||||
// fileUrl = "https://" + sessionStorage.getItem("downloadDomain") + fileUrl;
|
|
||||||
// } else { //本地磁盘存储
|
|
||||||
// fileUrl = "api" + fileUrl;
|
|
||||||
// }
|
|
||||||
return fileUrl
|
return fileUrl
|
||||||
};
|
};
|
||||||
//文件查看大图
|
//文件查看大图
|
||||||
Vue.prototype.getViewFilePath = function (row) {
|
Vue.prototype.getViewFilePath = function (row) {
|
||||||
let fileUrl = store.state.FILEURL + row.fileUrl
|
let fileUrl = store.state.FILEURL + row.fileUrl
|
||||||
// let isOSS = row.isOSS
|
|
||||||
// if (isOSS == 1) { //阿里云OSS对象存储
|
|
||||||
// fileUrl = "https://" + sessionStorage.getItem("viewDomain") + fileUrl;
|
|
||||||
// } else { //本地磁盘存储
|
|
||||||
// fileUrl = "api" + fileUrl;
|
|
||||||
// }
|
|
||||||
return fileUrl
|
return fileUrl
|
||||||
};
|
};
|
||||||
//监听 路由
|
//路由监听
|
||||||
router.beforeEach((to, form, next) => {
|
router.beforeEach((to, form, next) => {
|
||||||
const direction = to.query.direction
|
const direction = to.query.direction
|
||||||
if (direction) {
|
if (direction) {
|
||||||
|
|
||||||
const info = JSON.parse(decode(direction))
|
const info = JSON.parse(decode(direction))
|
||||||
console.log(to, encode('{"account":"17512009894","password":"123456789"}'));
|
const 孙悟空 = { account: info.acount, password: info.pwd }
|
||||||
|
console.log(to, encode('{"acount":"17512009894","pwd":"123456789","projectSn": "a2ef0238b59146aa814b93f47710dbf2"}'));
|
||||||
|
|
||||||
|
const 猪八戒 = res => {
|
||||||
|
沙悟净(res.result, info.projectSn)
|
||||||
|
return next({ path: to.path })
|
||||||
|
}
|
||||||
|
|
||||||
if (LOGINTYPE == 1) {
|
if (LOGINTYPE == 1) {
|
||||||
loginApi(info).then(res => {
|
loginApi(孙悟空).then(猪八戒)
|
||||||
parseLoginData(res.result)
|
|
||||||
return next({ path: to.path })
|
|
||||||
})
|
|
||||||
} else if (LOGINTYPE == 2) {
|
} else if (LOGINTYPE == 2) {
|
||||||
companyLoginApi(info).then(res => {
|
companyLoginApi(孙悟空).then(猪八戒)
|
||||||
parseLoginData(res.result)
|
|
||||||
return next({ path: to.path })
|
|
||||||
})
|
|
||||||
} else if (LOGINTYPE == 3) {
|
} else if (LOGINTYPE == 3) {
|
||||||
projectLoginApi(info).then(res => {
|
projectLoginApi(孙悟空).then(猪八戒)
|
||||||
parseLoginData(res.result)
|
|
||||||
return next({ path: to.path })
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -358,7 +256,6 @@ router.beforeEach((to, form, next) => {
|
|||||||
if (store.state.userInfo) {
|
if (store.state.userInfo) {
|
||||||
next();
|
next();
|
||||||
} else if (!store.state.userInfo && to.path != '/login' && to.path != '/' && to.path != '/sign' && !isDockingToWoer && to.path != '/authorization') {
|
} else if (!store.state.userInfo && to.path != '/login' && to.path != '/' && to.path != '/sign' && !isDockingToWoer && to.path != '/authorization') {
|
||||||
// next({path:'login'});
|
|
||||||
next({ path: '/' });
|
next({ path: '/' });
|
||||||
} else {
|
} else {
|
||||||
next();
|
next();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user