| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348 |
- <template>
- <view class="container page-bg">
- <view class="header-container">
- <navigator url="/pages/login/login">
- <view class="user-info">
- <uni-icons type="person" size="30" color="#FFFFFF"></uni-icons>
- </view>
- </navigator>
- </view>
- <view class="settle-container">
- <view class="settle-text-container">
- <view class="settle-title">待领取奖励数</view>
- <view class="settle-num">{{reward}}</view>
- </view>
- <view class="settle-btn" @click="claimReward">领取</view>
- </view>
- <view class="task-container">
- <view class="task-header">
- <view class="task-title">任务(3个)</view>
- <view class="task-add-btn">
- <navigator url="/pages/detail/detail">
- <uni-icons type="plusempty" size="30" color="#406CE7"></uni-icons>
- </navigator>
- </view>
- </view>
- <view class="task-item" v-for="punchIn in punchIns" :key="punchIn.punchInId">
- <view class="item-header">
- <view class="item-title">{{punchIn.taskName}}</view>
- <navigator :url="'/pages/detail/detail?id='+punchIn.punchInId">
- <uni-icons class="item-icon" type="settings" size="30" color="#C4C4C4"></uni-icons>
- </navigator>
- <view class="item-tag-container">
- <view class="item-tag" v-if="punchIn.fullAttendanceFlag">全勤奖励</view>
- <view class="item-tag" v-if="punchIn.weekendDoubleFlag">周末双倍</view>
- </view>
- <view class="item-btn" @click="doPunchIn(punchIn.punchInId)">完成</view>
- </view>
- <view class="item-detail-list">
- <view class="item-detail" v-for="punchInRecord in punchIn.punchInRecords">
- <view class="detail-text">
- <uni-dateformat :date="punchInRecord.punchInDate" format="M月d日"></uni-dateformat>
- </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>
- <uni-popup ref="claimRewardDialog" type="dialog">
- <uni-popup-dialog ref="inputClose" mode="input" title="领取奖励" value="对话框预置提示内容!"
- placeholder="请输入领取的奖励数" @confirm="claimRewardConfirm"></uni-popup-dialog>
- </uni-popup>
- </view>
- </view>
- </template>
- <script setup>
- import { onMounted, ref } from 'vue';
- import { rewardApi, punchInApi } from '@/service/apis.js';
-
- /**
- * 可领取奖励
- */
- const reward = ref(0);
-
- /**
- * 打卡任务
- */
- const punchIns = ref([]);
-
- /**
- * 领取奖励对话框
- */
- const claimRewardDialog = ref(null);
-
-
- /**
- * 领取奖励
- */
- const claimReward = () => {
- claimRewardDialog.value.open();
- }
-
- /**
- * 确认领取奖励
- */
- const claimRewardConfirm = async (val) => {
- await rewardApi.claimReward({"claimRewardNum": val});
- 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;
- }
-
- /**
- * 打卡
- */
- const doPunchIn = async (id) => {
- await punchInApi.doPunchIn({id});
- getPunchIn();
- }
-
- onMounted(() => {
- // 获取奖励
- getReward();
- // 获取打卡
- getPunchIn();
- })
- </script>
- <style lang="scss" scoped>
- .container {
- width: 100vw;
- height: 100vh;
- padding: 16rpx;
- .header-container {
- position: relative;
- height: 83rpx;
- .user-info {
- width: 83rpx;
- height: 83rpx;
- display: flex;
- justify-content: center;
- /* 水平居中 */
- align-items: center;
- /* 垂直居中 */
- position: absolute;
- right: 0rpx;
- top: 0rpx;
- border-radius: 50%;
- background: rgba(210, 239, 243, 1);
- }
- }
- .settle-container {
- margin-top: 16rpx;
- height: 228rpx;
- position: relative;
- border-radius: 20rpx;
- background: rgba(64, 108, 231, 1);
- box-shadow: 1rpx 2rpx 4rpx rgba(0, 0, 0, 0.25);
- .settle-text-container {
- position: absolute;
- left: 108rpx;
- top: 20rpx;
- .settle-title {
- font-size: 24rpx;
- line-height: 34.75rpx;
- color: rgba(255, 255, 255, 1);
- }
- .settle-num {
- font-size: 100rpx;
- font-weight: 700;
- line-height: 144.8rpx;
- color: rgba(255, 255, 255, 1);
- display: flex;
- justify-content: center;
- /* 水平居中 */
- align-items: center;
- /* 垂直居中 */
- }
- }
- .settle-btn {
- position: absolute;
- left: 503rpx;
- top: 76rpx;
- width: 164rpx;
- height: 99rpx;
- border-radius: 40rpx;
- background: rgba(242, 247, 255, 1);
- font-size: 48rpx;
- font-weight: 700;
- line-height: 69.5px;
- color: rgba(64, 108, 231, 1);
- display: flex;
- justify-content: center;
- /* 水平居中 */
- align-items: center;
- /* 垂直居中 */
- }
- }
- .task-container {
- margin-top: 16rpx;
- .task-header {
- position: relative;
- height: 80rpx;
- display: flex;
- justify-content: center;
- /* 水平居中 */
- align-items: center;
- /* 垂直居中 */
- .task-title {
- position: absolute;
- left: 0rpx;
- font-size: 30rpx;
- font-weight: 400;
- line-height: 43.44rpx;
- color: rgba(0, 0, 0, 1);
- }
- .task-add-btn {
- display: inline-flex;
- justify-content: center;
- align-items: center;
- position: absolute;
- right: 0rpx;
- width: 60rpx;
- height: 60rpx;
- border-radius: 10rpx;
- border: 3px solid rgba(64, 108, 231, 1);
- }
- }
- .task-item {
- margin-top: 16rpx;
- width: 100%;
- height: 201rpx;
- border-radius: 20px;
- background: #FFFFFF;
- box-shadow: 1px 2px 4px #000000;
- box-sizing: border-box;
- padding: 16rpx;
- .item-header {
- position: relative;
- display: flex;
- align-items: center;
- .item-title {
- display: inline-block;
- // margin-left: 20rpx;
- font-size: 36rpx;
- font-weight: 400;
- letter-spacing: 0rpx;
- line-height: 52.13rpx;
- color: rgba(0, 0, 0, 1);
- }
- .item-icon {
- margin-left: 10rpx;
- }
- .item-tag-container {
- display: inline-block;
- margin-left: 10rpx;
- .item-tag:not(:first-child) {
- margin-left: 10rpx;
- }
- .item-tag {
- display: inline-block;
- background-color: #F2F7FF;
- padding: 10rpx;
- border-radius: 40rpx;
- background: #F2F7FF;
- font-size: 16rpx;
- font-weight: 400;
- line-height: 23.17rpx;
- color: rgba(0, 0, 0, 1);
- text-align: center;
- vertical-align: top;
- }
- }
- .item-btn {
- display: inline-flex;
- position: absolute;
- right: 0rpx;
- width: 123rpx;
- height: 42rpx;
- border-radius: 30rpx;
- border: 1rpx solid #2A82E4;
- justify-content: center;
- align-items: center;
- font-size: 20rpx;
- font-weight: 400;
- line-height: 28.96px;
- color: rgba(64, 108, 231, 1);
- }
- }
- .item-detail-list {
- margin-top: 16rpx;
- display: grid;
- grid-template-columns: repeat(7, 1fr);
- .item-detail {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- .detail-text {
- font-size: 20rpx;
- font-weight: 400;
- letter-spacing: 0rpx;
- line-height: 28.96rpx;
- color: rgba(0, 0, 0, 1);
- }
- .detail-box {
- // display: block;
- width: 42rpx;
- height: 42rpx;
- margin-top: 5rpx;
- border: 5rpx solid #000000;
- }
- }
- }
- }
- }
- }
- </style>
|