|
|
@@ -8,15 +8,15 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="points-item">
|
|
|
- <text class="points-value">{{ pointsData.current }}</text>
|
|
|
+ <text class="points-value">{{ totalPoints }}</text>
|
|
|
<text class="points-label">我的积分</text>
|
|
|
</view>
|
|
|
<view class="points-item">
|
|
|
- <text class="points-value">{{ pointsData.completedTasks }}</text>
|
|
|
+ <text class="points-value">{{ completedTask }}</text>
|
|
|
<text class="points-label">已完成任务</text>
|
|
|
</view>
|
|
|
<view class="points-item">
|
|
|
- <text class="points-value">{{ pointsData.pendingTasks }}</text>
|
|
|
+ <text class="points-value">{{ pendingTasks }}</text>
|
|
|
<text class="points-label">待完成任务</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -78,18 +78,33 @@
|
|
|
|
|
|
<script>
|
|
|
import ImageItem from "@/components/swiper/components/image.vue";
|
|
|
-
|
|
|
+import { mapState } from 'vuex';
|
|
|
export default {
|
|
|
name: "taskList",
|
|
|
components: {ImageItem},
|
|
|
+ computed: {
|
|
|
+ ...mapState({
|
|
|
+ myPoint: state => state.points.myPoint
|
|
|
+ }),
|
|
|
+ totalPoints() {
|
|
|
+ return this.myPoint.totalPoints || 0;
|
|
|
+ },
|
|
|
+ completedTask() {
|
|
|
+ return this.myPoint.completedTask || 0;
|
|
|
+ },
|
|
|
+ pendingTasks() {
|
|
|
+ return this.myPoint.pendingTasks || 0;
|
|
|
+ },
|
|
|
+ categoryIndex() {
|
|
|
+ return this.tabs.findIndex(item => item.key === this.activeTab)
|
|
|
+ },
|
|
|
+ // 过滤后的任务
|
|
|
+ filteredTasks() {
|
|
|
+ return this.tasks.filter(task => task.type === this.activeTab)
|
|
|
+ }
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
- // 积分数据
|
|
|
- pointsData: {
|
|
|
- current: 563,
|
|
|
- completedTasks: 10,
|
|
|
- pendingTasks: 15
|
|
|
- },
|
|
|
// 标签数据
|
|
|
tabs: [
|
|
|
{ key: 'new', name: '新手任务' },
|
|
|
@@ -148,15 +163,6 @@ export default {
|
|
|
]
|
|
|
}
|
|
|
},
|
|
|
- computed: {
|
|
|
- categoryIndex() {
|
|
|
- return this.tabs.findIndex(item => item.key === this.activeTab)
|
|
|
- },
|
|
|
- // 过滤后的任务
|
|
|
- filteredTasks() {
|
|
|
- return this.tasks.filter(task => task.type === this.activeTab)
|
|
|
- }
|
|
|
- },
|
|
|
methods: {
|
|
|
// 切换标签
|
|
|
handleTabChange(data) {
|