diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..36018e4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM nginx +MAINTAINER jeecgos@163.com +VOLUME /tmp +ENV LANG en_US.UTF-8 +RUN echo "server { \ + #解决Router(mode: 'history')模式下,刷新路由地址不能找到页面的问题 \ + location / { \ + root /var/www/html/; \ + index index.html index.htm; \ + if (!-e \$request_filename) { \ + rewrite ^(.*)\$ /index.html?s=\$1 last; \ + break; \ + } \ + } \ + access_log /var/log/nginx/access.log ; \ + } " > /etc/nginx/conf.d/default.conf \ + && mkdir -p /var/www \ + && mkdir -p /var/www/html + +ADD dist/ /var/www/html/ +EXPOSE 3101 diff --git a/src/App.vue b/src/App.vue index 65d1499..aca3e9d 100644 --- a/src/App.vue +++ b/src/App.vue @@ -21,7 +21,7 @@ onMounted(async () => { try { - if (userStore.getToken && getBaseLogin() === '/centralScreenLogin') { + if (userStore.getToken) { const { result } = await getEmergencyCenterApi(); if (result?.screenPath) { router.replace(result?.screenPath); diff --git a/src/components/secondaryScreen/secondMap/components/basicTable/BasicTable.vue b/src/components/secondaryScreen/secondMap/components/basicTable/BasicTable.vue index 116be94..21d73f8 100644 --- a/src/components/secondaryScreen/secondMap/components/basicTable/BasicTable.vue +++ b/src/components/secondaryScreen/secondMap/components/basicTable/BasicTable.vue @@ -52,6 +52,7 @@ showTotal: (total) => `总 ${total} 条`, onChange: pageChange, }); + const emit = defineEmits(['tableLoad']); function pageChange(page, pageS) { current.value = page; @@ -74,6 +75,7 @@ async function getRecords() { try { tableLoading.value = true; + emit('tableLoad', true); const { code, result } = await props.api({ ...props.apiParams, pageSize: pageSize.value, pageNo: current.value }); if (code == 200) { if (props.afterFetch && isFunction(props.afterFetch)) { @@ -86,9 +88,9 @@ } } catch (e) { dataSource.value = []; - tableLoading.value = false; } finally { tableLoading.value = false; + emit('tableLoad', false); } } diff --git a/src/router/index.ts b/src/router/index.ts index c1f839a..486b43f 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -48,17 +48,18 @@ const router: Router = createRouter({ history: createWebHistory('/'), routes: [...routes], }); -const xian = ['/home', '/secondScreen', '/transfer']; -const yinchuan = ['/yinChuanHome', '/yinChuanTest', '/transfer']; router.beforeEach((to, from, next) => { - if (to.path !== '/login' && to.path !== '/home') { - setCurrentPath(to.path); - } - const flag = getAuthCache('flag3'); - const token = getAuthCache(TOKEN_KEY); - if (!flag || !token) { - return next({ path: '/login' }); + if (to.path == '/login') { + next(); + } else { + const flag = getAuthCache('flag3'); + const token = getAuthCache(TOKEN_KEY); + if (!flag || !token) { + return next({ path: '/login' }); + } else { + next(); + } } next(); diff --git a/src/views/indexSun.vue b/src/views/indexSun.vue index e2b88f4..e6328d2 100644 --- a/src/views/indexSun.vue +++ b/src/views/indexSun.vue @@ -1,5 +1,6 @@