|
@@ -10,12 +10,16 @@
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
import { ref } from 'vue'
|
|
import { ref } from 'vue'
|
|
-import { todayDetail } from '@/api/mine'
|
|
|
|
|
|
+import { clockIn, todayDetail } from '@/api/mine'
|
|
import { toPage } from '@/utils/page'
|
|
import { toPage } from '@/utils/page'
|
|
|
|
|
|
defineOptions({
|
|
defineOptions({
|
|
name: 'MissionCenter', // 任务中心
|
|
name: 'MissionCenter', // 任务中心
|
|
})
|
|
})
|
|
|
|
+const userInfo = computed(() => {
|
|
|
|
+ return getUserInfoHook()
|
|
|
|
+})
|
|
|
|
+
|
|
const dailyMission = [
|
|
const dailyMission = [
|
|
{
|
|
{
|
|
name: 'Invite Friends Earn Cash',
|
|
name: 'Invite Friends Earn Cash',
|
|
@@ -39,23 +43,23 @@ const dailyMission = [
|
|
// 当前签到天数
|
|
// 当前签到天数
|
|
const currentDay = ref(3)
|
|
const currentDay = ref(3)
|
|
// 今日是否已签到
|
|
// 今日是否已签到
|
|
-const hasSignedToday = ref(false)
|
|
|
|
|
|
+const hasSignedToday = ref(true)
|
|
|
|
|
|
// 签到方法
|
|
// 签到方法
|
|
-function signIn() {
|
|
|
|
|
|
+async function signIn() {
|
|
if (hasSignedToday.value)
|
|
if (hasSignedToday.value)
|
|
return
|
|
return
|
|
- hasSignedToday.value = true
|
|
|
|
- // 如果是新的一天,增加签到天数
|
|
|
|
- if (currentDay.value < 7) {
|
|
|
|
- currentDay.value++
|
|
|
|
|
|
+ const res = await clockIn({ uid: userInfo.value.userId })
|
|
|
|
+ if (res.code === '200') {
|
|
|
|
+ await getSignList()
|
|
}
|
|
}
|
|
- // 这里可以添加签到请求逻辑
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+const signList = ref<any[]>([])
|
|
async function getSignList() {
|
|
async function getSignList() {
|
|
- const res = await todayDetail()
|
|
|
|
|
|
+ const res = await todayDetail({ uid: userInfo.value.userId })
|
|
console.log(res)
|
|
console.log(res)
|
|
|
|
+ signList.value = res.data.signList
|
|
|
|
+ hasSignedToday.value = res.data.today
|
|
}
|
|
}
|
|
onLoad(() => {
|
|
onLoad(() => {
|
|
getSignList()
|
|
getSignList()
|
|
@@ -72,18 +76,18 @@ onLoad(() => {
|
|
</view>
|
|
</view>
|
|
<!-- 七天签到日历 -->
|
|
<!-- 七天签到日历 -->
|
|
<view class="flex items-center justify-between">
|
|
<view class="flex items-center justify-between">
|
|
- <view v-for="(day, index) in 7" :key="index" class="flex flex-col items-center">
|
|
|
|
|
|
+ <view v-for="(day, index) in signList" :key="index" class="flex flex-col items-center">
|
|
<view
|
|
<view
|
|
class="h-70rpx w-70rpx flex items-center justify-center rounded-full" :class="[
|
|
class="h-70rpx w-70rpx flex items-center justify-center rounded-full" :class="[
|
|
- index < currentDay ? 'bg-#FF3778/30' : 'bg-gray-100',
|
|
|
|
|
|
+ day.status === 1 ? 'bg-#FF3778/30' : 'bg-gray-100',
|
|
]"
|
|
]"
|
|
>
|
|
>
|
|
- <text class="text-24rpx" :class="[index < currentDay ? 'text-[var(--wot-color-theme)]' : 'text-#000/15']">
|
|
|
|
- ৳5
|
|
|
|
|
|
+ <text class="text-24rpx" :class="[day.status === 1 ? 'text-[var(--wot-color-theme)]' : 'text-#000/15']">
|
|
|
|
+ ৳{{ day.value }}
|
|
</text>
|
|
</text>
|
|
</view>
|
|
</view>
|
|
<view class="mt-8rpx text-20rpx text-gray-500">
|
|
<view class="mt-8rpx text-20rpx text-gray-500">
|
|
- {{ index + 1 }}D
|
|
|
|
|
|
+ {{ day.days }}D
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|