You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

list.vue 3.1 KiB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <view class="page">
  3. <uni-calendar
  4. :insert="true"
  5. :lunar="true"
  6. @change="change"
  7. :selected="selected"
  8. ></uni-calendar>
  9. <view class="attendBox" v-show="flag">
  10. <view class="attendBoxT">{{ data.data.day }}</view>
  11. <view class="attendBoxTime">
  12. <view class="attendCon" v-for="(n, i) in data.data.list" :key="n.time">
  13. <view class="attendConT">{{ n.time }} <span>(上班时间 {{ n.time }})</span></view>
  14. <!-- <view class="attendConTxt">
  15. <image src="~@/common/images/location2.png" mode="widthFix"></image>
  16. 山西省太原市杏花岭区七府园路11号山西冶金技师学院
  17. </view> -->
  18. <view class="attendConStatus attendConStatus1">{{ n.status == 1? '正常' : '早退'}}</view>
  19. <view class="attendCircular">{{ i == 0? '上' : '下'}}</view>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. import uniCalendar from '@/components/uni-calendar/uni-calendar.vue';
  27. export default {
  28. components: {
  29. uniCalendar
  30. },
  31. data() {
  32. return {
  33. selected:[],
  34. data: {
  35. data:{
  36. day: '',
  37. list: []
  38. }
  39. },
  40. flag: false
  41. };
  42. },
  43. methods: {
  44. init() {
  45. let _this = this;
  46. _this.LOADING('加载数据中…');
  47. _this.HTTP_GET('teachattendance/major', {}, '加载数据时出错').then(res => {
  48. _this.HIDE_LOADING();
  49. // console.log(res);
  50. res.forEach((n, i) => {
  51. let jsons = {
  52. date: `${n.y}-${n.m}-${n.d}`,
  53. info: n.state == 1? '正常' : n.state == 2? '迟到' : '缺勤',
  54. data:{
  55. day: n.day,
  56. list: []
  57. }
  58. }
  59. jsons.data.list = _this.COPY(n.list);
  60. _this.selected.push(jsons)
  61. })
  62. });
  63. },
  64. change(e) {
  65. // console.log(e)
  66. if(JSON.stringify(e.extraInfo) == '{}'){
  67. this.flag = false;
  68. }else{
  69. this.flag = true;
  70. this.data = {};
  71. this.data = this.COPY(e.extraInfo);
  72. // console.log(this.data)
  73. }
  74. }
  75. },
  76. created() {
  77. this.init();
  78. }
  79. };
  80. </script>
  81. <style lang="less" scoped>
  82. .attendBox{
  83. margin-top: 10px;
  84. background: #fff;
  85. padding: 20px 12px;
  86. // display: none;
  87. }
  88. .attendBoxT{
  89. font-size: 15px;
  90. color: #0089FE;
  91. }
  92. .attendBoxTime{
  93. position: relative;
  94. height: 143px;
  95. }
  96. .attendBoxTime:before{
  97. content: '';
  98. position: absolute;
  99. left: 12px;
  100. top: -17px;
  101. width: 1px;
  102. height: 143px;
  103. background: #CBD1D4;
  104. }
  105. .attendCon{
  106. position: relative;
  107. margin-top: 20px;
  108. padding-left: 30px;
  109. }
  110. .attendConT{
  111. font-size: 15px;
  112. color: #6E6E6E;
  113. }
  114. .attendConT span{
  115. color: #9E9E9E;
  116. margin-left: 5px;
  117. }
  118. .attendConTxt{
  119. font-size: 13px;
  120. color: #9E9E9E;
  121. margin: 10px 0;
  122. }
  123. .attendConTxt image{
  124. width: 10px;
  125. margin-right: 5px;
  126. position: relative;
  127. top: 1px;
  128. }
  129. .attendConStatus{
  130. height: 24px;
  131. line-height: 24px;
  132. padding: 0 10px;
  133. font-size: 13px;
  134. color: #fff;
  135. display: inline-block;
  136. border-radius: 12px;
  137. }
  138. .attendConStatus1{
  139. background: #0089FE;
  140. }
  141. .attendConStatus2{
  142. background: #F3C84E;
  143. }
  144. .attendCircular{
  145. position: absolute;
  146. top: 0;
  147. left: 0;
  148. width: 24px;
  149. height: 24px;
  150. border-radius: 50%;
  151. text-align: center;
  152. line-height: 24px;
  153. font-size: 15px;
  154. color: #fff;
  155. background: #CBD1D4;
  156. }
  157. </style>