[update 飞书跳转移动端] 临时增加移动端页面

This commit is contained in:
danshihao
2024-08-08 16:28:11 +08:00
parent bb5ecb6f27
commit 367c1bd1b7
5 changed files with 74 additions and 2 deletions
+37
View File
@@ -0,0 +1,37 @@
<template>
<div class="mobile-empty">
<div class="box"><img :src="require('@/assets/image/notMobile.png')" alt=''></div>
</div>
</template>
<script>
export default {
name: 'MobileApp.vue'
}
</script>
<style lang="less" scoped>
.mobile-empty {
position: relative;
height: 100vh;
overflow: hidden;
.box {
position: absolute;
top: 50%;
transform: translateY(-50%);
height: 500px;
width: 100%;
overflow: hidden;
img {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 100%;
}
}
}
</style>
Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

+3 -1
View File
@@ -3,6 +3,7 @@
import Vue from 'vue'
import App from './App.vue'
import MobileApp from './MobileApp'
import Storage from 'vue-ls'
import router from './router'
import store from './store/'
@@ -49,6 +50,7 @@ import JDictComponenets from '@comp/dict/index.js'
import JTable from '@comp/jero/JTable.vue'
import i18n from '@/common/lang'
import { isMobile } from '@/utils/util'
// Vue.prototype.rules = rules
Vue.config.productionTip = false
@@ -101,7 +103,7 @@ function main () {
store.commit('SET_TOKEN', Vue.ls.get(ACCESS_TOKEN))
store.commit('SET_MULTI_PAGE', Vue.ls.get(DEFAULT_MULTI_PAGE, config.multipage))
},
render: h => h(App),
render: h => h(isMobile() ? MobileApp : App),
data: {
Bus: new Vue()
}
+9 -1
View File
@@ -4,7 +4,7 @@ import store from './store'
import NProgress from 'nprogress' // progress bar
import 'nprogress/nprogress.css' // progress bar style
import { ACCESS_TOKEN, OAUTH2_LOGIN_PAGE_PATH, UI_CACHE_DB_DICT_DATA, USER_INFO, USER_NAME } from '@/store/mutation-types'
import { generateIndexRouter, isOAuth2AppEnv, findFirstRoute, welcome } from '@/utils/util'
import { generateIndexRouter, isOAuth2AppEnv, findFirstRoute, welcome, isMobile } from '@/utils/util'
import { getSSOUserInfo, getTodoSSOUserInfo } from './api/api'
import { updatePageHeight } from './components/tools/setting'
@@ -14,6 +14,14 @@ const whiteList = ['/user/login', '/user/register', '/user/register-result', '/u
whiteList.push(OAUTH2_LOGIN_PAGE_PATH)
router.beforeEach(async (to, from, next) => {
if (isMobile()) {
if (to.path !== '/') {
next({ path: '/' })
} else {
next()
}
return
}
// 单点登录-OA单点登录
if (to.query.ticket) {
const { result, success, message } = await getTodoSSOUserInfo({ ticket: to.query.ticket })
+25
View File
@@ -761,3 +761,28 @@ export function findNodeByField (tree, findVal, valueField = 'id', childrenField
}
return null
}
// 判断当前是否移动端
export function isMobile () {
const userAgentInfo = navigator.userAgent
const mobileAgents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod']
let mobileFlag = false
// 根据userAgent判断是否是手机
for (let v = 0; v < mobileAgents.length; v++) {
if (userAgentInfo.indexOf(mobileAgents[v]) > 0) {
mobileFlag = true
break
}
}
const screenWidth = window.screen.width
const screenHeight = window.screen.height
// 根据屏幕分辨率判断是否是手机
if (screenWidth < 500 && screenHeight < 800) {
mobileFlag = true
}
return mobileFlag
}