| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477 |
- <template>
- <view class="container">
- <view class="placeholder"></view>
- <!-- 头部区域 -->
- <view class="header">
- <!-- 时间区域 -->
- <view class="calendar">
- <!-- 双左箭头区域 -->
- <view class="double" @click="handleDoubleLeft"><img src="../../static/imgs/double_left.png" /></view>
- <!-- 左箭头区域区域 -->
- <view class="single" @click="handleLeft"><img src="../../static/imgs/left.png" /></view>
- <!-- 时间区域 -->
- <view class="time">{{ year }}-{{ format_month }}</view>
- <!-- 双右箭头区域 -->
- <view class="single2" @click="handleRight"><img src="../../static/imgs/right2.png" /></view>
- <!-- 右箭头区域 -->
- <view class="double" @click="handleDoubleRight"><img src="../../static/imgs/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 v-if="item.headImage" :src="item.headImage" />
- <img v-else src="../../static/imgs/headImage.png" />
- </view>
- <view class="info">
- <view class="name">{{ item.name }}</view>
- <view class="college">{{ item.college ? item.college : '南昌交通学院' }}</view>
- </view>
- </view>
- <!-- 图片区域 -->
- <view class="imgs" v-if="item.status == 4">
- <view class="imgs_item" v-if="item.faceImage">
- <view class="image" @click="handleBigImg(item.faceImage)"><img :src="item.faceImage" /></view>
- <view class="title">匹对照片</view>
- </view>
- <view class="imgs_item" v-if="item.matchFaceImage">
- <view class="image" @click="handleBigImg(item.matchFaceImage)"><img :src="item.matchFaceImage" /></view>
- <view class="title">被匹对照片</view>
- </view>
- <view class="imgs_item" v-if="item.sceneImage">
- <view class="image" @click="handleBigImg(item.sceneImage)"><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/imgs/nodata.png" />
- <view class="info">暂无数据</view>
- </view>
- <!-- 图片放大弹窗区域 -->
- <uni-popup ref="popup">
- <view class="popup_img"><img :src="popupImg" /></view>
- </uni-popup>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- // 第几页
- page: 1,
- // 每页条数
- size: 10,
- // 数据总条数
- total: 0,
- // 打卡状态参数
- status: '',
- // 打卡时间参数
- time: null,
- // 当前年份
- year: null,
- // 当前月份
- month: null,
- // 分段器选项
- items: ['全部', '打卡成功', '打卡失败'],
- // 当前所在分段器索引
- current: 0,
- // 列表数组
- list: [],
- // 弹窗图片路径
- popupImg: '',
- currentYear: ''
- }
- },
- onLoad() {
- this.getTime()
- this.getListData()
- },
- // 页面滑动到底部触发的回调
- onReachBottom() {
- if (this.list.length < this.total) {
- this.page++
- this.getListData()
- } else {
- uni.showToast({
- title: '没有更多数据了',
- icon: 'none'
- })
- }
- },
- computed: {
- // 格式化月份
- format_month() {
- let temTime = this.month < 10 ? '0' + this.month : this.month
- return temTime
- }
- },
- methods: {
- // 获取当前年份,月份
- getTime() {
- let date = new Date()
- let year = date.getFullYear()
- let month = date.getMonth() + 1
- this.month = month
- this.year = year
- this.currentYear = year
- },
- // 获取打卡记录列表数组
- async getListData() {
- this.time = this.year + '-' + this.format_month + '-01 00:00:00'
- let res = await this.$myRequest_clockIn({
- url: '/attendance/api/sign/check/in/list/month/all',
- 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 = [...this.list, ...res.data.list]
- }
- },
- // 点击放大图片
- handleBigImg(url) {
- this.popupImg = url
- this.$refs.popup.open()
- },
- // 点击分段器回调
- onClickItem(e) {
- this.list = []
- if (e.currentIndex == 0) {
- this.status = ''
- } else if (e.currentIndex == 1) {
- this.status = 4
- } else if (e.currentIndex == 2) {
- this.status = 3
- }
- this.page = 1
- this.getListData()
- },
- // 往后选择年份回调
- handleDoubleLeft() {
- if (this.year <= this.currentYear - 3) {
- uni.showToast({
- title: `不能选择${this.currentYear - 3}年之前`,
- icon: 'none'
- })
- } else {
- this.list = []
- this.year -= 1
- this.page = 1
- this.getListData()
- }
- },
- // 往前选择年份回调
- handleDoubleRight() {
- if (this.year >= this.currentYear - 0 + 3) {
- uni.showToast({
- title: `不能选择${this.currentYear - 0 + 3}年之后`,
- icon: 'none'
- })
- } else {
- this.list = []
- this.year += 1
- this.page = 1
- this.getListData()
- }
- },
- // 往后选择月份回调
- handleLeft() {
- if (this.month <= 1) {
- if (this.year <= this.currentYear - 3) {
- uni.showToast({
- title: `不能选择${this.currentYear - 3}年之前`,
- icon: 'none'
- })
- } else {
- this.list = []
- this.year -= 1
- this.month = 12
- this.page = 1
- this.getListData()
- }
- } else {
- this.list = []
- this.month -= 1
- this.page = 1
- this.getListData()
- }
- },
- // 往前选择月份回调
- handleRight() {
- if (this.month >= 12) {
- if (this.year >= this.currentYear - 0 + 3) {
- uni.showToast({
- title: `不能选择${this.currentYear - 0 + 3}年之后`,
- icon: 'none'
- })
- } else {
- this.list = []
- this.year += 1
- this.month = 1
- this.page = 1
- this.getListData()
- }
- } else {
- this.list = []
- 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 {
- min-width: 100vw;
- min-height: 100vh;
- background-color: #f2f2f2;
- .placeholder {
- height: 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;
- }
- }
- .popup_img {
- width: 600rpx;
- img {
- width: 100%;
- height: 100%;
- }
- }
- }
- </style>
|