| | |
| | | |
| | | # base api |
| | | VUE_APP_BASE_API = 'http://121.196.36.24:8001/api/' |
| | | |
| | |
| | | ENV = 'production' |
| | | |
| | | # base api |
| | | VUE_APP_BASE_API = '/prod-api' |
| | | #VUE_APP_BASE_API = './' |
| | | VUE_APP_BASE_API = 'http://121.196.36.24:8001/api/' |
| | | |
| | |
| | | "serve-static": "1.13.2", |
| | | "svg-sprite-loader": "4.1.3", |
| | | "svgo": "1.2.2", |
| | | "vue-template-compiler": "2.6.10" |
| | | "vue-template-compiler": "2.6.10", |
| | | "webpack-dev-server": "^3.0.0" |
| | | }, |
| | | "browserslist": [ |
| | | "> 1%", |
| | |
| | | params: data |
| | | }) |
| | | } |
| | | export function LoginMenu(data) { |
| | | export function LoginMenu() { |
| | | return request({ |
| | | url: 'Login/LoginMenu', |
| | | method: 'get', |
| | | params: data |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | |
| | | :collapse-transition="false" |
| | | mode="vertical" |
| | | > |
| | | <!-- <sidebar-item--> |
| | | <!-- v-for="route in routes"--> |
| | | <!-- :key="route.path"--> |
| | | <!-- class="el-scrollbar-menu"--> |
| | | <!-- :item="route"--> |
| | | <!-- :base-path="route.path"--> |
| | | <!-- />--> |
| | | <sidebar-item v-for="route in permission_routes" :key="route.path" :item="route" :base-path="route.path" /> |
| | | <sidebar-item |
| | | v-for="route in routes" |
| | | :key="route.path" |
| | | class="el-scrollbar-menu" |
| | | :item="route" |
| | | :base-path="route.path" |
| | | /> |
| | | <!-- <sidebar-item v-for="route in permission_routes" :key="route.path" :item="route" :base-path="route.path" />--> |
| | | |
| | | </el-menu> |
| | | </el-scrollbar> |
| | |
| | | import Logo from './Logo' |
| | | import SidebarItem from './SidebarItem' |
| | | import variables from '@/styles/variables.scss' |
| | | import { LoginMenu } from '@/api/user' |
| | | |
| | | export default { |
| | | components: { SidebarItem, Logo }, |
| | | data() { |
| | | return { |
| | | routers: [] |
| | | } |
| | | }, |
| | | async created() { |
| | | // const arr = [ |
| | | // { |
| | | // name: 'ç³»ç»é¦é¡µ' |
| | | // }, |
| | | // { |
| | | // name: 'åºç¡è®¾ç½®', |
| | | // children: [ |
| | | // { name: 'ç»ç»æ¶æ' }, |
| | | // { name: 'è§è²æ¸
å' }, |
| | | // { name: 'ç¨æ·æ¸
å' } |
| | | // ] |
| | | // }, |
| | | // { |
| | | // name: 'å¶é 模å', |
| | | // children: [ |
| | | // { name: 'å
¬ç路线' }, |
| | | // { name: 'èæå·¥ä»·' }, |
| | | // { name: 'åè´§æ¡£æ¡' } |
| | | // ] |
| | | // } |
| | | // ] |
| | | // this.routers = arr |
| | | const res = await LoginMenu() |
| | | console.log(res, 999) |
| | | }, |
| | | computed: { |
| | | ...mapGetters([ |
| | | 'permission_routes', |
| | | 'sidebar' |
| | | ]), |
| | | routes() { |
| | | return this.$router.options.routes |
| | | // console.log(this.$router.options.routes, 111) |
| | | // this.$router.options.routes.forEach((item, index) => { |
| | | // if (item.name === 'jcsz') { |
| | | // this.$router.options.routes.slice(index, 1) |
| | | // } |
| | | // }) |
| | | |
| | | // return this.$router.options.routes.filter(item => { |
| | | // console.log(item) |
| | | // return item.name === 'jcsz' |
| | | // }) |
| | | console.log(this.routers, 99) |
| | | console.log(this.$router.options.routes, 11) |
| | | |
| | | const newArr = [] |
| | | this.routers.forEach(item => { |
| | | if (item.name) { |
| | | newArr.push(item.name) |
| | | if (item.children) { |
| | | item.children.forEach(it => { |
| | | if (it.name) { |
| | | newArr.push(it.name) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | console.log(newArr, 333) |
| | | const arr = this.$router.options.routes |
| | | const arr2 = [] |
| | | arr.forEach((item, index) => { |
| | | console.log(newArr.includes(item.name), 222) |
| | | |
| | | if (newArr.includes(item.name) && item.children.length === 1) { |
| | | arr2.push(item) |
| | | } else if (newArr.includes(item.name) && item.children.length > 1) { |
| | | const a = [] |
| | | item.children.forEach((it, ind) => { |
| | | if (newArr.includes(it.name)) { |
| | | a.push(it) |
| | | } |
| | | }) |
| | | item.children = a |
| | | |
| | | arr2.push(item) |
| | | } |
| | | }) |
| | | return arr2 |
| | | }, |
| | | activeMenu() { |
| | | const route = this.$route |
| | |
| | | // if (s) { |
| | | // console.log(s) |
| | | // } |
| | | |
| | | next() |
| | | // next({ ...to, replace: true }) |
| | | } catch (error) { |
| | |
| | | path: '/', |
| | | component: Layout, |
| | | redirect: '/index', |
| | | name: 'ç³»ç»é¦é¡µ', |
| | | children: [{ |
| | | path: 'index', |
| | | name: 'index', |
| | |
| | | path: '/jcsz', |
| | | component: Layout, |
| | | redirect: '/jcsz/zzjg', |
| | | name: 'jcsz', |
| | | name: 'åºç¡è®¾ç½®', |
| | | meta: { title: 'åºç¡è®¾ç½®', icon: 'el-icon-setting' }, |
| | | children: [ |
| | | { |
| | | path: 'zzjg', |
| | | name: 'Table', |
| | | name: 'ç»ç»æ¶æ', |
| | | component: () => import('@/views/jcsz/zzjg'), |
| | | meta: { title: 'ç»ç»æ¶æ', icon: '' } |
| | | }, { |
| | | path: 'jsqd', |
| | | name: 'jsqd', |
| | | name: 'è§è²æ¸
å', |
| | | component: () => import('@/views/jcsz/jsqd'), |
| | | meta: { title: 'è§è²æ¸
å', icon: '' } |
| | | }, { |
| | | path: 'yhqd', |
| | | name: 'yhqd', |
| | | name: 'ç¨æ·æ¸
å', |
| | | component: () => import('@/views/jcsz/yhqd'), |
| | | meta: { title: 'ç¨æ·æ¸
å', icon: '' } |
| | | }, { |
| | | path: 'wldw', |
| | | name: 'wldw', |
| | | name: '徿¥åä½', |
| | | component: () => import('@/views/jcsz/wldw'), |
| | | meta: { title: '徿¥åä½', icon: '' } |
| | | } |
| | | ] |
| | | }, { |
| | | path: '/sbgl', |
| | | component: Layout, |
| | | redirect: '/sbgl/sbqd', |
| | | name: '设å¤ç®¡ç', |
| | | meta: { title: '设å¤ç®¡ç', icon: 'el-icon-setting' }, |
| | | children: [ |
| | | { |
| | | path: 'sbqd', |
| | | name: 'è®¾å¤æ¸
å', |
| | | component: () => import('@/views/sbgl/sbqd'), |
| | | meta: { title: 'è®¾å¤æ¸
å', icon: '' } |
| | | } |
| | | // { |
| | | // path: 'sblxsz', |
| | | // name: 'è§è²æ¸
å', |
| | | // component: () => import('@/views/jcsz/jsqd'), |
| | | // meta: { title: 'è§è²æ¸
å', icon: '' } |
| | | // }, |
| | | ] |
| | | }, { |
| | | path: '/wlgl', |
| | | component: Layout, |
| | | redirect: '/wlgl/ckdy', |
| | | name: 'ç©æç®¡ç', |
| | | meta: { title: 'ç©æç®¡ç', icon: 'el-icon-setting' }, |
| | | children: [ |
| | | { |
| | | path: 'ckdy', |
| | | name: 'ä»åºå®ä¹', |
| | | component: () => import('@/views/wlgl/ckdy'), |
| | | meta: { title: 'ä»åºå®ä¹', icon: '' } |
| | | }, |
| | | { |
| | | path: 'kwdy', |
| | | name: 'åºä½å®ä¹', |
| | | component: () => import('@/views/wlgl/kwdy'), |
| | | meta: { title: 'åºä½å®ä¹', icon: '' } |
| | | } |
| | | ] |
| | | }, |
| | |
| | | path: '/zzmx', |
| | | component: Layout, |
| | | redirect: '/zzmx/gylx', |
| | | name: 'zzmx', |
| | | name: 'å¶é 模å', |
| | | meta: { title: 'å¶é 模å', icon: 'el-icon-s-help' }, |
| | | children: [ |
| | | { |
| | | path: 'gylx', |
| | | name: 'gylx', |
| | | name: 'å
¬ç路线', |
| | | component: () => import('@/views/zzmx/gylx'), |
| | | meta: { title: 'å
¬ç路线', icon: 'table' } |
| | | meta: { title: 'å
¬ç路线', icon: '' } |
| | | }, |
| | | { |
| | | path: 'jpgj', |
| | | name: 'jpgj', |
| | | name: 'èæå·¥ä»·', |
| | | component: () => import('@/views/zzmx/jpgj'), |
| | | meta: { title: 'èæå·¥ä»·', icon: 'tree' } |
| | | meta: { title: 'èæå·¥ä»·', icon: '' } |
| | | }, { |
| | | path: 'wllx', |
| | | name: 'ç©æç±»å', |
| | | component: () => import('@/views/zzmx/wllx'), |
| | | meta: { title: 'ç©æç±»å', icon: '' } |
| | | }, |
| | | { |
| | | path: 'chda', |
| | | name: 'åè´§æ¡£æ¡', |
| | | component: () => import('@/views/zzmx/chda'), |
| | | meta: { title: 'åè´§æ¡£æ¡', icon: '' } |
| | | } |
| | | ] |
| | | } |
| | | }, |
| | | { path: '*', redirect: '/404', hidden: true } |
| | | ] |
| | | |
| | | // export const constantRoutesxxxxxx = [ |
| | |
| | | // ] |
| | | // }, |
| | | // |
| | | // // 404 page must be placed at the end !!! |
| | | // { path: '*', redirect: '/404', hidden: true } |
| | | // 404 page must be placed at the end !!! |
| | | // , {path: '*', redirect: '/404', hidden: true} |
| | | // ] |
| | | |
| | | const createRouter = () => new Router({ |
| | |
| | | return Cookies.remove(TokenKey) |
| | | } |
| | | |
| | | export function getCookie(key) { |
| | | return Cookies.get(key) |
| | | export function getCookie(c_name) { |
| | | // document.cookie = escape(key) + ';path=/' |
| | | if (document.cookie.length > 0) { |
| | | let c_start = document.cookie.indexOf(c_name + '=') |
| | | if (c_start != -1) { |
| | | c_start = c_start + c_name.length + 1 |
| | | let c_end = document.cookie.indexOf(';', c_start) |
| | | if (c_end == -1) { |
| | | c_end = document.cookie.length |
| | | } |
| | | return unescape(document.cookie.substring(c_start, c_end)) |
| | | } |
| | | } |
| | | return '' |
| | | // return Cookies.get(key) |
| | | } |
| | | |
| | | export function setCookie(key, value) { |
| | | return Cookies.set(key, value) |
| | | var date = new Date() |
| | | date.setSeconds(date.getSeconds() + 10000) |
| | | document.cookie = key + '=' + escape(value) + '; expires=' + date.toGMTString() + ';path=/' |
| | | |
| | | // return Cookies.set(key, value) |
| | | } |
| | | |
| | | export function removeCookie(key) { |
| | | return Cookies.remove(key) |
| | | setCookie(key, '', -1) |
| | | // return Cookies.remove(key) |
| | | } |
| | |
| | | import axios from 'axios' |
| | | import { MessageBox, Message } from 'element-ui' |
| | | import store from '@/store' |
| | | import { getToken } from '@/utils/auth' |
| | | |
| | | import { getCookie, getToken } from '@/utils/auth' |
| | | // create an axios instance |
| | | const service = axios.create({ |
| | | baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url |
| | | // withCredentials: true, // send cookies when cross-domain requests |
| | | withCredentials: true, // send cookies when cross-domain requests |
| | | timeout: 5000 // request timeout |
| | | |
| | | }) |
| | | |
| | | // request interceptor |
| | |
| | | config => { |
| | | // do something before request is sent |
| | | |
| | | if (store.getters.token) { |
| | | // let each request carry token |
| | | // ['X-Token'] is a custom headers key |
| | | // please modify it according to the actual situation |
| | | config.headers['X-Token'] = getToken() |
| | | if (getCookie('admin')) { |
| | | // let each request carry token |
| | | // ['X-Token'] is a custom headers key |
| | | // please modify it according to the actual situation |
| | | // config.headers['X-Token'] = getToken() |
| | | // config.headers['Authorization'] = 'admin=' + getCookie('admin') + ';navTabId=' + getCookie('navTabId') |
| | | config.headers['Cookie'] = 'admin=' + getCookie('admin') + ';navTabId=' + getCookie('navTabId') |
| | | // document.cookie = 'admin=' + getCookie('admin') + ';navTabId=' + getCookie('navTabId') |
| | | // document.cookie = 'admin' |
| | | } |
| | | console.log(config, 1) |
| | | return config |
| | | }, |
| | | error => { |
| | |
| | | /** |
| | | * If you want to get http information such as headers or status |
| | | * Please return response => response |
| | | */ |
| | | */ |
| | | |
| | | /** |
| | | * Determine the request status by custom code |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template /> |
| | | |
| | | <script> |
| | | export default { |
| | | name: 'Sbqd' |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template /> |
| | | |
| | | <script> |
| | | export default { |
| | | name: 'Ckdy' |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template /> |
| | | |
| | | <script> |
| | | export default { |
| | | name: 'Wldy' |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template /> |
| | | |
| | | <script> |
| | | export default { |
| | | name: 'Chda' |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template /> |
| | | |
| | | <script> |
| | | export default { |
| | | name: 'Wllx' |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| | |
| | | * In most cases please use '/' !!! |
| | | * Detail: https://cli.vuejs.org/config/#publicpath |
| | | */ |
| | | publicPath: '/', |
| | | publicPath: './', |
| | | outputDir: 'dist', |
| | | assetsDir: 'static', |
| | | lintOnSave: process.env.NODE_ENV === 'development', |
| | |
| | | warnings: false, |
| | | errors: true |
| | | }, |
| | | before: require('./mock/mock-server.js') |
| | | proxy: { |
| | | [process.env.VUE_APP_BASE_API]: { |
| | | target: process.env.VUE_APP_BASE_API, // 请æ±ç第ä¸â½
æ¥â¼å°å |
| | | changeOrigin: true, // 请æ±è·¨åæ¶ï¼éé
ç½®æ¤é¡¹ |
| | | pathRewrite: { // è·¯å¾éå,æ¿æ¢targetä¸ç请æ±å°å |
| | | ['^' + process.env.VUE_APP_BASE_API]: '' |
| | | } |
| | | } |
| | | } |
| | | // before: require('./mock/mock-server.js') |
| | | }, |
| | | configureWebpack: { |
| | | // provide the app's title in webpack's name field, so that |