diff --git a/.beagle.yml b/.beagle.yml index 54adff99b174c77f398307047d97638b562dc9a0..476641edc8500aff7d46045e0f2e34a7db83c5f1 100644 --- a/.beagle.yml +++ b/.beagle.yml @@ -50,7 +50,7 @@ pipeline: dns: 223.5.5.5 volumes: - /var/run/docker.sock:/var/run/docker.sock - base: hub.wodcloud.com/wod/ui-base:2.0-apaasv3 + base: registry.cn-qingdao.aliyuncs.com/wod-devops/ui-base:2.0-sjjy dockerfile: .beagle/dockerfile repo: gzgajzapi/apaas-ui version: v3.0.1 diff --git a/build/conf.yaml b/build/conf.yaml index 48474f17c582554f11e967088181d286fa5dde10..db393a84ac615f4506012e8dcb43a40139bdbc65 100644 --- a/build/conf.yaml +++ b/build/conf.yaml @@ -1,3 +1,4 @@ index: /apaas/ui/ login: /iam/login/#/login -logout: /iam/api/logout \ No newline at end of file +logout: /iam/api/logout +exts: ["/services_shop","/shop"] \ No newline at end of file diff --git a/build/dockerfile b/build/dockerfile index 7a41e8ce962d4b76a989e4fe6faa0e3d7d8b0b3d..798acf38a81161effca1ff0b7cbf6f30ab73164f 100644 --- a/build/dockerfile +++ b/build/dockerfile @@ -1,5 +1,13 @@ -FROM {{ BASEIMAGE }} -MAINTAINER {{ AUTHOR }} -LABEL Author={{ AUTHOR }} Name={{ PROJECT }} Version={{ VERSION }} +ARG BASE + +FROM $BASE + +ARG AUTHOR +ARG VERSION +LABEL maintainer=${AUTHOR} version=${VERSION} + +ARG TARGETOS +ARG TARGETARCH + ADD ./dist /www ADD ./build/conf.yaml /www/conf.yaml \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js index 1d2432ee5257ca144f820b526b18bb8aa3e8fe1d..fcfc431b988a12772bbb0f2a2440cd17b8e0b784 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,5 +1,6 @@ import Vue from "vue"; import Router from "vue-router"; +import {getCookie} from '../utils/common' Vue.use(Router); @@ -10,7 +11,7 @@ Router.prototype.push = function push(location, onResolve, onReject) { return originalPush.call(this, location).catch((err) => err); }; -export default new Router({ +var router = new Router({ scrollBehavior (to, from, savedPosition) { return { x: 0, y: 0 } }, @@ -848,3 +849,27 @@ export default new Router({ }, ], }); + +router.beforeEach(async (to, from, next) => { + let _user = getCookie('bgToken') + let _path = to.path; // 访问的页面 + if (_user) { + next(); + } else if ( + _path === "" || + _path === "/" || + _path === "/home" || + _path === "/search" || + _path === "/cart" || + _path.indexOf("/services_shop") === 0 || + _path.indexOf("/shop") === 0 + ) { + next(); + } else { + // ElementUI.Message.error(`未登录无法访问该页面`); + + next("/"); + } +}); // 导航守卫 + +export default router