Compare commits
No commits in common. "14bf2bd17e327ca205745e6558f83156b7014b23" and "dcc267ab9c160fd70a2e344f618df334bccb2099" have entirely different histories.
14bf2bd17e
...
dcc267ab9c
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* @Date: 2020-12-14 09:07:03
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @LastEditTime: 2021-12-06 15:14:46
|
||||
* @LastEditors: guo
|
||||
* @LastEditTime: 2021-01-11 09:40:09
|
||||
* @FilePath: \basic-admin\src\api\user.js
|
||||
* @Description: 用户管理 & 登录用户的相关api接口定义
|
||||
*/
|
||||
@ -13,8 +13,7 @@ export function login(data) {
|
||||
userType: 1
|
||||
})
|
||||
return request({
|
||||
url: '/api/passport/login',
|
||||
// url: '/passport/login',
|
||||
url: '/passport/login',
|
||||
method: 'post',
|
||||
data: dto
|
||||
})
|
||||
@ -27,13 +26,13 @@ export function logout() {
|
||||
})
|
||||
}
|
||||
// 获取当前登录的用户信息
|
||||
// export function getUserInfo(data) {
|
||||
// return request({
|
||||
// url: '/passport/getLoginUser',
|
||||
// method: 'post',
|
||||
// data
|
||||
// })
|
||||
// }
|
||||
export function getUserInfo(data) {
|
||||
return request({
|
||||
url: '/passport/getLoginUser',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改当前用户密码
|
||||
export function editUserPW(data) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
export default {
|
||||
title: {
|
||||
en: 'ARI WMS',
|
||||
zh: '中建材自动化智能仓库管理系统'
|
||||
en: 'ARI MES',
|
||||
zh: '中建材自动化智能制造执行系统'
|
||||
},
|
||||
btn: {
|
||||
start: {
|
||||
@ -254,8 +254,12 @@ export default {
|
||||
},
|
||||
routerTitle: {
|
||||
dashboard: {
|
||||
zh: '仪表盘',
|
||||
en: 'Dashboard'
|
||||
zh: '',
|
||||
en: '',
|
||||
dashboard: {
|
||||
zh: '仪表盘',
|
||||
en: 'Dashboard'
|
||||
}
|
||||
},
|
||||
basic: {
|
||||
zh: '系统管理',
|
||||
|
@ -1,8 +1,8 @@
|
||||
<!--
|
||||
* @Author: your name
|
||||
* @Date: 2021-01-27 10:07:42
|
||||
* @LastEditTime: 2021-12-22 16:06:25
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-03-08 11:59:59
|
||||
* @LastEditors: gtz
|
||||
* @Description: In User Settings Edit
|
||||
* @FilePath: \mt-bus-fe\src\layout\components\Sidebar\index.vue
|
||||
-->
|
||||
@ -31,17 +31,31 @@ import { mapGetters } from 'vuex'
|
||||
import Logo from './Logo'
|
||||
import SidebarItem from './SidebarItem'
|
||||
import variables from '@/styles/variables.scss'
|
||||
import { constantRoutes } from '@/router'
|
||||
// import { constantRoutes } from '@/router'
|
||||
import store from '@/store'
|
||||
export default {
|
||||
components: { SidebarItem, Logo },
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'sidebar',
|
||||
'permission_routes',
|
||||
'choicepart',
|
||||
'language'
|
||||
]),
|
||||
partList() {
|
||||
const cangoList = []
|
||||
const constantRoutes = store.getters.permission_routes
|
||||
constantRoutes.map(item => {
|
||||
if (!item.hidden && item.meta) {
|
||||
cangoList.push(item)
|
||||
}
|
||||
})
|
||||
const formatList = cangoList.map((item, index) => {
|
||||
return this.setIndex(item, index)
|
||||
})
|
||||
return formatList
|
||||
},
|
||||
routeList() {
|
||||
return constantRoutes
|
||||
return [this.partList[this.choicepart]]
|
||||
},
|
||||
activeMenu() {
|
||||
const route = this.$route
|
||||
@ -53,7 +67,6 @@ export default {
|
||||
return path
|
||||
},
|
||||
showLogo() {
|
||||
console.log(this.$route)
|
||||
return this.$store.state.settings.sidebarLogo
|
||||
},
|
||||
variables() {
|
||||
@ -62,6 +75,24 @@ export default {
|
||||
isCollapse() {
|
||||
return !this.sidebar.opened
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
$route: function(val) {
|
||||
if (val.meta.routeIndex >= 0) {
|
||||
this.$store.dispatch('app/setChoicepart', val.meta.routeIndex)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
setIndex(list, index) {
|
||||
list.meta.routeIndex = index
|
||||
if (list.children) {
|
||||
list.children.map(item => {
|
||||
this.setIndex(item, index)
|
||||
})
|
||||
}
|
||||
return list
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -45,8 +45,8 @@ export default {
|
||||
return this.$store.state.tagsView.visitedViews
|
||||
},
|
||||
routes() {
|
||||
return this.$store.state.permission.routes
|
||||
// return []
|
||||
// return this.$store.state.permission.routes
|
||||
return []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
@ -1,11 +1,12 @@
|
||||
/*
|
||||
* @Date: 2020-12-14 09:07:03
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-12-22 16:13:30
|
||||
* @LastEditors: gtz
|
||||
* @LastEditTime: 2021-02-25 09:42:36
|
||||
* @FilePath: \basic-admin\src\permission.js
|
||||
* @Description: 路由权限检查
|
||||
*/
|
||||
import router from './router'
|
||||
// import { resetRouter } from '@/router'
|
||||
import { Message } from 'element-ui'
|
||||
import NProgress from 'nprogress' // progress bar
|
||||
import 'nprogress/nprogress.css' // progress bar style
|
||||
@ -34,28 +35,38 @@ router.beforeEach(async(to, from, next) => {
|
||||
next({ path: '/' })
|
||||
NProgress.done() // hack: https://github.com/PanJiaChen/vue-element-admin/pull/2939
|
||||
} else {
|
||||
// next()
|
||||
NProgress.done()
|
||||
try {
|
||||
// // generate accessible routes map based on roles
|
||||
// const accessRoutes = await store.dispatch('permission/generateRoutes')
|
||||
// console.log(accessRoutes)
|
||||
// router.addRoutes(accessRoutes)
|
||||
const hasRoles = store.getters.menus && store.getters.menus.length > 0
|
||||
console.log('store.getters.menus', store.getters.menus)
|
||||
console.log('store.getters', store.getters)
|
||||
console.log('hasRoles=', hasRoles)
|
||||
if (hasRoles) {
|
||||
console.log('hasRoles=', store.getters.menus)
|
||||
next()
|
||||
NProgress.done()
|
||||
} else {
|
||||
try {
|
||||
// // generate accessible routes map based on roles
|
||||
const { menus } = await store.dispatch('user/getInfo')
|
||||
console.log(menus)
|
||||
const accessRoutes = await store.dispatch('permission/generateRoutes', menus)
|
||||
console.log('accessRoutes', accessRoutes)
|
||||
router.addRoutes(accessRoutes)
|
||||
next({ ...to, replace: true })
|
||||
// hack method to ensure that addRoutes is complete
|
||||
// set the replace: true, so the navigation will not leave a history record
|
||||
// next({ ...to, replace: true })
|
||||
} catch (error) {
|
||||
} catch (error) {
|
||||
// remove token and go to login page to re-login
|
||||
next(`/login?redirect=${to.path}`)
|
||||
await store.dispatch('user/resetToken')
|
||||
Message.error(error || 'Has Error')
|
||||
NProgress.done()
|
||||
next(`/login?redirect=${to.path}`)
|
||||
await store.dispatch('user/resetToken')
|
||||
Message.error(error || 'Has Error')
|
||||
NProgress.done()
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* has no token*/
|
||||
console.log('to.path=' + to.path)
|
||||
console.log('has no token to.path=' + to.path)
|
||||
console.log('whiteList.indexOf(to.path)=' + whiteList.indexOf(to.path))
|
||||
if (whiteList.indexOf(to.path) !== -1) {
|
||||
// in the free login whitelist, go directly
|
||||
|
@ -2,6 +2,7 @@ import Vue from 'vue'
|
||||
import Router from 'vue-router'
|
||||
import i18n from '@/lang/i18n'
|
||||
import Cookies from 'js-cookie'
|
||||
import store from '@/store'
|
||||
|
||||
const routerTitle = i18n.routerTitle
|
||||
const language = Cookies.get('language')
|
||||
@ -59,24 +60,11 @@ export const constantRoutes = [
|
||||
},
|
||||
{
|
||||
path: '/',
|
||||
component: Layout,
|
||||
redirect: '/dashboard',
|
||||
children: [
|
||||
{
|
||||
path: 'dashboard',
|
||||
component: () => import('@/views/dashboard/index'),
|
||||
name: 'Dashboard',
|
||||
meta: { title: routerTitle.dashboard?.[language] || routerTitle.dashboard.en, icon: 'form', iconPart: 'dashboard', affix: true, required: true, requireToken: true }
|
||||
}
|
||||
]
|
||||
component: () => import('@/views/ChoicePart'),
|
||||
hidden: true,
|
||||
meta: { requireToken: true }
|
||||
},
|
||||
// {
|
||||
// path: '/',
|
||||
// component: () => import('@/views/ChoicePart'),
|
||||
// hidden: true,
|
||||
// meta: { requireToken: true }
|
||||
// },
|
||||
// {
|
||||
// path: '/auth-redirect',
|
||||
// component: () => import('@/views/login/auth-redirect'),
|
||||
// hidden: true
|
||||
@ -90,7 +78,28 @@ export const constantRoutes = [
|
||||
path: '/401',
|
||||
component: () => import('@/views/error-page/401'),
|
||||
hidden: true
|
||||
},
|
||||
}
|
||||
// 工单管理、厂务管理、包装管理、接口管理、数据采集、报表、质量管理、SPC
|
||||
/** when your routing map is too long, you can split it into small modules **/
|
||||
// 404 page must be placed at the end !!!
|
||||
// { path: '*', redirect: '/404', hidden: true }
|
||||
]
|
||||
|
||||
export const dynamicRoutes = [
|
||||
// {
|
||||
// path: '/dashboard',
|
||||
// component: Layout,
|
||||
// redirect: '/dashboard',
|
||||
// name: 'dashboard',
|
||||
// children: [
|
||||
// {
|
||||
// path: 'dashboard',
|
||||
// component: () => import('@/views/dashboard/index'),
|
||||
// name: 'Dashboard',
|
||||
// meta: { title: routerTitle.dashboard.dashboard?.[language] || routerTitle.dashboard.dashboard.en, icon: 'dashboard', affix: true }
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
{
|
||||
path: '/basicData',
|
||||
component: Layout,
|
||||
@ -502,7 +511,7 @@ export const constantRoutes = [
|
||||
path: 'recipe',
|
||||
component: () => import('@/views/EquipmentManager/RecipeManager'),
|
||||
name: 'RecipeManage',
|
||||
meta: { title: routerTitle.equipment.recipe?.[language] || routerTitle.equipment.recipe.en, icon: 'form', affix: true }
|
||||
meta: { title: routerTitle.equipment.recipe?.[language] || routerTitle.equipment.recipe?.en, icon: 'form', affix: true }
|
||||
}, {
|
||||
path: 'sparepart',
|
||||
component: () => import('@/views/EquipmentManager/sqarepart'),
|
||||
@ -520,7 +529,7 @@ export const constantRoutes = [
|
||||
component: () => import('@/views/EquipmentManager/RecipeManager/subpage/detail'),
|
||||
name: 'RecipeParamManage',
|
||||
hidden: true,
|
||||
meta: { title: routerTitle.equipment.recipeform?.[language] || routerTitle.equipment.recipeform.en, icon: 'form', affix: true }
|
||||
meta: { title: routerTitle.equipment.recipeform?.[language] || routerTitle.equipment.recipeform?.en, icon: 'form', affix: true }
|
||||
}, {
|
||||
path: 'statussetting',
|
||||
component: () => import('@/views/EquipmentManager/StatusSetting'),
|
||||
@ -1178,18 +1187,18 @@ export const constantRoutes = [
|
||||
path: 'plan',
|
||||
component: () => import('@/views/QualityManager/plan'),
|
||||
name: 'PlanManage',
|
||||
meta: { title: routerTitle.quality.plan?.[language] || routerTitle.quality.plan.en, icon: 'form', affix: true }
|
||||
meta: { title: routerTitle.quality.plan?.[language] || routerTitle.quality.plan?.en, icon: 'form', affix: true }
|
||||
}, {
|
||||
path: 'planparam',
|
||||
component: () => import('@/views/QualityManager/plan/subpage/detail'),
|
||||
name: 'PlanParamManage',
|
||||
hidden: true,
|
||||
meta: { title: routerTitle.quality.planform?.[language] || routerTitle.quality.planform.en, icon: 'form', affix: true }
|
||||
meta: { title: routerTitle.quality.planform?.[language] || routerTitle.quality.planform?.en, icon: 'form', affix: true }
|
||||
}, {
|
||||
path: 'issue',
|
||||
component: () => import('@/views/QualityManager/plan/issuedplan'),
|
||||
name: 'PlanIssuedManage',
|
||||
meta: { title: routerTitle.quality.issuedplan?.[language] || routerTitle.quality.issuedplan.en, icon: 'form', affix: true }
|
||||
meta: { title: routerTitle.quality.issuedplan?.[language] || routerTitle.quality.issuedplan?.en, icon: 'form', affix: true }
|
||||
},
|
||||
{
|
||||
path: '/offlineDetec',
|
||||
@ -1287,23 +1296,49 @@ export const constantRoutes = [
|
||||
},
|
||||
{ path: '*', redirect: '/404', hidden: true }
|
||||
]
|
||||
export const asyncRoutes = [
|
||||
// 404 page must be placed at the end !!!
|
||||
{ path: '*', redirect: '/404', hidden: true }
|
||||
]
|
||||
|
||||
const createRouter = () =>
|
||||
const createRouter = (r) =>
|
||||
new Router({
|
||||
// mode: 'history', // require service support
|
||||
scrollBehavior: () => ({ y: 0 }),
|
||||
routes: constantRoutes
|
||||
routes: r
|
||||
})
|
||||
|
||||
const router = createRouter()
|
||||
const router = createRouter(constantRoutes)
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
console.log('route.index', to, to.meta.routeIndex)
|
||||
if (to.meta.routeIndex >= 0) {
|
||||
store.dispatch('app/setChoicepart', to.meta.routeIndex)
|
||||
}
|
||||
// 拦截器
|
||||
console.log('route,to.path:', to.path)
|
||||
if (to.meta.requireToken) {
|
||||
if (Cookies.get('Admin-Token')) {
|
||||
if (to.meta.required) {
|
||||
if (Cookies.get('choicepart') === 'undefined' || !Cookies.get('choicepart')) {
|
||||
next({
|
||||
path: '/'
|
||||
})
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
} else {
|
||||
next({
|
||||
path: '/login'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
})
|
||||
|
||||
// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
|
||||
export function resetRouter() {
|
||||
const newRouter = createRouter()
|
||||
const newRouter = createRouter(constantRoutes)
|
||||
router.matcher = newRouter.matcher // reset router
|
||||
}
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
/*
|
||||
* @Date: 2020-12-14 09:07:03
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @LastEditTime: 2021-12-06 14:24:30
|
||||
* @LastEditors: gtz
|
||||
* @LastEditTime: 2021-03-08 11:52:17
|
||||
* @FilePath: \basic-admin\src\settings.js
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
title: 'ARI WMS',
|
||||
title: 'ARI MES',
|
||||
|
||||
/**
|
||||
* @type {boolean} true | false
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* @Date: 2020-12-14 09:07:03
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-12-22 11:38:46
|
||||
* @LastEditors: gtz
|
||||
* @LastEditTime: 2021-01-29 14:24:20
|
||||
* @FilePath: \basic-admin\src\store\getters.js
|
||||
* @Description:
|
||||
*/
|
||||
@ -19,6 +19,7 @@ const getters = {
|
||||
introduction: state => state.user.introduction,
|
||||
username: state => state.user.username,
|
||||
roles: state => state.user.roles,
|
||||
menus: state => state.user.menus,
|
||||
permission_routes: state => state.permission.routes
|
||||
}
|
||||
export default getters
|
||||
|
@ -1,38 +1,36 @@
|
||||
/*
|
||||
* @Author: zwq
|
||||
* @Date: 2021-09-18 16:09:08
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-12-22 15:43:46
|
||||
* @Description:
|
||||
*/
|
||||
import { asyncRoutes, constantRoutes } from '@/router'
|
||||
import { dynamicRoutes, constantRoutes } from '@/router'
|
||||
import { getListItems } from '@/utils/tree'
|
||||
|
||||
/**
|
||||
* Use meta.role to determine if the current user has permission
|
||||
* @param roles
|
||||
* @param route
|
||||
*/
|
||||
function hasPermission(roles, route) {
|
||||
if (route.meta && route.meta.roles) {
|
||||
return roles.some(role => route.meta.roles.includes(role))
|
||||
} else {
|
||||
function hasPermission(menuList, route) {
|
||||
// if (route.meta && route.meta.roles) {
|
||||
// return roles.some(role => route.meta.roles.includes(role))
|
||||
// } else {
|
||||
// return true
|
||||
// }
|
||||
if (route.hidden) {
|
||||
return true
|
||||
}
|
||||
return menuList.some(m => route.path === m.h)
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter asynchronous routing tables by recursion
|
||||
* @param routes asyncRoutes
|
||||
* @param roles
|
||||
* @param menuList
|
||||
*/
|
||||
export function filterAsyncRoutes(routes, roles) {
|
||||
export function filterAsyncRoutes(routes, menuList) {
|
||||
const res = []
|
||||
|
||||
routes.forEach(route => {
|
||||
const tmp = { ...route }
|
||||
if (hasPermission(roles, tmp)) {
|
||||
if (hasPermission(menuList, tmp)) {
|
||||
if (tmp.children) {
|
||||
tmp.children = filterAsyncRoutes(tmp.children, roles)
|
||||
tmp.children = filterAsyncRoutes(tmp.children, menuList)
|
||||
}
|
||||
res.push(tmp)
|
||||
}
|
||||
@ -54,13 +52,19 @@ const mutations = {
|
||||
}
|
||||
|
||||
const actions = {
|
||||
generateRoutes({ commit }, roles) {
|
||||
generateRoutes({ commit }, menus) {
|
||||
return new Promise(resolve => {
|
||||
let accessedRoutes
|
||||
if (roles.includes('admin')) {
|
||||
accessedRoutes = asyncRoutes || []
|
||||
console.log(menus)
|
||||
if (!menus) {
|
||||
accessedRoutes = []
|
||||
} else {
|
||||
accessedRoutes = filterAsyncRoutes(asyncRoutes, roles)
|
||||
const menuList = []
|
||||
getListItems(menus, node => menuList.push(node))
|
||||
console.log(menuList)
|
||||
console.log(dynamicRoutes)
|
||||
accessedRoutes = filterAsyncRoutes(dynamicRoutes, menuList)
|
||||
console.log(accessedRoutes)
|
||||
}
|
||||
commit('SET_ROUTES', accessedRoutes)
|
||||
resolve(accessedRoutes)
|
||||
|
@ -9,6 +9,7 @@ const state = {
|
||||
avatar: '',
|
||||
introduction: '',
|
||||
roles: [],
|
||||
menus: [],
|
||||
username: Cookies.get('username') || ''
|
||||
}
|
||||
|
||||
@ -25,6 +26,9 @@ const mutations = {
|
||||
SET_AVATAR: (state, avatar) => {
|
||||
state.avatar = avatar
|
||||
},
|
||||
SET_MENUS: (state, menus) => {
|
||||
state.menus = menus
|
||||
},
|
||||
SET_ROLES: (state, roles) => {
|
||||
state.roles = roles
|
||||
},
|
||||
@ -38,7 +42,7 @@ const actions = {
|
||||
login({ commit }, userInfo) {
|
||||
const { username, password } = userInfo
|
||||
return new Promise((resolve, reject) => {
|
||||
login({ mobile: String(username).trim(), password }).then(res => {
|
||||
login({ mobile: username.trim(), password: password }).then(res => {
|
||||
console.log(res)
|
||||
if (res.code === 0) {
|
||||
const { token, name } = res.data
|
||||
@ -66,16 +70,17 @@ const actions = {
|
||||
reject('Verification failed, please Login again.')
|
||||
}
|
||||
|
||||
const { roles, name, avatar, introduction } = data
|
||||
const { roles, name, avatar, introduction, menus } = data
|
||||
|
||||
// roles must be a non-empty array
|
||||
if (!roles || roles.length <= 0) {
|
||||
reject('getInfo: roles must be a non-null array!')
|
||||
if (!menus || menus.length <= 0) {
|
||||
reject('getInfo: menus must be a non-null array!')
|
||||
}
|
||||
|
||||
commit('SET_ROLES', roles)
|
||||
commit('SET_ROLES', roles || [])
|
||||
commit('SET_NAME', name)
|
||||
commit('SET_AVATAR', avatar)
|
||||
commit('SET_MENUS', menus)
|
||||
commit('SET_INTRODUCTION', introduction)
|
||||
resolve(data)
|
||||
}).catch(error => {
|
||||
@ -92,6 +97,7 @@ const actions = {
|
||||
dispatch('tagsView/delAllViews', null, { root: true })
|
||||
commit('SET_TOKEN', '')
|
||||
commit('SET_ROLES', [])
|
||||
commit('SET_MENUS', [])
|
||||
commit('SET_USERNAME')
|
||||
Cookies.set('username', '')
|
||||
localStorage.clear()
|
||||
|
@ -102,13 +102,8 @@ export default {
|
||||
}
|
||||
return {
|
||||
loginForm: {
|
||||
username: 13588441519,
|
||||
password: 123456,
|
||||
// password: '123abc.'
|
||||
mobile: 13588441519,
|
||||
oauthCode: 13588441519,
|
||||
openId: 13588441519,
|
||||
wechatAppId: 13588441519
|
||||
username: '13588441519',
|
||||
password: '123abc.'
|
||||
},
|
||||
loginRules: {
|
||||
username: [{ required: true, trigger: 'blur', validator: validateUsername }],
|
||||
@ -138,7 +133,6 @@ export default {
|
||||
// window.addEventListener('storage', this.afterQRScan)
|
||||
},
|
||||
mounted() {
|
||||
// 自动获取焦点
|
||||
if (this.loginForm.username === '') {
|
||||
this.$refs.username.focus()
|
||||
} else if (this.loginForm.password === '') {
|
||||
@ -152,7 +146,6 @@ export default {
|
||||
// window.removeEventListener('storage', this.afterQRScan)
|
||||
},
|
||||
methods: {
|
||||
// 监听用户键盘输入
|
||||
checkCapslock(e) {
|
||||
const { key } = e
|
||||
this.capsTooltip = key && key.length === 1 && (key >= 'A' && key <= 'Z')
|
||||
@ -169,24 +162,12 @@ export default {
|
||||
},
|
||||
handleLogin() {
|
||||
this.$refs.loginForm.validate(valid => {
|
||||
// 自定义登陆验证,如符合验证console.log输出true
|
||||
console.log(valid)
|
||||
console.log(this.redirect, this.$route)
|
||||
if (valid) {
|
||||
this.loading = true
|
||||
// this.$store.dispatch('user/login', this.loginForm)
|
||||
// .then(() => {
|
||||
// console.log(this.redirect, this.otherQuery)
|
||||
// this.$router.push({ path: this.redirect || '/', query: this.otherQuery })
|
||||
// this.loading = false
|
||||
// })
|
||||
// .catch(() => {
|
||||
// this.loading = false
|
||||
// })
|
||||
|
||||
this.$store.dispatch('user/login', this.loginForm)
|
||||
.then(res => {
|
||||
console.log(res)
|
||||
.then(() => {
|
||||
console.log(this.redirect, this.otherQuery)
|
||||
this.$router.push({ path: this.redirect || '/', query: this.otherQuery })
|
||||
this.loading = false
|
||||
|
@ -46,8 +46,7 @@ module.exports = {
|
||||
// 这里写入需要代理的api和对应的目标地址
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://localhost:8080',
|
||||
// target: 'http://192.168.0.198:8080',
|
||||
target: 'http://cigs.mes.picaiba.com',
|
||||
// target: 'http://192.168.0.127:8080',
|
||||
// target: 'http://192.168.0.165:8080',
|
||||
// target: 'http://192.168.43.105:8080',
|
||||
@ -73,7 +72,6 @@ module.exports = {
|
||||
// }
|
||||
},
|
||||
'/spc': {
|
||||
// target: 'http://192.168.0.180:8080',
|
||||
target: 'http://58.210.206.230:8000',
|
||||
// target: 'http://192.168.0.187:8080',
|
||||
// target: 'http://192.168.43.105:8080',
|
||||
|
Loading…
Reference in New Issue
Block a user