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.

247 lines
5.3 KiB

7 months ago
  1. <template>
  2. <view class="pageBgImg">
  3. <topNavbar title="我的排课"></topNavbar>
  4. <view class="pad">
  5. <pickDateTimer @confirmPopup="confirmPopup" :step="step" @cancelChoose="step=1" ref="pickDateRef"/>
  6. <view class="btn_row" v-if="step==1">
  7. <view class="btnBorder btn" @click="changeStep(1)">管理排课计划</view>
  8. <view class="btnBg btn" @click="changeStep(2)">编辑排课信息</view>
  9. </view>
  10. <!-- <view class="step2" v-if="step==2">
  11. <view class="">
  12. <myCheckbox :checkData="checkData" @changeCheck="changeCheck"></myCheckbox>
  13. </view>
  14. <view class="btnBg" @click="showPopupFn">确认发布</view>
  15. </view> -->
  16. </view>
  17. <u-popup :show="show" @close="show=false" mode="center" :round="16">
  18. <view>
  19. <mySchedulePopup @confirmClass="confirmClass"/>
  20. </view>
  21. </u-popup>
  22. </view>
  23. </template>
  24. <script>
  25. import mySchedulePopup from './comp/mySchedulePopup'
  26. import pickDateTimer from './comp/pickDateTimer/pickDateTimer'
  27. import { scheduleClassGetById, scheduleClassGet, scheduleClassCreateByTime } from '@/config/api.js'
  28. export default {
  29. components: { mySchedulePopup,pickDateTimer },
  30. data() {
  31. return {
  32. show: false,
  33. dateArr: [
  34. {week: '一', num: '08'},
  35. {week: '二', num: '09'},
  36. {week: '三', num: '10'},
  37. {week: '四', num: '11'},
  38. {week: '五', num: '12'},
  39. ],
  40. checkData: [
  41. {name: '全选', id: 0},
  42. {name: '取消选择', id: 1},
  43. ],
  44. step: 1,
  45. course: [
  46. {status: 0, time: '06:00-07:00'},
  47. {status: 1, time: '08:00-09:00'},
  48. {status: 2, time: '09:00-10:00'},
  49. {status: 3, time: '11:00-12:00'},
  50. {status: 0, time: '14:00-15:00'},
  51. ],
  52. courseIds: []
  53. }
  54. },
  55. onLoad() {
  56. },
  57. methods: {
  58. changeStep(val) {
  59. if(val==1) {
  60. this.$goPage('/pages/recordEntry/operate/mySchedule/plan/plan')
  61. }else {
  62. let pickDateRef = this.$refs.pickDateRef
  63. if(!pickDateRef.timerArr.length||!pickDateRef.timerArr2.length) return this.$u.toast('没有排课计划,请添加排课计划')
  64. this.step = val
  65. }
  66. // this.$emit('changeStep', val)
  67. },
  68. // 根据时间段排课
  69. async confirmClass(val, obj) {
  70. this.show = false
  71. if(val==0) return
  72. obj.deptId = this.vuex_deptId
  73. obj.coachId = this.vuex_coachId
  74. const res = await scheduleClassCreateByTime(Object.assign(this.pickDate, obj))
  75. if(res.code==0) this.$u.toast('发布排课成功')
  76. this.$refs.pickDateRef.courseIds = []
  77. // uni.$emit('refreshMySchedule')
  78. this.step = 1
  79. this.$refs.pickDateRef.scheduleClassGetFn()
  80. },
  81. // 显示弹出框
  82. confirmPopup(pickDate) {
  83. if(!pickDate.timeList.length) return this.$u.toast('请选择排课时间')
  84. this.pickDate = pickDate
  85. this.show = true
  86. }
  87. }
  88. }
  89. </script>
  90. <style lang="scss" scoped>
  91. .step2 {
  92. display: flex;
  93. justify-content: space-between;
  94. align-items: center;
  95. .btnBg {
  96. width: 310rpx;
  97. }
  98. }
  99. .card {
  100. width: 100%;
  101. margin-bottom: 24rpx;
  102. overflow: hidden;
  103. .dateBox {
  104. padding: 36rpx 0 40rpx 0;
  105. .month-row {
  106. display: flex;
  107. justify-content: center;
  108. align-items: center;
  109. margin-bottom: 36rpx;
  110. .month {
  111. font-size: 32rpx;
  112. color: $themC;
  113. }
  114. .arrow {
  115. margin-left: 6rpx;
  116. }
  117. }
  118. .date_row {
  119. width: 100%;
  120. height: 100rpx;
  121. position: relative;
  122. .icon {
  123. width: 40rpx;
  124. height: 40rpx;
  125. background: rgba(51,51,51,0.18);
  126. backdrop-filter: blur(4rpx);
  127. position: absolute;
  128. top: 50%;
  129. transform: translateY(-50%);
  130. display: flex;
  131. align-items: center;
  132. justify-content: center;
  133. border-radius: 50%;
  134. &.left {
  135. left: 16rpx;
  136. }
  137. &.right {
  138. right: 16rpx;
  139. }
  140. }
  141. .dateArr {
  142. display: flex;
  143. padding: 0 70rpx;
  144. justify-content: space-between;
  145. .date {
  146. width: 74rpx;
  147. height: 100rpx;
  148. border-radius: 16rpx;
  149. display: flex;
  150. flex-direction: column;
  151. align-items: center;
  152. justify-content: center;
  153. font-size: 28rpx;
  154. color: #333;
  155. &.active {
  156. background: rgba(25,137,250,0.1);
  157. border: 2rpx solid #1989FA;
  158. color: $themC;
  159. }
  160. .week {
  161. }
  162. .num {
  163. margin-top: 4rpx;
  164. }
  165. }
  166. }
  167. }
  168. }
  169. }
  170. .card {
  171. .timeCon {
  172. padding: 0 24rpx 40rpx 24rpx;
  173. }
  174. .h2 {
  175. line-height: 90rpx;
  176. font-weight: 500;
  177. color: #333;
  178. }
  179. .time_box {
  180. display: flex;
  181. flex-wrap: wrap;
  182. justify-content: space-between;
  183. &::after {
  184. content: "";
  185. width: 30%;
  186. }
  187. .time_item {
  188. width: 30%;
  189. height: 120rpx;
  190. background: #F8F8F8;
  191. border-radius: 12rpx;
  192. display: flex;
  193. flex-direction: column;
  194. justify-content: center;
  195. align-items: center;
  196. border-radius: 12rpx;
  197. color: #333;
  198. margin-bottom: 20rpx;
  199. &.active {
  200. background: rgba(25,137,250,0.1);
  201. border: 2rpx solid #1989FA;
  202. color: $themC;
  203. }
  204. &.disable {
  205. opacity: 0.5;
  206. }
  207. .lab {
  208. font-size: 28rpx;
  209. font-weight: 500;
  210. display: flex;
  211. align-items: center;
  212. margin-bottom: 6rpx;
  213. .icon {
  214. margin-left: 10rpx;
  215. background: rgba(51,51,51,0.18);
  216. border-radius: 50%;
  217. padding: 6rpx;
  218. }
  219. }
  220. .time {
  221. font-size: 24rpx;
  222. margin-top: 4rpx;
  223. }
  224. }
  225. }
  226. }
  227. .btn_row {
  228. display: flex;
  229. justify-content: space-between;
  230. padding-bottom: 40rpx;
  231. .btn {
  232. width: 47%;
  233. }
  234. }
  235. </style>