修改手机端返回跳到pc的首页
This commit is contained in:
Vendored
+30
-30
@@ -268,36 +268,36 @@
|
||||
</style>
|
||||
<!-- 全局配置 -->
|
||||
<script>
|
||||
// 判断当前设备
|
||||
function isMobile() {
|
||||
var userAgentInfo = navigator.userAgent
|
||||
|
||||
var mobileAgents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod']
|
||||
|
||||
var mobile_flag = false
|
||||
|
||||
//根据userAgent判断是否是手机
|
||||
for (var v = 0; v < mobileAgents.length; v++) {
|
||||
if (userAgentInfo.indexOf(mobileAgents[v]) > 0) {
|
||||
mobile_flag = true
|
||||
break
|
||||
}
|
||||
}
|
||||
var screen_width = window.screen.width
|
||||
var screen_height = window.screen.height
|
||||
|
||||
//根据屏幕分辨率判断是否是手机
|
||||
if (screen_width < 500 && screen_height < 800) {
|
||||
mobile_flag = true
|
||||
}
|
||||
return mobile_flag
|
||||
}
|
||||
|
||||
if (isMobile()) {
|
||||
if (location.pathname == '/dashboard/analysis' || location.pathname == '/') {
|
||||
window.location.href = 'http://10.10.10.46:8102/phoneSearch'
|
||||
}
|
||||
}
|
||||
// // 判断当前设备
|
||||
// function isMobile() {
|
||||
// var userAgentInfo = navigator.userAgent
|
||||
//
|
||||
// var mobileAgents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod']
|
||||
//
|
||||
// var mobile_flag = false
|
||||
//
|
||||
// //根据userAgent判断是否是手机
|
||||
// for (var v = 0; v < mobileAgents.length; v++) {
|
||||
// if (userAgentInfo.indexOf(mobileAgents[v]) > 0) {
|
||||
// mobile_flag = true
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
// var screen_width = window.screen.width
|
||||
// var screen_height = window.screen.height
|
||||
//
|
||||
// //根据屏幕分辨率判断是否是手机
|
||||
// if (screen_width < 500 && screen_height < 800) {
|
||||
// mobile_flag = true
|
||||
// }
|
||||
// return mobile_flag
|
||||
// }
|
||||
//
|
||||
// if (isMobile()) {
|
||||
// if (location.pathname == '/dashboard/analysis' || location.pathname == '/') {
|
||||
// window.location.href = 'http://10.10.10.46:8102/phoneSearch'
|
||||
// }
|
||||
// }
|
||||
</script>
|
||||
</head>
|
||||
|
||||
|
||||
@@ -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'
|
||||
|
||||
|
||||
@@ -10,37 +10,39 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
import router from '../../router'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
name: '',
|
||||
breadList: [],
|
||||
breadList: []
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getBreadcrumb()
|
||||
},
|
||||
methods: {
|
||||
getBreadcrumb() {
|
||||
|
||||
console.log('this.$route.matched', this.$route.matched)
|
||||
|
||||
this.breadList = []
|
||||
this.breadList.push({ name: 'dashboard-analysis', path: '/dashboard/analysis', meta: { title: '首页' } })
|
||||
|
||||
this.name = this.$route.name
|
||||
this.$route.matched.forEach((item) => {
|
||||
// item.meta.name === 'dashboard' ? item.path = '/dashboard' : this.$route.path === item.path
|
||||
this.breadList.push(item)
|
||||
})
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
$route() {
|
||||
created() {
|
||||
this.getBreadcrumb()
|
||||
},
|
||||
methods: {
|
||||
getBreadcrumb() {
|
||||
this.breadList = []
|
||||
let isPhone = localStorage.getItem('isPhone')
|
||||
if (isPhone == 'yes') {
|
||||
} else {
|
||||
this.breadList.push({ name: 'dashboard-analysis', path: '/dashboard/analysis', meta: { title: '首页' } })
|
||||
}
|
||||
this.name = this.$route.name
|
||||
this.$route.matched.forEach((item) => {
|
||||
// item.meta.name === 'dashboard' ? item.path = '/dashboard' : this.$route.path === item.path
|
||||
this.breadList.push(item)
|
||||
})
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
$route() {
|
||||
this.getBreadcrumb()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -330,7 +330,15 @@
|
||||
resetRouter()
|
||||
let constRoutes = []
|
||||
constRoutes = generateIndexRouter(menuData)
|
||||
router.addRoutes(constRoutes)
|
||||
|
||||
let isPhone = localStorage.getItem('isPhone')
|
||||
if (isPhone == 'yes') {
|
||||
router.addRoutes([{
|
||||
'path': '*', 'redirect': '/404', 'hidden': true
|
||||
}])
|
||||
} else {
|
||||
router.addRoutes(constRoutes)
|
||||
}
|
||||
this.$root.Bus.$emit('switchLanguage', localeval)
|
||||
this.isLoading = false
|
||||
this.localeval = localeval
|
||||
|
||||
@@ -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')
|
||||
}
|
||||
]
|
||||
|
||||
@@ -18,8 +18,9 @@ require('@/components/onlineForm/onlineForm')
|
||||
require('@/components/onlineForm/OnlineForm.css')
|
||||
|
||||
import Antd, { version } from 'ant-design-vue'
|
||||
console.log('ant-design-vue version:', version)
|
||||
|
||||
console.log('ant-design-vue version:', version)
|
||||
localStorage.setItem('isPhone','yes')
|
||||
import Viser from 'viser-vue'
|
||||
import 'ant-design-vue/dist/antd.less' // or 'ant-design-vue/dist/antd.less'
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
@@ -176,7 +182,11 @@ 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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -145,7 +145,15 @@
|
||||
resetRouter()
|
||||
let constRoutes = []
|
||||
constRoutes = generateIndexRouter(menuData)
|
||||
router.addRoutes(constRoutes)
|
||||
|
||||
let isPhone = localStorage.getItem('isPhone')
|
||||
if (isPhone == 'yes') {
|
||||
router.addRoutes([{
|
||||
'path': '*', 'redirect': '/404', 'hidden': true
|
||||
}])
|
||||
} else {
|
||||
router.addRoutes(constRoutes)
|
||||
}
|
||||
this.$root.Bus.$emit('switchLanguage', localeval)
|
||||
this.isLoading = false
|
||||
this.localeval = localeval
|
||||
|
||||
@@ -359,9 +359,10 @@
|
||||
localStorage.setItem('language', 'zh-cn')
|
||||
}
|
||||
let fullPath = ''
|
||||
if (this.mobile) {
|
||||
let isPhone = localStorage.getItem('isPhone')
|
||||
if (isPhone == 'yes'){
|
||||
fullPath = '/phoneSearch'
|
||||
} else {
|
||||
}else{
|
||||
fullPath = '/dashboard/analysis'
|
||||
}
|
||||
this.$router.push({ path: fullPath }).catch((res) => {
|
||||
|
||||
@@ -208,9 +208,10 @@ export const JeroThirdLoginMixin = {
|
||||
// this.loginBtn = false
|
||||
// update-end- author:sunjianlei --- date:20190812 --- for: 登录成功后不解除禁用按钮,防止多次点击
|
||||
let fullPath = ''
|
||||
if (isMobile()) {
|
||||
let isPhone = localStorage.getItem('isPhone')
|
||||
if (isPhone == 'yes'){
|
||||
fullPath = '/phoneSearch'
|
||||
} else {
|
||||
}else{
|
||||
fullPath = '/dashboard/analysis'
|
||||
}
|
||||
this.$router.push({ path: fullPath }).catch(() => {
|
||||
|
||||
Reference in New Issue
Block a user