statDetail.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  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. year: null,
  135. // 当前月份
  136. month: null,
  137. // 分段器选项
  138. items: ['打卡成功', '打卡失败'],
  139. // 当前所在分段器索引
  140. current: 0,
  141. // 第几页
  142. page: 1,
  143. // 每页条数
  144. size: 10,
  145. // 数据总条数
  146. total: 0,
  147. // 打卡状态参数
  148. status: 4,
  149. // 打卡时间参数
  150. time: null,
  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. format_month() {
  172. if (this.month) {
  173. let month = this.month < 10 ? '0' + this.month : this.month
  174. return month
  175. }
  176. }
  177. },
  178. methods: {
  179. // 获取当前年份
  180. getTime() {
  181. let date = new Date()
  182. let year = date.getFullYear()
  183. let month = date.getMonth() + 1
  184. this.month = month
  185. this.year = year
  186. },
  187. // 获取打卡记录列表数组
  188. async getListData() {
  189. this.flag = false
  190. this.time = this.year + "-" + this.format_month + "-01 00:00:00"
  191. let res = await this.$myRequest({
  192. url: "/attendance/api/sign/check/in/list/month",
  193. data: {
  194. page: this.page,
  195. size: this.size,
  196. status: this.status,
  197. time: this.time
  198. }
  199. })
  200. // console.log(res);
  201. if (res.code == 200) {
  202. this.total = res.data.total
  203. this.list = res.data.list
  204. if (this.status == 4) {
  205. this.items[0] = `打卡成功(${this.total}次)`
  206. this.items[1] = `打卡失败`
  207. } else {
  208. this.items[0] = `打卡成功`
  209. this.items[1] = `打卡失败(${this.total}次)`
  210. }
  211. }
  212. },
  213. // 点击分段器回调
  214. onClickItem(e) {
  215. // console.log(e.currentIndex);
  216. if (e.currentIndex == 0) {
  217. this.status = 4
  218. } else {
  219. this.status = 3
  220. }
  221. this.page = 1
  222. this.getListData()
  223. },
  224. // 往后选择年份回调
  225. handleDoubleLeft() {
  226. if (this.year <= 2000) {
  227. uni.showToast({
  228. title: "不能选择2000年之前",
  229. icon: 'none'
  230. })
  231. } else {
  232. this.year -= 1
  233. this.page = 1
  234. this.getListData()
  235. }
  236. },
  237. // 往前选择年份回调
  238. handleDoubleRight() {
  239. if (this.year >= 2025) {
  240. uni.showToast({
  241. title: "不能选择2025年之后",
  242. icon: 'none'
  243. })
  244. } else {
  245. this.year += 1
  246. this.page = 1
  247. this.getListData()
  248. }
  249. },
  250. // 往后选择月份回调
  251. handleLeft() {
  252. if (this.month <= 1) {
  253. if (this.year <= 2000) {
  254. uni.showToast({
  255. title: "不能选择2000年之前",
  256. icon: 'none'
  257. })
  258. } else {
  259. this.year -= 1
  260. this.month = 12
  261. this.page = 1
  262. this.getListData()
  263. }
  264. } else {
  265. this.month -= 1
  266. this.page = 1
  267. this.getListData()
  268. }
  269. },
  270. // 往前选择月份回调
  271. handleRight() {
  272. if (this.month >= 12) {
  273. if (this.year >= 2025) {
  274. uni.showToast({
  275. title: "不能选择2025年之后",
  276. icon: 'none'
  277. })
  278. } else {
  279. this.year += 1
  280. this.month = 1
  281. this.page = 1
  282. this.getListData()
  283. }
  284. } else {
  285. this.month += 1
  286. this.page = 1
  287. this.getListData()
  288. }
  289. },
  290. // 格式化时间
  291. format_time(timestamp) {
  292. //时间戳为10位需*1000,时间戳为13位的话不需乘1000
  293. var date = new Date(timestamp);
  294. var y = date.getFullYear();
  295. var m = date.getMonth() + 1;
  296. var d = date.getDate();
  297. m = m < 10 ? "0" + m : m;
  298. d = d < 10 ? "0" + d : d;
  299. var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours());
  300. var mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes());
  301. var s = date.getSeconds()
  302. s = s < 10 ? "0" + s : s;
  303. let strDate = y + "-" + m + "-" + d + " " + h + ":" + mm + ":" + s;
  304. return strDate;
  305. }
  306. }
  307. }
  308. </script>
  309. <style lang="scss" scoped>
  310. .container {
  311. padding-top: 20rpx;
  312. .header {
  313. display: flex;
  314. flex-direction: column;
  315. justify-content: space-evenly;
  316. margin: 0 auto;
  317. width: 690rpx;
  318. height: 192rpx;
  319. background-color: #fff;
  320. .calendar {
  321. display: flex;
  322. justify-content: center;
  323. align-items: center;
  324. flex: 1;
  325. .double {
  326. width: 40rpx;
  327. height: 40rpx;
  328. img {
  329. width: 100%;
  330. height: 100%;
  331. }
  332. }
  333. .single {
  334. margin-left: 30rpx;
  335. width: 40rpx;
  336. height: 40rpx;
  337. img {
  338. width: 80%;
  339. height: 70%;
  340. }
  341. }
  342. .single2 {
  343. margin-right: 30rpx;
  344. width: 40rpx;
  345. height: 40rpx;
  346. img {
  347. width: 100%;
  348. height: 70%;
  349. }
  350. }
  351. .time {
  352. width: 180rpx;
  353. height: 44rpx;
  354. font-size: 32rpx;
  355. text-align: center;
  356. }
  357. }
  358. .state {
  359. display: flex;
  360. flex-direction: column;
  361. justify-content: center;
  362. flex: 1;
  363. }
  364. }
  365. .list {
  366. padding-bottom: 50rpx;
  367. .box {
  368. margin: 0 auto;
  369. margin-top: 20rpx;
  370. width: 690rpx;
  371. background-color: #fff;
  372. .person {
  373. display: flex;
  374. align-items: center;
  375. height: 134rpx;
  376. .img {
  377. margin: 0 20rpx 0 30rpx;
  378. width: 70rpx;
  379. height: 70rpx;
  380. img {
  381. width: 100%;
  382. height: 100%;
  383. }
  384. }
  385. .info {
  386. width: 620rpx;
  387. height: 70rpx;
  388. .name {
  389. font-size: 32rpx;
  390. }
  391. .college {
  392. font-size: 24rpx;
  393. color: #A6A6A6;
  394. }
  395. }
  396. }
  397. .imgs {
  398. display: flex;
  399. justify-content: space-evenly;
  400. height: 201rpx;
  401. .imgs_item {
  402. display: flex;
  403. flex-direction: column;
  404. align-items: center;
  405. flex: 1;
  406. .image {
  407. width: 120rpx;
  408. height: 120rpx;
  409. img {
  410. width: 100%;
  411. height: 100%;
  412. }
  413. }
  414. .title {
  415. margin-top: 10rpx;
  416. font-size: 28rpx;
  417. }
  418. }
  419. }
  420. .msg {
  421. margin-left: 30rpx;
  422. .msg_item {
  423. display: flex;
  424. align-items: center;
  425. height: 63rpx;
  426. font-size: 28rpx;
  427. .key {
  428. color: #808080;
  429. }
  430. .value {}
  431. }
  432. }
  433. }
  434. }
  435. .no_data {
  436. margin: 0 auto;
  437. margin-top: 230rpx;
  438. width: 480rpx;
  439. height: 508rpx;
  440. text-align: center;
  441. img {
  442. width: 100%;
  443. height: 100%;
  444. }
  445. .info {
  446. color: #5792F0;
  447. }
  448. }
  449. .foot {
  450. padding-bottom: 20rpx;
  451. text-align: center;
  452. }
  453. }
  454. </style>