From f4d6903d4a034e29de56718d84eca1410a420217 Mon Sep 17 00:00:00 2001 From: Jack <1638169491@qq.com> Date: Thu, 18 Aug 2022 10:16:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E8=B7=A8=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E8=B7=B3=E8=BD=AC=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/index/index.js | 143 ++++++--------------------------------- 1 file changed, 20 insertions(+), 123 deletions(-) diff --git a/src/pages/index/index.js b/src/pages/index/index.js index b16e8cf4..52f12bf7 100644 --- a/src/pages/index/index.js +++ b/src/pages/index/index.js @@ -97,23 +97,8 @@ if (COMPANY == 'xingxuan') { 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) @@ -121,21 +106,9 @@ if (COMPANY == 'xingxuan') { router.push(companyModule[0].modulePath); break; case 5: - // if (data.styleType == 1 || !data.styleType) { - // debugger - // router.push("/projectIndex"); - // } else { - // router.push("/projectV2/taskList"); - // } store.commit("setProjectSn", data.sn); break; case 6: - // if (data.styleType == 1 || !data.styleType) { - // debugger - // router.push("/projectIndex"); - // } else { - // router.push("/projectV2/taskList"); - // } store.commit("setProjectSn", data.sn); break; } @@ -143,16 +116,12 @@ if (COMPANY == 'xingxuan') { } -function parseLoginData(data) { +function 沙悟净(data, sn) { console.log(data, 'dllmhjc'); window._paq.push(['trackEvent', '点击', '登录', '登录账号']) axios.defaults.headers.common['Authorization'] = 'Bearer' + ' ' + data.token axios.defaults.headers.common['operateId'] = data.userId 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 companyModule = [] if (moduleList.length == 0 && data.accountType != 1) { @@ -163,71 +132,30 @@ function parseLoginData(data) { 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' - } + var 菜单 = [ + { 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) - console.log('-----------', menu2) + store.commit('setMenuList', 菜单) + store.commit('setProjectManageMenuList', 菜单) 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) + store.commit('setProjectSn', sn) break 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: if (data.styleType == 1 || !data.styleType) { router.push('/projectIndex') @@ -261,7 +189,6 @@ Vue.use(VueMatomo, { requireCookieConsent: false, enableHeartBeatTimer: true, heartBeatTimerInterval: 15, - // trackerFileName: 'piwik', userId: '', trackerFileName: 'matomo', trackerUrl: undefined, @@ -279,9 +206,7 @@ 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 @@ -292,65 +217,38 @@ Vue.use(vuescroll, { // 加载缩略图 Vue.prototype.downloadImgMin = function (row) { 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 }; -/** - * 当然,你还可以在这里封装并挂载更多的全局函数在这里,示例同上 - */ //获取文件下载路径 Vue.prototype.getDownloadFilePath = function (row) { 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 }; //文件查看大图 Vue.prototype.getViewFilePath = function (row) { 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 }; -//监听 路由 +//路由监听 router.beforeEach((to, form, next) => { const direction = to.query.direction if (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) { - loginApi(info).then(res => { - parseLoginData(res.result) - return next({ path: to.path }) - }) + loginApi(孙悟空).then(猪八戒) } else if (LOGINTYPE == 2) { - companyLoginApi(info).then(res => { - parseLoginData(res.result) - return next({ path: to.path }) - }) + companyLoginApi(孙悟空).then(猪八戒) } else if (LOGINTYPE == 3) { - projectLoginApi(info).then(res => { - parseLoginData(res.result) - return next({ path: to.path }) - }) + projectLoginApi(孙悟空).then(猪八戒) } } else { @@ -358,7 +256,6 @@ router.beforeEach((to, form, next) => { if (store.state.userInfo) { next(); } else if (!store.state.userInfo && to.path != '/login' && to.path != '/' && to.path != '/sign' && !isDockingToWoer && to.path != '/authorization') { - // next({path:'login'}); next({ path: '/' }); } else { next();