setPunchTime.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <view class="container">
  3. <!-- 选择星期区域 -->
  4. <view class="week_title">
  5. 选择星期
  6. </view>
  7. <view class="week">
  8. <jlk-week :value="selectedWeeks" @change="changeWeek"></jlk-week>
  9. </view>
  10. <!-- 选择打卡时间段区域 -->
  11. <view class="time_list">
  12. <view class="title">
  13. 选择打卡时间段
  14. </view>
  15. <view class="add" @click="handleAddTime">
  16. 添加时段
  17. </view>
  18. </view>
  19. <view class="list">
  20. <!-- 每一个时间段区域 -->
  21. <view class="item" v-for="(item,index) in list" :key="index">
  22. <view class="item_box">
  23. <picker mode="time" :value="item.startTime" @change="bindTimeChange($event,1,item)">
  24. <view class="uni-input">
  25. <view class="input_time">
  26. {{item.startTime}}
  27. </view>
  28. <view class="input_icon">
  29. <img src="../../static/time.png">
  30. </view>
  31. </view>
  32. </picker>
  33. </view>
  34. --
  35. <view class="item_box">
  36. <picker mode="time" :value="item.endTime" @change="bindTimeChange($event,2,item)">
  37. <view class="uni-input">
  38. <view class="input_time">
  39. {{item.endTime}}
  40. </view>
  41. <view class="input_icon">
  42. <img src="../../static/time.png">
  43. </view>
  44. </view>
  45. </picker>
  46. </view>
  47. </view>
  48. <view class="edit">
  49. 编辑
  50. </view>
  51. </view>
  52. <!-- switch区域 -->
  53. <view class="switch">
  54. <view class="switch_title">
  55. 除去法定节假日
  56. </view>
  57. <view class="switch_button">
  58. <switch color="#2A82E4" @change="switchChange" />
  59. </view>
  60. </view>
  61. </view>
  62. </template>
  63. <script>
  64. import JlkWeek from '@/uni_modules/jlk-week/components/jlk-week/jlk-week.vue';
  65. export default {
  66. components: {
  67. JlkWeek
  68. },
  69. data() {
  70. return {
  71. selectedWeeks: [],
  72. startTime: "09:00",
  73. endTime: "12:00",
  74. list: [{
  75. startTime: "09:00",
  76. endTime: "12:00",
  77. },
  78. {
  79. startTime: "00:00",
  80. endTime: "00:00",
  81. },
  82. ]
  83. }
  84. },
  85. methods: {
  86. changeWeek(value) {
  87. console.log(value);
  88. this.selectedWeeks = value
  89. },
  90. bindTimeChange(e, val,item) {
  91. console.log(e);
  92. console.log(val);
  93. console.log(item);
  94. if (val == 1) {
  95. item.startTime = e.detail.value
  96. } else {
  97. item.endTime = e.detail.value
  98. }
  99. },
  100. handleAddTime() {
  101. this.list.push({
  102. startTime: "00:00",
  103. endTime: "00:00",
  104. })
  105. },
  106. switchChange(e) {
  107. console.log('switch1 发生 change 事件,携带值为', e.detail.value)
  108. },
  109. }
  110. }
  111. </script>
  112. <style lang="scss" scoped>
  113. .container {
  114. padding-top: 33rpx;
  115. .week_title {
  116. margin-left: 35rpx;
  117. font-size: 34rpx;
  118. font-weight: 500;
  119. }
  120. .week {
  121. margin: 0 auto;
  122. margin-top: 12rpx;
  123. width: 690rpx;
  124. height: 107rpx;
  125. border-radius: 10rpx;
  126. background-color: #fff;
  127. }
  128. .time_list {
  129. display: flex;
  130. align-items: center;
  131. margin: 0 auto;
  132. margin-top: 32rpx;
  133. width: 690rpx;
  134. height: 60rpx;
  135. font-weight: 500;
  136. .title {
  137. flex: 4;
  138. font-size: 34rpx;
  139. }
  140. .add {
  141. flex: 1;
  142. text-align: end;
  143. font-size: 24rpx;
  144. color: #3396FB;
  145. }
  146. }
  147. .list {
  148. margin: 0 auto;
  149. margin-top: 13rpx;
  150. padding-top: 20rpx;
  151. width: 690rpx;
  152. border-radius: 10rpx;
  153. background-color: #fff;
  154. .item {
  155. display: flex;
  156. justify-content: space-between;
  157. margin: 0 20rpx 20rpx 20rpx;
  158. width: 650rpx;
  159. height: 60rpx;
  160. .item_box {
  161. width: 291rpx;
  162. height: 60rpx;
  163. border-radius: 8rpx;
  164. border: 1rpx solid #CCCCCC;
  165. .uni-input {
  166. display: flex;
  167. align-items: center;
  168. width: 291rpx;
  169. height: 60rpx;
  170. .input_time {
  171. flex: 2;
  172. margin-left: 34rpx;
  173. font-size: 28rpx;
  174. color: #707070;
  175. }
  176. .input_icon {
  177. flex: 1;
  178. display: flex;
  179. justify-content: center;
  180. align-items: center;
  181. img {
  182. width: 26rpx;
  183. height: 26rpx;
  184. }
  185. }
  186. }
  187. }
  188. }
  189. .edit {
  190. margin-left: 20rpx;
  191. padding-top: 10rpx;
  192. width: 70rpx;
  193. height: 60rpx;
  194. color: #3396FB;
  195. font-size: 24rpx;
  196. font-weight: 500;
  197. }
  198. }
  199. .switch {
  200. box-sizing: border-box;
  201. display: flex;
  202. align-items: center;
  203. margin: 0 auto;
  204. margin-top: 20rpx;
  205. padding: 0 20rpx;
  206. width: 690rpx;
  207. height: 86rpx;
  208. border-radius: 10rpx;
  209. background: #FFFFFF;
  210. .switch_title {
  211. flex: 5;
  212. font-size: 34rpx;
  213. font-weight: 500;
  214. }
  215. .switch_button {
  216. flex: 1;
  217. }
  218. }
  219. }
  220. // 选择星期区域圆角效果
  221. ::v-deep .weeks-outer {
  222. border-radius: 10rpx;
  223. }
  224. </style>