statDetail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  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="./imgs/double_left.png">
  10. </view>
  11. <!-- 左箭头区域区域 -->
  12. <view class="single" @click="handleLeft">
  13. <img src="./imgs/left.png">
  14. </view>
  15. <!-- 时间区域 -->
  16. <view class="time">
  17. {{year}}-{{comMonth}}
  18. </view>
  19. <!-- 双右箭头区域 -->
  20. <view class="single2" @click="handleRight">
  21. <img src="./imgs/right.png">
  22. </view>
  23. <!-- 右箭头区域 -->
  24. <view class="double" @click="handleDoubleRight">
  25. <img src="./imgs/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">
  36. <!-- 每一条记录区域 -->
  37. <view class="box" v-for="item in list" :key="item.id">
  38. <!-- 人物信息区域 -->
  39. <view class="person">
  40. <view class="img">
  41. <img :src="item.peopleImg">
  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.imgsList">
  54. <view class="imgs_item" v-for="(img,index) in (item.imgsList)" :key="index">
  55. <view class="image">
  56. <img :src="img.url">
  57. </view>
  58. <view class="title">
  59. {{img.title}}
  60. </view>
  61. </view>
  62. </view>
  63. <!-- 打卡信息区域 -->
  64. <view class="msg">
  65. <view class="msg_item">
  66. <view class="key">
  67. 打卡状态:
  68. </view>
  69. <view class="value">
  70. {{item.status}}
  71. </view>
  72. </view>
  73. <view class="msg_item">
  74. <view class="key">
  75. 打卡规则:
  76. </view>
  77. <view class="value">
  78. {{item.rule}}
  79. </view>
  80. </view>
  81. <view class="msg_item" v-if="item.time">
  82. <view class="key">
  83. 打卡时间:
  84. </view>
  85. <view class="value">
  86. {{item.time}}
  87. </view>
  88. </view>
  89. <view class="msg_item" v-if="item.place">
  90. <view class="key">
  91. 打卡地址:
  92. </view>
  93. <view class="value">
  94. {{item.place}}
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. </template>
  102. <script>
  103. export default {
  104. data() {
  105. return {
  106. year: null,
  107. month: null,
  108. items: ['打卡成功(30次)', '打卡失败(28次)'],
  109. current: 0,
  110. list: [],
  111. list2: [{
  112. id: 1,
  113. peopleImg: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Finews.gtimg.com%2Fnewsapp_bt%2F0%2F13579194276%2F1000&refer=http%3A%2F%2Finews.gtimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1671596163&t=52c9def84f0fa7832bfc5824364917e0",
  114. name: "程佳欢",
  115. college: "文法学院",
  116. imgsList: [{
  117. url: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Finews.gtimg.com%2Fnewsapp_bt%2F0%2F13579194276%2F1000&refer=http%3A%2F%2Finews.gtimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1671596163&t=52c9def84f0fa7832bfc5824364917e0",
  118. title: "匹对照片"
  119. },
  120. {
  121. url: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Finews.gtimg.com%2Fnewsapp_bt%2F0%2F13579194276%2F1000&refer=http%3A%2F%2Finews.gtimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1671596163&t=52c9def84f0fa7832bfc5824364917e0",
  122. title: "被匹对照片"
  123. },
  124. {
  125. url: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Finews.gtimg.com%2Fnewsapp_bt%2F0%2F13579194276%2F1000&refer=http%3A%2F%2Finews.gtimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1671596163&t=52c9def84f0fa7832bfc5824364917e0",
  126. title: "场景照片"
  127. },
  128. ],
  129. status: '打卡成功',
  130. rule: "课间操打卡规则已打卡",
  131. time: "2022-02-04 15:15:15",
  132. place: "江西省南昌市南昌交通学院操场"
  133. },
  134. {
  135. id: 2,
  136. peopleImg: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Finews.gtimg.com%2Fnewsapp_bt%2F0%2F13579194276%2F1000&refer=http%3A%2F%2Finews.gtimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1671596163&t=52c9def84f0fa7832bfc5824364917e0",
  137. name: "陈志斌",
  138. college: "南昌交通学院",
  139. imgsList: [{
  140. url: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Finews.gtimg.com%2Fnewsapp_bt%2F0%2F13579194276%2F1000&refer=http%3A%2F%2Finews.gtimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1671596163&t=52c9def84f0fa7832bfc5824364917e0",
  141. title: "匹对照片"
  142. },
  143. {
  144. url: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Finews.gtimg.com%2Fnewsapp_bt%2F0%2F13579194276%2F1000&refer=http%3A%2F%2Finews.gtimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1671596163&t=52c9def84f0fa7832bfc5824364917e0",
  145. title: "被匹对照片"
  146. },
  147. {
  148. url: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Finews.gtimg.com%2Fnewsapp_bt%2F0%2F13579194276%2F1000&refer=http%3A%2F%2Finews.gtimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1671596163&t=52c9def84f0fa7832bfc5824364917e0",
  149. title: "场景照片"
  150. },
  151. ],
  152. status: '打卡成功',
  153. rule: "课间操打卡规则已打卡",
  154. time: "2022-11-04 15:15:15",
  155. place: "江西省南昌市经开区"
  156. },
  157. ],
  158. list3: [{
  159. id: 1,
  160. peopleImg: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Finews.gtimg.com%2Fnewsapp_bt%2F0%2F13579194276%2F1000&refer=http%3A%2F%2Finews.gtimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1671596163&t=52c9def84f0fa7832bfc5824364917e0",
  161. name: "甘昱新",
  162. college: "文法学院",
  163. status: '未打卡',
  164. rule: "课间操打卡规则",
  165. },
  166. {
  167. id: 2,
  168. peopleImg: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Finews.gtimg.com%2Fnewsapp_bt%2F0%2F13579194276%2F1000&refer=http%3A%2F%2Finews.gtimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1671596163&t=52c9def84f0fa7832bfc5824364917e0",
  169. name: "甘昱新",
  170. college: "文法学院",
  171. status: '未打卡',
  172. rule: "课间操打卡规则",
  173. },
  174. ]
  175. };
  176. },
  177. onLoad(options) {
  178. this.month = options.month - 0 || 1
  179. this.getTime()
  180. this.list = this.list2
  181. },
  182. computed: {
  183. comMonth() {
  184. if (this.month) {
  185. let month = this.month < 10 ? '0' + this.month : this.month
  186. console.log(month);
  187. return month
  188. }
  189. }
  190. },
  191. methods: {
  192. // 获取当前年份
  193. getTime() {
  194. let date = new Date()
  195. let year = date.getFullYear()
  196. this.year = year
  197. },
  198. onClickItem(e) {
  199. console.log(e.currentIndex);
  200. if (e.currentIndex == 0) {
  201. this.list = this.list2
  202. } else {
  203. this.list = this.list3
  204. }
  205. },
  206. handleDoubleLeft() {
  207. if (this.year <= 2000) {
  208. uni.showToast({
  209. title: "不能选择2000年之前",
  210. icon: 'none'
  211. })
  212. } else {
  213. this.year -= 1
  214. }
  215. },
  216. handleLeft() {
  217. if (this.month <= 1) {
  218. if (this.year <= 2000) {
  219. uni.showToast({
  220. title: "不能选择2000年之前",
  221. icon: 'none'
  222. })
  223. } else {
  224. this.year -= 1
  225. this.month = 12
  226. }
  227. } else {
  228. this.month -= 1
  229. }
  230. },
  231. handleRight() {
  232. if (this.month >= 12) {
  233. if (this.year >= 2025) {
  234. uni.showToast({
  235. title: "不能选择2025年之后",
  236. icon: 'none'
  237. })
  238. } else {
  239. this.year += 1
  240. this.month = 1
  241. }
  242. } else {
  243. this.month += 1
  244. }
  245. },
  246. handleDoubleRight() {
  247. if (this.year >= 2025) {
  248. uni.showToast({
  249. title: "不能选择2025年之后",
  250. icon: 'none'
  251. })
  252. } else {
  253. this.year += 1
  254. }
  255. },
  256. }
  257. }
  258. </script>
  259. <style lang="scss" scoped>
  260. .container {
  261. padding-top: 20rpx;
  262. .header {
  263. display: flex;
  264. flex-direction: column;
  265. justify-content: space-evenly;
  266. margin: 0 auto;
  267. width: 690rpx;
  268. height: 192rpx;
  269. background-color: #fff;
  270. .calendar {
  271. display: flex;
  272. justify-content: center;
  273. align-items: center;
  274. flex: 1;
  275. .double {
  276. width: 40rpx;
  277. height: 40rpx;
  278. img {
  279. width: 100%;
  280. height: 100%;
  281. }
  282. }
  283. .single {
  284. margin-left: 30rpx;
  285. width: 40rpx;
  286. height: 40rpx;
  287. img {
  288. width: 80%;
  289. height: 70%;
  290. }
  291. }
  292. .single2 {
  293. margin-right: 30rpx;
  294. width: 40rpx;
  295. height: 40rpx;
  296. img {
  297. width: 100%;
  298. height: 70%;
  299. }
  300. }
  301. .time {
  302. width: 180rpx;
  303. height: 44rpx;
  304. font-size: 32rpx;
  305. text-align: center;
  306. }
  307. }
  308. .state {
  309. display: flex;
  310. flex-direction: column;
  311. justify-content: center;
  312. flex: 1;
  313. }
  314. }
  315. .list {
  316. padding-bottom: 50rpx;
  317. .box {
  318. margin: 0 auto;
  319. margin-top: 20rpx;
  320. width: 690rpx;
  321. background-color: #fff;
  322. .person {
  323. display: flex;
  324. align-items: center;
  325. height: 134rpx;
  326. .img {
  327. margin: 0 20rpx 0 30rpx;
  328. width: 70rpx;
  329. height: 70rpx;
  330. img {
  331. width: 100%;
  332. height: 100%;
  333. }
  334. }
  335. .info {
  336. width: 620rpx;
  337. height: 70rpx;
  338. .name {
  339. font-size: 32rpx;
  340. }
  341. .college {
  342. font-size: 24rpx;
  343. color: #A6A6A6;
  344. }
  345. }
  346. }
  347. .imgs {
  348. display: flex;
  349. justify-content: space-evenly;
  350. height: 201rpx;
  351. .imgs_item {
  352. display: flex;
  353. flex-direction: column;
  354. align-items: center;
  355. flex: 1;
  356. .image {
  357. width: 120rpx;
  358. height: 120rpx;
  359. img {
  360. width: 100%;
  361. height: 100%;
  362. }
  363. }
  364. .title {
  365. margin-top: 10rpx;
  366. font-size: 28rpx;
  367. }
  368. }
  369. }
  370. .msg {
  371. .msg_item {
  372. display: flex;
  373. align-items: center;
  374. height: 63rpx;
  375. font-size: 28rpx;
  376. .key {
  377. color: #808080;
  378. }
  379. .value {}
  380. }
  381. }
  382. }
  383. }
  384. }
  385. </style>