|
|
@ -2,7 +2,7 @@
|
|
|
|
* @Author: ch
|
|
|
|
* @Author: ch
|
|
|
|
* @Date: 2022-03-22 18:28:52
|
|
|
|
* @Date: 2022-03-22 18:28:52
|
|
|
|
* @LastEditors: ch
|
|
|
|
* @LastEditors: ch
|
|
|
|
* @LastEditTime: 2022-05-21 11:38:51
|
|
|
|
* @LastEditTime: 2022-06-10 16:51:08
|
|
|
|
* @Description: file content
|
|
|
|
* @Description: file content
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
import Vue from 'vue'
|
|
|
|
import Vue from 'vue'
|
|
|
@ -17,16 +17,19 @@ const
|
|
|
|
// 地址列表
|
|
|
|
// 地址列表
|
|
|
|
ADDRESS = 'ads',
|
|
|
|
ADDRESS = 'ads',
|
|
|
|
// oppenId
|
|
|
|
// oppenId
|
|
|
|
OPPED_ID = 'oi';
|
|
|
|
OPPED_ID = 'oi',
|
|
|
|
|
|
|
|
// 每个浏览器创建一个UUID作为同一个用户的标识
|
|
|
|
|
|
|
|
UUID = 'uid';;
|
|
|
|
|
|
|
|
|
|
|
|
export default new Vuex.Store({
|
|
|
|
export default new Vuex.Store({
|
|
|
|
state : {
|
|
|
|
state : {
|
|
|
|
token : uni.getStorageSync(TOKEN) || '',
|
|
|
|
token : uni.getStorageSync(TOKEN) || '',
|
|
|
|
userInfo : JSON.parse(uni.getStorageSync(USER_INFO) || '{}'),
|
|
|
|
userInfo : JSON.parse(uni.getStorageSync(USER_INFO) || '{}'),
|
|
|
|
address : JSON.parse(uni.getStorageSync(ADDRESS) || '[]'),
|
|
|
|
address : JSON.parse(uni.getStorageSync(ADDRESS) || '[]'),
|
|
|
|
|
|
|
|
openId : uni.getStorageSync(OPPED_ID) || '',
|
|
|
|
|
|
|
|
uuid : uni.getStorageSync(UUID) || '',
|
|
|
|
imData : [],
|
|
|
|
imData : [],
|
|
|
|
imMsgCount : 0,
|
|
|
|
imMsgCount : 0
|
|
|
|
openId : uni.getStorageSync(OPPED_ID) || ''
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
mutations:{
|
|
|
|
mutations:{
|
|
|
|
SET_TOKEN (state, token = ''){
|
|
|
|
SET_TOKEN (state, token = ''){
|
|
|
@ -41,15 +44,19 @@ export default new Vuex.Store({
|
|
|
|
state.address = address;
|
|
|
|
state.address = address;
|
|
|
|
uni.setStorageSync(ADDRESS, JSON.stringify(address));
|
|
|
|
uni.setStorageSync(ADDRESS, JSON.stringify(address));
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
SET_UUID (state, uid){
|
|
|
|
|
|
|
|
state.uuid = uid;
|
|
|
|
|
|
|
|
uni.setStorageSync(UUID, uid);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
SET_OPEN_ID (state, data){
|
|
|
|
|
|
|
|
state.openId = data;
|
|
|
|
|
|
|
|
uni.setStorageSync(OPPED_ID, data);
|
|
|
|
|
|
|
|
},
|
|
|
|
SET_IM_DATA (state, data){
|
|
|
|
SET_IM_DATA (state, data){
|
|
|
|
state.imData = data ;
|
|
|
|
state.imData = data ;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
SET_IM_MSG_COUNT (state, data){
|
|
|
|
SET_IM_MSG_COUNT (state, data){
|
|
|
|
state.imMsgCount = data;
|
|
|
|
state.imMsgCount = data;
|
|
|
|
},
|
|
|
|
|
|
|
|
SET_OPEN_ID (state, data){
|
|
|
|
|
|
|
|
state.openId = data;
|
|
|
|
|
|
|
|
uni.setStorageSync(OPPED_ID, data);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
actions : {
|
|
|
|
actions : {
|
|
|
|