keep-alive

This commit is contained in:
2023-06-29 16:02:24 +08:00
parent b28add0fc1
commit 5aa63a973b
6 changed files with 36 additions and 5 deletions

View File

@@ -2,18 +2,23 @@ import * as types from '../types'
import { getStore, setStore } from '@config/utils.js'
const state = {
keepAlive: [], // 缓存页面
deviceUuid: getStore('deviceUuid') || '',
deviceCode: getStore('deviceCode') || '',
isProductonplan: getStore('isProductonplan') || ''
}
const getters = {
keepAlive: state => state.keepAlive,
deviceUuid: state => state.deviceUuid,
deviceCode: state => state.deviceCode,
isProductonplan: state => state.isProductonplan
}
const actions = {
setKeepAlive ({commit}, res) {
commit(types.SET_KEEP_ALIVE, res)
},
setDevice ({commit}, res) {
setStore('deviceUuid', res.deviceUuid)
setStore('deviceCode', res.deviceCode)
@@ -26,6 +31,9 @@ const actions = {
}
const mutations = {
[types.SET_KEEP_ALIVE] (state, res) {
state.keepAlive = res
},
[types.DATA_DEVICE] (state, res) {
state.deviceUuid = res.deviceUuid
state.deviceCode = res.deviceCode

View File

@@ -13,6 +13,9 @@ export const SAVE_USER_INFO = 'SAVE_USER_INFO'
export const DEL_USER_INFO = 'DEL_USER_INFO'
export const SAVE_TOKEN = 'SAVE_TOKEN'
// 缓存页面
export const SET_KEEP_ALIVE = 'SET_KEEP_ALIVE'
// 数据
export const DATA_DEVICE = 'DATA_DEVICE'
export const DATA_IS_PROPLAN = 'DATA_IS_PROPLAN'