|
|
@@ -6,7 +6,7 @@
|
|
|
<view class="user-icon">
|
|
|
<uni-icons type="person" size="30"></uni-icons>
|
|
|
</view>
|
|
|
- <span class="nickname" v-if="!userInfo">登录</span>
|
|
|
+ <span class="nickname" v-if="!userInfo" @click="goUserInfoPage">登录</span>
|
|
|
<span class="user-btn" v-if="userInfo" @click="goUserInfoPage">用户中心</span>
|
|
|
</view>
|
|
|
|
|
|
@@ -17,35 +17,35 @@
|
|
|
<view class="split-box">
|
|
|
<view class="line-box">
|
|
|
<span>投入</span>
|
|
|
- <span class="number-box">50</span>
|
|
|
+ <span class="number-box">¥{{userInfo.lotteryInvestAmount}}</span>
|
|
|
</view>
|
|
|
<view class="under-line-box">
|
|
|
<span>中奖</span>
|
|
|
- <span class="number-box">100</span>
|
|
|
+ <span class="number-box">¥{{userInfo.lotteryWinAmount}}</span>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="split-box">
|
|
|
<view class="line-box">
|
|
|
<span>已领取</span>
|
|
|
- <span class="number-box">68</span>
|
|
|
+ <span class="number-box">{{userInfo.claimedRewardNum}}</span>
|
|
|
</view>
|
|
|
<view class="under-line-box">
|
|
|
<span>总奖励</span>
|
|
|
- <span class="number-box">100</span>
|
|
|
+ <span class="number-box">{{userInfo.totalRewardNum}}</span>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<!-- 待领取奖励区 -->
|
|
|
<view class="right-box">
|
|
|
<view class="reward-title">待领取奖励数</view>
|
|
|
- <view class="reward-num">24</view>
|
|
|
+ <view class="reward-num">{{userInfo.unclaimedRewardNum}}</view>
|
|
|
<view class="reward-btn-group">
|
|
|
<view class="reward-btn-left">全部领取</view>
|
|
|
<view class="reward-btn-right">部分领取</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<!-- 刷新按钮 -->
|
|
|
- <view class="refresh-btn">
|
|
|
+ <view class="refresh-btn" @click="getUserInfo">
|
|
|
<uni-icons type="refreshempty" color="#406CE7"></uni-icons>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -61,15 +61,15 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="task-item" v-for="punchIn in punchIns" :key="punchIn.punchInId">
|
|
|
- <view class="main-box" @click="goPunchInDetailPage">
|
|
|
+ <view class="main-box" @click="goPunchInDetailPage(punchIn.punchInId)">
|
|
|
<view class="item-header">
|
|
|
<span class="item-title">{{punchIn.taskName}}</span>
|
|
|
- <span class="item-reward">x88</span>
|
|
|
+ <span class="item-reward">x{{punchIn.rewardNum}}</span>
|
|
|
<view class="item-tag" v-if="punchIn.fullAttendanceFlag">全勤奖励</view>
|
|
|
<view class="item-tag" v-if="punchIn.weekendDoubleFlag">周末双倍</view>
|
|
|
</view>
|
|
|
<view class="item-desc">
|
|
|
- 规则:最少做金刚功两次,四次八部金刚功+一次长寿宫
|
|
|
+ 规则:{{punchIn.description}}
|
|
|
</view>
|
|
|
<view class="item-detail-list">
|
|
|
<view class="item-detail" v-for="punchInRecord in punchIn.punchInRecords"
|
|
|
@@ -89,9 +89,18 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="func-box">
|
|
|
- <span>06:30</span>
|
|
|
- <span>已完成</span>
|
|
|
+ <view class="func-box" v-if="punchIn.category == 0" @click="doPunchIn(punchIn.punchInId)">
|
|
|
+ <span>完成</span>
|
|
|
+ </view>
|
|
|
+ <view class="func-box" v-if="punchIn.category == 1" @click="doPunchIn(punchIn.punchInId)">
|
|
|
+ <span>{{punchIn.countTrack}}</span>
|
|
|
+ <span>计数</span>
|
|
|
+ </view>
|
|
|
+ <view class="func-box" v-if="punchIn.category == 2" @click="doPunchIn(punchIn.punchInId)">
|
|
|
+ <span>
|
|
|
+ {{punchIn.timeTrack.slice(0, 5)}}
|
|
|
+ </span>
|
|
|
+ <span>计时</span>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -110,32 +119,48 @@
|
|
|
<script setup>
|
|
|
import { onMounted, ref } from 'vue';
|
|
|
import { onLoad, onPullDownRefresh, onShow } from "@dcloudio/uni-app";
|
|
|
- import { rewardApi, punchInApi } from '@/service/apis.js';
|
|
|
+ import { rewardApi, punchInApi, userApi } from '@/service/apis.js';
|
|
|
import router from '@/common/constants/router.js';
|
|
|
|
|
|
/**
|
|
|
- * 可领取奖励
|
|
|
+ * 用户信息
|
|
|
*/
|
|
|
- const reward = ref(0);
|
|
|
-
|
|
|
+ const userInfo = ref({
|
|
|
+ totalRewardNum: 0,
|
|
|
+ unclaimedRewardNum: 0,
|
|
|
+ claimedRewardNum: 0,
|
|
|
+ lotteryInvestAmount: 0.00,
|
|
|
+ lotteryWinAmount: 0.00
|
|
|
+ });
|
|
|
+
|
|
|
/**
|
|
|
* 打卡任务
|
|
|
*/
|
|
|
const punchIns = ref([]);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取用户信息
|
|
|
+ */
|
|
|
+ const getUserInfo = async () => {
|
|
|
+ let res = await userApi.queryUserInfo();
|
|
|
+ userInfo.value = res;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
- * 领取奖励对话框
|
|
|
+ * 获取打卡
|
|
|
*/
|
|
|
- const claimRewardDialog = ref(null);
|
|
|
+ const getPunchIns = async () => {
|
|
|
+ let res = await punchInApi.queryPunchIns();
|
|
|
+ punchIns.value = res;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
- * 用户信息
|
|
|
+ * 领取奖励对话框
|
|
|
*/
|
|
|
- const userInfo = ref(null);
|
|
|
+ const claimRewardDialog = ref(null);
|
|
|
|
|
|
- const handleUserInfo = (e) => {
|
|
|
- console.log(e);
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 领取奖励
|
|
|
@@ -151,25 +176,10 @@
|
|
|
await rewardApi.claimReward({
|
|
|
"claimRewardNum": val
|
|
|
});
|
|
|
- getReward();
|
|
|
+ // getReward();
|
|
|
claimRewardDialog.value.close();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取奖励
|
|
|
- */
|
|
|
- const getReward = async () => {
|
|
|
- let res = await rewardApi.queryReward();
|
|
|
- reward.value = res.unclaimedRewardNum;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取打卡
|
|
|
- */
|
|
|
- const getPunchIn = async () => {
|
|
|
- let res = await punchInApi.queryPunchIn();
|
|
|
- punchIns.value = res;
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* 打卡
|
|
|
@@ -178,7 +188,7 @@
|
|
|
await punchInApi.doPunchIn({
|
|
|
id
|
|
|
});
|
|
|
- getPunchIn();
|
|
|
+ getPunchIns();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -196,16 +206,16 @@
|
|
|
const goPunchInEditPage = () => {
|
|
|
uni.navigateTo({
|
|
|
url: router.PUNCHIN_EDIT_URL
|
|
|
- })
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 跳转打卡详情页面
|
|
|
*/
|
|
|
- const goPunchInDetailPage = () => {
|
|
|
+ const goPunchInDetailPage = (id) => {
|
|
|
uni.navigateTo({
|
|
|
- url: router.PUNCHIN_DETAIL_URL
|
|
|
- })
|
|
|
+ url: router.PUNCHIN_DETAIL_URL + "?id=" + id
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
@@ -214,21 +224,29 @@
|
|
|
const loadData = async () => {
|
|
|
let token = uni.getStorageSync("token");
|
|
|
// 如果还没登录就结束获取数据
|
|
|
+ console.log(token);
|
|
|
if (!token) {
|
|
|
- reward.value = 0;
|
|
|
+ userInfo.value = ref({
|
|
|
+ totalRewardNum: 0,
|
|
|
+ unclaimedRewardNum: 0,
|
|
|
+ claimedRewardNum: 0,
|
|
|
+ lotteryInvestAmount: 0.00,
|
|
|
+ lotteryWinAmount: 0.00
|
|
|
+ });
|
|
|
punchIns.value = [];
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ console.log("开始啦啦啦");
|
|
|
try {
|
|
|
uni.showLoading({
|
|
|
title: '加载中',
|
|
|
mask: true
|
|
|
});
|
|
|
- // 获取奖励
|
|
|
- getReward();
|
|
|
+ // 获取用户信息
|
|
|
+ getUserInfo();
|
|
|
// 获取打卡
|
|
|
- getPunchIn();
|
|
|
+ getPunchIns();
|
|
|
} finally {
|
|
|
uni.hideLoading();
|
|
|
}
|
|
|
@@ -240,6 +258,7 @@
|
|
|
});
|
|
|
|
|
|
onPullDownRefresh(() => {
|
|
|
+ console.log('触发下拉刷星');
|
|
|
loadData();
|
|
|
uni.stopPullDownRefresh();
|
|
|
});
|
|
|
@@ -252,14 +271,13 @@
|
|
|
position: relative;
|
|
|
|
|
|
.user-icon {
|
|
|
- display: inline-block !important;
|
|
|
+ display: inline-flex !important;
|
|
|
|
|
|
width: 72rpx;
|
|
|
height: 72rpx;
|
|
|
background: #FFFFFF;
|
|
|
border-radius: 50%;
|
|
|
|
|
|
- display: flex;
|
|
|
justify-content: center;
|
|
|
align-items: center;
|
|
|
}
|
|
|
@@ -591,6 +609,7 @@
|
|
|
}
|
|
|
|
|
|
.func-box {
|
|
|
+ flex-shrink: 0;
|
|
|
width: 160rpx;
|
|
|
border-radius: 0rpx 24rpx 24rpx 0rpx;
|
|
|
background: #406CE7;
|