Commit ceedb43e authored by 王炽's avatar 王炽

任务person页面立即查询结果

parent bb7eb5d0
...@@ -130,6 +130,7 @@ ...@@ -130,6 +130,7 @@
import { ref, watch, onMounted, computed } from "vue"; import { ref, watch, onMounted, computed } from "vue";
import { onLoad } from "@dcloudio/uni-app"; import { onLoad } from "@dcloudio/uni-app";
import { useUserStore } from "../../stores/user.js"; import { useUserStore } from "../../stores/user.js";
import { useIntegralStore } from "../../stores/integral.js";
import PickerCustom from "../PickerCustom.vue"; import PickerCustom from "../PickerCustom.vue";
import MultiSelectLayer from "../MultiSelectLayer.vue"; import MultiSelectLayer from "../MultiSelectLayer.vue";
import { uploadImage } from "../../api/common.js"; import { uploadImage } from "../../api/common.js";
...@@ -138,6 +139,9 @@ import { updateBabyInfo, getGestationalWeeks } from "../../api/user.js"; ...@@ -138,6 +139,9 @@ import { updateBabyInfo, getGestationalWeeks } from "../../api/user.js";
import { usePageCfgStore } from "../../stores/pageCfg"; import { usePageCfgStore } from "../../stores/pageCfg";
import md from "../../md.js"; import md from "../../md.js";
import { jump, JumpType } from "../../utils/index.js"; import { jump, JumpType } from "../../utils/index.js";
import { useGlobalStore } from "../../stores/global.js";
const globalStore = useGlobalStore();
// Props 定义 // Props 定义
const props = defineProps({ const props = defineProps({
...@@ -534,6 +538,9 @@ const onSubmit = async (e) => { ...@@ -534,6 +538,9 @@ const onSubmit = async (e) => {
icon: "success", icon: "success",
}); });
//获取任务奖品
await checkAndUpdateTaskResult();
// 触发成功事件 // 触发成功事件
emit('success'); emit('success');
// 关闭弹窗 // 关闭弹窗
...@@ -546,6 +553,19 @@ const onSubmit = async (e) => { ...@@ -546,6 +553,19 @@ const onSubmit = async (e) => {
} }
}; };
// 检查任务结果并更新全局状态
const checkAndUpdateTaskResult = async () => {
const integralStore = useIntegralStore();
await integralStore.queryTodoResultServer();
console.log('queryTodoResult:', integralStore.queryTodoResult);
if(integralStore.queryTodoResult?.success && integralStore.queryTodoResult?.data?.length > 0) {
globalStore.isShowTaskComplete = true;
globalStore.taskCompletePoints = integralStore.queryTodoResult.data[0]?.actualCredits;
globalStore.taskCompleteTitle = integralStore.queryTodoResult.data[0]?.taskName;
}
};
const handleClose = () => { const handleClose = () => {
emit('close'); emit('close');
}; };
......
...@@ -179,7 +179,7 @@ const checkAndUpdateTaskResult = async () => { ...@@ -179,7 +179,7 @@ const checkAndUpdateTaskResult = async () => {
onMounted(async () => { onMounted(async () => {
// globalStore.isShowTaskComplete = true;//????????? // globalStore.isShowTaskComplete = true;//?????????
//签到奖品 //任务奖品
await checkAndUpdateTaskResult(); await checkAndUpdateTaskResult();
// 调用邀请活动首页接口 // 调用邀请活动首页接口
......
...@@ -140,6 +140,11 @@ import { updateBabyInfo, getGestationalWeeks } from "../../api/user.js"; ...@@ -140,6 +140,11 @@ import { updateBabyInfo, getGestationalWeeks } from "../../api/user.js";
import { usePageCfgStore } from "../../stores/pageCfg"; import { usePageCfgStore } from "../../stores/pageCfg";
import md from "../../md.js"; import md from "../../md.js";
import { jump, JumpType } from "../../utils/index.js"; import { jump, JumpType } from "../../utils/index.js";
import { useIntegralStore } from "../../stores/integral.js";
import { useGlobalStore } from "../../stores/global.js";
const globalStore = useGlobalStore();
const userStore = useUserStore(); const userStore = useUserStore();
const pageType = ref("add"); const pageType = ref("add");
const babyId = ref(""); const babyId = ref("");
...@@ -517,6 +522,10 @@ const onSubmit = async (e) => { ...@@ -517,6 +522,10 @@ const onSubmit = async (e) => {
title: "提交成功", title: "提交成功",
icon: "success", icon: "success",
}); });
//获取任务奖品
await checkAndUpdateTaskResult();
uni.navigateBack(); uni.navigateBack();
} else { } else {
uni.showToast({ uni.showToast({
...@@ -525,6 +534,22 @@ const onSubmit = async (e) => { ...@@ -525,6 +534,22 @@ const onSubmit = async (e) => {
}); });
} }
}; };
// 检查任务结果并更新全局状态
const checkAndUpdateTaskResult = async () => {
const integralStore = useIntegralStore();
await integralStore.queryTodoResultServer();
console.log('queryTodoResult:', integralStore.queryTodoResult);
if(integralStore.queryTodoResult?.success && integralStore.queryTodoResult?.data?.length > 0) {
globalStore.isShowTaskComplete = true;
globalStore.taskCompletePoints = integralStore.queryTodoResult.data[0]?.actualCredits;
globalStore.taskCompleteTitle = integralStore.queryTodoResult.data[0]?.taskName;
}
};
const handleReturn = () => { const handleReturn = () => {
uni.navigateBack(); uni.navigateBack();
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment