Commit 8399921f authored by 天马流星拳's avatar 天马流星拳

feat(任务): 修改任务领奖接口及参数传递方式

重构任务领奖接口配置,从字符串改为对象形式以支持更多配置
修改任务领奖参数传递方式,改为传递整个任务对象以便获取更多信息
parent 0368fa87
...@@ -58,7 +58,12 @@ const API = generateAPI({ ...@@ -58,7 +58,12 @@ const API = generateAPI({
withToken: true, withToken: true,
}, },
// 任务领奖接口 // 任务领奖接口
sendPrizeTask: "task_1/sendPrize.do", // sendPrizeTask: "task_1/sendPrize.do",
sendPrizeTask: {
uri: "task_1/sendPrize.do",
method: 'post',
withToken: true,
},
// 查询题目 // 查询题目
queryQS: "answer_1/query.do", queryQS: "answer_1/query.do",
// 开始答题 // 开始答题
......
...@@ -54,7 +54,7 @@ class TaskPanel extends React.Component { ...@@ -54,7 +54,7 @@ class TaskPanel extends React.Component {
})}></Button>} })}></Button>}
{el.taskStatus == 1 && <Button className='dailingqu' onClick={_asyncThrottle(() => { {el.taskStatus == 1 && <Button className='dailingqu' onClick={_asyncThrottle(() => {
handleTaskLogClick(16, el.code, 2); handleTaskLogClick(16, el.code, 2);
taskStore.sendPrize(el.prizePendingCodeList.code); taskStore.sendPrize(el);
})}></Button>} })}></Button>}
{el.taskStatus == 2 && <Button className='completed'></Button>} {el.taskStatus == 2 && <Button className='completed'></Button>}
</div> </div>
......
...@@ -86,9 +86,10 @@ const taskStore = makeAutoObservable({ ...@@ -86,9 +86,10 @@ const taskStore = makeAutoObservable({
setSendPrizeInfo(data) { setSendPrizeInfo(data) {
this.sendPrizeInfo = data || {}; this.sendPrizeInfo = data || {};
}, },
async sendPrize(code) { async sendPrize(item) {
console.log("🚀 ~ item:", item)
// const { success, data } = await API.sendPrizeTask({ code: code, channel: CFG.channel }); // const { success, data } = await API.sendPrizeTask({ code: code, channel: CFG.channel });
const { success, data } = await API.sendPrizeTask({ prizePendingCode: code }); const { success, data } = await API.sendPrizeTask({ prizePendingCode: item.prizePendingCode, taskCode: item.code });
if (success) { if (success) {
store.updateIndex(); store.updateIndex();
taskStore.queryTaskInfo(); taskStore.queryTaskInfo();
......
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