<script lang="ts" setup>
import { onMounted, ref } from 'vue'
import { TaskList } from '../TaskList/index.ts'
import type { TaskType } from './index.d'
import { noviceTask } from '@/api/task/index'

const totalScore = ref(0)
const list = ref<TaskType[]>([])
const finishedTaskCount = ref(0)
function getTaskList() {
  noviceTask().then((res) => {
    list.value = res.taskCenterList
    totalScore.value = res.totalScore
    finishedTaskCount.value = res.finishedTaskCount
  })
}
onMounted(() => {
  getTaskList()
})
</script>

<template>
  <TaskList title="新手任务" :list="list" :total-score="totalScore" :finished-task-count="finishedTaskCount" @update-list="getTaskList()" />
</template>

<style lang="scss" scoped>
.nvoice-task-box {
  width: 95%;
  .title {
    font-size: 14px;
    font-family: PingFang-SC, PingFang-SC;
    font-weight: bold;
    color: #000000;
    line-height: 22px;
    letter-spacing: 1px;
    margin: 16px 0;
  }
}
</style>
