Files
dvcp_v2_wxcp_app/src/project/qianxinan/AppSignIn/AppSignIn.vue

174 lines
3.8 KiB
Vue
Raw Normal View History

2023-02-02 16:09:24 +08:00
<template>
<div class="AppSignIn">
2023-02-05 06:17:57 +00:00
<div class="title">打卡记录</div>
2023-02-02 16:09:24 +08:00
2023-02-03 18:38:54 +08:00
<div class="sign_list" style="overflow-y: scroll;">
<div class="sign_card" v-for="item in signlist" :key="item.id">
2023-02-03 10:29:14 +08:00
<div class="sign_left">{{ item.createTime.substring(0,5) }}</div>
2023-02-02 16:09:24 +08:00
<div class="sign_right">
2023-02-03 10:29:14 +08:00
<div class="time">{{ item.createDate }}</div>
2023-02-05 06:17:57 +00:00
<div class="tips">打卡成功</div>
2023-02-02 16:09:24 +08:00
</div>
2023-02-03 18:37:11 +08:00
</div>
2023-02-02 16:09:24 +08:00
</div>
<div class="sign_btn">
2023-02-03 10:29:14 +08:00
<div class="btn" @click="signIn" :class="status==0? '': 'active'">
2023-02-05 06:17:57 +00:00
<div>{{ status==1? '已打卡':'打卡'}}</div>
2023-02-02 16:09:24 +08:00
<div>{{ time }}</div>
</div>
</div>
</div>
</template>
<script>
import dayjs from "dayjs"
2023-02-03 10:29:14 +08:00
import { mapState } from "vuex"
2023-02-02 16:09:24 +08:00
export default {
2023-02-05 06:17:57 +00:00
appName: "打卡",
2023-02-02 16:09:24 +08:00
data() {
return {
time: '',
2023-02-05 06:17:57 +00:00
status: 0, // 打卡状态0、未打卡1、已打卡
2023-02-03 10:29:14 +08:00
signlist: [],
current: 1,
2023-02-02 16:09:24 +08:00
}
},
2023-02-03 10:29:14 +08:00
computed: {
...mapState(['user'])
},
2023-02-02 16:09:24 +08:00
methods: {
2023-02-03 10:29:14 +08:00
getList() {
2023-02-03 18:40:12 +08:00
this.$http.post(`/api/appwechatsigninfo/listByWxUserId?current=${this.current}&size=3000`).then(res=> {
2023-02-03 10:29:14 +08:00
if(res?.data?.records) {
this.signlist = res.data.records
}
})
},
2023-02-05 06:17:57 +00:00
// 今天的打卡状态
2023-02-03 10:29:14 +08:00
getToday() {
this.$http.post(`/api/appwechatsigninfo/queryNowDetail`).then(res=> {
if(res?.data) {
this.status = res.data.status
}
})
},
2023-02-05 06:17:57 +00:00
// 打卡
2023-02-03 10:29:14 +08:00
signIn() {
2023-02-03 10:45:38 +08:00
if(this.status == 1) {
2023-02-05 06:17:57 +00:00
return this.$u.toast("已打卡,请勿重复打卡!")
2023-02-03 10:45:38 +08:00
}
2023-02-03 10:29:14 +08:00
this.$http.post(`/api/appwechatsigninfo/sign`).then(res=> {
if(res.code == 0) {
2023-02-05 06:17:57 +00:00
this.$u.toast(`打卡成功`)
2023-02-03 10:45:38 +08:00
this.getToday()
this.getList()
2023-02-03 10:29:14 +08:00
}
2023-02-03 10:45:38 +08:00
}).catch(err=> console.log(err))
2023-02-03 10:29:14 +08:00
}
},
2023-02-02 16:09:24 +08:00
onShow() {
2023-02-05 06:17:57 +00:00
document.title = '每日打卡'
2023-02-03 10:29:14 +08:00
this.getToday()
this.getList()
2023-02-02 16:09:24 +08:00
setInterval(() => {
this.time = dayjs(new Date()).format('HH:mm:ss')
}, 1000)
}
}
</script>
<style lang="scss" scoped>
.AppSignIn {
2023-02-06 11:10:57 +08:00
padding: 0px 32px;
2023-02-02 16:09:24 +08:00
box-sizing: border-box;
.title {
font-weight: 600;
font-size: 28px;
color: #333333;
width: 100%;
height: 100px;
line-height: 100px;
padding-left: 32px;
box-sizing: border-box;
background: #F5F5F5;
}
.sign_list {
2023-02-03 18:24:28 +08:00
width: 100%;
2023-02-06 08:55:23 +08:00
height: calc(100% - 500px);
2023-02-02 16:09:24 +08:00
.sign_card {
display: flex;
background: #FFFFFF;
padding: 24px;
box-sizing: border-box;
box-shadow: 0 0 8px 0 rgba(0,0,0,0.02);
border-radius: 16px;
margin-bottom: 24px;
.sign_left {
align-self: center;
font-weight: 600;
font-size: 40rpx;
color: #333333;
margin-right: 32px;
}
.sign_right {
font-weight: 400;
font-size: 26px;
color: #333333;
.tips {
color: #999999;
margin-top: 8px;
}
}
}
}
.sign_btn {
position: relative;
width: 100%;
height: 400px;
position: fixed;
bottom: 0;
left: 0;
background: #F5F5F5;
box-shadow: 0 -4px 8px 0 rgba(0,0,0,0.02);
z-index: 9;
.btn {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 240px;
height: 240px;
text-align: center;
2023-02-03 10:29:14 +08:00
background-image: linear-gradient(180deg, #75BDFF 0%, #4783FF 100%);
2023-02-02 16:09:24 +08:00
border: 8px solid #FFFFFF;
box-shadow: 0 8px 12px -4px rgba(133,196,255,0.65);
border-radius: 50%;
color: #FFFFFF;
& > div:first-child {
font-weight: 500;
font-size: 40px;
margin-top: 72px;
}
& > div:last-child {
margin-top: 10px;
font-weight: 400;
font-size: 28px;
}
}
2023-02-03 10:29:14 +08:00
.active {
background-image: linear-gradient(180deg, #bcff75 0%, hsl(132, 87%, 30%) 100%);
}
}
2023-02-02 16:09:24 +08:00
}
</style>