|
|
@@ -2,11 +2,11 @@
|
|
|
<view class="total-page page-box">
|
|
|
<Nav :title="'领取任务'" :genre="1" :fixedHeight="110"></Nav>
|
|
|
<view class="task-tabs m-t30">
|
|
|
- <TaskImgTab></TaskImgTab>
|
|
|
+ <TaskImgTab @setProductId="setProductId"></TaskImgTab>
|
|
|
</view>
|
|
|
<!-- <EnButton is_both></EnButton> -->
|
|
|
<EnScroll ref="scroll" :navHeight="110" class="main" @onRefresh="onRefresh" @onScrollBottom="onScrollBottom">
|
|
|
- <TaskItem :type="2" is_bottom></TaskItem>
|
|
|
+ <TaskItem :type="2" :task-list="taskList" is_bottom @takeTask="setTakeTask"></TaskItem>
|
|
|
</EnScroll>
|
|
|
</view>
|
|
|
</template>
|
|
|
@@ -14,6 +14,8 @@
|
|
|
<script>
|
|
|
import TaskItem from "@/common/task/task-item.vue"
|
|
|
import TaskImgTab from "@/page_task/module/task_ima_tab.vue"
|
|
|
+ import {getTaskReceiving, takeTask} from "@/api/task";
|
|
|
+ import tools from "@/service/tools";
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
|
@@ -22,11 +24,46 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
-
|
|
|
+ taskList: [],
|
|
|
+ page: 1,
|
|
|
+ totalNum: 9999,
|
|
|
+ isAjax: false,
|
|
|
+ productId:0
|
|
|
}
|
|
|
},
|
|
|
- methods: {
|
|
|
+ mounted() {
|
|
|
+ this.getTaskReceiving()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ setProductId(productId){
|
|
|
+ console.log('productId:'+productId)
|
|
|
+ this.productId=productId
|
|
|
+ this.startList()
|
|
|
+ },
|
|
|
// 下拉刷新
|
|
|
+ startList() {
|
|
|
+ this.taskList = [];
|
|
|
+ this.page = 1
|
|
|
+ this.totalNum = 99999
|
|
|
+ this.getTaskReceiving()
|
|
|
+ },
|
|
|
+ async getTaskReceiving() {
|
|
|
+ if (this.totalNum <= this.taskList.length) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const res = await getTaskReceiving({'page':this.page,'productId':this.productId})
|
|
|
+ if (res.code === 1) {
|
|
|
+ this.totalNum=res.data.totalNum
|
|
|
+ this.taskList.push(...res.data.items)
|
|
|
+ ++this.page
|
|
|
+ }
|
|
|
+ },
|
|
|
+ setTakeTask(index){
|
|
|
+ console.log('index:'+index)
|
|
|
+ this.taskList.splice(index, 1)
|
|
|
+ uni.$emit('updateMemberInfo')
|
|
|
+ },
|
|
|
+
|
|
|
onRefresh() {
|
|
|
uni.showLoading({
|
|
|
title: '数据加载中'
|
|
|
@@ -37,6 +74,7 @@
|
|
|
icon: 'none'
|
|
|
})
|
|
|
this.$refs.scroll.onEndPulling()
|
|
|
+ this.startList()
|
|
|
}, 1000)
|
|
|
console.log("下拉刷新");
|
|
|
},
|
|
|
@@ -45,6 +83,7 @@
|
|
|
uni.showLoading({
|
|
|
title: '数据加载中'
|
|
|
})
|
|
|
+ this.getTaskReceiving()
|
|
|
setTimeout(() => {
|
|
|
uni.showToast({
|
|
|
title: '加载完成',
|