10 changed files with 54 additions and 115 deletions
@ -1,33 +0,0 @@ |
|||
import Vue from 'vue'; |
|||
import Vuex from 'vuex'; |
|||
import chatStore from './chatStore.js'; |
|||
import friendStore from './friendStore.js'; |
|||
import userStore from './userStore.js'; |
|||
import groupStore from './groupStore.js'; |
|||
import configStore from './configStore.js'; |
|||
import uiStore from './uiStore.js'; |
|||
|
|||
Vue.use(Vuex) |
|||
|
|||
export default new Vuex.Store({ |
|||
modules: { chatStore, friendStore, userStore, groupStore, configStore, uiStore }, |
|||
state: {}, |
|||
mutations: { |
|||
}, |
|||
actions: { |
|||
load(context) { |
|||
return this.dispatch("loadUser").then(() => { |
|||
const promises = []; |
|||
promises.push(this.dispatch("loadFriend")); |
|||
promises.push(this.dispatch("loadGroup")); |
|||
promises.push(this.dispatch("loadChat")); |
|||
promises.push(this.dispatch("loadConfig")); |
|||
return Promise.all(promises); |
|||
}) |
|||
}, |
|||
unload(context) { |
|||
context.commit("clear"); |
|||
} |
|||
}, |
|||
strict: process.env.NODE_ENV !== 'production' |
|||
}) |
|||
@ -1,42 +0,0 @@ |
|||
import { defineStore } from 'pinia'; |
|||
export default defineStore('groupStore', { |
|||
state: () => { |
|||
return { |
|||
userInfo: { // 用户信息窗口
|
|||
show: false, |
|||
user: {}, |
|||
pos: { |
|||
x: 0, |
|||
y: 0 |
|||
} |
|||
}, |
|||
fullImage: { // 全屏大图
|
|||
show: false, |
|||
url: "" |
|||
} |
|||
} |
|||
}, |
|||
actions: { |
|||
showUserInfoBox(state, user) { |
|||
state.userInfo.show = true; |
|||
state.userInfo.user = user; |
|||
|
|||
}, |
|||
setUserInfoBoxPos(state, pos) { |
|||
let w = document.documentElement.clientWidth; |
|||
let h = document.documentElement.clientHeight; |
|||
state.userInfo.pos.x = Math.min(pos.x, w - 350); |
|||
state.userInfo.pos.y = Math.min(pos.y, h - 200); |
|||
}, |
|||
closeUserInfoBox(state) { |
|||
state.userInfo.show = false; |
|||
}, |
|||
showFullImageBox(state, url) { |
|||
state.fullImage.show = true; |
|||
state.fullImage.url = url; |
|||
}, |
|||
closeFullImageBox(state) { |
|||
state.fullImage.show = false; |
|||
} |
|||
} |
|||
}) |
|||
Loading…
Reference in new issue