| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501 |
- <template>
- <view class="container">
- <!-- 头部区域 -->
- <view class="header">
- <!-- 时间区域 -->
- <view class="calendar">
- <!-- 双左箭头区域 -->
- <view class="double" @click="handleDoubleLeft">
- <img src="../../static/double_left.png">
- </view>
- <!-- 左箭头区域区域 -->
- <view class="single" @click="handleLeft">
- <img src="../../static/left.png">
- </view>
- <!-- 时间区域 -->
- <view class="time">
- {{year}}-{{format_month}}
- </view>
- <!-- 双右箭头区域 -->
- <view class="single2" @click="handleRight">
- <img src="../../static/right2.png">
- </view>
- <!-- 右箭头区域 -->
- <view class="double" @click="handleDoubleRight">
- <img src="../../static/double_right.png">
- </view>
- </view>
- <!-- 打卡状态切换区域 -->
- <view class="state">
- <uni-segmented-control :current="current" :values="items" styleType="text" @clickItem="onClickItem"
- activeColor="#0082FC"></uni-segmented-control>
- </view>
- </view>
- <!-- 打卡记录区域 -->
- <view class="list" v-if="list.length">
- <!-- 每一条记录区域 -->
- <view class="box" v-for="(item,index) in list" :key="index">
- <!-- 人物信息区域 -->
- <view class="person">
- <view class="img">
- <img :src="item.headImage">
- </view>
- <view class="info">
- <view class="name">
- {{item.name}}
- </view>
- <view class="college">
- {{item.college}}
- </view>
- </view>
- </view>
- <!-- 图片区域 -->
- <view class="imgs" v-if="item.status==4">
- <view class="imgs_item">
- <view class="image">
- <img :src="item.faceImage">
- </view>
- <view class="title">
- 匹对照片
- </view>
- </view>
- <view class="imgs_item">
- <view class="image">
- <img :src="item.matchFaceImage">
- </view>
- <view class="title">
- 被匹对照片
- </view>
- </view>
- <view class="imgs_item">
- <view class="image">
- <img :src="item.sceneImage">
- </view>
- <view class="title">
- 场景照片
- </view>
- </view>
- </view>
- <!-- 打卡信息区域 -->
- <view class="msg">
- <view class="msg_item">
- <view class="key">
- 打卡状态:
- </view>
- <view class="value">
- {{item.status==4?"打卡成功":"打卡失败"}}
- </view>
- </view>
- <view class="msg_item">
- <view class="key">
- 打卡规则:
- </view>
- <view class="value">
- {{item.ruleName}}
- </view>
- </view>
- <view class="msg_item" v-if="item.status==4">
- <view class="key">
- 打卡时间:
- </view>
- <view class="value">
- {{format_time(item.updateTime)}}
- </view>
- </view>
- <view class="msg_item" v-if="item.status==4">
- <view class="key">
- 打卡地址:
- </view>
- <view class="value">
- {{item.location}}
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- 暂无数据显示区域 -->
- <view class="no_data" v-if="list.length==0">
- <img src="../../static/nodata.png">
- <view class="info">
- 暂无数据
- </view>
- </view>
- <!-- 底线区域 -->
- <view class="foot" v-if="flag">
- ------我是有底线的------
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- // 当前年份
- year: null,
- // 当前月份
- month: null,
- // 分段器选项
- items: ['打卡成功', '打卡失败'],
- // 当前所在分段器索引
- current: 0,
- // 第几页
- page: 1,
- // 每页条数
- size: 10,
- // 数据总条数
- total: 0,
- // 打卡状态参数
- status: 4,
- // 打卡时间参数
- time: null,
- // 列表数组
- list: [],
- // 底线区域显示隐藏控制标识
- flag: false,
- };
- },
- onLoad() {
- this.getTime()
- this.getListData()
- },
- // 页面滑动到底部触发的回调
- onReachBottom() {
- if (this.list.length < this.total) {
- this.page++
- this.getListData()
- } else {
- this.flag = true
- }
- },
- computed: {
- format_month() {
- if (this.month) {
- let month = this.month < 10 ? '0' + this.month : this.month
- return month
- }
- }
- },
- methods: {
- // 获取当前年份
- getTime() {
- let date = new Date()
- let year = date.getFullYear()
- let month = date.getMonth() + 1
- this.month = month
- this.year = year
- },
- // 获取打卡记录列表数组
- async getListData() {
- this.flag = false
- this.time = this.year + "-" + this.format_month + "-01 00:00:00"
- let res = await this.$myRequest({
- url: "/attendance/api/sign/check/in/list/month",
- data: {
- page: this.page,
- size: this.size,
- status: this.status,
- time: this.time
- }
- })
- // console.log(res);
- if (res.code == 200) {
- this.total = res.data.total
- this.list = res.data.list
- if (this.status == 4) {
- this.items[0] = `打卡成功(${this.total}次)`
- this.items[1] = `打卡失败`
- } else {
- this.items[0] = `打卡成功`
- this.items[1] = `打卡失败(${this.total}次)`
- }
- }
- },
- // 点击分段器回调
- onClickItem(e) {
- // console.log(e.currentIndex);
- if (e.currentIndex == 0) {
- this.status = 4
- } else {
- this.status = 3
- }
- this.page = 1
- this.getListData()
- },
- // 往后选择年份回调
- handleDoubleLeft() {
- if (this.year <= 2000) {
- uni.showToast({
- title: "不能选择2000年之前",
- icon: 'none'
- })
- } else {
- this.year -= 1
- this.page = 1
- this.getListData()
- }
- },
- // 往前选择年份回调
- handleDoubleRight() {
- if (this.year >= 2025) {
- uni.showToast({
- title: "不能选择2025年之后",
- icon: 'none'
- })
- } else {
- this.year += 1
- this.page = 1
- this.getListData()
- }
- },
- // 往后选择月份回调
- handleLeft() {
- if (this.month <= 1) {
- if (this.year <= 2000) {
- uni.showToast({
- title: "不能选择2000年之前",
- icon: 'none'
- })
- } else {
- this.year -= 1
- this.month = 12
- this.page = 1
- this.getListData()
- }
- } else {
- this.month -= 1
- this.page = 1
- this.getListData()
- }
- },
- // 往前选择月份回调
- handleRight() {
- if (this.month >= 12) {
- if (this.year >= 2025) {
- uni.showToast({
- title: "不能选择2025年之后",
- icon: 'none'
- })
- } else {
- this.year += 1
- this.month = 1
- this.page = 1
- this.getListData()
- }
- } else {
- this.month += 1
- this.page = 1
- this.getListData()
- }
- },
- // 格式化时间
- format_time(timestamp) {
- //时间戳为10位需*1000,时间戳为13位的话不需乘1000
- var date = new Date(timestamp);
- var y = date.getFullYear();
- var m = date.getMonth() + 1;
- var d = date.getDate();
- m = m < 10 ? "0" + m : m;
- d = d < 10 ? "0" + d : d;
- var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours());
- var mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes());
- var s = date.getSeconds()
- s = s < 10 ? "0" + s : s;
- let strDate = y + "-" + m + "-" + d + " " + h + ":" + mm + ":" + s;
- return strDate;
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .container {
- padding-top: 20rpx;
- .header {
- display: flex;
- flex-direction: column;
- justify-content: space-evenly;
- margin: 0 auto;
- width: 690rpx;
- height: 192rpx;
- background-color: #fff;
- .calendar {
- display: flex;
- justify-content: center;
- align-items: center;
- flex: 1;
- .double {
- width: 40rpx;
- height: 40rpx;
- img {
- width: 100%;
- height: 100%;
- }
- }
- .single {
- margin-left: 30rpx;
- width: 40rpx;
- height: 40rpx;
- img {
- width: 80%;
- height: 70%;
- }
- }
- .single2 {
- margin-right: 30rpx;
- width: 40rpx;
- height: 40rpx;
- img {
- width: 100%;
- height: 70%;
- }
- }
- .time {
- width: 180rpx;
- height: 44rpx;
- font-size: 32rpx;
- text-align: center;
- }
- }
- .state {
- display: flex;
- flex-direction: column;
- justify-content: center;
- flex: 1;
- }
- }
- .list {
- padding-bottom: 50rpx;
- .box {
- margin: 0 auto;
- margin-top: 20rpx;
- width: 690rpx;
- background-color: #fff;
- .person {
- display: flex;
- align-items: center;
- height: 134rpx;
- .img {
- margin: 0 20rpx 0 30rpx;
- width: 70rpx;
- height: 70rpx;
- img {
- width: 100%;
- height: 100%;
- }
- }
- .info {
- width: 620rpx;
- height: 70rpx;
- .name {
- font-size: 32rpx;
- }
- .college {
- font-size: 24rpx;
- color: #A6A6A6;
- }
- }
- }
- .imgs {
- display: flex;
- justify-content: space-evenly;
- height: 201rpx;
- .imgs_item {
- display: flex;
- flex-direction: column;
- align-items: center;
- flex: 1;
- .image {
- width: 120rpx;
- height: 120rpx;
- img {
- width: 100%;
- height: 100%;
- }
- }
- .title {
- margin-top: 10rpx;
- font-size: 28rpx;
- }
- }
- }
- .msg {
- margin-left: 30rpx;
- .msg_item {
- display: flex;
- align-items: center;
- height: 63rpx;
- font-size: 28rpx;
- .key {
- color: #808080;
- }
- .value {}
- }
- }
- }
- }
- .no_data {
- margin: 0 auto;
- margin-top: 230rpx;
- width: 480rpx;
- height: 508rpx;
- text-align: center;
- img {
- width: 100%;
- height: 100%;
- }
- .info {
- color: #5792F0;
- }
- }
- .foot {
- padding-bottom: 20rpx;
- text-align: center;
- }
- }
- </style>
|