cardRecord.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. <template>
  2. <view class="container">
  3. <!-- 头部区域 -->
  4. <view class="header">
  5. <!-- 时间区域 -->
  6. <view class="calendar">
  7. <!-- 双左箭头区域 -->
  8. <view class="double" @click="handleDoubleLeft">
  9. <img src="../../static/double_left.png">
  10. </view>
  11. <!-- 左箭头区域区域 -->
  12. <view class="single" @click="handleLeft">
  13. <img src="../../static/left.png">
  14. </view>
  15. <!-- 时间区域 -->
  16. <view class="time">
  17. {{year}}-{{format_month}}
  18. </view>
  19. <!-- 双右箭头区域 -->
  20. <view class="single2" @click="handleRight">
  21. <img src="../../static/right2.png">
  22. </view>
  23. <!-- 右箭头区域 -->
  24. <view class="double" @click="handleDoubleRight">
  25. <img src="../../static/double_right.png">
  26. </view>
  27. </view>
  28. <!-- 打卡状态切换区域 -->
  29. <view class="state">
  30. <uni-segmented-control :current="current" :values="items" styleType="text" @clickItem="onClickItem"
  31. activeColor="#0082FC"></uni-segmented-control>
  32. </view>
  33. </view>
  34. <!-- 打卡记录区域 -->
  35. <view class="list" v-if="list.length">
  36. <!-- 每一条记录区域 -->
  37. <view class="box" v-for="(item,index) in list" :key="index">
  38. <!-- 人物信息区域 -->
  39. <view class="person">
  40. <view class="img">
  41. <img :src="item.headImage">
  42. </view>
  43. <view class="info">
  44. <view class="name">
  45. {{item.name}}
  46. </view>
  47. <view class="college">
  48. {{item.college}}
  49. </view>
  50. </view>
  51. </view>
  52. <!-- 图片区域 -->
  53. <view class="imgs" v-if="item.status==4">
  54. <view class="imgs_item">
  55. <view class="image">
  56. <img :src="item.faceImage">
  57. </view>
  58. <view class="title">
  59. 匹对照片
  60. </view>
  61. </view>
  62. <view class="imgs_item">
  63. <view class="image">
  64. <img :src="item.matchFaceImage">
  65. </view>
  66. <view class="title">
  67. 被匹对照片
  68. </view>
  69. </view>
  70. <view class="imgs_item">
  71. <view class="image">
  72. <img :src="item.sceneImage">
  73. </view>
  74. <view class="title">
  75. 场景照片
  76. </view>
  77. </view>
  78. </view>
  79. <!-- 打卡信息区域 -->
  80. <view class="msg">
  81. <view class="msg_item">
  82. <view class="key">
  83. 打卡状态:
  84. </view>
  85. <view class="value">
  86. {{item.status==4?"打卡成功":"打卡失败"}}
  87. </view>
  88. </view>
  89. <view class="msg_item">
  90. <view class="key">
  91. 打卡规则:
  92. </view>
  93. <view class="value">
  94. {{item.ruleName}}
  95. </view>
  96. </view>
  97. <view class="msg_item" v-if="item.status==4">
  98. <view class="key">
  99. 打卡时间:
  100. </view>
  101. <view class="value">
  102. {{format_time(item.updateTime)}}
  103. </view>
  104. </view>
  105. <view class="msg_item" v-if="item.status==4">
  106. <view class="key">
  107. 打卡地址:
  108. </view>
  109. <view class="value">
  110. {{item.location}}
  111. </view>
  112. </view>
  113. </view>
  114. </view>
  115. </view>
  116. <!-- 暂无数据显示区域 -->
  117. <view class="no_data" v-if="list.length==0">
  118. <img src="../../static/nodata.png">
  119. <view class="info">
  120. 暂无数据
  121. </view>
  122. </view>
  123. <!-- 底线区域 -->
  124. <view class="foot" v-if="flag">
  125. ------我是有底线的------
  126. </view>
  127. </view>
  128. </template>
  129. <script>
  130. export default {
  131. data() {
  132. return {
  133. // 第几页
  134. page: 1,
  135. // 每页条数
  136. size: 10,
  137. // 数据总条数
  138. total: 0,
  139. // 打卡状态参数
  140. status: "",
  141. // 打卡时间参数
  142. time: null,
  143. // 当前年份
  144. year: null,
  145. // 当前月份
  146. month: null,
  147. // 分段器选项
  148. items: ['全部', '打卡成功', '打卡失败'],
  149. // 当前所在分段器索引
  150. current: 0,
  151. // 列表数组
  152. list: [],
  153. // 底线区域显示隐藏控制标识
  154. flag: false,
  155. };
  156. },
  157. onLoad() {
  158. this.getTime()
  159. this.getListData()
  160. },
  161. // 页面滑动到底部触发的回调
  162. onReachBottom() {
  163. if (this.list.length < this.total) {
  164. this.page++
  165. this.getListData()
  166. } else {
  167. this.flag = true
  168. }
  169. },
  170. computed: {
  171. // 格式化月份
  172. format_month() {
  173. let temTime = this.month < 10 ? '0' + this.month : this.month
  174. return temTime
  175. }
  176. },
  177. methods: {
  178. // 获取当前年份,月份
  179. getTime() {
  180. let date = new Date()
  181. let year = date.getFullYear()
  182. let month = date.getMonth() + 1
  183. this.month = month
  184. this.year = year
  185. },
  186. // 获取打卡记录列表数组
  187. async getListData() {
  188. this.flag = false
  189. this.time = this.year + "-" + this.format_month + "-01 00:00:00"
  190. let res = await this.$myRequest({
  191. url: "/attendance/api/sign/check/in/list/month",
  192. data: {
  193. page: this.page,
  194. size: this.size,
  195. status: this.status,
  196. time: this.time
  197. }
  198. })
  199. // console.log(res);
  200. if (res.code == 200) {
  201. this.total = res.data.total
  202. this.list = res.data.list
  203. }
  204. },
  205. // 点击分段器回调
  206. onClickItem(e) {
  207. if (e.currentIndex == 0) {
  208. this.status = ""
  209. } else if (e.currentIndex == 1) {
  210. this.status = 4
  211. } else if (e.currentIndex == 2) {
  212. this.status = 3
  213. }
  214. this.page = 1
  215. this.getListData()
  216. },
  217. // 往后选择年份回调
  218. handleDoubleLeft() {
  219. if (this.year <= 2000) {
  220. uni.showToast({
  221. title: "不能选择2000年之前",
  222. icon: 'none'
  223. })
  224. } else {
  225. this.year -= 1
  226. this.page = 1
  227. this.getListData()
  228. }
  229. },
  230. // 往前选择年份回调
  231. handleDoubleRight() {
  232. if (this.year >= 2025) {
  233. uni.showToast({
  234. title: "不能选择2025年之后",
  235. icon: 'none'
  236. })
  237. } else {
  238. this.year += 1
  239. this.page = 1
  240. this.getListData()
  241. }
  242. },
  243. // 往后选择月份回调
  244. handleLeft() {
  245. if (this.month <= 1) {
  246. if (this.year <= 2000) {
  247. uni.showToast({
  248. title: "不能选择2000年之前",
  249. icon: 'none'
  250. })
  251. } else {
  252. this.year -= 1
  253. this.month = 12
  254. this.page = 1
  255. this.getListData()
  256. }
  257. } else {
  258. this.month -= 1
  259. this.page = 1
  260. this.getListData()
  261. }
  262. },
  263. // 往前选择月份回调
  264. handleRight() {
  265. if (this.month >= 12) {
  266. if (this.year >= 2025) {
  267. uni.showToast({
  268. title: "不能选择2025年之后",
  269. icon: 'none'
  270. })
  271. } else {
  272. this.year += 1
  273. this.month = 1
  274. this.page = 1
  275. this.getListData()
  276. }
  277. } else {
  278. this.month += 1
  279. this.page = 1
  280. this.getListData()
  281. }
  282. },
  283. // 格式化时间
  284. format_time(timestamp) {
  285. //时间戳为10位需*1000,时间戳为13位的话不需乘1000
  286. var date = new Date(timestamp);
  287. var y = date.getFullYear();
  288. var m = date.getMonth() + 1;
  289. var d = date.getDate();
  290. m = m < 10 ? "0" + m : m;
  291. d = d < 10 ? "0" + d : d;
  292. var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours());
  293. var mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes());
  294. var s = date.getSeconds()
  295. s = s < 10 ? "0" + s : s;
  296. let strDate = y + "-" + m + "-" + d + " " + h + ":" + mm + ":" + s;
  297. return strDate;
  298. }
  299. }
  300. }
  301. </script>
  302. <style lang="scss" scoped>
  303. .container {
  304. padding-top: 20rpx;
  305. .header {
  306. display: flex;
  307. flex-direction: column;
  308. justify-content: space-evenly;
  309. margin: 0 auto;
  310. width: 690rpx;
  311. height: 192rpx;
  312. background-color: #fff;
  313. .calendar {
  314. display: flex;
  315. justify-content: center;
  316. align-items: center;
  317. flex: 1;
  318. .double {
  319. width: 40rpx;
  320. height: 40rpx;
  321. img {
  322. width: 100%;
  323. height: 100%;
  324. }
  325. }
  326. .single {
  327. margin-left: 30rpx;
  328. width: 40rpx;
  329. height: 40rpx;
  330. img {
  331. width: 80%;
  332. height: 70%;
  333. }
  334. }
  335. .single2 {
  336. margin-right: 30rpx;
  337. width: 40rpx;
  338. height: 40rpx;
  339. img {
  340. width: 100%;
  341. height: 70%;
  342. }
  343. }
  344. .time {
  345. width: 180rpx;
  346. height: 44rpx;
  347. font-size: 32rpx;
  348. text-align: center;
  349. }
  350. }
  351. .state {
  352. display: flex;
  353. flex-direction: column;
  354. justify-content: center;
  355. flex: 1;
  356. }
  357. }
  358. .list {
  359. padding-bottom: 50rpx;
  360. .box {
  361. margin: 0 auto;
  362. margin-top: 20rpx;
  363. width: 690rpx;
  364. background-color: #fff;
  365. .person {
  366. display: flex;
  367. align-items: center;
  368. height: 134rpx;
  369. .img {
  370. margin: 0 20rpx 0 30rpx;
  371. width: 70rpx;
  372. height: 70rpx;
  373. img {
  374. width: 100%;
  375. height: 100%;
  376. }
  377. }
  378. .info {
  379. width: 620rpx;
  380. height: 70rpx;
  381. .name {
  382. font-size: 32rpx;
  383. }
  384. .college {
  385. font-size: 24rpx;
  386. color: #A6A6A6;
  387. }
  388. }
  389. }
  390. .imgs {
  391. display: flex;
  392. justify-content: space-evenly;
  393. height: 201rpx;
  394. .imgs_item {
  395. display: flex;
  396. flex-direction: column;
  397. align-items: center;
  398. flex: 1;
  399. .image {
  400. width: 120rpx;
  401. height: 120rpx;
  402. img {
  403. width: 100%;
  404. height: 100%;
  405. }
  406. }
  407. .title {
  408. margin-top: 10rpx;
  409. font-size: 28rpx;
  410. }
  411. }
  412. }
  413. .msg {
  414. margin-left: 30rpx;
  415. .msg_item {
  416. display: flex;
  417. align-items: center;
  418. height: 63rpx;
  419. font-size: 28rpx;
  420. .key {
  421. color: #808080;
  422. }
  423. .value {}
  424. }
  425. }
  426. }
  427. }
  428. .no_data {
  429. margin: 0 auto;
  430. margin-top: 230rpx;
  431. width: 480rpx;
  432. height: 508rpx;
  433. text-align: center;
  434. img {
  435. width: 100%;
  436. height: 100%;
  437. }
  438. .info {
  439. color: #5792F0;
  440. }
  441. }
  442. .foot {
  443. padding-bottom: 20rpx;
  444. text-align: center;
  445. }
  446. }
  447. </style>