no message
This commit is contained in:
parent
804211973f
commit
be2f4d65b8
@ -10,6 +10,7 @@ use App\Models\ProjectTask;
|
||||
use App\Models\ProjectTaskFile;
|
||||
use App\Models\ProjectUser;
|
||||
use App\Models\User;
|
||||
use App\Models\WebSocketDialog;
|
||||
use App\Module\Base;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Arr;
|
||||
@ -973,6 +974,64 @@ class ProjectController extends AbstractController
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建/获取聊天室
|
||||
*
|
||||
* @apiParam {Number} task_id 任务ID
|
||||
*/
|
||||
public function task__dialog()
|
||||
{
|
||||
$user = User::authE();
|
||||
if (Base::isError($user)) {
|
||||
return $user;
|
||||
} else {
|
||||
$user = User::IDE($user['data']);
|
||||
}
|
||||
//
|
||||
$task_id = intval(Request::input('task_id'));
|
||||
// 任务
|
||||
$task = ProjectTask::whereId($task_id)->first();
|
||||
if (empty($task)) {
|
||||
return Base::retError('任务不存在');
|
||||
}
|
||||
// 项目
|
||||
$project = Project::select($this->projectSelect)
|
||||
->join('project_users', 'projects.id', '=', 'project_users.project_id')
|
||||
->where('projects.id', $task->project_id)
|
||||
->where('project_users.userid', $user->userid)
|
||||
->first();
|
||||
if (empty($project)) {
|
||||
return Base::retError('项目不存在或不在成员列表内');
|
||||
}
|
||||
//
|
||||
if ($task->parent_id > 0) {
|
||||
return Base::retError('子任务不支持此功能');
|
||||
}
|
||||
//
|
||||
return AbstractModel::transaction(function() use ($task) {
|
||||
if (empty($task->dialog_id)) {
|
||||
$task->lockForUpdate();
|
||||
$userids = $task->taskUser->pluck('userid')->toArray();
|
||||
$items = ProjectTask::with(['taskUser'])->where('parent_id', $task->id)->whereNull('archived_at')->get();
|
||||
foreach ($items as $item) {
|
||||
$userids = array_merge($userids, $item->taskUser->pluck('userid')->toArray());
|
||||
}
|
||||
$userids = array_values(array_filter(array_unique($userids)));
|
||||
$dialog = WebSocketDialog::createGroup('', $userids, 'task');
|
||||
if ($dialog) {
|
||||
$task->dialog_id = $dialog->id;
|
||||
$task->save();
|
||||
}
|
||||
}
|
||||
if (empty($task->dialog_id)) {
|
||||
return Base::retError('创建聊天失败');
|
||||
}
|
||||
return Base::retSuccess('success', [
|
||||
'dialog_id' => $task->dialog_id,
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 归档任务
|
||||
*
|
||||
@ -1003,6 +1062,10 @@ class ProjectController extends AbstractController
|
||||
return Base::retError('项目不存在或不在成员列表内');
|
||||
}
|
||||
//
|
||||
if ($task->parent_id > 0) {
|
||||
return Base::retError('子任务不支持此功能');
|
||||
}
|
||||
//
|
||||
return $task->archivedTask(Carbon::now());
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
* @property int|null $parent_id 父级任务ID
|
||||
* @property int|null $project_id 项目ID
|
||||
* @property int|null $column_id 列表ID
|
||||
* @property int|null $dialog_id 聊天会话ID
|
||||
* @property string|null $name 标题
|
||||
* @property string|null $color 颜色
|
||||
* @property string|null $desc 描述
|
||||
@ -31,7 +32,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property \Illuminate\Support\Carbon|null $deleted_at
|
||||
* @property-read \App\Models\ProjectTaskContent|null $content
|
||||
* @property-read int $dialog_id
|
||||
* @property-read int $file_num
|
||||
* @property-read int $msg_num
|
||||
* @property-read bool $overdue
|
||||
@ -57,6 +57,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereDeletedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereDesc($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereDialogId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereEndAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereName($value)
|
||||
@ -85,7 +86,6 @@ class ProjectTask extends AbstractModel
|
||||
'percent',
|
||||
'today',
|
||||
'overdue',
|
||||
'dialog_id',
|
||||
];
|
||||
|
||||
/**
|
||||
@ -107,7 +107,7 @@ class ProjectTask extends AbstractModel
|
||||
public function getMsgNumAttribute()
|
||||
{
|
||||
if (!isset($this->attributes['msg_num'])) {
|
||||
$this->attributes['msg_num'] = WebSocketDialogMsg::whereDialogId($this->dialog_id)->whereExtraInt($this->id)->count();
|
||||
$this->attributes['msg_num'] = $this->dialog_id ? WebSocketDialogMsg::whereDialogId($this->dialog_id)->count() : 0;
|
||||
}
|
||||
return $this->attributes['msg_num'];
|
||||
}
|
||||
@ -197,18 +197,6 @@ class ProjectTask extends AbstractModel
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对话ID
|
||||
* @return int
|
||||
*/
|
||||
public function getDialogIdAttribute()
|
||||
{
|
||||
if (!isset($this->attributes['dialog_id'])) {
|
||||
$this->attributes['dialog_id'] = intval(Project::whereId($this->project_id)->value('dialog_id'));
|
||||
}
|
||||
return $this->attributes['dialog_id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
*/
|
||||
|
@ -61,6 +61,8 @@ class WebSocketDialog extends AbstractModel
|
||||
case "group":
|
||||
if ($dialog->group_type === 'project') {
|
||||
$dialog->name = Project::whereDialogId($dialog->id)->value('name');
|
||||
} elseif ($dialog->group_type === 'task') {
|
||||
$dialog->name = ProjectTask::whereDialogId($dialog->id)->value('name');
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -136,7 +136,7 @@
|
||||
if (!this.userid) {
|
||||
return;
|
||||
}
|
||||
this.$store.dispatch('userBasic', {
|
||||
this.$store.dispatch("getUserBasic", {
|
||||
userid: this.userid,
|
||||
success: (user) => {
|
||||
this.user = user;
|
||||
|
@ -131,7 +131,7 @@
|
||||
userids.push(value);
|
||||
});
|
||||
//
|
||||
this.$store.dispatch('userBasic', {
|
||||
this.$store.dispatch("getUserBasic", {
|
||||
userid: userids,
|
||||
complete: () => {
|
||||
this.initialized = true;
|
||||
|
@ -80,7 +80,7 @@ export default {
|
||||
},
|
||||
}).then(({data}) => {
|
||||
this.loadIng--;
|
||||
this.$store.dispatch('saveUserInfo', data);
|
||||
this.$store.dispatch("saveUserInfo", data);
|
||||
this.goNext();
|
||||
}).catch(({data, msg}) => {
|
||||
this.loadIng--;
|
||||
|
@ -161,7 +161,7 @@ export default {
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.$store.dispatch('userInfo');
|
||||
this.$store.dispatch("getUserInfo");
|
||||
},
|
||||
|
||||
deactivated() {
|
||||
@ -274,16 +274,16 @@ export default {
|
||||
url: 'project/add',
|
||||
data: this.addData,
|
||||
}).then(({data, msg}) => {
|
||||
this.loadIng--;
|
||||
$A.messageSuccess(msg);
|
||||
this.loadIng--;
|
||||
this.addShow = false;
|
||||
this.$refs.addProject.resetFields();
|
||||
this.$set(this.addData, 'template', 0);
|
||||
this.$store.dispatch('saveProject', data);
|
||||
this.$store.dispatch("saveProject", data);
|
||||
this.toggleRoute('project/' + data.id)
|
||||
}).catch(({msg}) => {
|
||||
this.loadIng--;
|
||||
$A.modalError(msg);
|
||||
this.loadIng--;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -96,7 +96,7 @@ export default {
|
||||
|
||||
methods: {
|
||||
msgRead() {
|
||||
this.$store.dispatch('dialogMsgRead', this.msgData);
|
||||
this.$store.dispatch("dialogMsgRead", this.msgData);
|
||||
},
|
||||
|
||||
popperShow() {
|
||||
|
@ -124,13 +124,13 @@ export default {
|
||||
text: this.msgText,
|
||||
},
|
||||
}).then(({data}) => {
|
||||
this.$store.dispatch('dialogMsgSplice', {id: tempId, data});
|
||||
this.$store.dispatch("dialogMsgSplice", {id: tempId, data});
|
||||
}).catch(({msg}) => {
|
||||
$A.modalWarning({
|
||||
title: '发送失败',
|
||||
content: msg
|
||||
});
|
||||
this.$store.dispatch('dialogMsgSplice', {id: tempId});
|
||||
this.$store.dispatch("dialogMsgSplice", {id: tempId});
|
||||
});
|
||||
//
|
||||
this.msgText = '';
|
||||
@ -197,11 +197,11 @@ export default {
|
||||
break;
|
||||
|
||||
case 'error':
|
||||
this.$store.dispatch('dialogMsgSplice', {id: file.tempId});
|
||||
this.$store.dispatch("dialogMsgSplice", {id: file.tempId});
|
||||
break;
|
||||
|
||||
case 'success':
|
||||
this.$store.dispatch('dialogMsgSplice', {id: file.tempId, data: file.data});
|
||||
this.$store.dispatch("dialogMsgSplice", {id: file.tempId, data: file.data});
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
@ -54,7 +54,7 @@ export default {
|
||||
methods: {
|
||||
getMsg() {
|
||||
if (this.projectChatShow && this.projectDetail.dialog_id) {
|
||||
this.$store.dispatch('dialogMsgList', this.projectDetail.dialog_id);
|
||||
this.$store.dispatch("getDialogMsgList", this.projectDetail.dialog_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -576,18 +576,19 @@ export default {
|
||||
only_column: only_column === true ? 1 : 0
|
||||
},
|
||||
}).then(({msg}) => {
|
||||
this.sortDisabled = false;
|
||||
$A.messageSuccess(msg);
|
||||
}).catch(({msg}) => {
|
||||
this.sortDisabled = false;
|
||||
this.$store.dispatch('projectDetail', this.projectDetail.id);
|
||||
}).catch(({msg}) => {
|
||||
$A.modalError(msg);
|
||||
this.sortDisabled = false;
|
||||
this.$store.dispatch("getProjectDetail", this.projectDetail.id);
|
||||
});
|
||||
},
|
||||
|
||||
onAddTask() {
|
||||
this.taskLoad++;
|
||||
this.$store.dispatch("taskAdd", this.addData).then(({msg}) => {
|
||||
$A.messageSuccess(msg);
|
||||
this.taskLoad--;
|
||||
this.addShow = false;
|
||||
this.addData = {
|
||||
@ -599,10 +600,9 @@ export default {
|
||||
p_name: '',
|
||||
p_color: '',
|
||||
};
|
||||
$A.messageSuccess(msg);
|
||||
}).catch(({msg}) => {
|
||||
this.taskLoad--;
|
||||
$A.modalError(msg);
|
||||
this.taskLoad--;
|
||||
});
|
||||
},
|
||||
|
||||
@ -651,7 +651,7 @@ export default {
|
||||
this.addColumnName = '';
|
||||
this.projectDetail.project_column.push(data)
|
||||
}).catch(({msg}) => {
|
||||
$A.modalError(msg, 301);
|
||||
$A.modalError(msg);
|
||||
});
|
||||
},
|
||||
|
||||
@ -726,18 +726,17 @@ export default {
|
||||
column_id: column.id,
|
||||
},
|
||||
}).then(({msg}) => {
|
||||
$A.messageSuccess(msg);
|
||||
this.$set(column, 'loading', false);
|
||||
this.$Modal.remove();
|
||||
$A.messageSuccess(msg);
|
||||
let index = this.projectDetail.project_column.findIndex(({id}) => id === column.id);
|
||||
if (index > -1) {
|
||||
this.projectDetail.project_column.splice(index, 1);
|
||||
}
|
||||
this.$store.dispatch('projectDetail', this.projectDetail.id);
|
||||
}).catch(({msg}) => {
|
||||
$A.modalError(msg, 301);
|
||||
this.$set(column, 'loading', false);
|
||||
this.$Modal.remove();
|
||||
$A.modalError(msg, 301);
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -809,11 +808,11 @@ export default {
|
||||
task_id: task.id,
|
||||
type: type,
|
||||
}).then(({msg}) => {
|
||||
this.$Modal.remove();
|
||||
$A.messageSuccess(msg);
|
||||
}).catch(({msg}) => {
|
||||
this.$Modal.remove();
|
||||
}).catch(({msg}) => {
|
||||
$A.modalError(msg, 301);
|
||||
this.$Modal.remove();
|
||||
});
|
||||
},
|
||||
|
||||
@ -823,13 +822,13 @@ export default {
|
||||
url: 'project/edit',
|
||||
data: this.settingData,
|
||||
}).then(({data, msg}) => {
|
||||
this.settingLoad--;
|
||||
$A.messageSuccess(msg);
|
||||
this.settingLoad--;
|
||||
this.settingShow = false;
|
||||
this.$store.dispatch("saveProject", data)
|
||||
}).catch(({msg}) => {
|
||||
this.settingLoad--;
|
||||
$A.modalError(msg);
|
||||
this.settingLoad--;
|
||||
});
|
||||
},
|
||||
|
||||
@ -842,13 +841,13 @@ export default {
|
||||
userid: this.userData.userids,
|
||||
},
|
||||
}).then(({msg}) => {
|
||||
this.userLoad--;
|
||||
$A.messageSuccess(msg);
|
||||
this.$store.dispatch('projectDetail', this.userData.project_id);
|
||||
this.userShow = false;
|
||||
}).catch(({msg}) => {
|
||||
this.userLoad--;
|
||||
this.userShow = false;
|
||||
this.$store.dispatch("getProjectDetail", this.userData.project_id);
|
||||
}).catch(({msg}) => {
|
||||
$A.modalError(msg);
|
||||
this.userLoad--;
|
||||
});
|
||||
},
|
||||
|
||||
@ -861,13 +860,13 @@ export default {
|
||||
owner_userid: this.transferData.owner_userid[0],
|
||||
},
|
||||
}).then(({msg}) => {
|
||||
this.transferLoad--;
|
||||
$A.messageSuccess(msg);
|
||||
this.$store.dispatch('projectDetail', this.transferData.project_id);
|
||||
this.transferShow = false;
|
||||
}).catch(({msg}) => {
|
||||
this.transferLoad--;
|
||||
this.transferShow = false;
|
||||
this.$store.dispatch("getProjectDetail", this.transferData.project_id);
|
||||
}).catch(({msg}) => {
|
||||
$A.modalError(msg);
|
||||
this.transferLoad--;
|
||||
});
|
||||
},
|
||||
|
||||
@ -883,9 +882,9 @@ export default {
|
||||
project_id: this.projectDetail.id,
|
||||
},
|
||||
}).then(({msg}) => {
|
||||
this.$Modal.remove();
|
||||
$A.messageSuccess(msg);
|
||||
this.$store.dispatch('removeProject', this.projectDetail.id);
|
||||
this.$Modal.remove();
|
||||
this.$store.dispatch("removeProject", this.projectDetail.id);
|
||||
const project = this.projectList.find(({id}) => id);
|
||||
if (project) {
|
||||
this.goForward({path: '/manage/project/' + project.id}, true);
|
||||
@ -893,8 +892,8 @@ export default {
|
||||
this.goForward({path: '/manage/dashboard'}, true);
|
||||
}
|
||||
}).catch(({msg}) => {
|
||||
this.$Modal.remove();
|
||||
$A.modalError(msg, 301);
|
||||
this.$Modal.remove();
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -912,9 +911,9 @@ export default {
|
||||
project_id: this.projectDetail.id,
|
||||
},
|
||||
}).then(({msg}) => {
|
||||
this.$Modal.remove();
|
||||
$A.messageSuccess(msg);
|
||||
this.$store.dispatch('removeProject', this.projectDetail.id);
|
||||
this.$Modal.remove();
|
||||
this.$store.dispatch("removeProject", this.projectDetail.id);
|
||||
const project = this.projectList.find(({id}) => id);
|
||||
if (project) {
|
||||
this.goForward({path: '/manage/project/' + project.id}, true);
|
||||
@ -922,8 +921,8 @@ export default {
|
||||
this.goForward({path: '/manage/dashboard'}, true);
|
||||
}
|
||||
}).catch(({msg}) => {
|
||||
this.$Modal.remove();
|
||||
$A.modalError(msg, 301);
|
||||
this.$Modal.remove();
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -963,14 +962,14 @@ export default {
|
||||
|
||||
openTask(task) {
|
||||
if (task.parent_id > 0) {
|
||||
this.$store.dispatch('openTask', task.parent_id)
|
||||
this.$store.dispatch("openTask", task.parent_id)
|
||||
} else {
|
||||
this.$store.dispatch('openTask', task.id)
|
||||
this.$store.dispatch("openTask", task.id)
|
||||
}
|
||||
},
|
||||
|
||||
toggleBoolean(type) {
|
||||
this.$store.dispatch('toggleBoolean', type);
|
||||
this.$store.dispatch("toggleBoolean", type);
|
||||
},
|
||||
|
||||
formatTime(date) {
|
||||
|
@ -160,7 +160,7 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch('taskPriority').then(() => {
|
||||
this.$store.dispatch('getTaskPriority').then(() => {
|
||||
if (!this.value.p_name && this.taskPriority.length > 0) {
|
||||
this.choosePriority(this.taskPriority[0])
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ export default {
|
||||
this.active = true;
|
||||
this.$nextTick(() => {
|
||||
if (this.taskPriority.length === 0) {
|
||||
this.$store.dispatch('taskPriority').then(() => {
|
||||
this.$store.dispatch('getTaskPriority').then(() => {
|
||||
if (!this.addData.p_name && this.taskPriority.length > 0) {
|
||||
this.choosePriority(this.taskPriority[0])
|
||||
}
|
||||
@ -152,6 +152,7 @@ export default {
|
||||
}
|
||||
this.loadIng++;
|
||||
this.$store.dispatch("taskAdd", this.getData()).then(({msg}) => {
|
||||
$A.messageSuccess(msg);
|
||||
this.loadIng--;
|
||||
this.active = false;
|
||||
this.addData = {
|
||||
@ -163,10 +164,9 @@ export default {
|
||||
p_name: '',
|
||||
p_color: '',
|
||||
}
|
||||
$A.messageSuccess(msg);
|
||||
}).catch(({msg}) => {
|
||||
this.loadIng--;
|
||||
$A.modalError(msg);
|
||||
this.loadIng--;
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -319,28 +319,40 @@
|
||||
</div>
|
||||
<TaskUpload ref="upload" class="upload"/>
|
||||
</div>
|
||||
<div class="task-dialog" >
|
||||
<div class="head">
|
||||
<Icon class="icon" type="ios-chatbubbles-outline" />
|
||||
<div class="nav">
|
||||
<p class="active">{{$L('聊天')}}</p>
|
||||
<p>{{$L('动态')}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="no-dialog" :style="dialogStyle">
|
||||
<div class="no-tip">{{$L('暂无消息')}}</div>
|
||||
<div class="no-input">
|
||||
<Input
|
||||
ref="input"
|
||||
class="dialog-input"
|
||||
v-model="taskDetail._msgText"
|
||||
type="textarea"
|
||||
:rows="1"
|
||||
:autosize="{ minRows: 1, maxRows: 3 }"
|
||||
:maxlength="255"
|
||||
:placeholder="$L('输入消息...')"/>
|
||||
<div class="task-dialog">
|
||||
<DialogWrapper v-if="taskDetail.dialog_id > 0">
|
||||
<div slot="head" class="head">
|
||||
<Icon class="icon" type="ios-chatbubbles-outline" />
|
||||
<div class="nav">
|
||||
<p class="active">{{$L('聊天')}}</p>
|
||||
<p>{{$L('动态')}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</DialogWrapper>
|
||||
<div v-else>
|
||||
<div class="head">
|
||||
<Icon class="icon" type="ios-chatbubbles-outline" />
|
||||
<div class="nav">
|
||||
<p class="active">{{$L('聊天')}}</p>
|
||||
<p>{{$L('动态')}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="no-dialog" :style="dialogStyle">
|
||||
<div class="no-tip">{{$L('暂无消息')}}</div>
|
||||
<div class="no-input">
|
||||
<Input
|
||||
class="dialog-input"
|
||||
v-model="msgText"
|
||||
type="textarea"
|
||||
:rows="1"
|
||||
:autosize="{ minRows: 1, maxRows: 3 }"
|
||||
:maxlength="255"
|
||||
:placeholder="$L('输入消息...')"
|
||||
@on-keydown="msgKeydown"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Input ref="input" v-show="false"/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -351,10 +363,11 @@ import TEditor from "../../../components/TEditor";
|
||||
import TaskPriority from "./TaskPriority";
|
||||
import UserInput from "../../../components/UserInput";
|
||||
import TaskUpload from "./TaskUpload";
|
||||
import DialogWrapper from "./DialogWrapper";
|
||||
|
||||
export default {
|
||||
name: "TaskDetail",
|
||||
components: {TaskUpload, UserInput, TaskPriority, TEditor},
|
||||
components: {DialogWrapper, TaskUpload, UserInput, TaskPriority, TEditor},
|
||||
props: {
|
||||
openTask: {
|
||||
type: Object,
|
||||
@ -393,6 +406,8 @@ export default {
|
||||
|
||||
innerHeight: window.innerHeight,
|
||||
|
||||
msgText: '',
|
||||
|
||||
taskPlugins: [
|
||||
'advlist autolink lists link image charmap print preview hr anchor pagebreak imagetools',
|
||||
'searchreplace visualblocks visualchars code',
|
||||
@ -422,7 +437,7 @@ export default {
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.$store.dispatch('taskPriority');
|
||||
this.$store.dispatch('getTaskPriority');
|
||||
this.nowInterval = setInterval(() => {
|
||||
this.nowTime = Math.round(new Date().getTime() / 1000);
|
||||
}, 1000);
|
||||
@ -561,6 +576,7 @@ export default {
|
||||
openTask: {
|
||||
handler(data) {
|
||||
this.taskDetail = $A.cloneJSON(data);
|
||||
this.$store.dispatch("getDialogMsgList", this.taskDetail.dialog_id);
|
||||
},
|
||||
immediate: true,
|
||||
deep: true
|
||||
@ -753,11 +769,11 @@ export default {
|
||||
task_id: this.taskDetail.id,
|
||||
type: type,
|
||||
}).then(({msg}) => {
|
||||
this.$Modal.remove();
|
||||
$A.messageSuccess(msg);
|
||||
}).catch(({msg}) => {
|
||||
this.$Modal.remove();
|
||||
}).catch(({msg}) => {
|
||||
$A.modalError(msg, 301);
|
||||
this.$Modal.remove();
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -778,14 +794,14 @@ export default {
|
||||
task_id: this.taskDetail.id,
|
||||
owner: this.ownerData.owner_userid
|
||||
}).then(({msg}) => {
|
||||
this.ownerLoad--;
|
||||
this.ownerShow = false;
|
||||
this.$store.dispatch("taskOne", this.taskDetail.id);
|
||||
$A.messageSuccess(msg);
|
||||
}).catch(({msg}) => {
|
||||
this.ownerLoad--;
|
||||
this.ownerShow = false;
|
||||
this.$store.dispatch("getTaskOne", this.taskDetail.id);
|
||||
}).catch(({msg}) => {
|
||||
$A.modalError(msg);
|
||||
this.ownerLoad--;
|
||||
this.ownerShow = false;
|
||||
})
|
||||
},
|
||||
|
||||
@ -808,14 +824,14 @@ export default {
|
||||
task_id: this.taskDetail.id,
|
||||
assist,
|
||||
}).then(({msg}) => {
|
||||
this.assistLoad--;
|
||||
this.assistShow = false;
|
||||
this.$store.dispatch("taskOne", this.taskDetail.id);
|
||||
$A.messageSuccess(msg);
|
||||
}).catch(({msg}) => {
|
||||
this.assistLoad--;
|
||||
this.assistShow = false;
|
||||
this.$store.dispatch("getTaskOne", this.taskDetail.id);
|
||||
}).catch(({msg}) => {
|
||||
$A.modalError(msg);
|
||||
this.assistLoad--;
|
||||
this.assistShow = false;
|
||||
})
|
||||
},
|
||||
|
||||
@ -894,12 +910,12 @@ export default {
|
||||
task_id: this.taskDetail.id,
|
||||
name: this.addsubName,
|
||||
}).then(({msg}) => {
|
||||
$A.messageSuccess(msg);
|
||||
this.addsubLoad--;
|
||||
this.addsubName = "";
|
||||
$A.messageSuccess(msg);
|
||||
}).catch(({msg}) => {
|
||||
this.addsubLoad--;
|
||||
$A.modalError(msg);
|
||||
this.addsubLoad--;
|
||||
});
|
||||
},
|
||||
|
||||
@ -939,6 +955,35 @@ export default {
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
msgKeydown(e) {
|
||||
if (e.keyCode === 13) {
|
||||
if (e.shiftKey) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
this.msgDialog();
|
||||
}
|
||||
},
|
||||
|
||||
msgDialog() {
|
||||
if (!this.msgText) {
|
||||
return;
|
||||
}
|
||||
this.$store.dispatch("call", {
|
||||
url: 'project/task/dialog',
|
||||
data: {
|
||||
task_id: this.taskDetail.id,
|
||||
},
|
||||
}).then(({data}) => {
|
||||
this.$store.dispatch("saveTask", {
|
||||
id: this.taskDetail.id,
|
||||
dialog_id: data.dialog_id
|
||||
});
|
||||
}).catch(({msg}) => {
|
||||
$A.modalError(msg);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -158,7 +158,7 @@ export default {
|
||||
return;
|
||||
}
|
||||
this.$set(task, 'loading', true);
|
||||
this.$store.dispatch("subTask", task.id).then(({data}) => {
|
||||
this.$store.dispatch("getSubTask", task.id).then(({data}) => {
|
||||
this.$set(task, 'loading', false);
|
||||
this.$set(task, 'sub_list', data);
|
||||
this.$set(task, 'sub_open', true);
|
||||
@ -170,9 +170,9 @@ export default {
|
||||
|
||||
openTask(task) {
|
||||
if (task.parent_id > 0) {
|
||||
this.$store.dispatch('openTask', task.parent_id)
|
||||
this.$store.dispatch("openTask", task.parent_id)
|
||||
} else {
|
||||
this.$store.dispatch('openTask', task.id)
|
||||
this.$store.dispatch("openTask", task.id)
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -60,7 +60,7 @@ export default {
|
||||
if (res.ret === 1) {
|
||||
if (index > -1) {
|
||||
this.projectOpenTask.files.splice(index, 1, res.data);
|
||||
this.$store.dispatch("taskData", {
|
||||
this.$store.dispatch("saveTask", {
|
||||
id: this.projectOpenTask.id,
|
||||
file_num: this.projectOpenTask.files.length,
|
||||
});
|
||||
|
@ -81,7 +81,7 @@ export default {
|
||||
|
||||
mounted() {
|
||||
this.dialogLoad++;
|
||||
this.$store.dispatch("dialogList").then(() => {
|
||||
this.$store.dispatch("getDialogList").then(() => {
|
||||
this.dialogLoad--;
|
||||
this.openDialogStorage();
|
||||
}).catch(() => {
|
||||
@ -125,7 +125,7 @@ export default {
|
||||
methods: {
|
||||
openDialog(dialog) {
|
||||
this.$store.state.method.setStorage('messengerDialogId', dialog.id)
|
||||
this.$store.dispatch('dialogMsgList', dialog.id);
|
||||
this.$store.dispatch("getDialogMsgList", dialog.id);
|
||||
},
|
||||
|
||||
openDialogStorage() {
|
||||
|
@ -24,7 +24,7 @@ export default {
|
||||
this.project_id = route.params.id;
|
||||
},
|
||||
project_id(id) {
|
||||
this.$store.dispatch('projectDetail', id);
|
||||
this.$store.dispatch("getProjectDetail", id);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
@ -83,13 +83,13 @@ export default {
|
||||
url: 'users/editpass',
|
||||
data: this.formDatum,
|
||||
}).then(({data}) => {
|
||||
this.loadIng--;
|
||||
$A.messageSuccess('修改成功');
|
||||
this.$store.dispatch('saveUserInfo', data);
|
||||
this.loadIng--;
|
||||
this.$store.dispatch("saveUserInfo", data);
|
||||
this.$refs.formDatum.resetFields();
|
||||
}).catch(({msg}) => {
|
||||
this.loadIng--;
|
||||
$A.modalError(msg);
|
||||
this.loadIng--;
|
||||
});
|
||||
}
|
||||
})
|
||||
|
@ -76,12 +76,12 @@ export default {
|
||||
url: 'users/editdata',
|
||||
data: this.formDatum,
|
||||
}).then(() => {
|
||||
this.loadIng--;
|
||||
$A.messageSuccess('修改成功');
|
||||
this.$store.dispatch('userInfo');
|
||||
}).catch(({msg}) => {
|
||||
this.loadIng--;
|
||||
this.$store.dispatch('getUserInfo');
|
||||
}).catch(({msg}) => {
|
||||
$A.modalError(msg);
|
||||
this.loadIng--;
|
||||
});
|
||||
}
|
||||
})
|
||||
|
@ -97,6 +97,9 @@ export default {
|
||||
list: this.formDatum
|
||||
},
|
||||
}).then(({data}) => {
|
||||
if (save) {
|
||||
$A.messageSuccess('修改成功');
|
||||
}
|
||||
this.loadIng--;
|
||||
this.$store.state.taskPriority = $A.cloneJSON(data);
|
||||
this.formDatum = data;
|
||||
@ -104,14 +107,11 @@ export default {
|
||||
this.addDatum();
|
||||
}
|
||||
this.formDatum_bak = $A.cloneJSON(this.formDatum);
|
||||
if (save) {
|
||||
$A.messageSuccess('修改成功');
|
||||
}
|
||||
}).catch(({msg}) => {
|
||||
this.loadIng--;
|
||||
if (save) {
|
||||
$A.modalError(msg);
|
||||
}
|
||||
this.loadIng--;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -55,17 +55,17 @@ export default {
|
||||
url: 'system/setting?type=' + (save ? 'save' : 'get'),
|
||||
data: this.formDatum,
|
||||
}).then(({data}) => {
|
||||
this.loadIng--;
|
||||
this.formDatum = data;
|
||||
this.formDatum_bak = $A.cloneJSON(this.formDatum);
|
||||
if (save) {
|
||||
$A.messageSuccess('修改成功');
|
||||
}
|
||||
}).catch(({msg}) => {
|
||||
this.loadIng--;
|
||||
this.formDatum = data;
|
||||
this.formDatum_bak = $A.cloneJSON(this.formDatum);
|
||||
}).catch(({msg}) => {
|
||||
if (save) {
|
||||
$A.modalError(msg);
|
||||
}
|
||||
this.loadIng--;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
261
resources/assets/js/store/actions.js
vendored
261
resources/assets/js/store/actions.js
vendored
@ -137,12 +137,12 @@ export default {
|
||||
* @param dispatch
|
||||
* @returns {Promise<unknown>}
|
||||
*/
|
||||
userInfo({dispatch}) {
|
||||
getUserInfo({dispatch}) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
dispatch("call", {
|
||||
url: 'users/info',
|
||||
}).then(result => {
|
||||
dispatch('saveUserInfo', result.data);
|
||||
dispatch("saveUserInfo", result.data);
|
||||
resolve(result)
|
||||
}).catch(result => {
|
||||
dispatch("logout");
|
||||
@ -168,8 +168,8 @@ export default {
|
||||
state.userToken = userInfo.token;
|
||||
state.userIsAdmin = state.method.inArray('admin', userInfo.identity);
|
||||
state.method.setStorage('userInfo', state.userInfo);
|
||||
dispatch('projectList');
|
||||
dispatch('dialogMsgUnread');
|
||||
dispatch('getProjectList');
|
||||
dispatch('getDialogMsgUnread');
|
||||
dispatch('websocketConnection');
|
||||
resolve()
|
||||
});
|
||||
@ -193,7 +193,7 @@ export default {
|
||||
* @param dispatch
|
||||
* @param params {userid, success, complete}
|
||||
*/
|
||||
userBasic({state, dispatch}, params) {
|
||||
getUserBasic({state, dispatch}, params) {
|
||||
if (!state.method.isJson(params)) {
|
||||
return;
|
||||
}
|
||||
@ -220,7 +220,7 @@ export default {
|
||||
//
|
||||
if (state.cacheUserBasic["::load"] === true) {
|
||||
setTimeout(() => {
|
||||
dispatch('userBasic', params);
|
||||
dispatch("getUserBasic", params);
|
||||
}, 20);
|
||||
return;
|
||||
}
|
||||
@ -239,7 +239,7 @@ export default {
|
||||
data: item
|
||||
};
|
||||
state.method.setStorage("cacheUserBasic", state.cacheUserBasic);
|
||||
dispatch('saveUserOnlineStatus', item);
|
||||
dispatch("saveUserOnlineStatus", item);
|
||||
typeof success === "function" && success(item, true)
|
||||
});
|
||||
}).catch(result => {
|
||||
@ -254,85 +254,12 @@ export default {
|
||||
* @param dispatch
|
||||
*/
|
||||
logout({dispatch}) {
|
||||
dispatch('saveUserInfo', {}).then(() => {
|
||||
dispatch("saveUserInfo", {}).then(() => {
|
||||
const from = window.location.pathname == '/' ? '' : encodeURIComponent(window.location.href);
|
||||
$A.goForward({path: '/login', query: from ? {from: from} : {}}, true);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取项目列表
|
||||
* @param state
|
||||
* @param dispatch
|
||||
*/
|
||||
projectList({state, dispatch}) {
|
||||
if (state.userId === 0) {
|
||||
state.projectList = [];
|
||||
return;
|
||||
}
|
||||
if (state.cacheProjectList.length > 0) {
|
||||
state.projectList = state.cacheProjectList;
|
||||
}
|
||||
dispatch("call", {
|
||||
url: 'project/lists',
|
||||
}).then(result => {
|
||||
dispatch('saveProject', result.data.data);
|
||||
}).catch(result => {
|
||||
$A.modalError(result.msg);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取项目信息
|
||||
* @param state
|
||||
* @param dispatch
|
||||
* @param project_id
|
||||
*/
|
||||
projectOne({state, dispatch}, project_id) {
|
||||
if (state.method.runNum(project_id) === 0) {
|
||||
return;
|
||||
}
|
||||
dispatch("call", {
|
||||
url: 'project/one',
|
||||
data: {
|
||||
project_id: project_id,
|
||||
},
|
||||
}).then(result => {
|
||||
dispatch('saveProject', result.data);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取项目详情
|
||||
* @param state
|
||||
* @param dispatch
|
||||
* @param project_id
|
||||
*/
|
||||
projectDetail({state, dispatch}, project_id) {
|
||||
if (state.method.runNum(project_id) === 0) {
|
||||
return;
|
||||
}
|
||||
const project = state.cacheProjectList.find(({id}) => id == project_id);
|
||||
if (project) {
|
||||
state.projectDetail = Object.assign({project_column: [], project_user: []}, project);
|
||||
}
|
||||
state.projectDetail.id = project_id;
|
||||
//
|
||||
state.projectLoad++;
|
||||
dispatch("call", {
|
||||
url: 'project/detail',
|
||||
data: {
|
||||
project_id: project_id,
|
||||
},
|
||||
}).then(result => {
|
||||
state.projectLoad--;
|
||||
dispatch('saveProject', result.data);
|
||||
}).catch(result => {
|
||||
state.projectLoad--;
|
||||
$A.modalError(result.msg);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 保存项目信息
|
||||
* @param state
|
||||
@ -361,6 +288,79 @@ export default {
|
||||
state.method.setStorage("cacheProjectList", state.projectList);
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取项目列表
|
||||
* @param state
|
||||
* @param dispatch
|
||||
*/
|
||||
getProjectList({state, dispatch}) {
|
||||
if (state.userId === 0) {
|
||||
state.projectList = [];
|
||||
return;
|
||||
}
|
||||
if (state.cacheProjectList.length > 0) {
|
||||
state.projectList = state.cacheProjectList;
|
||||
}
|
||||
dispatch("call", {
|
||||
url: 'project/lists',
|
||||
}).then(result => {
|
||||
dispatch("saveProject", result.data.data);
|
||||
}).catch(result => {
|
||||
$A.modalError(result.msg);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取项目信息
|
||||
* @param state
|
||||
* @param dispatch
|
||||
* @param project_id
|
||||
*/
|
||||
getProjectOne({state, dispatch}, project_id) {
|
||||
if (state.method.runNum(project_id) === 0) {
|
||||
return;
|
||||
}
|
||||
dispatch("call", {
|
||||
url: 'project/one',
|
||||
data: {
|
||||
project_id: project_id,
|
||||
},
|
||||
}).then(result => {
|
||||
dispatch("saveProject", result.data);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取项目详情
|
||||
* @param state
|
||||
* @param dispatch
|
||||
* @param project_id
|
||||
*/
|
||||
getProjectDetail({state, dispatch}, project_id) {
|
||||
if (state.method.runNum(project_id) === 0) {
|
||||
return;
|
||||
}
|
||||
const project = state.cacheProjectList.find(({id}) => id == project_id);
|
||||
if (project) {
|
||||
state.projectDetail = Object.assign({project_column: [], project_user: []}, project);
|
||||
}
|
||||
state.projectDetail.id = project_id;
|
||||
//
|
||||
state.projectLoad++;
|
||||
dispatch("call", {
|
||||
url: 'project/detail',
|
||||
data: {
|
||||
project_id: project_id,
|
||||
},
|
||||
}).then(result => {
|
||||
state.projectLoad--;
|
||||
dispatch("saveProject", result.data);
|
||||
}).catch(result => {
|
||||
state.projectLoad--;
|
||||
$A.modalError(result.msg);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除项目信息
|
||||
* @param state
|
||||
@ -375,11 +375,11 @@ export default {
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新任务信息
|
||||
* 保存任务信息
|
||||
* @param state
|
||||
* @param data
|
||||
*/
|
||||
taskData({state}, data) {
|
||||
saveTask({state}, data) {
|
||||
state.projectDetail.project_column.some(({project_task}) => {
|
||||
let index = project_task.findIndex(({id}) => id === data.id);
|
||||
if (index > -1) {
|
||||
@ -404,7 +404,7 @@ export default {
|
||||
* @param task_id
|
||||
* @returns {Promise<unknown>}
|
||||
*/
|
||||
taskOne({state, dispatch}, task_id) {
|
||||
getTaskOne({state, dispatch}, task_id) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
dispatch("call", {
|
||||
url: 'project/task/one',
|
||||
@ -412,7 +412,7 @@ export default {
|
||||
task_id,
|
||||
},
|
||||
}).then(result => {
|
||||
dispatch("taskData", result.data);
|
||||
dispatch("saveTask", result.data);
|
||||
resolve(result)
|
||||
}).catch(result => {
|
||||
reject(result)
|
||||
@ -427,7 +427,7 @@ export default {
|
||||
* @param task_id
|
||||
* @returns {Promise<unknown>}
|
||||
*/
|
||||
taskContent({state, dispatch}, task_id) {
|
||||
getTaskContent({state, dispatch}, task_id) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
dispatch("call", {
|
||||
url: 'project/task/content',
|
||||
@ -454,7 +454,7 @@ export default {
|
||||
* @param task_id
|
||||
* @returns {Promise<unknown>}
|
||||
*/
|
||||
taskFiles({state, dispatch}, task_id) {
|
||||
getTaskFiles({state, dispatch}, task_id) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
dispatch("call", {
|
||||
url: 'project/task/files',
|
||||
@ -480,7 +480,7 @@ export default {
|
||||
* @param task_id
|
||||
* @returns {Promise<unknown>}
|
||||
*/
|
||||
subTask({state, dispatch}, task_id) {
|
||||
getSubTask({state, dispatch}, task_id) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
dispatch("call", {
|
||||
url: 'project/task/sublist',
|
||||
@ -520,10 +520,10 @@ export default {
|
||||
data.sub_task = state.projectSubTask[task_id] || []
|
||||
//
|
||||
state.projectOpenTask = Object.assign({}, data, {_show: true});
|
||||
dispatch("taskOne", task_id);
|
||||
dispatch("taskContent", task_id);
|
||||
dispatch("taskFiles", task_id);
|
||||
dispatch("subTask", task_id);
|
||||
dispatch("getTaskOne", task_id);
|
||||
dispatch("getTaskContent", task_id);
|
||||
dispatch("getTaskFiles", task_id);
|
||||
dispatch("getSubTask", task_id);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -562,7 +562,7 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
dispatch('projectOne', task.project_id);
|
||||
dispatch("getProjectOne", task.project_id);
|
||||
resolve(result)
|
||||
}).catch(result => {
|
||||
reject(result)
|
||||
@ -586,7 +586,7 @@ export default {
|
||||
if (data.task_id == state.projectOpenTask.id) {
|
||||
state.projectOpenTask.sub_task.push(result.data.task);
|
||||
}
|
||||
dispatch('taskOne', data.task_id);
|
||||
dispatch("getTaskOne", data.task_id);
|
||||
resolve(result)
|
||||
}).catch(result => {
|
||||
reject(result)
|
||||
@ -613,15 +613,15 @@ export default {
|
||||
method: 'post',
|
||||
}).then(result => {
|
||||
if (result.data.parent_id) {
|
||||
dispatch('taskOne', result.data.parent_id);
|
||||
dispatch("getTaskOne", result.data.parent_id);
|
||||
}
|
||||
if (typeof post.complete_at !== "undefined") {
|
||||
dispatch('projectOne', result.data.project_id);
|
||||
dispatch("getProjectOne", result.data.project_id);
|
||||
}
|
||||
dispatch("taskData", result.data);
|
||||
dispatch("saveTask", result.data);
|
||||
resolve(result)
|
||||
}).catch(result => {
|
||||
dispatch('taskOne', post.task_id);
|
||||
dispatch("getTaskOne", post.task_id);
|
||||
reject(result)
|
||||
});
|
||||
});
|
||||
@ -659,7 +659,6 @@ export default {
|
||||
state.projectOpenTask.sub_task.splice(index, 1)
|
||||
}
|
||||
}
|
||||
dispatch('projectDetail', data.project_id);
|
||||
resolve(result);
|
||||
}).catch(result => {
|
||||
reject(result)
|
||||
@ -673,7 +672,7 @@ export default {
|
||||
* @param dispatch
|
||||
* @returns {Promise<unknown>}
|
||||
*/
|
||||
taskPriority({state, dispatch}) {
|
||||
getTaskPriority({state, dispatch}) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
dispatch("call", {
|
||||
url: 'system/priority',
|
||||
@ -686,12 +685,30 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新会话数据
|
||||
* @param state
|
||||
* @param dispatch
|
||||
* @param data
|
||||
*/
|
||||
saveDialog({state, dispatch}, data) {
|
||||
let splice = false;
|
||||
state.dialogList.some(({id, unread}, index) => {
|
||||
if (id == data.id) {
|
||||
unread !== data.unread && dispatch('getDialogMsgUnread');
|
||||
state.dialogList.splice(index, 1, data);
|
||||
return splice = true;
|
||||
}
|
||||
});
|
||||
!splice && state.dialogList.unshift(data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取会话列表
|
||||
* @param state
|
||||
* @param dispatch
|
||||
*/
|
||||
dialogList({state, dispatch}) {
|
||||
getDialogList({state, dispatch}) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
dispatch("call", {
|
||||
url: 'dialog/lists',
|
||||
@ -704,38 +721,20 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新会话数据
|
||||
* @param state
|
||||
* @param dispatch
|
||||
* @param data
|
||||
*/
|
||||
dialogUpdate({state, dispatch}, data) {
|
||||
let splice = false;
|
||||
state.dialogList.some(({id, unread}, index) => {
|
||||
if (id == data.id) {
|
||||
unread !== data.unread && dispatch('dialogMsgUnread');
|
||||
state.dialogList.splice(index, 1, data);
|
||||
return splice = true;
|
||||
}
|
||||
});
|
||||
!splice && state.dialogList.unshift(data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取单个会话
|
||||
* @param state
|
||||
* @param dispatch
|
||||
* @param dialog_id
|
||||
*/
|
||||
dialogOne({state, dispatch}, dialog_id) {
|
||||
getDialogOne({state, dispatch}, dialog_id) {
|
||||
dispatch("call", {
|
||||
url: 'dialog/one',
|
||||
data: {
|
||||
dialog_id,
|
||||
},
|
||||
}).then(result => {
|
||||
dispatch('dialogUpdate', result.data);
|
||||
dispatch("dialogUpdate", result.data);
|
||||
});
|
||||
},
|
||||
|
||||
@ -756,8 +755,8 @@ export default {
|
||||
},
|
||||
}).then(result => {
|
||||
state.method.setStorage('messengerDialogId', result.data.id)
|
||||
dispatch('dialogMsgList', result.data.id);
|
||||
dispatch('dialogUpdate', result.data);
|
||||
dispatch("getDialogMsgList", result.data.id);
|
||||
dispatch("saveDialog", result.data);
|
||||
}).catch(result => {
|
||||
$A.modalError(result.msg);
|
||||
});
|
||||
@ -769,7 +768,7 @@ export default {
|
||||
* @param dispatch
|
||||
* @param dialog_id
|
||||
*/
|
||||
dialogMsgList({state, dispatch}, dialog_id) {
|
||||
getDialogMsgList({state, dispatch}, dialog_id) {
|
||||
if (state.method.runNum(dialog_id) === 0) {
|
||||
return;
|
||||
}
|
||||
@ -823,7 +822,7 @@ export default {
|
||||
})
|
||||
}
|
||||
// 更新会话数据
|
||||
dispatch('dialogUpdate', dialog);
|
||||
dispatch("saveDialog", dialog);
|
||||
}).catch(() => {
|
||||
state.dialogMsgLoad--;
|
||||
state.cacheDialogList[dialog_id + "::load"] = false;
|
||||
@ -835,7 +834,7 @@ export default {
|
||||
* @param state
|
||||
* @param dispatch
|
||||
*/
|
||||
dialogMsgUnread({state, dispatch}) {
|
||||
getDialogMsgUnread({state, dispatch}) {
|
||||
if (state.userId === 0) {
|
||||
state.dialogMsgUnread = 0;
|
||||
return;
|
||||
@ -848,7 +847,7 @@ export default {
|
||||
state.dialogMsgUnread = result.data.unread;
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
dispatch('dialogMsgUnread');
|
||||
dispatch('getDialogMsgUnread');
|
||||
}, 200);
|
||||
}
|
||||
});
|
||||
@ -907,7 +906,7 @@ export default {
|
||||
state.wsReadWaitList.push(id);
|
||||
clearTimeout(state.wsReadTimeout);
|
||||
state.wsReadTimeout = setTimeout(() => {
|
||||
dispatch('websocketSend', {
|
||||
dispatch("websocketSend", {
|
||||
type: 'readMsg',
|
||||
data: {
|
||||
id: state.method.cloneJSON(state.wsReadWaitList)
|
||||
@ -977,11 +976,11 @@ export default {
|
||||
break
|
||||
|
||||
case "line":
|
||||
dispatch('saveUserOnlineStatus', msgDetail.data);
|
||||
dispatch("saveUserOnlineStatus", msgDetail.data);
|
||||
break
|
||||
|
||||
default:
|
||||
msgId && dispatch('websocketSend', {type: 'receipt', msgId});
|
||||
msgId && dispatch("websocketSend", {type: 'receipt', msgId});
|
||||
state.wsMsg = msgDetail;
|
||||
Object.values(state.wsListener).forEach((call) => {
|
||||
if (typeof call === "function") {
|
||||
@ -1015,7 +1014,7 @@ export default {
|
||||
if (dialog) {
|
||||
dialog.last_msg = data;
|
||||
} else {
|
||||
dispatch('dialogOne', dialog_id);
|
||||
dispatch("getDialogOne", dialog_id);
|
||||
}
|
||||
if (mode === "add") {
|
||||
if (dialog) {
|
||||
|
@ -430,6 +430,12 @@
|
||||
margin: 0 0 0 18px;
|
||||
}
|
||||
}
|
||||
.dialog-wrapper {
|
||||
z-index: 0;
|
||||
.dialog-footer {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user