diff --git a/backend/src/main/java/io/dataease/auth/util/JWTUtils.java b/backend/src/main/java/io/dataease/auth/util/JWTUtils.java index 6d0aaef239..cebe34c5f5 100644 --- a/backend/src/main/java/io/dataease/auth/util/JWTUtils.java +++ b/backend/src/main/java/io/dataease/auth/util/JWTUtils.java @@ -68,7 +68,8 @@ public class JWTUtils { public static boolean needRefresh(String token) { Date exp = JWTUtils.getExp(token); - return new Date().getTime() >= exp.getTime(); + Long advanceTime = 5000L; + return (new Date().getTime() + advanceTime) >= exp.getTime(); } /** diff --git a/frontend/src/permission.js b/frontend/src/permission.js index c5961184b6..c612f949c9 100644 --- a/frontend/src/permission.js +++ b/frontend/src/permission.js @@ -18,9 +18,13 @@ import { changeFavicon } from '@/utils/index' import Layout from '@/layout/index' -import { getSysUI } from '@/utils/auth' +import { + getSysUI +} from '@/utils/auth' -import { getSocket } from '@/websocket' +import { + getSocket +} from '@/websocket' NProgress.configure({ showSpinner: false @@ -53,14 +57,19 @@ const routeBefore = (callBack) => { callBack() } } -router.beforeEach(async (to, from, next) => routeBefore(() => { +router.beforeEach(async(to, from, next) => routeBefore(() => { // start progress bar NProgress.start() - const mobileIgnores = ['/delink'] + const mobileIgnores = ['/delink', '/de-auto-login'] const mobilePreview = '/preview/' + const hasToken = getToken() if (isMobile() && !to.path.includes(mobilePreview) && mobileIgnores.indexOf(to.path) === -1) { - window.location.href = window.origin + '/app.html' + let urlSuffix = '/app.html' + if (hasToken) { + urlSuffix += ('?detoken=' + hasToken) + } + window.location.href = window.origin + urlSuffix NProgress.done() } @@ -68,7 +77,7 @@ router.beforeEach(async (to, from, next) => routeBefore(() => { document.title = getPageTitle(to.meta.title) // determine whether the user has logged in - const hasToken = getToken() + if (hasToken) { if (to.path === '/login') { // if is logged in, redirect to the home page diff --git a/mobile/src/common/utils.js b/mobile/src/common/utils.js index f4c10d9700..2e6fa8b2f7 100644 --- a/mobile/src/common/utils.js +++ b/mobile/src/common/utils.js @@ -142,4 +142,17 @@ export function parseLanguage() { const language = getLanguage() if(language === 'sys') return uni.getLocale() return language -} \ No newline at end of file +} + +export function getUrlParams(url){ + const Params = {} + if(url.indexOf('?')>0){//判断是否有qurey + let parmas = url.slice(url.indexOf('?')+1)//截取出query + const paramlists = parmas.split('&')//分割键值对 + for (const param of paramlists) { + let a = param.split('=') + Object.assign(Params,{[a[0]]:a[1]})//将键值对封装成对象 + } + } + return Params +} diff --git a/mobile/src/pages.json b/mobile/src/pages.json index 1e6be356ac..1fcfb0dc34 100644 --- a/mobile/src/pages.json +++ b/mobile/src/pages.json @@ -1,192 +1,192 @@ { - "pages": [ + "pages": [ + + { + "path": "pages/login/index", + "style": { + "navigationBarTitleText": "%navigate.login%", + "app-plus": { + "titleNView": false + } + } + }, + { + "path": "pages/tabBar/home/index", + "style": { + "navigationBarTitleText": "%navigate.menuHome%", + "app-plus": { + "titleNView": false - { - "path": "pages/login/index", - "style": { - "navigationBarTitleText": "%navigate.login%", - "app-plus": { - "titleNView": false - } - } - }, - { - "path": "pages/tabBar/home/index", - "style": { - "navigationBarTitleText": "%navigate.menuHome%", - "app-plus": { - "titleNView": false - - }, - "enablePullDownRefresh": true - } - }, - - { - "path": "pages/tabBar/home/detail", - "style": { - "navigationBarTitleText": "", - "app-plus": { - "titleNView": false, - "bounce": "none" - } - } }, - { - "path": "pages/tabBar/dir/index", - "style": { - "navigationBarTitleText": "%navigate.menuDir%", - "app-plus": { - "titleNView": { - "type": "transparent", - "titleColor": "#fff", - "backgroundColor": "#0faeff", - "buttons": [], - "searchInput": { - "backgroundColor": "#fff", - "borderRadius": "6px", - "placeholder": "%searchPlaceholder%", - "disabled": true - } - } - }, - "enablePullDownRefresh": true - } - }, - { - "path": "pages/tabBar/dir/search", - "style": { - "navigationBarTitleText": "%navigate.search%", - "app-plus": { - "titleNView": { - "titleColor": "#fff", - "backgroundColor": "#0faeff", - - "searchInput": { - "backgroundColor": "#fff", - "borderRadius": "6px", - "placeholder": "%searchPlaceholder%", - "autoFocus": true - } - } - } + "enablePullDownRefresh": true + } + }, + + { + "path": "pages/tabBar/home/detail", + "style": { + "navigationBarTitleText": "", + "app-plus": { + "titleNView": false, + "bounce": "none" + } + } + }, + { + "path": "pages/tabBar/dir/index", + "style": { + "navigationBarTitleText": "%navigate.menuDir%", + "app-plus": { + "titleNView": { + "type": "transparent", + "titleColor": "#fff", + "backgroundColor": "#0faeff", + "buttons": [], + "searchInput": { + "backgroundColor": "#fff", + "borderRadius": "6px", + "placeholder": "%searchPlaceholder%", + "disabled": true } + } }, - { - "path": "pages/tabBar/dir/folder", - "style": { - "navigationBarTitleText": "", - "app-plus": { - "titleNView": { - "type": "transparent" - } - }, - "h5": { - "titleNView": { - "type": "transparent", - "buttons": [] - } - } + "enablePullDownRefresh": true + } + }, + { + "path": "pages/tabBar/dir/search", + "style": { + "navigationBarTitleText": "%navigate.search%", + "app-plus": { + "titleNView": { + "titleColor": "#fff", + "backgroundColor": "#0faeff", + + "searchInput": { + "backgroundColor": "#fff", + "borderRadius": "6px", + "placeholder": "%searchPlaceholder%", + "autoFocus": true } + } + } + } + }, + { + "path": "pages/tabBar/dir/folder", + "style": { + "navigationBarTitleText": "", + "app-plus": { + "titleNView": { + "type": "transparent" + } }, - { - "path": "pages/tabBar/me/index", - "style": { - "navigationBarTitleText": "%navigate.menuMe%", - "app-plus": { - "titleNView": false - } - } - }, - { - "path": "pages/tabBar/me/person", - "style": { - "navigationBarTitleText": "%navigate.personInfo%", - - "app-plus": { - "titleNView": { - "type": "transparent" - } - } - } - }, - { - "path": "pages/tabBar/me/language", - "style": { - "navigationBarTitleText": "%navigate.language%", - - "app-plus": { - "titleNView": { - "type": "transparent" - } - } - } - }, - { - "path": "pages/tabBar/me/about", - "style": { - "navigationBarTitleText": "%navigate.about%", - - "app-plus": { - "titleNView": { - "type": "transparent" - } - } - } - }, - { - "path": "pages/tabBar/me/outlink", - "style": { - "navigationBarTitleText": "", - - "app-plus": { - "titleNView": { - "type": "transparent" - } - } - } - }, - { - "path": "pages/index/index", - "style": { - "navigationBarTitleText": "%app.name%", - "h5": { - "maxWidth": 1190, - "navigationBarTextStyle": "black", - "navigationBarBackgroundColor": "#F1F1F1" - } - } - } - ], - "globalStyle": { - "navigationBarTextStyle": "black", - "navigationBarTitleText": "%app.name%", - "navigationBarBackgroundColor": "#ffffff", - "backgroundColor": "#ffffff" - }, - "tabBar": { - "color": "#7A7E83", - "selectedColor": "#007AFF", - "borderStyle": "black", - "backgroundColor": "#ffffff", - - "list": [{ - "pagePath": "pages/tabBar/home/index", - "iconPath": "static/home.png", - "selectedIconPath": "static/home_select.png", - "text": "%navigate.menuHome%" - }, - { - "pagePath": "pages/tabBar/dir/index", - "iconPath": "static/dir.png", - "selectedIconPath": "static/dir_select.png", - "text": "%navigate.menuDir%" - }, { - "pagePath": "pages/tabBar/me/index", - "iconPath": "static/me.png", - "selectedIconPath": "static/me_select.png", - "text": "%navigate.menuMe%" - } - ] - } -} + "h5": { + "titleNView": { + "type": "transparent", + "buttons": [] + } + } + } + }, + { + "path": "pages/tabBar/me/index", + "style": { + "navigationBarTitleText": "%navigate.menuMe%", + "app-plus": { + "titleNView": false + } + } + }, + { + "path": "pages/tabBar/me/person", + "style": { + "navigationBarTitleText": "%navigate.personInfo%", + + "app-plus": { + "titleNView": { + "type": "transparent" + } + } + } + }, + { + "path": "pages/tabBar/me/language", + "style": { + "navigationBarTitleText": "%navigate.language%", + + "app-plus": { + "titleNView": { + "type": "transparent" + } + } + } + }, + { + "path": "pages/tabBar/me/about", + "style": { + "navigationBarTitleText": "%navigate.about%", + + "app-plus": { + "titleNView": { + "type": "transparent" + } + } + } + }, + { + "path": "pages/tabBar/me/outlink", + "style": { + "navigationBarTitleText": "", + + "app-plus": { + "titleNView": { + "type": "transparent" + } + } + } + }, + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "%app.name%", + "h5": { + "maxWidth": 1190, + "navigationBarTextStyle": "black", + "navigationBarBackgroundColor": "#F1F1F1" + } + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "%app.name%", + "navigationBarBackgroundColor": "#ffffff", + "backgroundColor": "#ffffff" + }, + "tabBar": { + "color": "#7A7E83", + "selectedColor": "#007AFF", + "borderStyle": "black", + "backgroundColor": "#ffffff", + + "list": [{ + "pagePath": "pages/tabBar/home/index", + "iconPath": "static/home.png", + "selectedIconPath": "static/home_select.png", + "text": "%navigate.menuHome%" + }, + { + "pagePath": "pages/tabBar/dir/index", + "iconPath": "static/dir.png", + "selectedIconPath": "static/dir_select.png", + "text": "%navigate.menuDir%" + }, { + "pagePath": "pages/tabBar/me/index", + "iconPath": "static/me.png", + "selectedIconPath": "static/me_select.png", + "text": "%navigate.menuMe%" + } + ] + } +} \ No newline at end of file diff --git a/mobile/src/pages/login/index.vue b/mobile/src/pages/login/index.vue index 5b10f91ac3..12b9d94dee 100644 --- a/mobile/src/pages/login/index.vue +++ b/mobile/src/pages/login/index.vue @@ -1,385 +1,404 @@ + .oauth-image image { + width: 30px; + height: 30px; + margin: 10px; + } + + .oauth-image button { + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; + opacity: 0; + } + + .captcha-view { + line-height: 0; + justify-content: center; + align-items: center; + display: flex; + position: relative; + background-color: #f3f3f3; + } + + .welcome { + padding-left: 15px; + font-size: x-large; + font-weight: 500; + letter-spacing: 2px; + } + \ No newline at end of file