feat: 新增任务接口路由
This commit is contained in:
33
Yi.Bbs.Vue3/src/apis/assignmentApi.js
Normal file
33
Yi.Bbs.Vue3/src/apis/assignmentApi.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import request from "@/config/axios/service";
|
||||
|
||||
//接受任务
|
||||
export function acceptAssignment(id) {
|
||||
return request({
|
||||
url: `/assignment/accept/${id}`,
|
||||
method: "post"
|
||||
});
|
||||
}
|
||||
//领取奖励
|
||||
export function receiveAssignment(id) {
|
||||
return request({
|
||||
url: `/assignment/complete/${id}`,
|
||||
method: "post",
|
||||
});
|
||||
}
|
||||
|
||||
//查询能够领取的任务
|
||||
export function getCanReceiveAssignment() {
|
||||
return request({
|
||||
url: `/assignment/receive`,
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
//查询已领取的任务
|
||||
export function getAssignmentList(data) {
|
||||
return request({
|
||||
url: `/assignment`,
|
||||
method: "get",
|
||||
params:data
|
||||
});
|
||||
}
|
||||
@@ -156,6 +156,14 @@ const router = createRouter({
|
||||
title: "银行",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "assignment",
|
||||
path: "assignment",
|
||||
component: () => import("../views/assignment/Index.vue"),
|
||||
meta: {
|
||||
title: "任务",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
|
||||
18
Yi.Bbs.Vue3/src/views/assignment/Index.vue
Normal file
18
Yi.Bbs.Vue3/src/views/assignment/Index.vue
Normal file
@@ -0,0 +1,18 @@
|
||||
<script setup>
|
||||
import {getCanReceiveAssignment} from '@/apis/assignmentApi'
|
||||
import {onMounted, ref} from "vue";
|
||||
|
||||
const canReceiveAssignmentList=ref([]);
|
||||
onMounted( async ()=>{
|
||||
const {data:canReceiveAssignmentListData}= await getCanReceiveAssignment();
|
||||
canReceiveAssignmentList.value=canReceiveAssignmentListData;
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
<div>
|
||||
<div v-for="item in canReceiveAssignmentList">{{item}}</div>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user