You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.3 KiB
62 lines
1.3 KiB
/*
|
|
* @Author: ch
|
|
* @Date: 2022-03-22 18:28:52
|
|
* @LastEditors: ch
|
|
* @LastEditTime: 2022-04-29 14:13:05
|
|
* @Description: file content
|
|
*/
|
|
import Vue from 'vue'
|
|
import Vuex from 'vuex';
|
|
|
|
Vue.use(Vuex);
|
|
const
|
|
// token
|
|
TOKEN = 'tk',
|
|
// 用户信息
|
|
USER_INFO = 'ui',
|
|
// 地址列表
|
|
ADDRESS = 'ads',
|
|
// oppenId
|
|
OPPED_ID = 'oi';
|
|
|
|
export default new Vuex.Store({
|
|
state : {
|
|
token : uni.getStorageSync(TOKEN) || '',
|
|
userInfo : JSON.parse(uni.getStorageSync(USER_INFO) || '{}'),
|
|
address : JSON.parse(uni.getStorageSync(ADDRESS) || '[]'),
|
|
sessionData : [],
|
|
sessionMsgCount : 0,
|
|
sessionMsgId : '',
|
|
openId : uni.getStorageSync(OPPED_ID) || ''
|
|
},
|
|
mutations:{
|
|
SET_TOKEN (state, token = ''){
|
|
state.token = token;
|
|
uni.setStorageSync(TOKEN, token);
|
|
},
|
|
SET_USER_INFO (state, userInfo = {}){
|
|
state.userInfo = userInfo;
|
|
uni.setStorageSync(USER_INFO, JSON.stringify(userInfo));
|
|
},
|
|
SET_ADDRESS (state, address = []){
|
|
state.address = address;
|
|
uni.setStorageSync(ADDRESS, JSON.stringify(address));
|
|
},
|
|
SET_SESSION_DATA (state, data){
|
|
state.sessionData = data ;
|
|
},
|
|
SET_SESSION_MSG_COUNT (state, data){
|
|
state.sessionMsgCount = data;
|
|
},
|
|
SET_OPEN_ID (state, data){
|
|
state.openId = data;
|
|
uni.setStorageSync(OPPED_ID, data);
|
|
},
|
|
SET_SESSION_MSG_ID (state, data){
|
|
state.sessionMsgId = data;
|
|
}
|
|
},
|
|
actions : {
|
|
|
|
}
|
|
}) |