diff --git a/jero-web/public/index.html b/jero-web/public/index.html index 63ed7250c..2f7255407 100644 --- a/jero-web/public/index.html +++ b/jero-web/public/index.html @@ -268,36 +268,39 @@ diff --git a/jero-web/src/components/layouts/TabLayout.vue b/jero-web/src/components/layouts/TabLayout.vue index 4cca72ab2..fb69ff51e 100644 --- a/jero-web/src/components/layouts/TabLayout.vue +++ b/jero-web/src/components/layouts/TabLayout.vue @@ -41,7 +41,13 @@ import { mixin, mixinDevice } from '@/utils/mixin.js' import { triggerWindowResizeEvent } from '@/utils/util' - const indexKey = '/dashboard/analysis' + let isPhone = localStorage.getItem('isPhone') + let indexKey = '' + if (isPhone == 'yes') { + indexKey = '/phoneSearch' + } else { + indexKey = '/dashboard/analysis' + } import Vue from 'vue' import { CACHE_INCLUDED_ROUTES } from '@/store/mutation-types' diff --git a/jero-web/src/components/tools/Breadcrumb.vue b/jero-web/src/components/tools/Breadcrumb.vue index 3bd067fa8..1d6a199ef 100644 --- a/jero-web/src/components/tools/Breadcrumb.vue +++ b/jero-web/src/components/tools/Breadcrumb.vue @@ -10,37 +10,39 @@ + \ No newline at end of file diff --git a/jero-web/src/config/router.config.js b/jero-web/src/config/router.config.js index a1b5db65a..ed1c2df03 100644 --- a/jero-web/src/config/router.config.js +++ b/jero-web/src/config/router.config.js @@ -293,6 +293,7 @@ export const asyncRouterMap = [ * 基础路由 * @type { *[] } */ + export const constantRouterMap = [ { path: '/user', @@ -605,3 +606,119 @@ export const constantRouterMap = [ component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404') } ] + +export const phoneConstantRouterMap = [ + { + path: '/user', + component: UserLayout, + redirect: '/user/login', + hidden: true, + children: [ + { + path: 'login', + name: 'login', + component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login') + }, + { + path: 'register', + name: 'register', + component: () => import(/* webpackChunkName: "user" */ '@/views/user/register/Register') + }, + { + path: 'register-result', + name: 'registerResult', + component: () => import(/* webpackChunkName: "user" */ '@/views/user/register/RegisterResult') + }, + { + path: 'alteration', + name: 'alteration', + component: () => import(/* webpackChunkName: "user" */ '@/views/user/alteration/Alteration') + } + ] + }, + + /* 手机端开始 */ + //搜索 + { + path: '/phoneSearch', + name: 'phoneSearch', + component: () => import('@/views/phoneView/search') + }, + //待办中心 + { + path: '/phoneToDoCenter', + name: 'phoneToDoCenter', + component: () => import('@/views/phoneView/toDoCenter') + }, + //任务数据 + { + path: '/phoneTaskData', + name: 'phoneTaskData', + component: () => import('@/views/phoneView/taskData') + }, + //我的 + { + path: '/phoneHome', + name: 'phoneHome', + component: () => import('@/views/phoneView/home') + }, + //搜索列表 + { + path: '/phoneSearchList', + name: 'phoneSearchList', + component: () => import('@/views/phoneView/searchList') + }, + //文档详情 + { + path: '/phoneDocumentDetails', + name: 'phoneDocumentDetails', + component: () => import('@/views/phoneView/documentDetails') + }, + //流程 + { + path: '/phoneProcessManagement', + name: 'phoneProcessManagement', + component: () => import('@/views/phoneView/processManagement') + }, + //知识分享 + { + path: '/phoneProblemKnowledgeBase', + name: 'phoneProblemKnowledgeBase', + component: () => import('@/views/phoneView/problemKnowledgeBase') + }, + //办理页面 + { + path: '/phoneHandlingPage', + name: 'phoneHandlingPage', + component: () => import('@/views/phoneView/handlingPage') + }, + //我的收藏 + { + path: '/phoneMyCollection', + name: 'phoneMyCollection', + component: () => import('@/views/phoneView/myCollection') + }, + //最近预览 + { + path: '/phoneRecentBrowsing', + name: 'phoneRecentBrowsing', + component: () => import('@/views/phoneView/recentBrowsing') + }, + //我的订阅 + { + path: '/phoneMySubscribe', + name: 'phoneMySubscribe', + component: () => import('@/views/phoneView/mySubscribe') + }, + //perhome办理流程 + { + path: '/phonePreHomoMangement', + name: 'phonePreHomoMangement', + component: () => import('@/views/phoneView/preHomoMangement') + }, + /* 手机端结束 */ + { + path: '/404', + component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404') + } +] diff --git a/jero-web/src/main.js b/jero-web/src/main.js index ea78ffa30..96d9467eb 100644 --- a/jero-web/src/main.js +++ b/jero-web/src/main.js @@ -18,6 +18,7 @@ require('@/components/onlineForm/onlineForm') require('@/components/onlineForm/OnlineForm.css') import Antd, { version } from 'ant-design-vue' + console.log('ant-design-vue version:', version) import Viser from 'viser-vue' @@ -54,6 +55,7 @@ import socketPublicOne from '@/utils/socketVuexOne.js' //挂载 Vue.prototype.$socketPublic = socketPublic Vue.prototype.$socketPublicOne = socketPublicOne +Vue.prototype.isPhone = false import JDictSelectTag from './components/dict/index.js' import hasPermission from '@/utils/hasPermission' import vueBus from '@/utils/vueBus' @@ -65,16 +67,17 @@ import '@/components/JVxeCells/install' // 挂载全局使用的方法 import VueDraggableResizable from 'vue-draggable-resizable' -import Vant from 'vant'; -import 'vant/lib/index.css'; +import Vant from 'vant' +import 'vant/lib/index.css' import 'amfe-flexible/index.js' + Vue.component('vue-draggable-resizable', VueDraggableResizable) Vue.config.productionTip = false Vue.use(Storage, config.storageOptions) Vue.use(Antd) Vue.use(VueAxios, router) Vue.use(Viser) -Vue.use(Vant); +Vue.use(Vant) Vue.use(hasPermission) Vue.use(JDictSelectTag) Vue.use(Print) diff --git a/jero-web/src/permission.js b/jero-web/src/permission.js index 75510d21d..430dbd8d2 100644 --- a/jero-web/src/permission.js +++ b/jero-web/src/permission.js @@ -10,6 +10,9 @@ import { JSEncrypt } from 'jsencrypt' import { getAction } from '@/api/manage' import { welcome } from '@/utils/util' +let isPhone = localStorage.getItem('isPhone') +console.log(isPhone) + // 判断当前设备 function isMobile() { var userAgentInfo = navigator.userAgent @@ -72,7 +75,7 @@ router.beforeEach((to, from, next) => { store.commit('SET_AVATAR', res.result.userInfo.avatar) let fullPath = '' if (to.fullPath == '/') { - if (mobile) { + if (isPhone == 'yes') { fullPath = '/phoneSearch' } else { fullPath = INDEX_MAIN_PAGE_PATH @@ -95,7 +98,7 @@ router.beforeEach((to, from, next) => { /* has token */ if (to.path === '/user/login') { let fullPath = '' - if (mobile) { + if (isPhone == 'yes') { fullPath = '/phoneSearch' } else { fullPath = INDEX_MAIN_PAGE_PATH @@ -116,14 +119,17 @@ router.beforeEach((to, from, next) => { store.dispatch('UpdateAppRouter', { constRoutes }).then(() => { // 根据roles权限生成可访问的路由表 // 动态添加可访问路由表 - router.addRoutes(store.getters.addRouters) let redirect = decodeURIComponent(from.query.redirect || to.path) - if (mobile) { - if (redirect == '/' || redirect == '/dashboard/analysis'){ + if (isPhone == 'yes') { + router.addRoutes([{ + 'path': '*', 'redirect': '/404', 'hidden': true + }]) + if (redirect == '/') { redirect = '/phoneSearch' } + } else { + router.addRoutes(store.getters.addRouters) } - if (to.path === redirect) { // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record next({ ...to, replace: true }) @@ -145,7 +151,7 @@ router.beforeEach((to, from, next) => { let fullPath = '' if (to.fullPath == '/') { - if (mobile) { + if (isPhone == 'yes') { fullPath = '/phoneSearch' } else { fullPath = INDEX_MAIN_PAGE_PATH @@ -153,13 +159,10 @@ router.beforeEach((to, from, next) => { } else { fullPath = to.path } - // http://grp.nioint.com - // window.location.href = 'https://signin-test.nio.com/oauth2/authorize?client_id=100679&redirect_uri=' - // + encodeURIComponent('http://localhost:3000' + fullPath) + '&response_type=code&state=' + JSON.stringify(to.query) //本地 // TODO 在部署线上时解开此代码 // window.location.href = 'https://signin.nio.com/oauth2/authorize?client_id=100679&redirect_uri=' - // + encodeURIComponent('https://grp.nioint.com' + fullPath) + '&response_type=code&state=' + JSON.stringify(to.query) //线上 + // + encodeURIComponent(window.loginUrl + fullPath) + '&response_type=code&state=' + JSON.stringify(to.query) //线上 }) }) } else { @@ -176,16 +179,17 @@ router.beforeEach((to, from, next) => { let fullPath = '' if (to.fullPath == '/') { - fullPath = INDEX_MAIN_PAGE_PATH + if (isPhone == 'yes') { + fullPath = '/phoneSearch' + } else { + fullPath = INDEX_MAIN_PAGE_PATH + } } else { fullPath = to.path } - // http://grp.nioint.com - // window.location.href = 'https://signin-test.nio.com/oauth2/authorize?client_id=100679&redirect_uri=' - // + encodeURIComponent('http://localhost:3000' + fullPath) + '&response_type=code&state=' + JSON.stringify(to.query) //本地 // TODO 在部署线上时解开此代码 // window.location.href = 'https://signin.nio.com/oauth2/authorize?client_id=100679&redirect_uri=' - // + encodeURIComponent('https://grp.nioint.com' + fullPath) + '&response_type=code&state=' + JSON.stringify(to.query) //线上 + // + encodeURIComponent(window.loginUrl + fullPath) + '&response_type=code&state=' + JSON.stringify(to.query) //线上 NProgress.done() // if current page is login will not trigger afterEach hook, so manually handle it } diff --git a/jero-web/src/router/index.js b/jero-web/src/router/index.js index 3bdcb9161..ca8707611 100644 --- a/jero-web/src/router/index.js +++ b/jero-web/src/router/index.js @@ -1,8 +1,17 @@ import Vue from 'vue' import Router from 'vue-router' -import { constantRouterMap } from '@/config/router.config' + +import { constantRouterMap, phoneConstantRouterMap } from '@/config/router.config' Vue.use(Router) +let isPhone = localStorage.getItem('isPhone') +let RouterMap = [] + +if (isPhone == 'yes') { + RouterMap = phoneConstantRouterMap +} else { + RouterMap = constantRouterMap +} const originalPush = Router.prototype.push Router.prototype.push = function push(location, onResolve, onReject) { @@ -10,15 +19,17 @@ Router.prototype.push = function push(location, onResolve, onReject) { return originalPush.call(this, location).catch(err => err) } -const createRouter = ()=> new Router({ +const createRouter = () => new Router({ mode: 'history', base: process.env.BASE_URL, scrollBehavior: () => ({ y: 0 }), - routes: constantRouterMap + routes: RouterMap }) const router = createRouter() -export function resetRouter () { + +export function resetRouter() { const newRouter = createRouter() router.matcher = newRouter.matcher // reset router } + export default router \ No newline at end of file diff --git a/jero-web/src/views/exception/ExceptionPage.vue b/jero-web/src/views/exception/ExceptionPage.vue index 0550d5efc..1702f441c 100644 --- a/jero-web/src/views/exception/ExceptionPage.vue +++ b/jero-web/src/views/exception/ExceptionPage.vue @@ -7,7 +7,7 @@