This commit is contained in:
2025-06-24 19:17:10 +08:00
parent a608fcb530
commit 872999905c
9 changed files with 127 additions and 62 deletions

View File

@@ -9,7 +9,8 @@ import AddMaterial from "../../pages/merchant/components/AddMaterial.vue";
import AddComment from "../../pages/merchant/components/AddComment.vue";
import RejectTaskModal from "../../pages/manage/pages/manage-reward-mission/components/RejectTaskModal.vue";
const emits = defineEmits(['success']);
const emits = defineEmits(['success', 'checkChange']);
const checked = ref(false);
const selecdKey = ref([]);
const {id} = defineProps({
id: {
@@ -44,42 +45,19 @@ watch(
const passTaskChildren = async () => {
console.log(selecdKey.value);
const pro_list = [];
if (selecdKey.value.length === 0) {
pro_list.push(new Promise((reactive, reject) => {
Api.admin.passChildrenMaterial(detail.content[activeKey.value]).then((res) => {
reactive(res);
}).catch((err) => {
reject(err);
})
}));
}
selecdKey.value.forEach(v => {
pro_list.push(new Promise((reactive, reject) => {
Api.admin.passChildrenMaterial(v).then((res) => {
reactive(res);
}).catch((err) => {
reject(err);
})
}));
})
const res = await Promise.all(pro_list);
let flag = true;
for (const v of res) {
if (v.code !== 1) {
Message.warning(v.msg)
flag = false;
}
}
if (flag) {
Message.success(res[0].msg);
visible.value = false;
emits('success');
}
const {msg} = await Api.admin.passChildrenMaterial({
id: detail.id,
data: detail.content.map(v => ({
id: v.id,
title: v.title,
content: v.content,
tags: v.tags,
material: v.material,
}))
});
Message.success(msg);
visible.value = false;
emits('success');
}
const refuseTaskChildren = async () => {
@@ -88,6 +66,14 @@ const refuseTaskChildren = async () => {
visible.value = false;
emits('success');
}
watch(
() => checked.value,
(val) => {
emits('checkChange', val)
},
{deep: true}
)
</script>
<template>
@@ -172,12 +158,7 @@ const refuseTaskChildren = async () => {
<template #footer>
<div class="flex items-center gap-[8px]">
<a-checkbox-group v-model:model-value="selecdKey">
<template v-for="(item, index) in detail.content" :key="item">
<a-checkbox v-show="activeKey === index" :value="item">选中
</a-checkbox>
</template>
</a-checkbox-group>
<a-checkbox v-model:model-value="checked">选中</a-checkbox>
<template v-if="detail.check_status === 0">
<a-button @click="passTaskChildren" type="primary" class="ml-auto">通过