diff --git a/src/api/im/index.js b/src/api/im/index.js
index aa51360..52f51f7 100644
--- a/src/api/im/index.js
+++ b/src/api/im/index.js
@@ -1,8 +1,9 @@
import request from '@/utils/request.js';
-export const online = () => {
+export const online = (params) => {
return request({
url: '/im/admin/count/online',
method: 'get',
+ params,
});
};
export const hours = (params) => {
diff --git a/src/store/modules/im/chatHome.js b/src/store/modules/im/chatHome.js
new file mode 100644
index 0000000..81a9909
--- /dev/null
+++ b/src/store/modules/im/chatHome.js
@@ -0,0 +1,45 @@
+import * as api from '@/api/im/index.js';
+import { ElMessage } from '@/plugins/element-plus';
+const state = () => ({
+ online: 0,
+ single: [],
+ range: [],
+});
+const getters = {};
+const mutations = {
+ setOnline: (state, data) => (state.online = data),
+ setSingle: (state, data) => (state.single = data),
+ setRange: (state, data) => (state.range = data),
+};
+const actions = {
+ loadOnline: async ({ commit }, data) => {
+ let res = await api.online(data);
+ commit('setOnline', res || 0);
+ if (!res) {
+ ElMessage.error('查询失败');
+ }
+ return res;
+ },
+ loadSingle: async ({ commit }, data) => {
+ let res = await api.hours(data);
+ commit('setSingle', res || []);
+ if (!res) {
+ ElMessage.error('查询失败');
+ }
+ return res;
+ },
+ loadRange: async ({ commit }, data) => {
+ let res = await api.days(data);
+ commit('setRange', res || []);
+ if (!res) {
+ ElMessage.error('查询失败');
+ }
+ return res;
+ },
+};
+export default {
+ state,
+ getters,
+ mutations,
+ actions,
+};
diff --git a/src/views/im/home/index.vue b/src/views/im/home/index.vue
index 914fcd1..125e29f 100644
--- a/src/views/im/home/index.vue
+++ b/src/views/im/home/index.vue
@@ -1,7 +1,126 @@
- 在线人数
+
+
+
+
+
+
+
{{ online }}
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+