Browse Source

currentUserInfo 使用stroe存并使用

master
安虹睿 1 year ago
parent
commit
112ea27afb
  1. 2
      Code/Fe/src/components/rowDrop/index.vue
  2. 6
      Code/Fe/src/layout/components/Navbar.vue
  3. 2
      Code/Fe/src/mixins/TableHeaderMixins.js
  4. 4
      Code/Fe/src/mixins/mixins.js
  5. 90
      Code/Fe/src/permission - 副本.js
  6. 185
      Code/Fe/src/permission-0718.js
  7. 132
      Code/Fe/src/permission-0721.js
  8. 81
      Code/Fe/src/permission.js
  9. 3
      Code/Fe/src/store/getters.js
  10. 50
      Code/Fe/src/store/modules/user.js
  11. 2
      Code/Fe/src/utils/defaultButtons.js
  12. 23
      Code/Fe/src/views/login/index.vue

2
Code/Fe/src/components/rowDrop/index.vue

@ -61,7 +61,7 @@ export default {
dataList: [],
// allSelect hasSelect NoSelect
allSeletType:'NoSelect',
userName:JSON.parse(localStorage.getItem('currentUserInfo')).userName
userName:this.$store.getters.currentUserInfo.userName
}
},
props: {

6
Code/Fe/src/layout/components/Navbar.vue

@ -78,11 +78,11 @@ export default {
this.$store.dispatch("app/toggleSideBar");
},
async logout() {
// await this.$store.dispatch("user/logout");
await this.$store.dispatch("user/logout")
// this.$router.push(`/login?redirect=${this.$route.fullPath}`);
localStorage.removeItem("interfaceBoardColumnsNames")
localStorage.removeItem("currentUserInfo")
this.$router.push(`/login?redirect=${this.$route.fullPath}&isAutoLogin=false`)
// this.$router.push(`/login?redirect=${this.$route.fullPath}&isAutoLogin=false`)
this.$router.push(`/login?isAutoLogin=false`)
},
handleClick() {

2
Code/Fe/src/mixins/TableHeaderMixins.js

@ -40,7 +40,7 @@ export const TableHeaderMixins = {
let _params = {
isRedundance:Boolean(form.isRedundance),
isDetailExport:Boolean(form.isDetail),
userId:JSON.parse(localStorage.getItem("currentUserInfo")).id
userId:this.$store.getters.currentUserInfo.id
}
let _exportUrl = this.URLOption_export ? this.URLOption_export : this.URLOption_base;
let _special = this.URLOption_export ? true : false

4
Code/Fe/src/mixins/mixins.js

@ -58,8 +58,8 @@ export const mixins = {
let _list_defalut = columnsData ? columnsData : this.$isTableColumns[this.$route.name]
let _type = type ? type : 'list_api'
if(!_list_defalut)return
let _local = localStorage.getItem('file_Columns_' + _type + '_' + JSON.parse(localStorage.getItem('currentUserInfo')).userName + '_' + this.$route.name)
let _list_local = JSON.parse(localStorage.getItem('file_Columns_' + _type + '_' + JSON.parse(localStorage.getItem('currentUserInfo')).userName + '_' + this.$route.name))
let _local = localStorage.getItem('file_Columns_' + _type + '_' + this.$store.getters.currentUserInfo.userName + '_' + this.$route.name)
let _list_local = JSON.parse(localStorage.getItem('file_Columns_' + _type + '_' + this.$store.getters.currentUserInfo.userName + '_' + this.$route.name))
let _new_list = [] //格式化后的数据
// 如果没有缓存则直接为默认值
if(!_local){

90
Code/Fe/src/permission - 副本.js

@ -1,90 +0,0 @@
import router from './router'
import store from './store'
import {
Message
} from 'element-ui'
import NProgress from 'nprogress' // progress bar
import 'nprogress/nprogress.css' // progress bar style
import {
getToken
} from '@/utils/auth' // get token from cookie
import getPageTitle from '@/utils/get-page-title'
import {
asyncRoutes
} from '@/router'
NProgress.configure({
showSpinner: false
}) // NProgress Configuration
const whiteList = ['/login', '/auth-redirect', '/testForm'] // no redirect whitelist
router.beforeEach(async (to, from, next) => {
// 添加路由信息,方便代码修改定位
// console.log('----------------' + to.meta.title + '-----------------------'+ to.fullPath.substring(to.fullPath.lastIndexOf('-')+1,to.fullPath.length) + '.vue' );
// start progress bar
NProgress.start()
// set page title
document.title = getPageTitle()
next()
// determine whether the user has logged in
// todo-new:等获取token接口恢复后做处理
const hasRoles =await store.getters.roles && await store.getters.roles.length > 0
if (hasRoles) {
next()
} else {
try {
// get user info
// note: roles must be a object array! such as: ['admin'] or ,['developer','editor']
// 如果缓存中没有 interfaceBoardColumnsNames(接口监控看板表头信息) 的缓存数据 则退出登录
let _interfaceBoardColumnsNames = localStorage.getItem("interfaceBoardColumnsNames")
if(!_interfaceBoardColumnsNames || _interfaceBoardColumnsNames == 'undefined' || _interfaceBoardColumnsNames == 'null'){
await store.dispatch('user/logout')
next(`/login?redirect=${to.path}`)
NProgress.done()
}
const {
roles
} = await store.dispatch('user/getInfo')
// generate accessible routes map based on roles
// const accessRoutes = await store.dispatch('permission/generateRoutes', localStorage.getItem('userId'))
// router.addRoutes(accessRoutes)
// 原码 防止刷新出现空白页(系统暂无出现所以注释)
// const accessRoutes = await store.dispatch('permission/generateRoutes', roles)
// router.addRoutes(accessRoutes)
// 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) {
// remove token and go to login page to re-login
await store.dispatch('user/resetToken')
Message.error(error || 'Has Error')
next(`/login?redirect=${to.path}`)
NProgress.done()
}
}
})
router.afterEach(() => {
// element-ui 使用 Tooltip 提示时候,更换页面,提示依旧存在偶现bug处理。
const mytooltipList = document.querySelectorAll('.el-tooltip__popper') // 获取页面所有tooltip的dom集合
setTimeout(() => {
mytooltipList.forEach((value) => {
value.style.display = 'none'
if(value.parentElement){
value.parentElement.removeChild(value)
}
})
}, 1000)
// finish progress bar
NProgress.done()
})

185
Code/Fe/src/permission-0718.js

@ -1,185 +0,0 @@
import router from './router'
import store from './store'
import {
Message
} from 'element-ui'
import NProgress from 'nprogress' // progress bar
import 'nprogress/nprogress.css' // progress bar style
import {
getToken
} from '@/utils/auth' // get token from cookie
import getPageTitle from '@/utils/get-page-title'
import {
asyncRoutes
} from '@/router'
import { getInterfaceBoard } from "@/api/wms-interface"
import { login,getUsersByUserName } from "@/api/wms-auth"
NProgress.configure({
showSpinner: false
}) // NProgress Configuration
const whiteList = ['/login', '/auth-redirect', '/testForm'] // no redirect whitelist
router.beforeEach(async (to, from, next) => {
// 添加路由信息,方便代码修改定位
// console.log('----------------' + to.meta.title + '-----------------------'+ to.fullPath.substring(to.fullPath.lastIndexOf('-')+1,to.fullPath.length) + '.vue' );
// start progress bar
NProgress.start()
// set page title
document.title = getPageTitle()
// 判断是否自动登录
let isAutoLogin = JSON.parse(localStorage.getItem('isAutoLogin'))
// 如果路径中有isAutoLogin参数则优先,否则读取配置文件中的isAutoLogin参数
let _url_isAutoLogin = to.query.isAutoLogin
if( _url_isAutoLogin== 'false' || _url_isAutoLogin == 'true'){
isAutoLogin = JSON.parse(_url_isAutoLogin)
}
let userInfo = localStorage.getItem('currentUserInfo')
let _zh = localStorage.getItem('columnsApiNamesZh')
// 是否有用户信息:
// 1、如果没有判断是否为自动登录(是自动登录则自动执行登录,账号密码为配置信息中的值,不是自动登录则跳到登录页)
// 2、如果有用户信息:则检查是否有api接口的表头数据,没有的话重新获取
if(!userInfo){
if(isAutoLogin || to.query.loginName){
// let loginForm= {
// userNameOrEmailAddress:localStorage.getItem("userNameOrEmailAddress"),
// password:localStorage.getItem("client_secret"),
// // rememberMe:true,
// // grant_type: 'password',
// // client_id: 'Auth_App',
// }
// store.dispatch('user/login', loginForm).then(() => {
// login(loginForm).then(()=>{
getUsersByUserName(localStorage.getItem("userNameOrEmailAddress")).then(res=>{
// todo:currentUserInfo全程需要优化
localStorage.setItem("currentUserInfo", JSON.stringify(res));
})
.catch(err => {
console.log('获取用户信息失败,请重试')
})
// 提前获取接口监控看板表头数据并存储
getInterfaceBoard().then(result => {
localStorage.setItem("interfaceBoardColumnsNames", JSON.stringify(result.resources[_zh].texts));
next('/')
})
.catch(err => {
console.log('获取表头失败,请重试')
})
// })
// .catch((error) => {
// console.log('登录失败')
// })
}else{
if (to.path != '/login') {
next('/login')
}else{
next()
}
NProgress.done()
}
}else{
// 重新获取api接口表头
const _interfaceBoardColumnsNames = localStorage.getItem("interfaceBoardColumnsNames")
if( !_interfaceBoardColumnsNames || _interfaceBoardColumnsNames == 'undefined' || _interfaceBoardColumnsNames == 'null'){
getInterfaceBoard().then(result => {
// todo-new:columnsApiNamesZh配置的地址补全(evel)
localStorage.setItem("interfaceBoardColumnsNames", JSON.stringify(result.resources[_zh].texts));
setTimeout(()=>{
next()
},0)
})
}else{
next()
}
}
// determine whether the user has logged in
// todo-new:如果token接口恢复做处理
const hasToken = getToken()
// else if (hasToken) {
// // if(from.path != '/login'){
// // let _interfaceBoardColumnsNames = localStorage.getItem("interfaceBoardColumnsNames")
// // if(!_interfaceBoardColumnsNames){
// // // next({
// // // path: '/'
// // // })
// // // NProgress.done()
// // }
// // }
// if (to.path === '/login') {
// // if is logged in, redirect to the home page
// next({
// path: '/'
// })
// NProgress.done() // hack: https://github.com/PanJiaChen/vue-element-admin/pull/2939
// } else {
// // determine whether the user has obtained his permission roles through getInfo
// const hasRoles =await store.getters.roles && await store.getters.roles.length > 0
// if (hasRoles) {
// next()
// } else {
// try {
// // get user info
// // note: roles must be a object array! such as: ['admin'] or ,['developer','editor']
// const {
// roles
// } = await store.dispatch('user/getInfo')
// // generate accessible routes map based on roles
// // const accessRoutes = await store.dispatch('permission/generateRoutes', localStorage.getItem('userId'))
// // router.addRoutes(accessRoutes)
// // 原码 防止刷新出现空白页(系统暂无出现所以注释)
// // const accessRoutes = await store.dispatch('permission/generateRoutes', roles)
// // router.addRoutes(accessRoutes)
// // 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) {
// // remove token and go to login page to re-login
// await store.dispatch('user/resetToken')
// Message.error(error || 'Has Error')
// next(`/login?redirect=${to.path}`)
// NProgress.done()
// }
// }
// }
// } else {
// /* has no token*/
// if (whiteList.indexOf(to.path) !== -1) {
// // in the free login whitelist, go directly
// next()
// } else {
// // other pages that do not have permission to access are redirected to the login page.
// next(`/login?redirect=${to.path}`)
// NProgress.done()
// }
// }
})
router.afterEach(() => {
// element-ui 使用 Tooltip 提示时候,更换页面,提示依旧存在偶现bug处理。
const mytooltipList = document.querySelectorAll('.el-tooltip__popper') // 获取页面所有tooltip的dom集合
setTimeout(() => {
mytooltipList.forEach((value) => {
value.style.display = 'none'
if(value.parentElement){
value.parentElement.removeChild(value)
}
})
}, 1000)
// finish progress bar
NProgress.done()
})

132
Code/Fe/src/permission-0721.js

@ -0,0 +1,132 @@
import router from './router'
import store from './store'
import { Message } from 'element-ui'
import NProgress from 'nprogress' // progress bar
import 'nprogress/nprogress.css' // progress bar style
import { getToken } from '@/utils/auth' // get token from cookie
import getPageTitle from '@/utils/get-page-title'
import { asyncRoutes } from '@/router'
import { getInterfaceBoard } from "@/api/wms-interface"
import { login,getUsersByUserName } from "@/api/wms-auth"
NProgress.configure({
showSpinner: false
}) // NProgress Configuration
router.beforeEach(async (to, from, next) => {
// start progress bar
NProgress.start()
// set page title
document.title = getPageTitle()
// 判断是否自动登录
let isAutoLogin = JSON.parse(localStorage.getItem('isAutoLogin'))
const interfaceBoardColumnsNames = localStorage.getItem("interfaceBoardColumnsNames")
// 如果路径中有isAutoLogin参数则优先,否则读取配置文件中的isAutoLogin参数
let _url_isAutoLogin = to.query.isAutoLogin
if( _url_isAutoLogin== 'false' || _url_isAutoLogin == 'true'){
isAutoLogin = JSON.parse(_url_isAutoLogin)
}
let userInfo = localStorage.getItem('currentUserInfo')
// 是否有用户信息:
// 1、如果没有判断是否为自动登录(是自动登录则自动执行登录,账号密码为配置信息中的值,不是自动登录则跳到登录页)
// 2、有/没有:则检查是否有api接口的表头数据,没有的话重新获取
if(userInfo){
if(store.getters.permission_routes && store.getters.permission_routes.length > 0){
next()
}else{
const accessRoutes = await store.dispatch('permission/getApiColumnsNames')
router.addRoutes(accessRoutes)
console.log(52)
next({
...to,
query:{
loginName:from.query.loginName,
isAutoLogin:from.query.isAutoLogin,
},
replace: true
})
}
}else{
if(!interfaceBoardColumnsNames){
const accessRoutes = await store.dispatch('permission/getApiColumnsNames')
router.addRoutes(accessRoutes)
console.log(123,to)
next({
...to,
query:{
loginName:to.query.loginName,
isAutoLogin:to.query.isAutoLogin,
},
replace: true
})
}
if(isAutoLogin || to.query.loginName){
// let loginForm= {
// userNameOrEmailAddress:localStorage.getItem("userNameOrEmailAddress"),
// password:localStorage.getItem("client_secret"),
// // rememberMe:true,
// // grant_type: 'password',
// // client_id: 'Auth_App',
// }
// // store.dispatch('user/login', loginForm).then(() => {
// login(loginForm).then(()=>{
let _username = to.query.loginName ? to.query.loginName : localStorage.getItem("userNameOrEmailAddress")
if(to.path != '/login'){
getUsersByUserName(_username).then(res=>{
// todo:currentUserInfo全程需要优化
if(res && JSON.stringify(res).length > 0){
localStorage.setItem("currentUserInfo", JSON.stringify(res));
// next('/')
next({
...to,
query:{
loginName:to.query.loginName,
isAutoLogin:to.query.isAutoLogin,
},
replace: true
})
}else{
next(`/login?loginName=${to.query.loginName}&isAutoLogin=${to.query.isAutoLogin}`)
// next(`/login`)
Message.error('获取用户信息失败,请重试')
}
})
.catch(err => {
console.log('获取用户信息失败,请重试')
})
}else{
next()
}
// })
// .catch((error) => {
// console.log('登录失败')
// })
}
else{
if (to.path != '/login') {
Message.error('获取用户信息失败,请重新登录')
next(`/login?loginName=${to.query.loginName}&isAutoLogin=${to.query.isAutoLogin}`)
next(`/login`)
}else{
next()
}
}
NProgress.done()
}
})
router.afterEach(() => {
// element-ui 使用 Tooltip 提示时候,更换页面,提示依旧存在偶现bug处理。
const mytooltipList = document.querySelectorAll('.el-tooltip__popper') // 获取页面所有tooltip的dom集合
setTimeout(() => {
mytooltipList.forEach((value) => {
value.style.display = 'none'
if(value.parentElement){
value.parentElement.removeChild(value)
}
})
}, 1000)
// finish progress bar
NProgress.done()
})

81
Code/Fe/src/permission.js

@ -27,31 +27,35 @@ router.beforeEach(async (to, from, next) => {
if( _url_isAutoLogin== 'false' || _url_isAutoLogin == 'true'){
isAutoLogin = JSON.parse(_url_isAutoLogin)
}
let userInfo = localStorage.getItem('currentUserInfo')
// 是否有用户信息:
const userInfo = store.getters.currentUserInfo
// 1、如果没有判断是否为自动登录(是自动登录则自动执行登录,账号密码为配置信息中的值,不是自动登录则跳到登录页)
// 2、有/没有:则检查是否有api接口的表头数据,没有的话重新获取
if(userInfo){
console.log('有store.getters.currentUserInfo',store.getters.currentUserInfo)
if(store.getters.permission_routes && store.getters.permission_routes.length > 0){
console.log('有store.getters.permission_routes',store.getters.permission_routes)
next()
}else{
}
else{
console.log('没有store.getters.permission_routes',store.getters.permission_routes)
const accessRoutes = await store.dispatch('permission/getApiColumnsNames')
router.addRoutes(accessRoutes)
console.log(52)
next({
...to,
query:{
loginName:from.query.loginName,
isAutoLogin:from.query.isAutoLogin,
loginName:to.query.loginName,
isAutoLogin:to.query.isAutoLogin,
},
replace: true
})
}
}else{
console.log('没有store.getters.currentUserInfo',store.getters.currentUserInfo)
if(!interfaceBoardColumnsNames){
console.log('没有interfaceBoardColumnsNames',interfaceBoardColumnsNames)
const accessRoutes = await store.dispatch('permission/getApiColumnsNames')
router.addRoutes(accessRoutes)
console.log(123,to)
next({
...to,
query:{
@ -62,6 +66,7 @@ router.beforeEach(async (to, from, next) => {
})
}
if(isAutoLogin || to.query.loginName){
console.log('有自动登录',isAutoLogin,to.query.loginName)
// let loginForm= {
// userNameOrEmailAddress:localStorage.getItem("userNameOrEmailAddress"),
// password:localStorage.getItem("client_secret"),
@ -71,29 +76,28 @@ router.beforeEach(async (to, from, next) => {
// }
// // store.dispatch('user/login', loginForm).then(() => {
// login(loginForm).then(()=>{
let _username = to.query.loginName ? to.query.loginName : localStorage.getItem("userNameOrEmailAddress")
let _username = to.query.loginName || localStorage.getItem("isLoginName") || localStorage.getItem("userNameOrEmailAddress")
if(to.path != '/login'){
getUsersByUserName(_username).then(res=>{
// todo:currentUserInfo全程需要优化
if(res && JSON.stringify(res).length > 0){
localStorage.setItem("currentUserInfo", JSON.stringify(res));
// next('/')
next({
...to,
query:{
loginName:to.query.loginName,
isAutoLogin:to.query.isAutoLogin,
},
replace: true
})
}else{
next(`/login?loginName=${to.query.loginName}&isAutoLogin=${to.query.isAutoLogin}`)
// next(`/login`)
Message.error('获取用户信息失败,请重试')
}
})
.catch(err => {
console.log('获取用户信息失败,请重试')
await store.dispatch('user/getUserInfo',_username).then(()=>{
next({
...to,
query:{
loginName:to.query.loginName,
isAutoLogin:to.query.isAutoLogin,
},
replace: true
})
}).catch(()=>{
next({
path:'/login',
query:{
isAutoLogin:to.query.isAutoLogin,
},
replace: true
})
// next(`/login?loginName=${to.query.loginName}&isAutoLogin=${to.query.isAutoLogin}`)
// next(`/login`)
Message.error('获取用户信息失败,请重试!')
})
}else{
next()
@ -104,11 +108,28 @@ router.beforeEach(async (to, from, next) => {
// })
}
else{
console.log('不自动登录',isAutoLogin,to.query.loginName)
if (to.path != '/login') {
Message.error('获取用户信息失败,请重新登录')
next(`/login?loginName=${to.query.loginName}&isAutoLogin=${to.query.isAutoLogin}`)
next(`/login`)
next({
path:'/login',
query:{
isAutoLogin:to.query.isAutoLogin,
loginName:to.query.loginName,
},
replace: true
})
// next(`/login?loginName=${to.query.loginName}&isAutoLogin=${to.query.isAutoLogin}`)
// next(`/login`)
}else{
// next({
// ...to,
// query:{
// isAutoLogin:to.query.isAutoLogin,
// loginName:to.query.loginName,
// },
// replace: true
// })
next()
}
}

3
Code/Fe/src/store/getters.js

@ -12,6 +12,7 @@ const getters = {
roles: state => state.user.roles,
permission_routes: state => state.permission.routes,
errorLogs: state => state.errorLog.logs,
dictionaries: state => state.dictionaries.dict
dictionaries: state => state.dictionaries.dict,
currentUserInfo: state => state.user.userInfo,
}
export default getters

50
Code/Fe/src/store/modules/user.js

@ -1,7 +1,8 @@
import {
token,
logout,
getInfo
getInfo,
getUsersByUserName
} from '@/api/wms-auth'
import {
getToken,
@ -20,8 +21,10 @@ const state = {
name: '',
avatar: '',
introduction: '',
roles: []
roles: [],
userInfo:null
}
import { Message } from 'element-ui'
const mutations = {
SET_TOKEN: (state, token) => {
@ -38,6 +41,9 @@ const mutations = {
},
SET_ROLES: (state, roles) => {
state.roles = roles
},
SET_USERINFO: (state, data) => {
state.userInfo = data
}
}
@ -141,13 +147,14 @@ const actions = {
dispatch
}) {
return new Promise((resolve, reject) => {
logout().then(() => {
// logout().then(() => {
commit('SET_TOKEN', '')
commit('SET_ROLES', [])
removeToken()
resetRouter()
removeCompany()
removeWarehouseCode()
// commit('SET_USERINFO', null)
// removeToken()
// resetRouter()
// removeCompany()
// removeWarehouseCode()
// reset visited views and cached views
// to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2485
dispatch('tagsView/delAllViews', null, {
@ -155,10 +162,10 @@ const actions = {
})
resolve()
// 防止路由叠加
location.reload()
}).catch(error => {
reject(error)
})
// location.reload()
// }).catch(error => {
// reject(error)
// })
})
},
@ -202,7 +209,26 @@ const actions = {
dispatch('tagsView/delAllViews', null, {
root: true
})
}
},
getUserInfo({
commit
},username) {
return new Promise((resolve, reject) => {
getUsersByUserName(username).then(res=>{
if(res && JSON.stringify(res).length > 0){
localStorage.setItem('isLoginName',username)
commit('SET_USERINFO', res)
resolve(res)
}else{
reject('获取用户信息失败,请重试111')
}
})
.catch(err => {
reject(error)
console.log('获取用户信息失败,请重试')
})
})
},
}
export default {

2
Code/Fe/src/utils/defaultButtons.js

@ -43,7 +43,7 @@ export function defaultExportBtn(option) {
export function defaultFieldSettingBtn(option,source) {
let _source = source ? source : 'list_api'
// todo:监听已经配置过的字段按钮更改状态特殊显示
let _local = localStorage.getItem('file_Columns_' + _source + '_' + JSON.parse(localStorage.getItem('currentUserInfo')).userName + '_' + this.$route.name)
let _local = localStorage.getItem('file_Columns_' + _source + '_' + this.$store.getters.currentUserInfo.userName + '_' + this.$route.name)
let _type = ''
let _num = 0
if(_local){

23
Code/Fe/src/views/login/index.vue

@ -166,10 +166,17 @@ export default {
this.$refs.loginForm.validate(valid => {
if (valid) {
// todo-new:localStorage.getItem("userNameOrEmailAddress")
getUsersByUserName(this.loginForm.username).then(res=>{
// store.dispatch('user/setName',res)
localStorage.setItem("currentUserInfo", JSON.stringify(res));
this.$router.push({ path: '/'})
this.$store.dispatch('user/getUserInfo',this.loginForm.username).then(()=>{
this.$router.push({
path:'/',
query:{
loginName:this.loginForm.username,
isAutoLogin:this.$route.query.isAutoLogin,
},
replace: true
})
}).catch(()=>{
this.$message.error('获取用户信息失败,请重试!')
})
return
this.loading = true
@ -179,10 +186,10 @@ export default {
login(this.loginForm).then(()=>{
// this.$store.dispatch('user/login', this.loginForm).then(() => {
//
getUsersByUserName(localStorage.getItem("userNameOrEmailAddress")).then(res=>{
// store.dispatch('user/setName',res)
localStorage.setItem("currentUserInfo", JSON.stringify(res));
})
// getUsersByUserName(localStorage.getItem("userNameOrEmailAddress")).then(res=>{
// // store.dispatch('user/setName',res)
// localStorage.setItem("currentUserInfo", JSON.stringify(res));
// })
getInterfaceBoard().then(result => {
localStorage.setItem("interfaceBoardColumnsNames", JSON.stringify(result.resources[_zh].texts));
this.$router.push({ path: '/'})

Loading…
Cancel
Save