江西小程序管理端
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.

322 lines
7.6 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. <template>
  2. <view class="pageBgImg">
  3. <topNavbar title="我的排课"></topNavbar>
  4. <view class="pad">
  5. <view class="step1">
  6. <view class="card">
  7. <view class="dateBox">
  8. <view class="month-row">
  9. <view class="month">2032.08</view>
  10. <view class="arrow">
  11. <u-icon name="arrow-down" :size="12" :color="'#1989FA'"></u-icon>
  12. </view>
  13. </view>
  14. <view class="date_row">
  15. <view class="icon left">
  16. <u-icon name="arrow-left" :size="12" :color="'#fff'"></u-icon>
  17. </view>
  18. <view class="dateArr">
  19. <view class="date" v-for="(item,index) in dateArr" :key="index" :class="{active: index==1}">
  20. <view class="week">{{ item.week }}</view>
  21. <view class="num">{{ item.num }}</view>
  22. </view>
  23. </view>
  24. <view class="icon right">
  25. <u-icon name="arrow-right" :size="12" :color="'#fff'"></u-icon>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="card">
  31. <view class="timeCon">
  32. <view class="h2">上午</view>
  33. <view class="time_box">
  34. <view class="time_item" v-for="(item, index) in course" :key="index" @click="chooseCourse(item)" :class="{active: courseIds.indexOf(item.time)!=-1}">
  35. <view class="lab" v-if="item.status==0">未排课</view>
  36. <view class="lab" v-if="item.status==1">已约满</view>
  37. <view class="lab" v-if="item.status==2">已过期</view>
  38. <view class="lab" v-if="item.status==3">
  39. <view class="text">4/4</view>
  40. <view class="icon right">
  41. <u-icon name="arrow-right" :size="12" :color="'#fff'"></u-icon>
  42. </view>
  43. </view>
  44. <view class="time">{{ item.time }}</view>
  45. </view>
  46. </view>
  47. <view class="h2">下午</view>
  48. <view class="time_box">
  49. <view class="time_item" v-for="(item, index) in course" :key="index" @click="chooseCourse(item)" :class="{active: courseIds.indexOf(item.time)!=-1}">
  50. <view class="lab" v-if="item.status==0">未排课</view>
  51. <view class="lab" v-if="item.status==1">已约满</view>
  52. <view class="lab" v-if="item.status==2">已过期</view>
  53. <view class="lab" v-if="item.status==3">
  54. <view class="text">4/4</view>
  55. <view class="icon right" @click="$goPage('/pages/recordEntry/operate/mySchedule/detail/detail')">
  56. <u-icon name="arrow-right" :size="12" :color="'#fff'"></u-icon>
  57. </view>
  58. </view>
  59. <view class="time">{{ item.time }}</view>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="btn_row" v-if="step==1">
  65. <view class="btnBorder btn" @click="changeStep(1)">管理排课计划</view>
  66. <view class="btnBg btn" @click="changeStep(2)">编辑排课信息</view>
  67. </view>
  68. <view class="step2" v-if="step==2">
  69. <view class="">
  70. <myCheckbox :checkData="checkData" @changeCheck="changeCheck"></myCheckbox>
  71. </view>
  72. <view class="btnBg" @click="showPopupFn">确认发布</view>
  73. </view>
  74. </view>
  75. </view>
  76. <u-popup :show="show" @close="show=false" mode="center" :round="16">
  77. <view>
  78. <mySchedulePopup @confirmPopup="confirmPopup"/>
  79. </view>
  80. </u-popup>
  81. </view>
  82. </template>
  83. <script>
  84. import mySchedulePopup from './comp/mySchedulePopup'
  85. export default {
  86. components: { mySchedulePopup },
  87. data() {
  88. return {
  89. show: false,
  90. dateArr: [
  91. {week: '一', num: '08'},
  92. {week: '二', num: '09'},
  93. {week: '三', num: '10'},
  94. {week: '四', num: '11'},
  95. {week: '五', num: '12'},
  96. ],
  97. checkData: [
  98. {name: '全选', id: 0},
  99. {name: '取消选择', id: 1},
  100. ],
  101. step: 1,
  102. course: [
  103. {status: 0, time: '06:00-07:00'},
  104. {status: 1, time: '08:00-09:00'},
  105. {status: 2, time: '09:00-10:00'},
  106. {status: 3, time: '11:00-12:00'},
  107. {status: 0, time: '14:00-15:00'},
  108. ],
  109. courseIds: []
  110. }
  111. },
  112. methods: {
  113. changeStep(val) {
  114. if(val==1) {
  115. this.$goPage('/pages/recordEntry/operate/mySchedule/plan/plan')
  116. }else {
  117. this.step = val
  118. }
  119. // this.$emit('changeStep', val)
  120. },
  121. changeCheck(val) {
  122. // console.log(val)
  123. if(val.indexOf(1)!=-1) {
  124. this.courseIds = []
  125. this.step = 1
  126. }else {
  127. let total = this.course.reduce((pre, item)=>{
  128. if(item.status==0) {
  129. pre.push(item.time)
  130. }
  131. return pre
  132. },[])
  133. console.log(total.length)
  134. console.log(this.courseIds.length)
  135. if(total.length==this.courseIds.length) {
  136. this.courseIds = []
  137. this.$emit('upDateCheck', [])
  138. }else {
  139. this.courseIds = total
  140. }
  141. }
  142. },
  143. chooseCourse(item) {
  144. if(this.step==1) return
  145. if(item.status!=0) return //如果状态不为未排课
  146. let index = this.courseIds.indexOf(item.time)
  147. if(index!==-1) {
  148. this.courseIds.splice(index, 1)
  149. }else {
  150. this.courseIds.push(item.time)
  151. }
  152. },
  153. confirmPopup(val) {
  154. this.show = false
  155. },
  156. // 显示弹出框
  157. showPopupFn() {
  158. if(!this.courseIds.length) return this.$u.toast('请选择排课时间')
  159. this.show = true
  160. }
  161. }
  162. }
  163. </script>
  164. <style lang="scss" scoped>
  165. .step2 {
  166. display: flex;
  167. justify-content: space-between;
  168. align-items: center;
  169. .btnBg {
  170. width: 310rpx;
  171. }
  172. }
  173. .card {
  174. width: 100%;
  175. margin-bottom: 24rpx;
  176. overflow: hidden;
  177. .dateBox {
  178. padding: 36rpx 0 40rpx 0;
  179. .month-row {
  180. display: flex;
  181. justify-content: center;
  182. align-items: center;
  183. margin-bottom: 36rpx;
  184. .month {
  185. font-size: 32rpx;
  186. color: $themC;
  187. }
  188. .arrow {
  189. margin-left: 6rpx;
  190. }
  191. }
  192. .date_row {
  193. width: 100%;
  194. height: 100rpx;
  195. position: relative;
  196. .icon {
  197. width: 40rpx;
  198. height: 40rpx;
  199. background: rgba(51,51,51,0.18);
  200. backdrop-filter: blur(4rpx);
  201. position: absolute;
  202. top: 50%;
  203. transform: translateY(-50%);
  204. display: flex;
  205. align-items: center;
  206. justify-content: center;
  207. border-radius: 50%;
  208. &.left {
  209. left: 16rpx;
  210. }
  211. &.right {
  212. right: 16rpx;
  213. }
  214. }
  215. .dateArr {
  216. display: flex;
  217. padding: 0 70rpx;
  218. justify-content: space-between;
  219. .date {
  220. width: 74rpx;
  221. height: 100rpx;
  222. border-radius: 16rpx;
  223. display: flex;
  224. flex-direction: column;
  225. align-items: center;
  226. justify-content: center;
  227. font-size: 28rpx;
  228. color: #333;
  229. &.active {
  230. background: rgba(25,137,250,0.1);
  231. border: 2rpx solid #1989FA;
  232. color: $themC;
  233. }
  234. .week {
  235. }
  236. .num {
  237. margin-top: 4rpx;
  238. }
  239. }
  240. }
  241. }
  242. }
  243. }
  244. .card {
  245. .timeCon {
  246. padding: 0 24rpx 40rpx 24rpx;
  247. }
  248. .h2 {
  249. line-height: 90rpx;
  250. font-weight: 500;
  251. color: #333;
  252. }
  253. .time_box {
  254. display: flex;
  255. flex-wrap: wrap;
  256. justify-content: space-between;
  257. &::after {
  258. content: "";
  259. width: 30%;
  260. }
  261. .time_item {
  262. width: 30%;
  263. height: 120rpx;
  264. background: #F8F8F8;
  265. border-radius: 12rpx;
  266. display: flex;
  267. flex-direction: column;
  268. justify-content: center;
  269. align-items: center;
  270. border-radius: 12rpx;
  271. color: #333;
  272. margin-bottom: 20rpx;
  273. &.active {
  274. background: rgba(25,137,250,0.1);
  275. border: 2rpx solid #1989FA;
  276. color: $themC;
  277. }
  278. &.disable {
  279. opacity: 0.5;
  280. }
  281. .lab {
  282. font-size: 28rpx;
  283. font-weight: 500;
  284. display: flex;
  285. align-items: center;
  286. margin-bottom: 6rpx;
  287. .icon {
  288. margin-left: 10rpx;
  289. background: rgba(51,51,51,0.18);
  290. border-radius: 50%;
  291. padding: 6rpx;
  292. }
  293. }
  294. .time {
  295. font-size: 24rpx;
  296. margin-top: 4rpx;
  297. }
  298. }
  299. }
  300. }
  301. .btn_row {
  302. display: flex;
  303. justify-content: space-between;
  304. .btn {
  305. width: 47%;
  306. }
  307. }
  308. </style>