diff --git a/app/Http/Controllers/Api/FileController.php b/app/Http/Controllers/Api/FileController.php index f5df5aec..b17920f9 100755 --- a/app/Http/Controllers/Api/FileController.php +++ b/app/Http/Controllers/Api/FileController.php @@ -2,7 +2,6 @@ namespace App\Http\Controllers\Api; - use App\Exceptions\ApiException; use App\Models\AbstractModel; use App\Models\File; diff --git a/app/Http/Controllers/Api/ProjectController.php b/app/Http/Controllers/Api/ProjectController.php index 1190a68f..d9ab79fd 100755 --- a/app/Http/Controllers/Api/ProjectController.php +++ b/app/Http/Controllers/Api/ProjectController.php @@ -1274,72 +1274,6 @@ class ProjectController extends AbstractController return Base::retSuccess('修改成功', $data); } - /** - * @api {post} api/project/task/upload 26. 上传文件 - * - * @apiDescription 需要token身份(限:项目、任务负责人) - * @apiVersion 1.0.0 - * @apiGroup project - * @apiName task__upload - * - * @apiParam {Number} task_id 任务ID - * @apiParam {String} [filename] post-文件名称 - * @apiParam {String} [image64] post-base64图片(二选一) - * @apiParam {File} [files] post-文件对象(二选一) - * - * @apiSuccess {Number} ret 返回状态码(1正确、0错误) - * @apiSuccess {String} msg 返回信息(错误描述) - * @apiSuccess {Object} data 返回数据 - */ - public function task__upload() - { - $user = User::auth(); - // - $task_id = Base::getPostInt('task_id'); - // - $task = ProjectTask::userTask($task_id, true, true); - // - $path = "uploads/task/" . $task->id . "/"; - $image64 = Base::getPostValue('image64'); - $fileName = Base::getPostValue('filename'); - if ($image64) { - $data = Base::image64save([ - "image64" => $image64, - "path" => $path, - "fileName" => $fileName, - ]); - } else { - $data = Base::upload([ - "file" => Request::file('files'), - "type" => 'file', - "path" => $path, - "fileName" => $fileName, - ]); - } - // - if (Base::isError($data)) { - return Base::retError($data['msg']); - } else { - $fileData = $data['data']; - $file = ProjectTaskFile::createInstance([ - 'project_id' => $task->project_id, - 'task_id' => $task->id, - 'name' => $fileData['name'], - 'size' => $fileData['size'] * 1024, - 'ext' => $fileData['ext'], - 'path' => $fileData['path'], - 'thumb' => Base::unFillUrl($fileData['thumb']), - 'userid' => $user->userid, - ]); - $file->save(); - // - $file = ProjectTaskFile::find($file->id); - $task->addLog("上传文件:" . $file->name); - $task->pushMsg('upload', $file); - return Base::retSuccess("上传成功", $file); - } - } - /** * @api {get} api/project/task/dialog 27. 创建/获取聊天室 * diff --git a/app/Http/Middleware/VerifyCsrfToken.php b/app/Http/Middleware/VerifyCsrfToken.php index 9775ee86..4a2269d6 100644 --- a/app/Http/Middleware/VerifyCsrfToken.php +++ b/app/Http/Middleware/VerifyCsrfToken.php @@ -30,9 +30,6 @@ class VerifyCsrfToken extends Middleware // 修改任务 'api/project/task/update/', - // 上传任务问题 - 'api/project/task/upload/', - // 聊天发文件 'api/dialog/msg/sendfile/', diff --git a/resources/assets/js/pages/manage/components/DialogWrapper.vue b/resources/assets/js/pages/manage/components/DialogWrapper.vue index 682791be..0991c733 100644 --- a/resources/assets/js/pages/manage/components/DialogWrapper.vue +++ b/resources/assets/js/pages/manage/components/DialogWrapper.vue @@ -216,12 +216,21 @@ export default { watch: { '$route': { handler (route) { - if (route.query && route.query.sendmsg && this.msgText == '') { + if ($A.isJson(window.__sendDialogMsg) && window.__sendDialogMsg.time > $A.Time()) { + const {msgFile, msgText} = window.__sendDialogMsg; + window.__sendDialogMsg = null; + this.$nextTick(() => { + if ($A.isArray(msgFile) && msgFile.length > 0) { + this.sendFileMsg(msgFile); + } else if (msgText) { + this.sendMsg(msgText); + } + }); + } + if (route.query && route.query._) { let query = $A.cloneJSON(route.query); - delete query.sendmsg; + delete query._; this.goForward({query}, true); - this.msgText = route.query.sendmsg; - this.$nextTick(this.sendMsg); } }, immediate: true diff --git a/resources/assets/js/pages/manage/components/TaskDetail.vue b/resources/assets/js/pages/manage/components/TaskDetail.vue index ed2d2e31..7acde97f 100644 --- a/resources/assets/js/pages/manage/components/TaskDetail.vue +++ b/resources/assets/js/pages/manage/components/TaskDetail.vue @@ -347,7 +347,7 @@ - +