From c99ceeaa165b4964bd476a8f2f3265164701eeba Mon Sep 17 00:00:00 2001 From: kuaifan Date: Sat, 12 Jun 2021 21:32:13 +0800 Subject: [PATCH] no message --- app/Models/ProjectTask.php | 4 +- resources/assets/js/components/ImgUpload.vue | 4 +- resources/assets/js/components/UserInput.vue | 4 +- resources/assets/js/pages/login.vue | 8 +- resources/assets/js/pages/manage.vue | 4 +- .../js/pages/manage/components/DialogView.vue | 2 +- .../pages/manage/components/DialogWrapper.vue | 4 +- .../pages/manage/components/ProjectList.vue | 90 +++----- .../pages/manage/components/TaskAddSimple.vue | 4 +- .../js/pages/manage/components/TaskRow.vue | 4 +- .../assets/js/pages/manage/messenger.vue | 4 +- .../js/pages/manage/setting/password.vue | 4 +- .../js/pages/manage/setting/personal.vue | 4 +- .../js/pages/manage/setting/priority.vue | 4 +- .../assets/js/pages/manage/setting/system.vue | 4 +- resources/assets/js/store/actions.js | 197 ++++++++++++------ 16 files changed, 188 insertions(+), 157 deletions(-) diff --git a/app/Models/ProjectTask.php b/app/Models/ProjectTask.php index d0b90b2f..d8988592 100644 --- a/app/Models/ProjectTask.php +++ b/app/Models/ProjectTask.php @@ -460,7 +460,7 @@ class ProjectTask extends AbstractModel $this->archived_at = $archived_at; } $this->save(); - return Base::retSuccess('修改成功'); + return Base::retSuccess('修改成功', $this->toArray()); }); } @@ -472,7 +472,7 @@ class ProjectTask extends AbstractModel { return AbstractModel::transaction(function () { $this->delete(); - return Base::retSuccess('删除成功'); + return Base::retSuccess('删除成功', $this->toArray()); }); } } diff --git a/resources/assets/js/components/ImgUpload.vue b/resources/assets/js/components/ImgUpload.vue index af03145c..69258c03 100755 --- a/resources/assets/js/components/ImgUpload.vue +++ b/resources/assets/js/components/ImgUpload.vue @@ -290,14 +290,14 @@ this.$store.dispatch("call", { url: 'system/imgview', data: {path: path ? path : ''}, - }).then((data, msg) => { + }).then(({data}) => { this.isLoading = false; let dirs = data['dirs']; for (let i = 0; i < dirs.length; i++) { this.browseList.push(dirs[i]); } this.browsePictureFor(data['files']); - }).catch((data, msg) => { + }).catch(({msg}) => { this.isLoading = false; this.browseVisible = false; $A.noticeWarning(msg); diff --git a/resources/assets/js/components/UserInput.vue b/resources/assets/js/components/UserInput.vue index 5f50c893..24724d0c 100755 --- a/resources/assets/js/components/UserInput.vue +++ b/resources/assets/js/components/UserInput.vue @@ -150,10 +150,10 @@ }, take: 30 }, - }).then((data, msg) => { + }).then(({data}) => { this.loading = false; this.lists = data; - }).catch((data, msg) => { + }).catch(({msg}) => { this.loading = false; this.lists = []; $A.messageWarning(msg); diff --git a/resources/assets/js/pages/login.vue b/resources/assets/js/pages/login.vue index f996aed5..b53d586d 100644 --- a/resources/assets/js/pages/login.vue +++ b/resources/assets/js/pages/login.vue @@ -52,11 +52,11 @@ export default { data: { email: this.email, }, - }).then((data, msg) => { + }).then(() => { this.loadIng--; this.reCode(); this.codeNeed = true; - }).catch((data, msg) => { + }).catch(() => { this.loadIng--; this.codeNeed = false; }); @@ -78,11 +78,11 @@ export default { password: this.password, code: this.code, }, - }).then((data, msg) => { + }).then(({data}) => { this.loadIng--; this.$store.dispatch('saveUserInfo', data); this.goNext(); - }).catch((data, msg) => { + }).catch(({data, msg}) => { this.loadIng--; $A.noticeError(msg); if (data.code === 'need') { diff --git a/resources/assets/js/pages/manage.vue b/resources/assets/js/pages/manage.vue index 622285e9..ad1d3836 100644 --- a/resources/assets/js/pages/manage.vue +++ b/resources/assets/js/pages/manage.vue @@ -273,7 +273,7 @@ export default { this.$store.dispatch("call", { url: 'project/add', data: this.addData, - }).then((data, msg) => { + }).then(({data, msg}) => { this.loadIng--; $A.messageSuccess(msg); this.addShow = false; @@ -281,7 +281,7 @@ export default { this.$set(this.addData, 'template', 0); this.$store.dispatch('saveProject', data); this.toggleRoute('project/' + data.id) - }).catch((data, msg) => { + }).catch(({msg}) => { this.loadIng--; $A.modalError(msg); }); diff --git a/resources/assets/js/pages/manage/components/DialogView.vue b/resources/assets/js/pages/manage/components/DialogView.vue index 03438687..328a580e 100644 --- a/resources/assets/js/pages/manage/components/DialogView.vue +++ b/resources/assets/js/pages/manage/components/DialogView.vue @@ -105,7 +105,7 @@ export default { data: { msg_id: this.msgData.id, }, - }).then((data, msg) => { + }).then(({data}) => { this.read_list = data; }); }, diff --git a/resources/assets/js/pages/manage/components/DialogWrapper.vue b/resources/assets/js/pages/manage/components/DialogWrapper.vue index d716e397..41e89e79 100644 --- a/resources/assets/js/pages/manage/components/DialogWrapper.vue +++ b/resources/assets/js/pages/manage/components/DialogWrapper.vue @@ -123,9 +123,9 @@ export default { dialog_id: this.dialogId, text: this.msgText, }, - }).then((data, msg) => { + }).then(({data}) => { this.$store.dispatch('dialogMsgSplice', {id: tempId, data}); - }).catch((data, msg) => { + }).catch(({msg}) => { $A.modalWarning({ title: '发送失败', content: msg diff --git a/resources/assets/js/pages/manage/components/ProjectList.vue b/resources/assets/js/pages/manage/components/ProjectList.vue index 62361e95..6cd56ef1 100644 --- a/resources/assets/js/pages/manage/components/ProjectList.vue +++ b/resources/assets/js/pages/manage/components/ProjectList.vue @@ -577,10 +577,10 @@ export default { sort: this.sortData, only_column: only_column === true ? 1 : 0 }, - }).then((data, msg) => { + }).then(({msg}) => { this.sortDisabled = false; $A.messageSuccess(msg); - }).catch((data, msg) => { + }).catch(({msg}) => { this.sortDisabled = false; this.$store.dispatch('projectDetail', this.projectDetail.id); $A.modalError(msg); @@ -593,7 +593,7 @@ export default { url: 'project/task/add', data: this.addData, method: 'post', - }).then((data, msg) => { + }).then(({data, msg}) => { this.taskLoad--; $A.messageSuccess(msg); this.addShow = false; @@ -608,7 +608,7 @@ export default { }; this.$store.dispatch('projectOne', data.project_id); this.addTaskSuccess(data) - }).catch((data, msg) => { + }).catch(({msg}) => { this.taskLoad--; $A.modalError(msg); }); @@ -669,11 +669,11 @@ export default { project_id: this.projectDetail.id, name: name, }, - }).then((data, msg) => { + }).then(({data, msg}) => { $A.messageSuccess(msg); this.addColumnName = ''; this.projectDetail.project_column.push(data) - }).catch((data, msg) => { + }).catch(({msg}) => { $A.modalError(msg, 301); }); }, @@ -724,12 +724,12 @@ export default { data: Object.assign(updata, { column_id: column.id, }), - }).then((data, msg) => { + }).then(({data}) => { this.$set(column, 'loading', false); Object.keys(data).forEach(key => { this.$set(column, key, data[key]); }); - }).catch((data, msg) => { + }).catch(({msg}) => { this.$set(column, 'loading', false); Object.keys(updata).forEach(key => { this.$set(column, key, backup[key]); @@ -754,7 +754,7 @@ export default { data: { column_id: column.id, }, - }).then((data, msg) => { + }).then(({msg}) => { this.$set(column, 'loading', false); this.$Modal.remove(); $A.messageSuccess(msg); @@ -763,7 +763,7 @@ export default { this.projectDetail.project_column.splice(index, 1); } this.$store.dispatch('projectDetail', this.projectDetail.id); - }).catch((data, msg) => { + }).catch(({msg}) => { this.$set(column, 'loading', false); this.$Modal.remove(); $A.modalError(msg, 301); @@ -818,32 +818,14 @@ export default { } this.$set(task, 'loading', true); // - const backup = $A.cloneJSON(task); - Object.keys(updata).forEach(key => { - this.$set(task, key, updata[key]); - }); - this.$store.dispatch("call", { - url: 'project/task/update', - data: Object.assign(updata, { - task_id: task.id, - }), - method: 'post', - }).then((data, msg) => { + Object.keys(updata).forEach(key => this.$set(task, key, updata[key])); + this.$store.dispatch("taskUpdate", Object.assign(updata, { + task_id: task.id, + })).then(({data}) => { this.$set(task, 'loading', false); - Object.keys(data).forEach(key => { - this.$set(task, key, data[key]); - }); - if (data.parent_id) { - this.$store.dispatch('taskOne', data.parent_id); - } - if (typeof updata.complete_at !== "undefined") { - this.$store.dispatch('projectOne', data.project_id); - } - }).catch((data, msg) => { + Object.keys(data).forEach(key => this.$set(task, key, data[key])); + }).catch(({msg}) => { this.$set(task, 'loading', false); - Object.keys(updata).forEach(key => { - this.$set(task, key, backup[key]); - }); $A.modalError(msg); }); }, @@ -853,23 +835,13 @@ export default { return; } this.$set(task, 'loading', true); - this.$store.dispatch("call", { - url: 'project/task/' + type, - data: { - task_id: task.id, - }, - }).then((data, msg) => { + this.$store.dispatch("taskArchivedOrRemove", { + id: task.id, + type: type, + }).then(({msg}) => { this.$Modal.remove(); $A.messageSuccess(msg); - let column = this.projectDetail.project_column.find(({id}) => id === task.column_id); - if (column) { - let index = column.project_task.findIndex(({id}) => id === task.id); - if (index > -1) { - column.project_task.splice(index, 1); - } - } - this.$store.dispatch('projectDetail', this.projectDetail.id); - }).catch((data, msg) => { + }).catch(({msg}) => { this.$Modal.remove(); $A.modalError(msg, 301); }); @@ -880,12 +852,12 @@ export default { this.$store.dispatch("call", { url: 'project/edit', data: this.settingData, - }).then((data, msg) => { + }).then(({data, msg}) => { this.settingLoad--; $A.messageSuccess(msg); this.settingShow = false; this.$store.dispatch("saveProject", data) - }).catch((data, msg) => { + }).catch(({msg}) => { this.settingLoad--; $A.modalError(msg); }); @@ -899,12 +871,12 @@ export default { project_id: this.userData.project_id, userid: this.userData.userids, }, - }).then((data, msg) => { + }).then(({msg}) => { this.userLoad--; $A.messageSuccess(msg); this.$store.dispatch('projectDetail', this.userData.project_id); this.userShow = false; - }).catch((data, msg) => { + }).catch(({msg}) => { this.userLoad--; $A.modalError(msg); }); @@ -918,12 +890,12 @@ export default { project_id: this.transferData.project_id, owner_userid: this.transferData.owner_userid[0], }, - }).then((data, msg) => { + }).then(({msg}) => { this.transferLoad--; $A.messageSuccess(msg); this.$store.dispatch('projectDetail', this.transferData.project_id); this.transferShow = false; - }).catch((data, msg) => { + }).catch(({msg}) => { this.transferLoad--; $A.modalError(msg); }); @@ -940,7 +912,7 @@ export default { data: { project_id: this.projectDetail.id, }, - }).then((data, msg) => { + }).then(({msg}) => { this.$Modal.remove(); $A.messageSuccess(msg); this.$store.dispatch('removeProject', this.projectDetail.id); @@ -950,7 +922,7 @@ export default { } else { this.goForward({path: '/manage/dashboard'}, true); } - }).catch((data, msg) => { + }).catch(({msg}) => { this.$Modal.remove(); $A.modalError(msg, 301); }); @@ -969,7 +941,7 @@ export default { data: { project_id: this.projectDetail.id, }, - }).then((data, msg) => { + }).then(({msg}) => { this.$Modal.remove(); $A.messageSuccess(msg); this.$store.dispatch('removeProject', this.projectDetail.id); @@ -979,7 +951,7 @@ export default { } else { this.goForward({path: '/manage/dashboard'}, true); } - }).catch((data, msg) => { + }).catch(({msg}) => { this.$Modal.remove(); $A.modalError(msg, 301); }); diff --git a/resources/assets/js/pages/manage/components/TaskAddSimple.vue b/resources/assets/js/pages/manage/components/TaskAddSimple.vue index 9ed035e5..43dd29a7 100644 --- a/resources/assets/js/pages/manage/components/TaskAddSimple.vue +++ b/resources/assets/js/pages/manage/components/TaskAddSimple.vue @@ -155,7 +155,7 @@ export default { url: 'project/task/add', data: this.getData(), method: 'post', - }).then((data, msg) => { + }).then(({data, msg}) => { this.loadIng--; $A.messageSuccess(msg); this.active = false; @@ -170,7 +170,7 @@ export default { } this.$store.dispatch('projectOne', data.project_id); this.$emit("on-success", data) - }).catch((data, msg) => { + }).catch(({msg}) => { this.loadIng--; $A.modalError(msg); }); diff --git a/resources/assets/js/pages/manage/components/TaskRow.vue b/resources/assets/js/pages/manage/components/TaskRow.vue index 2a279cfe..70eec4ed 100644 --- a/resources/assets/js/pages/manage/components/TaskRow.vue +++ b/resources/assets/js/pages/manage/components/TaskRow.vue @@ -158,11 +158,11 @@ export default { return; } this.$set(task, 'loading', true); - this.$store.dispatch("subTask", task.id).then((data, msg) => { + this.$store.dispatch("subTask", task.id).then(({data}) => { this.$set(task, 'loading', false); this.$set(task, 'sub_list', data); this.$set(task, 'sub_open', true); - }).catch((data, msg) => { + }).catch(({msg}) => { this.$set(task, 'loading', false); $A.modalError(msg); }); diff --git a/resources/assets/js/pages/manage/messenger.vue b/resources/assets/js/pages/manage/messenger.vue index a6ed4a74..6d6b0576 100644 --- a/resources/assets/js/pages/manage/messenger.vue +++ b/resources/assets/js/pages/manage/messenger.vue @@ -148,7 +148,7 @@ export default { data: { take: 50 }, - }).then((data, msg) => { + }).then(({data}) => { this.contactsLoad--; data.some((user) => { if (user.userid === this.userId) { @@ -164,7 +164,7 @@ export default { this.contactsLists[az].push(user); } }); - }).catch((data, msg) => { + }).catch(() => { this.contactsLoad--; }); }, diff --git a/resources/assets/js/pages/manage/setting/password.vue b/resources/assets/js/pages/manage/setting/password.vue index e684c878..d2f7f9fa 100644 --- a/resources/assets/js/pages/manage/setting/password.vue +++ b/resources/assets/js/pages/manage/setting/password.vue @@ -82,12 +82,12 @@ export default { this.$store.dispatch("call", { url: 'users/editpass', data: this.formDatum, - }).then((data, msg) => { + }).then(({data}) => { this.loadIng--; $A.messageSuccess('修改成功'); this.$store.dispatch('saveUserInfo', data); this.$refs.formDatum.resetFields(); - }).catch((data, msg) => { + }).catch(({msg}) => { this.loadIng--; $A.modalError(msg); }); diff --git a/resources/assets/js/pages/manage/setting/personal.vue b/resources/assets/js/pages/manage/setting/personal.vue index 7cd52e9d..1c55ead7 100644 --- a/resources/assets/js/pages/manage/setting/personal.vue +++ b/resources/assets/js/pages/manage/setting/personal.vue @@ -75,11 +75,11 @@ export default { this.$store.dispatch("call", { url: 'users/editdata', data: this.formDatum, - }).then((data, msg) => { + }).then(() => { this.loadIng--; $A.messageSuccess('修改成功'); this.$store.dispatch('userInfo'); - }).catch((data, msg) => { + }).catch(({msg}) => { this.loadIng--; $A.modalError(msg); }); diff --git a/resources/assets/js/pages/manage/setting/priority.vue b/resources/assets/js/pages/manage/setting/priority.vue index 5bbd0ca4..6f27c94c 100644 --- a/resources/assets/js/pages/manage/setting/priority.vue +++ b/resources/assets/js/pages/manage/setting/priority.vue @@ -96,7 +96,7 @@ export default { data: { list: this.formDatum }, - }).then((data, msg) => { + }).then(({data}) => { this.loadIng--; this.$store.state.taskPriority = $A.cloneJSON(data); this.formDatum = data; @@ -107,7 +107,7 @@ export default { if (save) { $A.messageSuccess('修改成功'); } - }).catch((data, msg) => { + }).catch(({msg}) => { this.loadIng--; if (save) { $A.modalError(msg); diff --git a/resources/assets/js/pages/manage/setting/system.vue b/resources/assets/js/pages/manage/setting/system.vue index 6b022460..b27ce8d6 100644 --- a/resources/assets/js/pages/manage/setting/system.vue +++ b/resources/assets/js/pages/manage/setting/system.vue @@ -54,14 +54,14 @@ export default { this.$store.dispatch("call", { url: 'system/setting?type=' + (save ? 'save' : 'get'), data: this.formDatum, - }).then((data, msg) => { + }).then(({data}) => { this.loadIng--; this.formDatum = data; this.formDatum_bak = $A.cloneJSON(this.formDatum); if (save) { $A.messageSuccess('修改成功'); } - }).catch((data, msg) => { + }).catch(({msg}) => { this.loadIng--; if (save) { $A.modalError(msg); diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js index 41098c67..70ab6a4d 100644 --- a/resources/assets/js/store/actions.js +++ b/resources/assets/js/store/actions.js @@ -40,7 +40,8 @@ export default { // params.success = (result, status, xhr) => { if (!state.method.isJson(result)) { - resolve(result, status, xhr); + console.log(result, status, xhr); + reject({data: {}, msg: "Return error"}) return; } const {ret, data, msg} = result; @@ -55,13 +56,13 @@ export default { return; } if (ret === 1) { - resolve(data, msg); + resolve({data, msg}); } else { - reject(data, msg || "Unknown error") + reject({data, msg: msg || "Unknown error"}) } }; params.error = () => { - reject({}, "System error") + reject({data: {}, msg: "System error"}) }; // if (params.websocket === true || params.ws === true) { @@ -140,12 +141,12 @@ export default { return new Promise(function (resolve, reject) { dispatch("call", { url: 'users/info', - }).then((data, msg) => { - dispatch('saveUserInfo', data); - resolve(data, msg) - }).catch((data, msg) => { + }).then(result => { + dispatch('saveUserInfo', result.data); + resolve(result) + }).catch(result => { dispatch("logout"); - reject(data, msg) + reject(result) }); }); }, @@ -229,10 +230,10 @@ export default { data: { userid: array }, - }).then((data, msg) => { + }).then(result => { state.cacheUserBasic["::load"] = false; typeof complete === "function" && complete() - data.forEach((item) => { + result.data.forEach((item) => { state.cacheUserBasic[item.userid] = { time, data: item @@ -241,10 +242,10 @@ export default { dispatch('saveUserOnlineStatus', item); typeof success === "function" && success(item, true) }); - }).catch((data, msg) => { + }).catch(result => { state.cacheUserBasic["::load"] = false; typeof complete === "function" && complete() - $A.modalError(msg); + $A.modalError(result.msg); }); }, @@ -274,10 +275,10 @@ export default { } dispatch("call", { url: 'project/lists', - }).then((data, msg) => { - dispatch('saveProject', data.data); - }).catch((data, msg) => { - $A.modalError(msg); + }).then(result => { + dispatch('saveProject', result.data); + }).catch(result => { + $A.modalError(result.msg); }); }, @@ -296,8 +297,8 @@ export default { data: { project_id: project_id, }, - }).then((data, msg) => { - dispatch('saveProject', data); + }).then(result => { + dispatch('saveProject', result.data); }); }, @@ -323,12 +324,12 @@ export default { data: { project_id: project_id, }, - }).then((data, msg) => { + }).then(result => { state.projectLoad--; - dispatch('saveProject', data); - }).catch((data, msg) => { + dispatch('saveProject', result.data); + }).catch(result => { state.projectLoad--; - $A.modalError(msg); + $A.modalError(result.msg); }); }, @@ -387,20 +388,20 @@ export default { data: { task_id, }, - }).then((data, msg) => { + }).then(result => { state.projectDetail.project_column.some(({project_task}) => { let index = project_task.findIndex(({id}) => id === task_id); if (index > -1) { - project_task.splice(index, 1, Object.assign(project_task[index], data)) + project_task.splice(index, 1, Object.assign(project_task[index], result.data)) return true; } }); if (task_id == state.projectOpenTask.id) { - state.projectOpenTask = Object.assign({}, state.projectOpenTask, data); + state.projectOpenTask = Object.assign({}, state.projectOpenTask, result.data); } - resolve(data, msg) - }).catch((data, msg) => { - reject(data, msg) + resolve(result) + }).catch(result => { + reject(result) }); }); }, @@ -419,14 +420,14 @@ export default { data: { task_id, }, - }).then((data, msg) => { - state.projectTaskContent[task_id] = data; + }).then(result => { + state.projectTaskContent[task_id] = result.data; if (task_id == state.projectOpenTask.id) { - state.projectOpenTask = Object.assign({}, state.projectOpenTask, {content: data || {}}); + state.projectOpenTask = Object.assign({}, state.projectOpenTask, {content: result.data || {}}); } - resolve(data, msg) - }).catch((data, msg) => { - reject(data, msg) + resolve(result) + }).catch(result => { + reject(result) }); }); }, @@ -445,14 +446,14 @@ export default { data: { task_id, }, - }).then((data, msg) => { - state.projectTaskFiles[task_id] = data; + }).then(result => { + state.projectTaskFiles[task_id] = result.data; if (task_id == state.projectOpenTask.id) { - state.projectOpenTask = Object.assign({}, state.projectOpenTask, {files: data}); + state.projectOpenTask = Object.assign({}, state.projectOpenTask, {files: result.data}); } - resolve(data, msg) - }).catch((data, msg) => { - reject(data, msg) + resolve(result) + }).catch(result => { + reject(result) }); }); }, @@ -471,14 +472,14 @@ export default { data: { task_id, }, - }).then((data, msg) => { - state.projectSubTask[task_id] = data; + }).then(result => { + state.projectSubTask[task_id] = result.data; if (task_id == state.projectOpenTask.id) { - state.projectOpenTask = Object.assign({}, state.projectOpenTask, {sub_task: data}); + state.projectOpenTask = Object.assign({}, state.projectOpenTask, {sub_task: result.data}); } - resolve(data, msg) - }).catch((data, msg) => { - reject(data, msg) + resolve(result) + }).catch(result => { + reject(result) }); }); }, @@ -520,11 +521,69 @@ export default { return new Promise(function (resolve, reject) { dispatch("call", { url: 'system/priority', - }).then((data, msg) => { - state.taskPriority = data; - resolve(data, msg) - }).catch((data, msg) => { - reject(data, msg) + }).then(result => { + state.taskPriority = result.data; + resolve(result) + }).catch(result => { + reject(result) + }); + }); + }, + + /** + * 更新任务 + * @param dispatch + * @param data + * @returns {Promise} + */ + taskUpdate({dispatch}, data) { + return new Promise(function (resolve, reject) { + dispatch("call", { + url: 'project/task/update', + data: data, + method: 'post', + }).then(result => { + if (result.data.parent_id) { + dispatch('taskOne', result.data.parent_id); + } + if (typeof updata.complete_at !== "undefined") { + dispatch('projectOne', result.data.project_id); + } + resolve(result) + }).catch(result => { + dispatch('taskOne', data.id); + reject(result) + }); + }); + }, + + /** + * 删除或归档任务 + * @param state + * @param dispatch + * @param data + * @returns {Promise} + */ + taskArchivedOrRemove({state, dispatch}, data) { + let {id, type} = data; + return new Promise(function (resolve, reject) { + dispatch("call", { + url: 'project/task/' + type, + data: { + task_id: id, + }, + }).then(result => { + const column = state.projectDetail.project_column.find(({id}) => id === result.data.column_id); + if (column) { + let index = column.project_task.findIndex(({id}) => id === result.data.id); + if (index > -1) { + column.project_task.splice(index, 1); + } + } + dispatch('projectDetail', result.data.project_id); + resolve(result); + }).catch(result => { + reject(result) }); }); }, @@ -538,10 +597,10 @@ export default { dialogList({state, dispatch}, afterCallback) { dispatch("call", { url: 'dialog/lists', - }).then((data, msg) => { - state.dialogList = data.data; + }).then(result => { + state.dialogList = result.data.data; typeof afterCallback === "function" && afterCallback(); - }).catch((data, msg) => { + }).catch(result => { typeof afterCallback === "function" && afterCallback(); }); }, @@ -576,8 +635,8 @@ export default { data: { dialog_id, }, - }).then((data, msg) => { - dispatch('dialogUpdate', data); + }).then(result => { + dispatch('dialogUpdate', result.data); }); }, @@ -596,12 +655,12 @@ export default { data: { userid, }, - }).then((data, msg) => { - state.method.setStorage('messengerDialogId', data.id) - dispatch('dialogMsgList', data.id); - dispatch('dialogUpdate', data); - }).catch((data, msg) => { - $A.modalError(msg); + }).then(result => { + state.method.setStorage('messengerDialogId', result.data.id) + dispatch('dialogMsgList', result.data.id); + dispatch('dialogUpdate', result.data); + }).catch(result => { + $A.modalError(result.msg); }); }, @@ -641,11 +700,11 @@ export default { data: { dialog_id: dialog_id, }, - }).then((data, msg) => { + }).then(result => { state.dialogMsgLoad--; state.cacheDialogList[dialog_id + "::load"] = false; - const dialog = data.dialog; - const reverse = data.data.reverse(); + const dialog = result.data.dialog; + const reverse = result.data.data.reverse(); // 更新缓存 state.cacheDialogList[dialog_id] = { dialog, @@ -666,7 +725,7 @@ export default { } // 更新会话数据 dispatch('dialogUpdate', dialog); - }).catch((data, msg) => { + }).catch(result => { state.dialogMsgLoad--; state.cacheDialogList[dialog_id + "::load"] = false; }); @@ -685,9 +744,9 @@ export default { const unread = state.dialogMsgUnread; dispatch("call", { url: 'dialog/msg/unread', - }).then((data, msg) => { + }).then(result => { if (unread == state.dialogMsgUnread) { - state.dialogMsgUnread = data.unread; + state.dialogMsgUnread = result.data.unread; } else { setTimeout(() => { dispatch('dialogMsgUnread');