|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
import Vue from 'vue'
|
|
|
|
|
import { login, getLoginUser, logout } from '@/api/modular/system/loginManage'
|
|
|
|
|
import { login, getLoginUser, logout, loginWithCode } from '@/api/modular/system/loginManage'
|
|
|
|
|
import { sysDictTypeTree } from '@/api/modular/system/dictManage'
|
|
|
|
|
import { sysMenuChange } from '@/api/modular/system/menuManage'
|
|
|
|
|
import { ACCESS_TOKEN, ALL_APPS_MENU, DICT_TYPE_TREE_DATA, NOTICE_RECEIVED } from '@/store/mutation-types'
|
|
|
|
@ -54,11 +54,11 @@ const user = {
|
|
|
|
|
},
|
|
|
|
|
APPEND_NOTICE: (state, notice) => {
|
|
|
|
|
notice.publicTime = dateFormat(notice.publicTime, 'YYYY-mm-dd HH:MM:SS')
|
|
|
|
|
let notices = state.notices
|
|
|
|
|
let temp = notices.rows.filter(m => {
|
|
|
|
|
const notices = state.notices
|
|
|
|
|
const temp = notices.rows.filter(m => {
|
|
|
|
|
return m.value == notice.type
|
|
|
|
|
})[0]
|
|
|
|
|
let other = notices.rows.filter(m => {
|
|
|
|
|
const other = notices.rows.filter(m => {
|
|
|
|
|
return m.value != notice.type
|
|
|
|
|
})
|
|
|
|
|
temp.noticeData.unshift(notice)
|
|
|
|
@ -105,7 +105,28 @@ const user = {
|
|
|
|
|
// eslint-disable-next-line handle-callback-err
|
|
|
|
|
})
|
|
|
|
|
.catch(error => {
|
|
|
|
|
// eslint-disable-next-line prefer-promise-reject-errors
|
|
|
|
|
console.log(error)
|
|
|
|
|
reject('后端未启动或代理错误')
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 跨平台登录
|
|
|
|
|
LoginWithCode({ commit }, userInfo) {
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
loginWithCode(userInfo)
|
|
|
|
|
.then(response => {
|
|
|
|
|
if (!response.success) {
|
|
|
|
|
reject(response.message)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
const result = response.data
|
|
|
|
|
console.log(response, 1111)
|
|
|
|
|
Vue.ls.set(ACCESS_TOKEN, result, 7 * 24 * 60 * 60 * 1000)
|
|
|
|
|
commit('SET_TOKEN', result)
|
|
|
|
|
resolve()
|
|
|
|
|
})
|
|
|
|
|
.catch(error => {
|
|
|
|
|
console.log(error)
|
|
|
|
|
reject('后端未启动或代理错误')
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|