|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
<script lang="ts" setup> |
|
|
|
|
import type { ComputedRef } from 'vue' |
|
|
|
|
import { computed, ref } from 'vue' |
|
|
|
|
import { |
|
|
|
|
DownOutlined, |
|
|
|
@ -10,7 +11,7 @@ import money from '@/assets/images/task/money.png'
|
|
|
|
|
import { receiveAward } from '@/api/task/index' |
|
|
|
|
import { useUserStore } from '@/store/moules/userStore/index' |
|
|
|
|
|
|
|
|
|
const { title, list, totalScore } = defineProps({ |
|
|
|
|
const props = defineProps({ |
|
|
|
|
title: { |
|
|
|
|
type: String, |
|
|
|
|
}, |
|
|
|
@ -20,13 +21,14 @@ const { title, list, totalScore } = defineProps({
|
|
|
|
|
finishedTaskCount: { |
|
|
|
|
type: Number, |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
list: { |
|
|
|
|
type: Array as PropType<TaskType[]>, |
|
|
|
|
default: () => [], |
|
|
|
|
default: (): TaskType[] => [], // 默认空数组 [], |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
const emit = defineEmits(['updateList']) |
|
|
|
|
const reactiveList: ComputedRef<TaskType[]> = computed(() => props.list) |
|
|
|
|
|
|
|
|
|
const userStore = useUserStore() |
|
|
|
|
// 领取积分 |
|
|
|
|
function handleGetDot(id: string) { |
|
|
|
@ -43,7 +45,7 @@ const dynamicStyle = computed(() => {
|
|
|
|
|
let maxHeight |
|
|
|
|
if (isExpanded.value) { |
|
|
|
|
// 如果展开,那么高度应该是单个项目的高度乘以项目总数 |
|
|
|
|
maxHeight = singleItemHeight * list.length |
|
|
|
|
maxHeight = singleItemHeight * reactiveList.value.length |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
// 如果没有展开,那么高度应该是单个项目的高度乘以默认显示的项目个数 |
|
|
|
@ -66,22 +68,22 @@ const dynamicStyle = computed(() => {
|
|
|
|
|
全部完成可获得 {{ totalScore }} 点数 |
|
|
|
|
</div> |
|
|
|
|
<div class="right"> |
|
|
|
|
已完成 {{ finishedTaskCount }}/{{ list.length }} |
|
|
|
|
已完成 {{ finishedTaskCount }}/{{ reactiveList.length }} |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div class="content" :style="dynamicStyle"> |
|
|
|
|
<div class="earn-list-box"> |
|
|
|
|
<div v-for="(item, index) in list" :key="index" class="earn-list"> |
|
|
|
|
<div v-for="(item, index) in reactiveList" :key="index" class="earn-list"> |
|
|
|
|
<div class="earn-list-left"> |
|
|
|
|
<div class="name"> |
|
|
|
|
{{ item.name }} |
|
|
|
|
</div> |
|
|
|
|
<div v-show="item.status === 2" class="accomplish"> |
|
|
|
|
已获得{{ item.score }}点数 |
|
|
|
|
已获得{{ item.points }}点数 |
|
|
|
|
</div> |
|
|
|
|
<div v-show="item.status !== 2" class="unfinished"> |
|
|
|
|
0/{{ item.score }} |
|
|
|
|
{{ item.status === 1 ? 1 : 0 }}/1 |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="earn-list-right"> |
|
|
|
@ -89,7 +91,7 @@ const dynamicStyle = computed(() => {
|
|
|
|
|
<div class="flex items-center"> |
|
|
|
|
<img class="add-dot-photo" :src="money" alt=""> |
|
|
|
|
<div class="add-dot-num"> |
|
|
|
|
+{{ item.score }} |
|
|
|
|
+{{ item.points }} |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
@ -110,7 +112,7 @@ const dynamicStyle = computed(() => {
|
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div v-if="list.length > 4" class="shrink" @click="isExpanded = !isExpanded"> |
|
|
|
|
<div v-if="reactiveList.length > 4" class="shrink" @click="isExpanded = !isExpanded"> |
|
|
|
|
<DownOutlined v-if="!isExpanded" /> |
|
|
|
|
<UpOutlined v-else /> |
|
|
|
|
</div> |
|
|
|
|