fix: 修复lina nginx

This commit is contained in:
ibuler
2020-06-01 15:54:15 +08:00
parent c38b1cdb8a
commit 3df6af53cb
2 changed files with 12 additions and 3 deletions

View File

@@ -2,7 +2,11 @@ server {
listen 80; listen 80;
location /ui/ { location /ui/ {
try_files $uri / /ui/index.html; try_files $uri / /ui/index.html;
alias /opt/lina/; alias /opt/lina/;
}
location / {
rewrite ^/(.*)$ /ui/$1 last;
} }
} }

View File

@@ -8,6 +8,10 @@ import { getPermission, getToken, setPermission } from '@/utils/auth'
const whiteList = ['/login', process.env.VUE_APP_LOGIN_PATH] // no redirect whitelist const whiteList = ['/login', process.env.VUE_APP_LOGIN_PATH] // no redirect whitelist
let initial = false let initial = false
function reject() {
return new Promise((resolve, reject) => reject())
}
function setHeadTitle({ to, from, next }) { function setHeadTitle({ to, from, next }) {
document.title = getPageTitle(to.meta.title) document.title = getPageTitle(to.meta.title)
} }
@@ -20,7 +24,7 @@ async function checkLogin({ to, from, next }) {
const hasToken = getToken() const hasToken = getToken()
if (!hasToken) { if (!hasToken) {
window.location = process.env.VUE_APP_LOGIN_PATH window.location = process.env.VUE_APP_LOGIN_PATH
return return reject()
} }
try { try {
@@ -28,6 +32,7 @@ async function checkLogin({ to, from, next }) {
} catch (e) { } catch (e) {
// return false // return false
window.location = process.env.VUE_APP_LOGIN_PATH window.location = process.env.VUE_APP_LOGIN_PATH
return reject()
} }
} }