course.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  1. <template>
  2. <view class="u-wrap">
  3. <view v-if="show">
  4. <authPhone v-on:watchShow='watchShow'></authPhone>
  5. </view>
  6. <view class="select-top">
  7. <view class="top-tab">
  8. <u-tabs :list="list" :is-scroll="false" :current="current" @change="change" active-color="#FF4600"></u-tabs>
  9. </view>
  10. <!-- <view class="top">
  11. <view class="day">
  12. <view class="left">
  13. 2020年8月
  14. </view>
  15. <view class="right">
  16. <view class="name">
  17. <text style="margin-right: 5px;">{{cardName}}</text>
  18. <u-icon name="arrow-down" color="#FF4600" size="28" margin-left="30"></u-icon>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="tab">
  23. <view class="item" v-for="(item,index) in date" :key='index' @click="changeTab(item)">
  24. <view class="week">
  25. {{item.week ? item.week :'今天'}}
  26. </view>
  27. <view :class="currentDay== item.day ? 'active' : 'day'">
  28. <view class="num">{{item.day}}</view>
  29. <view class="dian">·</view>
  30. </view>
  31. </view>
  32. </view>
  33. </view> -->
  34. </view>
  35. <view class="order" v-if="classList.length>0" v-for="(item,index) in classList" :key='index'>
  36. <view class="order-message">
  37. <view class="order-left">
  38. <view class="coach">
  39. {{item.course.name}}
  40. </view>
  41. <view class="text">
  42. <text class="tag">教练:</text>{{item.coach.name}}
  43. </view>
  44. <view class="text">
  45. <text class="tag">学员:</text>{{item.child.name}}
  46. </view>
  47. <view class="text">
  48. <text class="tag">开班时间:</text><text class="tag">{{item.start_time}}~{{item.end_time}} </text>
  49. </view>
  50. <view class="text">
  51. <text class="tag">上课时间:</text>每天{{item.course.start }}~{{item.course.end}}
  52. </view>
  53. <!-- <view class="text">
  54. <text class="tag">类型:</text>
  55. <u-tag text="培训班" type="primary" size="small" border-color="#ecf5ff" />
  56. </view> -->
  57. </view>
  58. <image src="../../static/finish.png" v-if="item.complete_status==1" mode="" class="finish" ></image>
  59. <view class="evaluate" @click="evaluate(item)" v-if="current==1 && item.complete_status!=1">
  60. 去评价
  61. </view>
  62. <view class="order-right">
  63. <image :src="item.coach.head_portrait" mode=""></image>
  64. </view>
  65. </view>
  66. <!-- <view class="tips">
  67. <image src="../../static/clock.png" mode=""></image>
  68. <text>距离上课还有30分钟28秒</text>
  69. </view> -->
  70. </view>
  71. <view class="empty" v-if="classList.length==0 || !classList.length">
  72. <u-empty text="暂无课程" mode="order"></u-empty>
  73. </view>
  74. </view>
  75. </template>
  76. <script>
  77. var app=getApp()
  78. import authPhone from "../../components/authorize.vue"
  79. import classifyData from "@/common/classify.data.js";
  80. export default {
  81. components: {
  82. // 注册
  83. authPhone
  84. },
  85. data() {
  86. return {
  87. show: false,
  88. list: [{
  89. name: '未开始',
  90. type: 0
  91. }, {
  92. name: '进行中',
  93. type: 1
  94. }, {
  95. name: '已结束',
  96. type: 2
  97. }],
  98. current: 1,
  99. length: [0, 1, 2, 3, 4, 5],
  100. date: [],
  101. currentDay: '',
  102. year: '', //年分
  103. schedulingId: '', //课程id
  104. day: '', //选中日期
  105. classList: [], //课程列表
  106. page: 1, //页码
  107. last:false
  108. }
  109. },
  110. onLoad(options) {
  111. console.log(app.globalData.classCurrent)
  112. },
  113. onShow() {
  114. this.page=1
  115. this.last=false
  116. this.classList=[]
  117. // this.getTabs()
  118. // // if(app.globalData.classCurrent){
  119. // // this.current=app.globalData.classCurrent
  120. // // }else{
  121. // this.current=1
  122. // }
  123. this.getClass()
  124. },
  125. onReachBottom() {
  126. if (!this.last) {
  127. this.page++
  128. }
  129. this.getClass()
  130. },
  131. methods: {
  132. //去评价
  133. evaluate(item) {
  134. console.log(item, '去评价')
  135. let cardUserId = item.card_user_id
  136. let subscribeId = item.scheduling_id
  137. let data1={
  138. course_child_id:item.id,
  139. head_portrait:item.coach.head_portrait,
  140. name:item.coach.name,
  141. courseName:item.course.name
  142. }
  143. let data=JSON.stringify(data1)
  144. console.log(data,'ppppp')
  145. uni.navigateTo({
  146. url:'./evaluate?data=' + data
  147. })
  148. },
  149. //监听子组件变化
  150. watchShow(value) {
  151. this.show = value
  152. },
  153. //课程列表
  154. getClass() {
  155. let params = {
  156. page: this.page,
  157. type: this.current
  158. }
  159. this.$u.get('/user/course', params).then(res => {
  160. console.log(res, 'pppppppp')
  161. let data = res.data.data
  162. if (this.page > 1 && data.length == 0) {
  163. uni.showToast({
  164. title: '暂无更多'
  165. })
  166. this.last=true
  167. } else {
  168. this.classList = this.classList.concat(data)
  169. }
  170. })
  171. },
  172. change(e) {
  173. console.log(e, '顶部切换')
  174. this.current = e
  175. this.page = 1
  176. this.last=false
  177. this.classList = []
  178. this.getClass()
  179. },
  180. }
  181. }
  182. </script>
  183. <style lang="scss" scoped>
  184. .u-wrap {
  185. padding-top: 45px;
  186. padding-bottom: 10px;
  187. }
  188. .select-top {
  189. position: fixed;
  190. width: 100%;
  191. top: 0;
  192. left: 0;
  193. height: 45px;
  194. z-index: 2;
  195. }
  196. .top-tab {
  197. height: 44px;
  198. border-top: 1px solid #eeeeee;
  199. border-bottom: 1px solid #eeeeee;
  200. background-color: #FFFFFF;
  201. }
  202. .top {
  203. background-color: #FFFFFF;
  204. padding: 12px;
  205. margin-bottom: 12px;
  206. font-size: 15px;
  207. line-height: 28px;
  208. font-family: PingFang SC;
  209. font-weight: bold;
  210. color: #333333;
  211. opacity: 1;
  212. .day {
  213. display: flex;
  214. .left {
  215. flex: 1;
  216. }
  217. .right {
  218. flex: 1;
  219. text-align: right;
  220. .name {
  221. display: inline-block;
  222. padding: 4px 7px;
  223. font-size: 14px;
  224. font-family: PingFang SC;
  225. font-weight: 400;
  226. line-height: 20px;
  227. color: #FF4600;
  228. opacity: 1;
  229. background: #FFEEE5;
  230. }
  231. }
  232. }
  233. .tab {
  234. display: flex;
  235. .item {
  236. flex: 1;
  237. font-size: 14px;
  238. font-family: PingFang SC;
  239. font-weight: bold;
  240. line-height: 20px;
  241. color: #333333;
  242. opacity: 1;
  243. .week {
  244. height: 36px;
  245. line-height: 36px;
  246. }
  247. .day,
  248. .active {
  249. height: 32px;
  250. width: 32px;
  251. text-align: center;
  252. border-radius: 4px;
  253. .num {
  254. display: block;
  255. height: 23px;
  256. line-height: 23px;
  257. }
  258. .dian {
  259. display: none;
  260. height: 9px;
  261. line-height: 0px;
  262. }
  263. }
  264. .active {
  265. height: 32px;
  266. width: 32px;
  267. background: linear-gradient(180deg, #FF3B21 0%, #FF8F09 100%);
  268. text-align: center;
  269. border-radius: 4px;
  270. color: #FFFFFF;
  271. .dian {
  272. display: block;
  273. height: 9px;
  274. line-height: 0px;
  275. }
  276. }
  277. }
  278. }
  279. }
  280. .order {
  281. padding: 10px;
  282. margin: 10px 12px 0;
  283. border-radius: 8px;
  284. background-color: #FFFFFF;
  285. position: relative;
  286. .finish{
  287. position: absolute;
  288. bottom: 12px;
  289. right:12px;
  290. height:60px;
  291. width:70px;
  292. }
  293. .evaluate {
  294. position: absolute;
  295. right: 12px;
  296. bottom: 12px;
  297. width: 82px;
  298. height: 30px;
  299. background: linear-gradient(266deg, #FF3B21 0%, #FF8F09 100%);
  300. opacity: 1;
  301. font-size: 14px;
  302. font-family: PingFang SC;
  303. font-weight: 400;
  304. line-height: 30px;
  305. color: #FFFFFF;
  306. text-align: center;
  307. opacity: 1;
  308. border-radius: 15px;
  309. }
  310. .order-message {
  311. display: flex;
  312. .order-left {
  313. flex: 1;
  314. .coach {
  315. font-size: 19px;
  316. font-weight: bold;
  317. color: #333333;
  318. margin-bottom: 10px;
  319. }
  320. .text {
  321. line-height: 28px;
  322. font-size: 14px;
  323. font-family: PingFang SC;
  324. font-weight: 400;
  325. color: #333333;
  326. opacity: 1;
  327. .tag {
  328. margin-right: 5px;
  329. }
  330. }
  331. }
  332. .order-right {
  333. flex: 0 0 73px;
  334. image {
  335. height: 73px;
  336. width: 73px;
  337. }
  338. }
  339. }
  340. .tips {
  341. margin-top: 10px;
  342. height: 36px;
  343. // line-height: 36px;
  344. text-align: center;
  345. background: #FFEEE5;
  346. opacity: 1;
  347. border-radius: 4px;
  348. image {
  349. display: inline-block;
  350. vertical-align: middle;
  351. line-height: 36px;
  352. height: 24px;
  353. width: 24px;
  354. }
  355. text {
  356. margin-left: 8px;
  357. font-size: 15px;
  358. display: inline-block;
  359. vertical-align: middle;
  360. font-family: PingFang SC;
  361. font-weight: bold;
  362. line-height: 21px;
  363. line-height: 36px;
  364. color: #FF4600;
  365. opacity: 1;
  366. }
  367. }
  368. }
  369. .empty {
  370. margin-top: 50%;
  371. }
  372. </style>