|
@@ -2,27 +2,29 @@
|
|
|
<view class="layout-container">
|
|
<view class="layout-container">
|
|
|
<!-- 顶部填充区 -->
|
|
<!-- 顶部填充区 -->
|
|
|
<view class="top-fill" :style="{height: safeArea.statusBarHeight+'px'}"></view>
|
|
<view class="top-fill" :style="{height: safeArea.statusBarHeight+'px'}"></view>
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
<!-- 顶部胶囊区 -->
|
|
<!-- 顶部胶囊区 -->
|
|
|
- <view class="capsule-container"
|
|
|
|
|
- :style="{
|
|
|
|
|
|
|
+ <view class="capsule-container" :style="{
|
|
|
height: safeArea.capsuleBarHeight+'px',
|
|
height: safeArea.capsuleBarHeight+'px',
|
|
|
width: safeArea.capsuleBarLeft+'px',
|
|
width: safeArea.capsuleBarLeft+'px',
|
|
|
- 'padding-top': safeArea.capsuleBarMarginTop+'px',
|
|
|
|
|
|
|
+ 'padding-top': safeArea.capsuleBarMarginTop+'px',
|
|
|
'padding-bottom': safeArea.capsuleBarMarginBottom+'px'}">
|
|
'padding-bottom': safeArea.capsuleBarMarginBottom+'px'}">
|
|
|
- <view class="user-info" @click="goUserInfoPage" :style="{
|
|
|
|
|
- height: safeArea.capsuleBarContentHeight+'px',
|
|
|
|
|
- width: safeArea.capsuleBarContentHeight+'px',
|
|
|
|
|
- }">
|
|
|
|
|
- <!-- <uni-icons type="person" :size="safeArea.capsuleBarContentHeight" color="#FFFFFF"></uni-icons> -->
|
|
|
|
|
- <image :style="{
|
|
|
|
|
- height: safeArea.capsuleBarContentHeight+'px',
|
|
|
|
|
- width: safeArea.capsuleBarContentHeight+'px',
|
|
|
|
|
- }"
|
|
|
|
|
- mode="aspectFill" src="https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132"></image>
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <view class="user-info-container" @click="goUserInfoPage">
|
|
|
|
|
+ <view class="user-info"
|
|
|
|
|
+ :style="{height: safeArea.capsuleBarContentHeight+'px',width: safeArea.capsuleBarContentHeight+'px'}">
|
|
|
|
|
+ <image v-if="userInfo" :style="{
|
|
|
|
|
+ height: safeArea.capsuleBarContentHeight+'px',
|
|
|
|
|
+ width: safeArea.capsuleBarContentHeight+'px',
|
|
|
|
|
+ }" mode="aspectFill" :src="userInfo.avatar"></image>
|
|
|
|
|
+ <uni-icons v-else type="person" :size="safeArea.capsuleBarContentHeight" color="#FFFFFF"></uni-icons>
|
|
|
|
|
+ </view>
|
|
|
|
|
+
|
|
|
|
|
+ <view class="nickname" v-if="userInfo">{{userInfo.nickname}}</view>
|
|
|
|
|
+ <view class="nickname" v-else>登录</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
<!-- 内容区 -->
|
|
<!-- 内容区 -->
|
|
|
<view class="content-container">
|
|
<view class="content-container">
|
|
|
<view class="settle-container">
|
|
<view class="settle-container">
|
|
@@ -34,7 +36,8 @@
|
|
|
</view>
|
|
</view>
|
|
|
<view class="task-container">
|
|
<view class="task-container">
|
|
|
<view class="task-header">
|
|
<view class="task-header">
|
|
|
- <view class="task-title" v-if="punchIns.length > 0">任务({{punchIns.lengt}}个)</view>
|
|
|
|
|
|
|
+ <view class="task-title" v-if="punchIns.length && punchIns.length > 0">任务({{punchIns.lengt}}个)
|
|
|
|
|
+ </view>
|
|
|
<view class="task-title" v-else>任务</view>
|
|
<view class="task-title" v-else>任务</view>
|
|
|
<view class="task-add-btn" @click="goPunchInDetailPage">
|
|
<view class="task-add-btn" @click="goPunchInDetailPage">
|
|
|
<uni-icons type="plusempty" size="30" color="#406CE7"></uni-icons>
|
|
<uni-icons type="plusempty" size="30" color="#406CE7"></uni-icons>
|
|
@@ -53,76 +56,101 @@
|
|
|
<view class="item-btn" @click="doPunchIn(punchIn.punchInId)">完成</view>
|
|
<view class="item-btn" @click="doPunchIn(punchIn.punchInId)">完成</view>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="item-detail-list">
|
|
<view class="item-detail-list">
|
|
|
- <view class="item-detail" v-for="punchInRecord in punchIn.punchInRecords" :key="punchInRecord.punchInDate">
|
|
|
|
|
|
|
+ <view class="item-detail" v-for="punchInRecord in punchIn.punchInRecords"
|
|
|
|
|
+ :key="punchInRecord.punchInDate">
|
|
|
<view class="detail-text">
|
|
<view class="detail-text">
|
|
|
<uni-dateformat :date="punchInRecord.punchInDate" format="M月d日"></uni-dateformat>
|
|
<uni-dateformat :date="punchInRecord.punchInDate" format="M月d日"></uni-dateformat>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="detail-box" style="background-color: #E5E5E5;" v-if="punchInRecord.punchInStatus == 'uncreated'"></view>
|
|
|
|
|
- <view class="detail-box" style="background-color: #A5D63F;" v-if="punchInRecord.punchInStatus == 'punchIn'"></view>
|
|
|
|
|
- <view class="detail-box" style="background-color: #D43030;" v-if="punchInRecord.punchInStatus == 'unPunchIn'"></view>
|
|
|
|
|
- <view class="detail-box" v-if="punchInRecord.punchInStatus == 'futureTime' || punchInRecord.punchInStatus == 'todayUnknown'"></view>
|
|
|
|
|
|
|
+ <view class="detail-box" style="background-color: #E5E5E5;"
|
|
|
|
|
+ v-if="punchInRecord.punchInStatus == 'uncreated'"></view>
|
|
|
|
|
+ <view class="detail-box" style="background-color: #A5D63F;"
|
|
|
|
|
+ v-if="punchInRecord.punchInStatus == 'punchIn'"></view>
|
|
|
|
|
+ <view class="detail-box" style="background-color: #D43030;"
|
|
|
|
|
+ v-if="punchInRecord.punchInStatus == 'unPunchIn'"></view>
|
|
|
|
|
+ <view class="detail-box"
|
|
|
|
|
+ v-if="punchInRecord.punchInStatus == 'futureTime' || punchInRecord.punchInStatus == 'todayUnknown'">
|
|
|
|
|
+ </view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
<!-- 弹出框 -->
|
|
<!-- 弹出框 -->
|
|
|
<view>
|
|
<view>
|
|
|
<uni-popup ref="claimRewardDialog" type="dialog">
|
|
<uni-popup ref="claimRewardDialog" type="dialog">
|
|
|
- <uni-popup-dialog ref="inputClose" mode="input" title="领取奖励" value="对话框预置提示内容!"
|
|
|
|
|
- placeholder="请输入领取的奖励数" @confirm="claimRewardConfirm"></uni-popup-dialog>
|
|
|
|
|
|
|
+ <uni-popup-dialog ref="inputClose" mode="input" title="领取奖励" value="对话框预置提示内容!" placeholder="请输入领取的奖励数"
|
|
|
|
|
+ @confirm="claimRewardConfirm"></uni-popup-dialog>
|
|
|
</uni-popup>
|
|
</uni-popup>
|
|
|
</view>
|
|
</view>
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
<!-- 底部填充区 -->
|
|
<!-- 底部填充区 -->
|
|
|
<view class="bottom-fill" :style="{height: safeArea.bottomHeight+'px'}"></view>
|
|
<view class="bottom-fill" :style="{height: safeArea.bottomHeight+'px'}"></view>
|
|
|
</view>
|
|
</view>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
- import { onMounted, ref } from 'vue';
|
|
|
|
|
- import { onLoad, onPullDownRefresh } from "@dcloudio/uni-app";
|
|
|
|
|
- import { rewardApi, punchInApi } from '@/service/apis.js';
|
|
|
|
|
- import { getSafeArea } from '@/utils/system.js';
|
|
|
|
|
-
|
|
|
|
|
|
|
+ import {
|
|
|
|
|
+ onMounted,
|
|
|
|
|
+ ref
|
|
|
|
|
+ } from 'vue';
|
|
|
|
|
+ import {
|
|
|
|
|
+ onLoad,
|
|
|
|
|
+ onPullDownRefresh,
|
|
|
|
|
+ onShow
|
|
|
|
|
+ } from "@dcloudio/uni-app";
|
|
|
|
|
+ import {
|
|
|
|
|
+ rewardApi,
|
|
|
|
|
+ punchInApi
|
|
|
|
|
+ } from '@/service/apis.js';
|
|
|
|
|
+ import {
|
|
|
|
|
+ getSafeArea
|
|
|
|
|
+ } from '@/utils/system.js';
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 可领取奖励
|
|
* 可领取奖励
|
|
|
*/
|
|
*/
|
|
|
const reward = ref(0);
|
|
const reward = ref(0);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 打卡任务
|
|
* 打卡任务
|
|
|
*/
|
|
*/
|
|
|
const punchIns = ref([]);
|
|
const punchIns = ref([]);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 领取奖励对话框
|
|
* 领取奖励对话框
|
|
|
*/
|
|
*/
|
|
|
const claimRewardDialog = ref(null);
|
|
const claimRewardDialog = ref(null);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 安全区
|
|
* 安全区
|
|
|
*/
|
|
*/
|
|
|
const safeArea = ref({});
|
|
const safeArea = ref({});
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 用户信息
|
|
|
|
|
+ */
|
|
|
|
|
+ const userInfo = ref(null);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 领取奖励
|
|
* 领取奖励
|
|
|
*/
|
|
*/
|
|
|
const claimReward = () => {
|
|
const claimReward = () => {
|
|
|
claimRewardDialog.value.open();
|
|
claimRewardDialog.value.open();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 确认领取奖励
|
|
* 确认领取奖励
|
|
|
*/
|
|
*/
|
|
|
const claimRewardConfirm = async (val) => {
|
|
const claimRewardConfirm = async (val) => {
|
|
|
- await rewardApi.claimReward({"claimRewardNum": val});
|
|
|
|
|
|
|
+ await rewardApi.claimReward({
|
|
|
|
|
+ "claimRewardNum": val
|
|
|
|
|
+ });
|
|
|
getReward();
|
|
getReward();
|
|
|
claimRewardDialog.value.close();
|
|
claimRewardDialog.value.close();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 获取奖励
|
|
* 获取奖励
|
|
|
*/
|
|
*/
|
|
@@ -130,7 +158,7 @@
|
|
|
let res = await rewardApi.queryReward();
|
|
let res = await rewardApi.queryReward();
|
|
|
reward.value = res.unclaimedRewardNum;
|
|
reward.value = res.unclaimedRewardNum;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 获取打卡
|
|
* 获取打卡
|
|
|
*/
|
|
*/
|
|
@@ -138,15 +166,17 @@
|
|
|
let res = await punchInApi.queryPunchIn();
|
|
let res = await punchInApi.queryPunchIn();
|
|
|
punchIns.value = res;
|
|
punchIns.value = res;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 打卡
|
|
* 打卡
|
|
|
*/
|
|
*/
|
|
|
const doPunchIn = async (id) => {
|
|
const doPunchIn = async (id) => {
|
|
|
- await punchInApi.doPunchIn({id});
|
|
|
|
|
|
|
+ await punchInApi.doPunchIn({
|
|
|
|
|
+ id
|
|
|
|
|
+ });
|
|
|
getPunchIn();
|
|
getPunchIn();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 跳转用户用心
|
|
* 跳转用户用心
|
|
|
*/
|
|
*/
|
|
@@ -155,7 +185,7 @@
|
|
|
url: "/pages/userInfo/userInfo"
|
|
url: "/pages/userInfo/userInfo"
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 获取打卡编辑页面
|
|
* 获取打卡编辑页面
|
|
|
*/
|
|
*/
|
|
@@ -165,11 +195,10 @@
|
|
|
})
|
|
})
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- onLoad(() => {
|
|
|
|
|
- safeArea.value = getSafeArea();
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- onMounted(() => {
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 加载数据
|
|
|
|
|
+ */
|
|
|
|
|
+ const loadData = async () => {
|
|
|
let token = uni.getStorageSync("token");
|
|
let token = uni.getStorageSync("token");
|
|
|
// 如果还没登录就结束获取数据
|
|
// 如果还没登录就结束获取数据
|
|
|
if (!token) {
|
|
if (!token) {
|
|
@@ -177,33 +206,62 @@
|
|
|
punchIns.value = [];
|
|
punchIns.value = [];
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- // 获取奖励
|
|
|
|
|
- getReward();
|
|
|
|
|
- // 获取打卡
|
|
|
|
|
- getPunchIn();
|
|
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ uni.showLoading({
|
|
|
|
|
+ title: '加载中',
|
|
|
|
|
+ mask: true
|
|
|
|
|
+ });
|
|
|
|
|
+ // 获取奖励
|
|
|
|
|
+ getReward();
|
|
|
|
|
+ // 获取打卡
|
|
|
|
|
+ getPunchIn();
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ uni.hideLoading();
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ onLoad(() => {
|
|
|
|
|
+ safeArea.value = getSafeArea();
|
|
|
});
|
|
});
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ onShow(() => {
|
|
|
|
|
+ console.log("onSHow");
|
|
|
|
|
+ userInfo.value = uni.getStorageSync("userInfo");
|
|
|
|
|
+ loadData();
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
onPullDownRefresh(() => {
|
|
onPullDownRefresh(() => {
|
|
|
- // 获取奖励
|
|
|
|
|
- getReward();
|
|
|
|
|
- // 获取打卡
|
|
|
|
|
- getPunchIn();
|
|
|
|
|
|
|
+ loadData();
|
|
|
uni.stopPullDownRefresh();
|
|
uni.stopPullDownRefresh();
|
|
|
});
|
|
});
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
|
- .user-info {
|
|
|
|
|
|
|
+ .user-info-container {
|
|
|
display: flex;
|
|
display: flex;
|
|
|
- justify-content: center;
|
|
|
|
|
- /* 水平居中 */
|
|
|
|
|
align-items: center;
|
|
align-items: center;
|
|
|
- /* 垂直居中 */
|
|
|
|
|
|
|
|
|
|
- border-radius: 50%;
|
|
|
|
|
- background: rgba(210, 239, 243, 1);
|
|
|
|
|
|
|
+ .user-info {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+
|
|
|
|
|
+ border-radius: 50%;
|
|
|
|
|
+ background: rgba(210, 239, 243, 1);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .nickname {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ /* 水平居中 */
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+ /* 垂直居中 */
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ margin-left: 10rpx;
|
|
|
|
|
+ color: rgba(0, 0, 0, 1);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
.content-container {
|
|
.content-container {
|
|
|
|
|
|
|
|
.settle-container {
|
|
.settle-container {
|