更新任务列表等
This commit is contained in:
@@ -7,14 +7,15 @@ let isConnect = false
|
||||
const getDefaultState = () => {
|
||||
return {
|
||||
reconnections: 0,
|
||||
taskList: []
|
||||
}
|
||||
}
|
||||
|
||||
const state = getDefaultState()
|
||||
|
||||
const mutations = {
|
||||
set_client_id: (state, client_id) => {
|
||||
state.client_id = client_id
|
||||
setData: (state, obj) => {
|
||||
state[obj.name] = obj.data
|
||||
},
|
||||
}
|
||||
|
||||
@@ -43,8 +44,10 @@ const actions = {
|
||||
// 接收消息
|
||||
websocketonmessage({ commit, dispatch }, e) {
|
||||
const data = JSON.parse(e.data) // 转json对象
|
||||
if (data.state) {
|
||||
|
||||
if (data.resp_name) {
|
||||
if (data.resp_name === 'task_list') {
|
||||
commit('chat/setData', { name: 'taskList', data: data.resp_info.task_list })
|
||||
}
|
||||
} else {
|
||||
if (data.type === 'init') {
|
||||
state.pingNum = 0
|
||||
|
||||
Reference in New Issue
Block a user