From 2d80b2f2ac99219ff230b510c58139030f139d1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=96=87=E5=8F=AF?= <1041367524@qq.com> Date: Tue, 7 Jun 2022 15:34:13 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20IM=E4=B8=AD=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/im/index.js | 105 ++++++++++++++ src/store/modules/im/chatStore.js | 78 +++++++++++ src/store/modules/im/chatSystem.js | 73 ++++++++++ src/store/modules/im/chatWaiter.js | 78 +++++++++++ src/store/modules/im/im.js | 83 +++++++++++ src/store/modules/system/notify.js | 2 +- src/views/im/home/index.vue | 7 + src/views/im/store/index.vue | 190 +++++++++++++++++++++++++ src/views/im/system/index.vue | 164 ++++++++++++++++++++++ src/views/im/waiter/index.vue | 216 +++++++++++++++++++++++++++++ vite.config.js | 4 +- 11 files changed, 997 insertions(+), 3 deletions(-) create mode 100644 src/api/im/index.js create mode 100644 src/store/modules/im/chatStore.js create mode 100644 src/store/modules/im/chatSystem.js create mode 100644 src/store/modules/im/chatWaiter.js create mode 100644 src/store/modules/im/im.js create mode 100644 src/views/im/home/index.vue create mode 100644 src/views/im/store/index.vue create mode 100644 src/views/im/system/index.vue create mode 100644 src/views/im/waiter/index.vue diff --git a/src/api/im/index.js b/src/api/im/index.js new file mode 100644 index 0000000..aa51360 --- /dev/null +++ b/src/api/im/index.js @@ -0,0 +1,105 @@ +import request from '@/utils/request.js'; +export const online = () => { + return request({ + url: '/im/admin/count/online', + method: 'get', + }); +}; +export const hours = (params) => { + return request({ + url: '/im/admin/count/hoursMessage', + method: 'get', + params, + }); +}; +export const days = (params) => { + return request({ + url: '/im/admin/count/daysMessage', + method: 'get', + params, + }); +}; +export const searchSystem = (params) => { + return request({ + url: '/im/admin/thirdSystem', + method: 'get', + params, + }); +}; +export const createSystem = (data) => { + return request({ + url: '/im/admin/thirdSystem', + method: 'post', + data, + }); +}; +export const updateSystem = (data) => { + return request({ + url: '/im/admin/thirdSystem', + method: 'put', + data, + }); +}; +export const removeSystem = (data) => { + return request({ + url: '/im/admin/thirdSystem', + method: 'delete', + data, + }); +}; +export const searchStore = (params) => { + return request({ + url: '/im/admin/storeConfig', + method: 'get', + params, + }); +}; +export const createStore = (data) => { + return request({ + url: '/im/admin/storeConfig', + method: 'post', + data, + }); +}; +export const updateStore = (data) => { + return request({ + url: '/im/admin/storeConfig', + method: 'put', + data, + }); +}; +export const removeStore = (data) => { + return request({ + url: '/im/admin/storeConfig', + method: 'delete', + data, + }); +}; +export const searchWaiter = (params) => { + return request({ + url: '/im/admin/waiter', + method: 'get', + params, + }); +}; +export const createWaiter = (data) => { + return request({ + url: '/im/admin/waiter', + method: 'post', + data, + }); +}; +export const updateWaiter = (data) => { + return request({ + url: '/im/admin/waiter', + method: 'put', + data, + }); +}; +export const removeWaiter = (data) => { + return request({ + url: '/im/admin/waiter', + method: 'delete', + data, + }); +}; diff --git a/src/store/modules/im/chatStore.js b/src/store/modules/im/chatStore.js new file mode 100644 index 0000000..48528f4 --- /dev/null +++ b/src/store/modules/im/chatStore.js @@ -0,0 +1,78 @@ +import * as api from '@/api/im/index.js'; +import { ElMessage, ElMessageBox } from '@/plugins/element-plus'; +const state = () => ({ + code: 'ChatStore', + condition: {}, + list: [], + total: 0, + opts: { + init: false, + system: [], + }, +}); +const getters = {}; +const mutations = { + setCode: (state, data) => (state.code = data), + setCondition: (state, data) => (state.condition = data), + setList: (state, data) => (state.list = data), + setTotal: (state, data) => (state.total = data), + setOpts: (state, data) => (state.opts = data), +}; +const actions = { + search: async ({ state, commit, rootGetters }) => { + let data = { ...state.condition }; + let res = await api.searchStore({ ...rootGetters['local/page'](state.code), ...data }); + if (res) { + commit('setList', res.records); + commit('setTotal', res.total); + } else { + ElMessage.error('查询失败'); + commit('setList', []); + } + return res; + }, + load: async ({ commit }) => { + commit('setOpts', { + init: true, + system: (await api.searchSystem({ pageIndex: 1, length: 9999 }))?.records || [], + }); + }, + save: async ({ dispatch }, data) => { + if (data.id) { + data.systemId = data.sysId; + } + let save = data.id ? api.updateStore : api.createStore; + let res = await save(data); + if (res) { + ElMessage.success('保存成功'); + dispatch('search'); + } else { + ElMessage.error('保存失败'); + } + return res; + }, + remove: async ({ dispatch }, ids) => { + if (!ids.length) { + ElMessage.warning('请选择要删除的数据'); + } else { + try { + await ElMessageBox.confirm('数据删除后无法恢复,确定要删除吗?', '危险操作'); + let res = await api.removeStore({ ids }); + if (res) { + ElMessage.success('删除成功'); + dispatch('search'); + } else { + ElMessage.error('删除失败'); + } + } catch (e) { + console.info('取消删除', e); + } + } + }, +}; +export default { + state, + getters, + mutations, + actions, +}; diff --git a/src/store/modules/im/chatSystem.js b/src/store/modules/im/chatSystem.js new file mode 100644 index 0000000..7bc9559 --- /dev/null +++ b/src/store/modules/im/chatSystem.js @@ -0,0 +1,73 @@ +import * as api from '@/api/im/index.js'; +import { ElMessage, ElMessageBox } from '@/plugins/element-plus'; +const state = () => ({ + code: 'ChatSystem', + condition: {}, + list: [], + total: 0, + opts: { + init: false, + }, +}); +const getters = {}; +const mutations = { + setCode: (state, data) => (state.code = data), + setCondition: (state, data) => (state.condition = data), + setList: (state, data) => (state.list = data), + setTotal: (state, data) => (state.total = data), + setOpts: (state, data) => (state.opts = data), +}; +const actions = { + search: async ({ state, commit, rootGetters }) => { + let data = { ...state.condition }; + let res = await api.searchSystem({ ...rootGetters['local/page'](state.code), ...data }); + if (res) { + commit('setList', res.records); + commit('setTotal', res.total); + } else { + ElMessage.error('查询失败'); + commit('setList', []); + } + return res; + }, + load: async ({ commit }) => { + commit('setOpts', { + init: true, + }); + }, + save: async ({ dispatch }, data) => { + let save = data.id ? api.updateSystem : api.createSystem; + let res = await save(data); + if (res) { + ElMessage.success('保存成功'); + dispatch('search'); + } else { + ElMessage.error('保存失败'); + } + return res; + }, + remove: async ({ dispatch }, ids) => { + if (!ids.length) { + ElMessage.warning('请选择要删除的数据'); + } else { + try { + await ElMessageBox.confirm('数据删除后无法恢复,确定要删除吗?', '危险操作'); + let res = await api.removeSystem({ ids }); + if (res) { + ElMessage.success('删除成功'); + dispatch('search'); + } else { + ElMessage.error('删除失败'); + } + } catch (e) { + console.info('取消删除', e); + } + } + }, +}; +export default { + state, + getters, + mutations, + actions, +}; diff --git a/src/store/modules/im/chatWaiter.js b/src/store/modules/im/chatWaiter.js new file mode 100644 index 0000000..9ac965e --- /dev/null +++ b/src/store/modules/im/chatWaiter.js @@ -0,0 +1,78 @@ +import * as api from '@/api/im/index.js'; +import { ElMessage, ElMessageBox } from '@/plugins/element-plus'; +const state = () => ({ + code: 'ChatWaiter', + condition: {}, + list: [], + total: 0, + opts: { + init: false, + system: [], + }, +}); +const getters = {}; +const mutations = { + setCode: (state, data) => (state.code = data), + setCondition: (state, data) => (state.condition = data), + setList: (state, data) => (state.list = data), + setTotal: (state, data) => (state.total = data), + setOpts: (state, data) => (state.opts = data), +}; +const actions = { + search: async ({ state, commit, rootGetters }) => { + let data = { ...state.condition }; + let res = await api.searchWaiter({ ...rootGetters['local/page'](state.code), ...data }); + if (res) { + commit('setList', res.records); + commit('setTotal', res.total); + } else { + ElMessage.error('查询失败'); + commit('setList', []); + } + return res; + }, + load: async ({ commit }) => { + commit('setOpts', { + init: true, + system: (await api.searchSystem({ pageIndex: 1, length: 9999 }))?.records || [], + }); + }, + save: async ({ dispatch }, data) => { + if (data.id) { + data.systemId = data.sysId; + } + let save = data.id ? api.updateWaiter : api.createWaiter; + let res = await save(data); + if (res) { + ElMessage.success('保存成功'); + dispatch('search'); + } else { + ElMessage.error('保存失败'); + } + return res; + }, + remove: async ({ dispatch }, ids) => { + if (!ids.length) { + ElMessage.warning('请选择要删除的数据'); + } else { + try { + await ElMessageBox.confirm('数据删除后无法恢复,确定要删除吗?', '危险操作'); + let res = await api.removeWaiter({ ids }); + if (res) { + ElMessage.success('删除成功'); + dispatch('search'); + } else { + ElMessage.error('删除失败'); + } + } catch (e) { + console.info('取消删除', e); + } + } + }, +}; +export default { + state, + getters, + mutations, + actions, +}; diff --git a/src/store/modules/im/im.js b/src/store/modules/im/im.js new file mode 100644 index 0000000..535c033 --- /dev/null +++ b/src/store/modules/im/im.js @@ -0,0 +1,83 @@ +import * as api from '@/api/system/notify.js'; +import { ElMessage, ElMessageBox } from '@/plugins/element-plus'; +const state = () => ({ + code: 'NotifyManagement', + condition: {}, + list: [], + total: 0, + opts: { + init: false, + }, +}); +const getters = {}; +const mutations = { + setCode: (state, data) => (state.code = data), + setCondition: (state, data) => (state.condition = data), + setList: (state, data) => (state.list = data), + setTotal: (state, data) => (state.total = data), + setOpts: (state, data) => (state.opts = data), +}; +const actions = { + search: async ({ state, commit, rootGetters }) => { + let data = { ...state.condition }; + data.startReleaseTime = data.dateRange?.[0]; + data.endReleaseTime = data.dateRange?.[1]; + delete data.dateRange; + let res = await api.search({ ...rootGetters['local/page'](state.code), ...state.condition }); + if (res) { + commit('setList', res.records); + commit('setTotal', res.total); + } else { + ElMessage.error('查询失败'); + commit('setList', []); + } + return res; + }, + load: async ({ commit }) => { + commit('setOpts', { + init: true, + }); + }, + detail: async (context, id) => { + let res = await api.detail(id); + if (!res) { + ElMessage.error('加载详情失败'); + } + return res; + }, + save: async ({ dispatch }, data) => { + let save = data.id ? api.update : api.create; + let res = await save(data); + if (res) { + ElMessage.success('保存成功'); + dispatch('search'); + } else { + ElMessage.error('保存失败'); + } + return res; + }, + remove: async ({ dispatch }, idList) => { + if (!idList.length) { + ElMessage.warning('请选择要删除的数据'); + } else { + try { + await ElMessageBox.confirm('数据删除后无法恢复,确定要删除吗?', '危险操作'); + let res = await api.remove(idList.join(',')); + if (res) { + ElMessage.success('删除成功'); + dispatch('search'); + } else { + ElMessage.error('删除失败'); + } + } catch (e) { + console.info('取消删除', e); + } + } + }, +}; +export default { + state, + getters, + mutations, + actions, +}; diff --git a/src/store/modules/system/notify.js b/src/store/modules/system/notify.js index 535c033..d4a1d55 100644 --- a/src/store/modules/system/notify.js +++ b/src/store/modules/system/notify.js @@ -23,7 +23,7 @@ const actions = { data.startReleaseTime = data.dateRange?.[0]; data.endReleaseTime = data.dateRange?.[1]; delete data.dateRange; - let res = await api.search({ ...rootGetters['local/page'](state.code), ...state.condition }); + let res = await api.search({ ...rootGetters['local/page'](state.code), ...data }); if (res) { commit('setList', res.records); commit('setTotal', res.total); diff --git a/src/views/im/home/index.vue b/src/views/im/home/index.vue new file mode 100644 index 0000000..914fcd1 --- /dev/null +++ b/src/views/im/home/index.vue @@ -0,0 +1,7 @@ + + + + + diff --git a/src/views/im/store/index.vue b/src/views/im/store/index.vue new file mode 100644 index 0000000..9706e0b --- /dev/null +++ b/src/views/im/store/index.vue @@ -0,0 +1,190 @@ + + + + + diff --git a/src/views/im/system/index.vue b/src/views/im/system/index.vue new file mode 100644 index 0000000..8f29ace --- /dev/null +++ b/src/views/im/system/index.vue @@ -0,0 +1,164 @@ + + + + + diff --git a/src/views/im/waiter/index.vue b/src/views/im/waiter/index.vue new file mode 100644 index 0000000..80e253f --- /dev/null +++ b/src/views/im/waiter/index.vue @@ -0,0 +1,216 @@ + + + + + diff --git a/vite.config.js b/vite.config.js index 611fffc..e61b7e3 100644 --- a/vite.config.js +++ b/vite.config.js @@ -23,9 +23,9 @@ export default (configEnv) => { // target: 'http://192.168.10.109:8090/', // 显雨 // target: 'http://192.168.10.5:4500', // 高玉 // target: 'http://192.168.10.67:8090', // 罗战 - // target: 'http://192.168.10.93:8090', // 周渺 + target: 'http://192.168.10.94:8090', // 周渺 // target: 'http://192.168.10.124:8090', // 舒梦娇 - target: 'https://k8s-horse-gateway.mashibing.cn/', // 测试地址 + // target: 'https://k8s-horse-gateway.mashibing.cn/', // 测试地址 // target: 'https://you-gateway.mashibing.com', // 生产环境 changeOrigin: true, rewrite: (path) => path.replace(/^\/api/, ''), From e2f84193cd83b0824c866923f6935ac685a5295d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=96=87=E5=8F=AF?= <1041367524@qq.com> Date: Wed, 8 Jun 2022 14:33:25 +0800 Subject: [PATCH 2/4] =?UTF-8?q?feat:=20=E6=8E=A5=E5=8F=A3=E5=AF=B9?= =?UTF-8?q?=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/im/chatWaiter.js | 14 ++--- src/utils/request.js | 8 +++ src/views/im/store/index.vue | 22 +++++++- src/views/im/system/index.vue | 1 + src/views/im/waiter/index.vue | 82 +++++++++++++++++++----------- 5 files changed, 89 insertions(+), 38 deletions(-) diff --git a/src/store/modules/im/chatWaiter.js b/src/store/modules/im/chatWaiter.js index 9ac965e..3d4c0d7 100644 --- a/src/store/modules/im/chatWaiter.js +++ b/src/store/modules/im/chatWaiter.js @@ -7,7 +7,7 @@ const state = () => ({ total: 0, opts: { init: false, - system: [], + store: [], }, }); const getters = {}; @@ -34,12 +34,12 @@ const actions = { load: async ({ commit }) => { commit('setOpts', { init: true, - system: (await api.searchSystem({ pageIndex: 1, length: 9999 }))?.records || [], + store: (await api.searchStore({ pageIndex: 1, length: 9999 }))?.records || [], }); }, - save: async ({ dispatch }, data) => { + save: async ({ state, dispatch }, data) => { if (data.id) { - data.systemId = data.sysId; + data.systemId = state.condition.systemid; } let save = data.id ? api.updateWaiter : api.createWaiter; let res = await save(data); @@ -51,13 +51,13 @@ const actions = { } return res; }, - remove: async ({ dispatch }, ids) => { - if (!ids.length) { + remove: async ({ dispatch }, data) => { + if (!data.waiterIds.length) { ElMessage.warning('请选择要删除的数据'); } else { try { await ElMessageBox.confirm('数据删除后无法恢复,确定要删除吗?', '危险操作'); - let res = await api.removeWaiter({ ids }); + let res = await api.removeWaiter(data); if (res) { ElMessage.success('删除成功'); dispatch('search'); diff --git a/src/utils/request.js b/src/utils/request.js index 034ba57..c25c604 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -61,6 +61,14 @@ instance.interceptors.request.use( if (token) { config.headers['Authorization'] = token; } + config.params = Object.fromEntries( + Object.entries(config.params || {}).filter( + (entry) => + entry[1] !== null && + typeof entry[1] !== 'undefined' && + (typeof entry[1] !== 'string' || entry[1].trim() !== '') + ) + ); if (config.data && config.headers['Content-Type'] === 'application/x-www-form-urlencoded;charset=UTF-8') { config.data = qs.stringify(config.data); } diff --git a/src/views/im/store/index.vue b/src/views/im/store/index.vue index 9706e0b..cf7cf76 100644 --- a/src/views/im/store/index.vue +++ b/src/views/im/store/index.vue @@ -26,7 +26,13 @@ - + store.state.chatStore.code); @@ -145,6 +152,14 @@ rows.map((item) => item.id) ); }; + const handleWaiter = (row) => { + router.push({ + name: 'ChatWaiter', + query: { + storeId: row.id, + }, + }); + }; const config = reactive({ // 表格列配置 columns: [ @@ -169,19 +184,22 @@ { label: '操作', fixed: 'right', + width: 160, slots: { default: ({ row }) => (
handleCreate(row)}> 编辑 + handleWaiter(row)}> + 客服 + handleRemove([row])}> 删除
), }, - width: 120, }, ], }); diff --git a/src/views/im/system/index.vue b/src/views/im/system/index.vue index 8f29ace..ec1496a 100644 --- a/src/views/im/system/index.vue +++ b/src/views/im/system/index.vue @@ -16,6 +16,7 @@ - - + + - + - + @@ -78,35 +84,50 @@ } const state = reactive({ condition: { - systemId: null, + storeId: null, waiterId: null, waiterNickname: null, }, }); const handleReset = () => { state.condition = { - systemId: null, + storeId: null, waiterId: null, waiterNickname: null, }; }; const handleSearch = async () => { - loading.value = true; - await store.dispatch('chatWaiter/search'); - loading.value = false; + if (state.condition.storeId) { + loading.value = true; + await store.dispatch('chatWaiter/search'); + loading.value = false; + } }; + watch( + () => unref(opts).store, + (value) => { + if (!state.condition.storeId) { + state.condition.storeId = value[0]?.id; + } + } + ); watch( () => state.condition, (value) => { store.commit('chatWaiter/setCondition', _.cloneDeep(value)); - handleSearch(); }, { immediate: true, deep: true } ); + watch( + () => state.condition.storeId, + () => { + handleSearch(); + } + ); onActivated(() => { - let sysId = route.query.sysId; - if (sysId) { - state.condition.sysId = +sysId; + let storeId = route.query.storeId; + if (storeId) { + state.condition.storeId = +storeId; } else { handleSearch(); } @@ -119,14 +140,14 @@ submitting: false, form: { id: null, - systemId: null, - type: 0, + storeId: null, + type: null, waiterAvatar: null, waiterId: null, waiterNickname: null, }, rules: { - systemId: [{ required: true, message: '所属系统不能为空' }], + storeId: [{ required: true, message: '所属店铺不能为空' }], type: [{ required: true, message: '客服类型不能为空' }], waiterAvatar: [{ required: true, message: '客服头像不能为空' }], waiterId: [{ required: true, message: '客服ID不能为空' }], @@ -139,13 +160,16 @@ formState.form, row || { id: null, - systemId: null, - type: 0, + storeId: null, + type: null, waiterAvatar: null, waiterId: null, waiterNickname: null, } ); + if (!formState.form.storeId) { + formState.form.storeId = state.condition.storeId; + } formState.formVisible = true; }; // 保存 @@ -162,19 +186,19 @@ formState.submitting = false; }; const handleRemove = async (rows) => { - store.dispatch( - 'chatWaiter/remove', - rows.map((item) => item.id) - ); + store.dispatch('chatWaiter/remove', { + storeId: state.condition.storeId, + waiterIds: rows.map((item) => item.waiterId), + }); }; const config = reactive({ // 表格列配置 columns: [ { - label: '所属系统', + label: '所属店铺', width: 160, slots: { - default: ({ row }) => proxy.$dict(unref(opts).system, row.sysId, { label: 'name', value: 'id' }), + default: ({ row }) => proxy.$dict(unref(opts).store, row.storeId, { label: 'name', value: 'id' }), }, }, { From 56a45fb9bfdbe724e920b34a3451c49fe6cd94d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=96=87=E5=8F=AF?= <1041367524@qq.com> Date: Wed, 8 Jun 2022 15:27:03 +0800 Subject: [PATCH 3/4] =?UTF-8?q?feat:=20=E9=A6=96=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/im/index.js | 3 +- src/store/modules/im/chatHome.js | 45 +++++++++++ src/views/im/home/index.vue | 125 ++++++++++++++++++++++++++++++- 3 files changed, 169 insertions(+), 4 deletions(-) create mode 100644 src/store/modules/im/chatHome.js 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 @@ - + + + From ffe1bb7690a30e756658427751df84b62ab5f1b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=96=87=E5=8F=AF?= <1041367524@qq.com> Date: Wed, 8 Jun 2022 16:56:03 +0800 Subject: [PATCH 4/4] =?UTF-8?q?feat:=20=E6=8E=A5=E5=8F=A3=E5=AF=B9?= =?UTF-8?q?=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/im/chatHome.js | 2 +- src/views/im/home/index.vue | 122 ++++++++++++++++++++++++++++--- 2 files changed, 113 insertions(+), 11 deletions(-) diff --git a/src/store/modules/im/chatHome.js b/src/store/modules/im/chatHome.js index 81a9909..8f12d1e 100644 --- a/src/store/modules/im/chatHome.js +++ b/src/store/modules/im/chatHome.js @@ -15,7 +15,7 @@ const actions = { loadOnline: async ({ commit }, data) => { let res = await api.online(data); commit('setOnline', res || 0); - if (!res) { + if (!res && res !== 0) { ElMessage.error('查询失败'); } return res; diff --git a/src/views/im/home/index.vue b/src/views/im/home/index.vue index 125e29f..5029b89 100644 --- a/src/views/im/home/index.vue +++ b/src/views/im/home/index.vue @@ -2,7 +2,12 @@
- + {{ online }} @@ -33,6 +38,8 @@