mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2026-01-04 04:45:28 +08:00
Jeecg-Boot 2.2.0 版本发布 | 重磅升级
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import Vue from 'vue'
|
||||
import { USER_INFO} from "@/store/mutation-types"
|
||||
import { USER_INFO, ENHANCE_PRE } from "@/store/mutation-types"
|
||||
const getters = {
|
||||
device: state => state.app.device,
|
||||
theme: state => state.app.theme,
|
||||
@ -11,7 +11,12 @@ const getters = {
|
||||
welcome: state => state.user.welcome,
|
||||
permissionList: state => state.user.permissionList,
|
||||
userInfo: state => {state.user.info = Vue.ls.get(USER_INFO); return state.user.info},
|
||||
addRouters: state => state.permission.addRouters
|
||||
addRouters: state => state.permission.addRouters,
|
||||
enhanceJs:(state) => (code) => {
|
||||
state.enhance.enhanceJs[code] = Vue.ls.get(ENHANCE_PRE+code);
|
||||
return state.enhance.enhanceJs[code]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default getters
|
||||
@ -4,6 +4,7 @@ import Vuex from 'vuex'
|
||||
import app from './modules/app'
|
||||
import user from './modules/user'
|
||||
import permission from './modules/permission'
|
||||
import enhance from './modules/enhance'
|
||||
import getters from './getters'
|
||||
|
||||
Vue.use(Vuex)
|
||||
@ -12,7 +13,8 @@ export default new Vuex.Store({
|
||||
modules: {
|
||||
app,
|
||||
user,
|
||||
permission
|
||||
permission,
|
||||
enhance
|
||||
},
|
||||
state: {
|
||||
|
||||
|
||||
37
ant-design-vue-jeecg/src/store/modules/enhance.js
Normal file
37
ant-design-vue-jeecg/src/store/modules/enhance.js
Normal file
@ -0,0 +1,37 @@
|
||||
import Vue from 'vue'
|
||||
const enhance = {
|
||||
state: {
|
||||
enhanceJs:{
|
||||
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
ADD_TABLE_ENHANCE: (state, record) => {
|
||||
if(!state.enhanceJs){
|
||||
let obj = {}
|
||||
let arr = []
|
||||
arr.push({...record})
|
||||
obj[record.code] = arr
|
||||
state.enhanceJs = obj
|
||||
}else{
|
||||
if(!state.enhanceJs[record.code]){
|
||||
let arr = []
|
||||
arr.push({...record})
|
||||
state.enhanceJs[record.code] = arr
|
||||
}
|
||||
state.enhanceJs[record.code].push({...record})
|
||||
}
|
||||
let arr = state.enhanceJs[record.code]
|
||||
while(arr.length>16){
|
||||
arr.shift()
|
||||
}
|
||||
Vue.ls.set('enhance_'+record['code'], arr)
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
addEhanceRecord({ commit }, record) {
|
||||
commit('ADD_TABLE_ENHANCE', record)
|
||||
}
|
||||
}
|
||||
}
|
||||
export default enhance
|
||||
@ -1,6 +1,6 @@
|
||||
import Vue from 'vue'
|
||||
import { login, logout, phoneLogin } from "@/api/login"
|
||||
import { ACCESS_TOKEN, USER_NAME,USER_INFO,USER_AUTH,SYS_BUTTON_AUTH } from "@/store/mutation-types"
|
||||
import { login, logout, phoneLogin, thirdLogin } from "@/api/login"
|
||||
import { ACCESS_TOKEN, USER_NAME,USER_INFO,USER_AUTH,SYS_BUTTON_AUTH,UI_CACHE_DB_DICT_DATA } from "@/store/mutation-types"
|
||||
import { welcome } from "@/utils/util"
|
||||
import { queryPermissionsByUser } from '@/api/api'
|
||||
import { getAction } from '@/api/manage'
|
||||
@ -71,6 +71,7 @@ const user = {
|
||||
Vue.ls.set(ACCESS_TOKEN, result.token, 7 * 24 * 60 * 60 * 1000)
|
||||
Vue.ls.set(USER_NAME, userInfo.username, 7 * 24 * 60 * 60 * 1000)
|
||||
Vue.ls.set(USER_INFO, userInfo, 7 * 24 * 60 * 60 * 1000)
|
||||
Vue.ls.set(UI_CACHE_DB_DICT_DATA, result.sysAllDictItems, 7 * 24 * 60 * 60 * 1000)
|
||||
commit('SET_TOKEN', result.token)
|
||||
commit('SET_INFO', userInfo)
|
||||
commit('SET_NAME', { username: userInfo.username,realname: userInfo.realname, welcome: welcome() })
|
||||
@ -94,6 +95,7 @@ const user = {
|
||||
Vue.ls.set(ACCESS_TOKEN, result.token, 7 * 24 * 60 * 60 * 1000)
|
||||
Vue.ls.set(USER_NAME, userInfo.username, 7 * 24 * 60 * 60 * 1000)
|
||||
Vue.ls.set(USER_INFO, userInfo, 7 * 24 * 60 * 60 * 1000)
|
||||
Vue.ls.set(UI_CACHE_DB_DICT_DATA, result.sysAllDictItems, 7 * 24 * 60 * 60 * 1000)
|
||||
commit('SET_TOKEN', result.token)
|
||||
commit('SET_INFO', userInfo)
|
||||
commit('SET_NAME', { username: userInfo.username,realname: userInfo.realname, welcome: welcome() })
|
||||
@ -151,10 +153,11 @@ const user = {
|
||||
commit('SET_TOKEN', '')
|
||||
commit('SET_PERMISSIONLIST', [])
|
||||
Vue.ls.remove(ACCESS_TOKEN)
|
||||
Vue.ls.remove(UI_CACHE_DB_DICT_DATA)
|
||||
//console.log('logoutToken: '+ logoutToken)
|
||||
logout(logoutToken).then(() => {
|
||||
//var sevice = "http://"+window.location.host+"/";
|
||||
//var serviceUrl = encodeURIComponent(sevice);
|
||||
//let sevice = "http://"+window.location.host+"/";
|
||||
//let serviceUrl = encodeURIComponent(sevice);
|
||||
//window.location.href = window._CONFIG['casPrefixUrl']+"/logout?service="+serviceUrl;
|
||||
resolve()
|
||||
}).catch(() => {
|
||||
@ -162,6 +165,29 @@ const user = {
|
||||
})
|
||||
})
|
||||
},
|
||||
// 第三方登录
|
||||
ThirdLogin({ commit }, token) {
|
||||
return new Promise((resolve, reject) => {
|
||||
thirdLogin(token).then(response => {
|
||||
if(response.code =='200'){
|
||||
const result = response.result
|
||||
const userInfo = result.userInfo
|
||||
Vue.ls.set(ACCESS_TOKEN, result.token, 7 * 24 * 60 * 60 * 1000)
|
||||
Vue.ls.set(USER_NAME, userInfo.username, 7 * 24 * 60 * 60 * 1000)
|
||||
Vue.ls.set(USER_INFO, userInfo, 7 * 24 * 60 * 60 * 1000)
|
||||
commit('SET_TOKEN', result.token)
|
||||
commit('SET_INFO', userInfo)
|
||||
commit('SET_NAME', { username: userInfo.username,realname: userInfo.realname, welcome: welcome() })
|
||||
commit('SET_AVATAR', userInfo.avatar)
|
||||
resolve(response)
|
||||
}else{
|
||||
reject(response)
|
||||
}
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,6 +14,9 @@ export const USER_INFO = 'Login_Userinfo'
|
||||
export const USER_AUTH = 'LOGIN_USER_BUTTON_AUTH'
|
||||
export const SYS_BUTTON_AUTH = 'SYS_BUTTON_AUTH'
|
||||
export const ENCRYPTED_STRING = 'ENCRYPTED_STRING'
|
||||
export const ENHANCE_PRE = 'enhance_'
|
||||
export const UI_CACHE_DB_DICT_DATA = 'UI_CACHE_DB_DICT_DATA'
|
||||
export const INDEX_MAIN_PAGE_PATH = "/dashboard/analysis"
|
||||
|
||||
export const CONTENT_WIDTH_TYPE = {
|
||||
Fluid: 'Fluid',
|
||||
|
||||
Reference in New Issue
Block a user