fix: 客户端任务窗口首次聊天失败的问题

This commit is contained in:
kuaifan 2022-01-27 23:44:06 +08:00
parent f61d79d53e
commit 569164ed56

View File

@ -38,18 +38,25 @@
</style> </style>
<script> <script>
import TaskDetail from "../manage/components/TaskDetail"; import TaskDetail from "../manage/components/TaskDetail";
import {mapState} from "vuex";
export default { export default {
components: {TaskDetail}, components: {TaskDetail},
data() { data() {
return { return {
loadIng: 0, loadIng: 0,
taskId: 0,
taskInfo: {},
} }
}, },
mounted() { mounted() {
// //
}, },
computed: {
...mapState(['cacheTasks']),
taskInfo() {
return this.cacheTasks.find(({id}) => id === this.taskId) || {}
}
},
watch: { watch: {
'$route': { '$route': {
handler() { handler() {
@ -60,20 +67,19 @@ export default {
}, },
methods: { methods: {
getInfo() { getInfo() {
let task_id = $A.runNum(this.$route.params.id); this.taskId = $A.runNum(this.$route.params.id);
if (task_id <= 0) { if (this.taskId <= 0) {
return; return;
} }
this.loadIng++; this.loadIng++;
this.$store.dispatch("getTaskOne", { this.$store.dispatch("getTaskOne", {
task_id, task_id: this.taskId,
archived: 'all' archived: 'all'
}).then(({data}) => { }).then(() => {
this.loadIng--; this.loadIng--;
this.taskInfo = data; this.$store.dispatch("getTaskContent", this.taskId);
this.$store.dispatch("getTaskContent", task_id); this.$store.dispatch("getTaskFiles", this.taskId);
this.$store.dispatch("getTaskFiles", task_id); this.$store.dispatch("getTaskForParent", this.taskId).catch(() => {})
this.$store.dispatch("getTaskForParent", task_id).catch(() => {})
}).catch(({msg}) => { }).catch(({msg}) => {
this.loadIng--; this.loadIng--;
$A.modalError({ $A.modalError({