| | |
| | | ENV = 'development' |
| | | |
| | | # 管理系统/开发环境 |
| | | VUE_APP_BASE_API = '/dev-api' |
| | | VUE_APP_BASE_API = '/prod-api' |
| | | |
| | | # 路由懒加载 |
| | | VUE_CLI_BABEL_TRANSPILE_MODULES = true |
| | | |
| | | #项目子路径 |
| | | VUE_APP_ITEM_PATH = '/sys' |
| | |
| | | |
| | | # 管理系统/生产环境 |
| | | VUE_APP_BASE_API = '/prod-api' |
| | | |
| | | #项目子路径 |
| | | VUE_APP_ITEM_PATH = '/sys' |
| | |
| | | 'sidebar', |
| | | 'avatar', |
| | | 'device' |
| | | ]), |
| | | setting: { |
| | | ]), setting: { |
| | | get() { |
| | | return this.$store.state.settings.showSettings |
| | | return this.$store.state.settings.showSettings; |
| | | }, |
| | | set(val) { |
| | | this.$store.dispatch('settings/changeSetting', { |
| | | key: 'showSettings', |
| | | this.$store.dispatch("settings/changeSetting", { |
| | | key: "showSettings", |
| | | value: val |
| | | }) |
| | | }); |
| | | } |
| | | }, |
| | | topNav: { |
| | | get() { |
| | | return this.$store.state.settings.topNav |
| | | return this.$store.state.settings.topNav; |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | toggleSideBar() { |
| | | this.$store.dispatch('app/toggleSideBar') |
| | | this.$store.dispatch("app/toggleSideBar"); |
| | | }, |
| | | async logout() { |
| | | this.$confirm('确定注销并退出系统吗?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | this.$store.dispatch('LogOut').then(() => { |
| | | location.href = '/index'; |
| | | this.$confirm("确定注销并退出系统吗?", "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | this.$store.dispatch("LogOut").then(() => { |
| | | location.href = window.location.origin + '/sso/login' |
| | | }); |
| | | }) |
| | | }).catch(() => {}); |
| | | .catch(() => {}); |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | |
| | | overflow: hidden; |
| | | position: relative; |
| | | background: #fff; |
| | | box-shadow: 0 1px 4px rgba(0,21,41,.08); |
| | | box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08); |
| | | |
| | | .hamburger-container { |
| | | line-height: 46px; |
| | | height: 100%; |
| | | float: left; |
| | | cursor: pointer; |
| | | transition: background .3s; |
| | | -webkit-tap-highlight-color:transparent; |
| | | transition: background 0.3s; |
| | | -webkit-tap-highlight-color: transparent; |
| | | |
| | | &:hover { |
| | | background: rgba(0, 0, 0, .025) |
| | | background: rgba(0, 0, 0, 0.025); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | &.hover-effect { |
| | | cursor: pointer; |
| | | transition: background .3s; |
| | | transition: background 0.3s; |
| | | |
| | | &:hover { |
| | | background: rgba(0, 0, 0, .025) |
| | | background: rgba(0, 0, 0, 0.025); |
| | | } |
| | | } |
| | | } |
| | |
| | | next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 |
| | | }) |
| | | }).catch(err => { |
| | | store.dispatch('LogOut').then(() => { |
| | | Message.error(err) |
| | | next({ path: '/' }) |
| | | }) |
| | | store.dispatch('LogOut').then(() => { |
| | | Message.error(err) |
| | | window.location.href = window.location.origin + '/sso/login' |
| | | // next({ path: '/' }) |
| | | }) |
| | | }) |
| | | } else { |
| | | next() |
| | | } |
| | |
| | | // 在免登录白名单,直接进入 |
| | | next() |
| | | } else { |
| | | next(`/login?redirect=${encodeURIComponent(to.fullPath)}`) // 否则全部重定向到登录页 |
| | | // next(`/login?redirect=${encodeURIComponent(to.fullPath)}`) // 否则全部重定向到登录页 |
| | | window.location.href = window.location.origin + '/sso/login' |
| | | NProgress.done() |
| | | } |
| | | } |
| | |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | path: '/login', |
| | | component: () => import('@/views/login'), |
| | | hidden: true |
| | | }, |
| | | // { |
| | | // path: '/login', |
| | | // component: () => import('@/views/login'), |
| | | // hidden: true |
| | | // }, |
| | | { |
| | | path: '/register', |
| | | component: () => import('@/views/register'), |
| | |
| | | { |
| | | path: '', |
| | | component: Layout, |
| | | redirect: 'index', |
| | | children: [ |
| | | { |
| | | path: 'index', |
| | | component: () => import('@/views/index'), |
| | | name: 'Index', |
| | | meta: { title: '首页', icon: 'dashboard', affix: true } |
| | | } |
| | | ] |
| | | redirect: 'system/user', |
| | | // children: [ |
| | | // { |
| | | // path: 'index', |
| | | // component: () => import('@/views/index'), |
| | | // name: 'Index', |
| | | // meta: { title: '首页', icon: 'dashboard', affix: true } |
| | | // } |
| | | // ] |
| | | }, |
| | | { |
| | | path: '/user', |
| | |
| | | |
| | | export default new Router({ |
| | | mode: 'history', // 去掉url中的# |
| | | base: process.env.VUE_APP_ITEM_PATH, |
| | | scrollBehavior: () => ({ y: 0 }), |
| | | routes: constantRoutes |
| | | }) |
| | |
| | | // 创建axios实例 |
| | | const service = axios.create({ |
| | | // axios中请求配置有baseURL选项,表示请求URL公共部分 |
| | | // baseURL: process.env.VUE_APP_BASE_API, |
| | | baseURL: 'http://192.168.11.203:8090/prod-api', |
| | | baseURL: process.env.VUE_APP_BASE_API, |
| | | // baseURL: 'http://192.168.11.203:8090/prod-api', |
| | | // 超时 |
| | | timeout: 10000 |
| | | }) |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { getCodeImg } from "@/api/login"; |
| | | // import { getCodeImg } from "@/api/login"; |
| | | import Cookies from "js-cookie"; |
| | | import { encrypt, decrypt } from '@/utils/jsencrypt' |
| | | |
| | |
| | | // 部署生产环境和开发环境下的URL。 |
| | | // 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上 |
| | | // 例如 https://www.se.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.se.vip/admin/,则设置 baseUrl 为 /admin/。 |
| | | publicPath: process.env.NODE_ENV === "production" ? "/" : "/", |
| | | publicPath: process.env.NODE_ENV === "production" ? process.env.VUE_APP_ITEM_PATH : "/", |
| | | // 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist) |
| | | outputDir: 'dist', |
| | | // 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下) |
| | |
| | | target: `http://192.168.11.203:8090`, |
| | | changeOrigin: true, |
| | | pathRewrite: { |
| | | ['^' + process.env.VUE_APP_BASE_API]: '' |
| | | ['^' + process.env.VUE_APP_BASE_API]: process.env.VUE_APP_BASE_API |
| | | } |
| | | } |
| | | }, |