homePage.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723
  1. <template>
  2. <view>
  3. <view class="navigation">
  4. <view class="title">
  5. 青年夜校·学员端
  6. </view>
  7. <view class="identity">
  8. <view class="picture">
  9. <u-avatar class="avatar" :src="form.headPhoto != null ? form.headPhoto : '../../assets/img/head.png'" size="48">
  10. </u-avatar>
  11. </view>
  12. <view class="name">
  13. {{form.studentName}}
  14. </view>
  15. </view>
  16. </view>
  17. <view class="head">
  18. <view class="wrap">
  19. <u-swiper :list="bannerList" v-if="bannerList.length != 0"></u-swiper>
  20. </view>
  21. </view>
  22. <view class="my-app">
  23. <view class="app-items">
  24. <view class="item" @click="toClassSchedule">
  25. <view class="icon-box"
  26. style="background: linear-gradient(180deg, rgba(89,222,232,1) 1%,rgba(13,186,199,1) 100%)">
  27. <img src="../../../assets/img/riFill-calendar-2-fill@1x.png" alt="">
  28. </view>
  29. <view class="text">
  30. 课程表
  31. </view>
  32. </view>
  33. <!-- <view class="item" @click="toSickNote">
  34. <view class="icon-box"
  35. style="background: linear-gradient(180deg, rgba(169,147,255,1) 1%,rgba(129,97,255,1) 100%);">
  36. <img src="../../../assets/img/riFill-quill-pen-fill@1x.png" alt="">
  37. </view>
  38. <view class="text">
  39. 请假
  40. </view>
  41. </view> -->
  42. <view class="item" @click="toMyCourses">
  43. <view class="icon-box"
  44. style="background: linear-gradient(180deg, rgba(91,160,242,1) 1%,rgba(26,118,226,1) 100%);">
  45. <img src="../../../assets/img/riFill-book-open-fill@1x.png" alt="">
  46. </view>
  47. <view class="text">
  48. 我的课程
  49. </view>
  50. </view>
  51. <!-- <view class="item">
  52. <view class="icon-box"
  53. style="background: linear-gradient(180deg, rgba(255,189,96,1) 1%,rgba(255,150,0,1) 100%);">
  54. <img src="../../../assets/img/riFill-folder-user-fill@1x(1).png" alt="">
  55. </view>
  56. <view class="text">
  57. 学员文件
  58. </view>
  59. </view> -->
  60. <view class="item" @click="toPaymentRecord">
  61. <view class="icon-box"
  62. style="background: linear-gradient(180deg, rgba(169,147,255,1) 1%,rgba(129,97,255,1) 100%);">
  63. <img src="../../../assets/img/riFill-bank-card-fill@1x.png" alt="">
  64. </view>
  65. <view class="text">
  66. 缴费记录
  67. </view>
  68. </view>
  69. <!-- <view class="item">
  70. <view class="icon-box"
  71. style="background: linear-gradient(180deg, rgba(255,189,96,1) 1%,rgba(255,150,0,1) 100%);">
  72. <img src="../../../assets/img/riFill-file-edit-fill@1x.png" alt="">
  73. </view>
  74. <view class="text">
  75. 签到记录
  76. </view>
  77. </view> -->
  78. <!-- <view class="item">
  79. <view class="icon-box"
  80. style="background: linear-gradient(180deg, rgba(89,222,232,1) 1%,rgba(13,186,199,1) 100%);">
  81. <img src="../../../assets/img/riFill-file-edit-fill@1x.png" alt="">
  82. </view>
  83. <view class="text">
  84. 测温记录
  85. </view>
  86. </view> -->
  87. <!-- <view class="item">
  88. <view class="icon-box"
  89. style="background: linear-gradient(180deg, rgba(91,160,242,1) 1%,rgba(26,118,226,1) 100%);">
  90. <img src="../../../assets/img/riFill-calendar-2-fill@1x.png" alt="">
  91. </view>
  92. <view class="text">
  93. 机构报名
  94. </view>
  95. </view> -->
  96. </view>
  97. </view>
  98. <!-- 最近课程 -->
  99. <view class="course" v-if="courseList.length != 0">
  100. <view class="title">
  101. <img src="../../../assets/img/riFill-calendar-todo-fill@1x.png" alt="">最近课程
  102. </view>
  103. <view class="course-infos">
  104. <view class="info-box" v-for="(item,index) in courseList" :key="index"
  105. @click="gotoUrl('pages/youth/classSchedule/classScheduleDetails?id=' + item.sheetId)">
  106. <view class="position today" v-if="item.courseDate == day">
  107. </view>
  108. <view class="position tomorrow" v-if="item.courseDate == tomorrow">
  109. </view>
  110. <view class="class-name">
  111. {{item.className}}
  112. </view>
  113. <view class="location-time">
  114. <view class="location" style="width: 50%;">
  115. {{item.classroomName}}
  116. </view>
  117. <view class="time">
  118. {{item.coursePeriods}}
  119. </view>
  120. </view>
  121. <view class="date">
  122. {{item.courseDate}}
  123. </view>
  124. </view>
  125. </view>
  126. </view>
  127. <!-- 课程推荐 -->
  128. <!-- <view class="recommend">
  129. <view class="title">
  130. <view class="title">
  131. <img src="../../../assets/img/riFill-award-fill@1x.png" alt="">课程推荐
  132. </view>
  133. </view>
  134. <view class="classify">
  135. <view class="item" v-for="(item,index) in chosenList" :key="index"
  136. :class="chosenActive == index ? 'chosen' : ''" @click="chosenClick(item,index)">
  137. {{item.name}}
  138. </view>
  139. </view>
  140. <view class="infos-box" v-for="(item,index) in reCoursesList" :key="index"
  141. @click="gotoUrl('pages/youth/course/courseDetails?id='+item.course_id+'&classId='+item.class_id)">
  142. <view class="picture" v-if="item.posterUrl != null">
  143. <img :src="item.posterUrl" alt="">
  144. </view>
  145. <view class="picture" v-else>
  146. <img src="../../../assets/img/classify1.png" alt="">
  147. </view>
  148. <view class="infos">
  149. <view class="name">
  150. {{item.className}}
  151. </view>
  152. <view class="tips">
  153. <view class="item" v-if="item.courseDesc != null">
  154. {{item.courseDesc}}
  155. </view>
  156. <view class="item" v-else>
  157. 暂无简介
  158. </view>
  159. </view>
  160. <view class="teacher-price">
  161. <view class="teacher">
  162. <view class="name-teacher">
  163. 咨询电话:
  164. </view>
  165. <view class="phone-teacher">
  166. {{item.consultPhone != null ? item.consultPhone : '暂无'}}
  167. </view>
  168. </view>
  169. </view>
  170. </view>
  171. </view>
  172. <u-divider v-if="reCoursesList.length == recordsTotal && recordsTotal != 0" style="margin-top: 10px">没有更多了</u-divider>
  173. </view> -->
  174. <YouthTabbar :current="0" ref="tabbarMain"></YouthTabbar>
  175. </view>
  176. </template>
  177. <script>
  178. import * as homePageApi from '@/apis/youth/homePage.js'
  179. import * as mineApi from '@/apis/youth/mine.js'
  180. import YouthTabbar from '@/components/YouthTabbar.vue'
  181. import * as loginApi from '@/apis/login.js'
  182. export default {
  183. components: {
  184. YouthTabbar
  185. },
  186. data() {
  187. return {
  188. bannerList: [],
  189. pageNum: 1,
  190. pageSize: 5,
  191. recordsTotal: 0,
  192. tag: '',
  193. reCoursesList: [],
  194. chosenList: [],
  195. chosenActive: 0,
  196. day: '',
  197. tomorrow: '',
  198. weekDate: [],
  199. weekN: ["一", "二", "三", "四", "五", "六", "日"],
  200. activeClass: 0,
  201. weekDate1: '',
  202. courseList: [],
  203. form: {
  204. headPhoto: null
  205. },
  206. studentId: '',
  207. list: [{
  208. image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
  209. }, ],
  210. }
  211. },
  212. onReady() {
  213. let date = new Date() //当前日期
  214. this.day = this.getFormatDate(date);
  215. this.tomorrow = this.getFormatDate(new Date(date.setDate(date.getDate() + 1)));
  216. this.getInfo();
  217. // this.getFindByCatalogName();
  218. // this.getReCoursesList();
  219. // this.getLoadBannerForShow();
  220. },
  221. onReachBottom() {
  222. if (this.reCoursesList.length < this.recordsTotal) {
  223. this.myLoadmore();
  224. }
  225. },
  226. methods: {
  227. getInfo() {
  228. uni.showLoading({
  229. title: "加载中",
  230. mask: true,
  231. })
  232. loginApi.findByOpenId({
  233. openId: this.carhelp.getOpenId()
  234. }).then((response) => {
  235. uni.hideLoading();
  236. this.form = response.data.nsStudentInfo;
  237. this.carhelp.setNsStudentId({studentId: response.data.nsStudentInfo.id});
  238. }).catch(error => {
  239. uni.showToast({
  240. title: error,
  241. icon: "none"
  242. })
  243. })
  244. },
  245. getLoadBannerForShow() {
  246. uni.showLoading({
  247. title: "加载中",
  248. mask: true,
  249. })
  250. homePageApi.loadBannerForShow().then((response) => {
  251. uni.hideLoading();
  252. this.bannerList = response.data;
  253. }).catch(error => {
  254. uni.showToast({
  255. title: error,
  256. icon: "none"
  257. })
  258. })
  259. },
  260. myLoadmore() {
  261. this.pageNum += 1;
  262. this.getReCoursesList()
  263. },
  264. getReCoursesList(bl) {
  265. uni.showLoading({
  266. title: "加载中",
  267. mask: true,
  268. })
  269. if (bl) {
  270. this.reCoursesList = [];
  271. this.pageNum = 1;
  272. }
  273. homePageApi.loadCoursesForHomeShow({
  274. tag: this.tag,
  275. pageNum: this.pageNum,
  276. pageSize: this.pageSize
  277. }).then((res) => {
  278. uni.hideLoading();
  279. this.reCoursesList = [
  280. ...this.reCoursesList,
  281. ...res.data.data
  282. ];
  283. this.recordsTotal = res.data.recordsTotal;
  284. }).catch(error => {
  285. uni.showToast({
  286. title: error,
  287. icon: "none"
  288. })
  289. })
  290. },
  291. getFindByCatalogName() {
  292. this.chosenList = [];
  293. uni.showLoading({
  294. title: "加载中",
  295. mask: true,
  296. })
  297. homePageApi.findByCatalogName({
  298. catalogName: '课程分类标签'
  299. }).then((response) => {
  300. uni.hideLoading();
  301. this.chosenList.push({id: '',name: '全部'});
  302. var list = response.data;
  303. for (var i = 0; i < list.length; i++) {
  304. this.chosenList.push(list[i]);
  305. }
  306. }).catch(error => {
  307. uni.showToast({
  308. title: error,
  309. icon: "none"
  310. })
  311. })
  312. },
  313. toClassSchedule() {
  314. uni.navigateTo({
  315. url: '/pages/youth/classSchedule/classSchedule'
  316. })
  317. },
  318. toSickNote() {
  319. uni.navigateTo({
  320. url: '/pages/youth/sickNote/sickNote'
  321. })
  322. },
  323. toMyCourses() {
  324. uni.navigateTo({
  325. url: '/pages/youth/mine/myCourses'
  326. })
  327. },
  328. toPaymentRecord() {
  329. uni.navigateTo({
  330. url: '/pages/youth/course/paymentRecords'
  331. })
  332. },
  333. getFormatDate(date) {
  334. let myyear = date.getFullYear();
  335. let mymonth = date.getMonth() + 1;
  336. let myweekday = date.getDate();
  337. if (mymonth < 10) {
  338. mymonth = "0" + mymonth;
  339. }
  340. if (myweekday < 10) {
  341. myweekday = "0" + myweekday;
  342. }
  343. return (myyear + "-" + mymonth + "-" + myweekday);
  344. },
  345. chosenClick(item, index) {
  346. this.chosenActive = index;
  347. if(index != 0) {
  348. this.tag = item.name;
  349. } else {
  350. this.tag = '';
  351. }
  352. this.getReCoursesList(true);
  353. },
  354. getLatelyCourseList() {
  355. uni.showLoading({
  356. title: "加载中",
  357. mask: true,
  358. })
  359. homePageApi.getMyLastSchedules({
  360. studentId: this.studentId,
  361. count: 2
  362. }).then((response) => {
  363. uni.hideLoading();
  364. this.courseList = response.data;
  365. }).catch(error => {
  366. uni.showToast({
  367. title: error,
  368. icon: "none"
  369. })
  370. })
  371. }
  372. }
  373. }
  374. </script>
  375. <style lang="scss" scoped>
  376. page {
  377. padding-bottom: 100px;
  378. }
  379. .navigation {
  380. display: flex;
  381. justify-content: space-between;
  382. height: 44px;
  383. background-color: rgba(13, 186, 199, 1);
  384. padding: 0 16px;
  385. .title {
  386. line-height: 44px;
  387. color: #ffffff;
  388. font-size: 20px
  389. }
  390. .identity {
  391. display: flex;
  392. align-items: center;
  393. .picture {
  394. width: 24px;
  395. height: 24px;
  396. border-radius: 50px;
  397. overflow: hidden;
  398. margin-right: 4px;
  399. img {
  400. width: 100%;
  401. height: 100%;
  402. vertical-align: middle;
  403. }
  404. }
  405. .name {
  406. margin-right: 4px;
  407. color: rgba(255, 255, 255, 1);
  408. }
  409. .icon {
  410. img {
  411. vertical-align: middle;
  412. }
  413. }
  414. }
  415. }
  416. .head {
  417. background: linear-gradient(179.89deg, rgba(13, 186, 199, 1) 61.7%, rgba(244, 246, 246, 1) 97.7%);
  418. padding-bottom: 100px;
  419. .wrap {
  420. padding: 16px;
  421. }
  422. }
  423. .my-app {
  424. margin: -100px 16px 16px 16px;
  425. border-radius: 12px 12px 0px 0px;
  426. padding: 16px;
  427. background-color: #fff;
  428. .app-items {
  429. display: flex;
  430. flex-wrap: wrap;
  431. .item {
  432. width: 25%;
  433. display: flex;
  434. flex-direction: column;
  435. align-items: center;
  436. margin-bottom: 40rpx;
  437. .icon-box {
  438. width: 40px;
  439. height: 40px;
  440. text-align: center;
  441. border-radius: 8px;
  442. position: relative;
  443. .count {
  444. width: 28px;
  445. height: 16px;
  446. line-height: 16px;
  447. border-radius: 50px;
  448. background-color: rgba(238, 49, 56, 1);
  449. color: rgba(255, 255, 255, 1);
  450. font-size: 10px;
  451. text-align: center;
  452. position: absolute;
  453. top: -16rpx;
  454. right: -28rpx;
  455. }
  456. img {
  457. margin: 8px 0;
  458. }
  459. }
  460. .text {
  461. margin-top: 16rpx;
  462. }
  463. }
  464. }
  465. }
  466. // 最近课程
  467. .course {
  468. margin: auto;
  469. margin-top: 16px;
  470. width: 91.4%;
  471. .title {
  472. height: 20px;
  473. line-height: 20px;
  474. margin-bottom: 14px;
  475. color: #333333;
  476. font-weight: bold;
  477. img {
  478. vertical-align: middle;
  479. margin-right: 8px;
  480. }
  481. }
  482. .course-infos {
  483. display: flex;
  484. justify-content: space-between;
  485. .info-box {
  486. border-top: 2px solid #0DBAC7;
  487. background: linear-gradient(to right, #E4F8E3, #dcf5f6);
  488. width: 47.8%;
  489. padding: 24rpx 0 14rpx 24rpx;
  490. box-shadow: 2px 2px 2px 2px #e7e9e9;
  491. border-radius: 8px;
  492. position: relative;
  493. .position {
  494. width: 48rpx;
  495. height: 40rpx;
  496. line-height: 40rpx;
  497. position: absolute;
  498. top: 0;
  499. right: 16rpx;
  500. text-align: center;
  501. border-radius: 0px 0px 4px 4px;
  502. font-size: 12px;
  503. color: #fff;
  504. }
  505. .today {
  506. background-color: #0DBAC7;
  507. }
  508. .tomorrow {
  509. background-color: #0086FF;
  510. }
  511. .class-name {
  512. height: 20px;
  513. color: rgba(51, 51, 51, 1);
  514. font-size: 14px;
  515. }
  516. .location-time {
  517. margin-top: 8rpx;
  518. display: flex;
  519. justify-content: start;
  520. color: rgba(119, 119, 119, 1);
  521. font-size: 12px;
  522. .time {
  523. margin-left: 8rpx;
  524. }
  525. }
  526. .date {
  527. color: rgba(119, 119, 119, 1);
  528. font-size: 12px;
  529. margin-top: 8rpx;
  530. }
  531. }
  532. .info-box2 {
  533. border-top: 2px solid #0086FF;
  534. }
  535. }
  536. }
  537. .recommend {
  538. margin: 32px 16px;
  539. .title {
  540. height: 20px;
  541. line-height: 20px;
  542. margin-bottom: 14px;
  543. color: #333333;
  544. font-weight: bold;
  545. img {
  546. vertical-align: middle;
  547. margin-right: 8px;
  548. }
  549. }
  550. .classify {
  551. display: flex;
  552. margin-bottom: 24px;
  553. .item {
  554. border-radius: 12px;
  555. line-height: 32px;
  556. background-color: rgba(255, 255, 255, 1);
  557. color: rgba(119, 119, 119, 1);
  558. text-align: center;
  559. border: 1px solid rgba(204, 204, 204, 1);
  560. padding: 0 8px;
  561. margin-left: 12px;
  562. }
  563. .chosen {
  564. border: 1px solid rgba(13, 186, 199, 1);
  565. color: rgba(13, 186, 199, 1);
  566. }
  567. }
  568. .infos-box {
  569. border-radius: 12px;
  570. background-color: rgba(255, 255, 255, 1);
  571. padding: 12px;
  572. margin-bottom: 12px;
  573. display: flex;
  574. .picture {
  575. width: 200rpx;
  576. height: 200rpx;
  577. border-radius: 4px;
  578. overflow: hidden;
  579. img {
  580. width: 100%;
  581. height: 100%;
  582. }
  583. }
  584. .infos {
  585. flex: 1;
  586. margin-left: 12px;
  587. .name {
  588. color: rgba(51, 51, 51, 1);
  589. font-size: 16px;
  590. }
  591. .name-teacher {
  592. color: rgba(51, 51, 51, 1);
  593. font-size: 16px;
  594. width: 55%;
  595. }
  596. .phone-teacher {
  597. margin-right: 8px;
  598. }
  599. .tips {
  600. display: flex;
  601. margin-top: 8px;
  602. .item {
  603. padding: 0 8px;
  604. line-height: 20px;
  605. border-radius: 4px;
  606. background-color: rgba(241, 243, 244, 1);
  607. color: rgba(16, 16, 16, 1);
  608. font-size: 12px;
  609. margin-right: 8px;
  610. }
  611. }
  612. .teacher-price {
  613. margin-top: 44rpx;
  614. // display: flex;
  615. // justify-content: space-between;
  616. // align-items: center;
  617. .teacher {
  618. display: flex;
  619. // align-items: center;
  620. .photo {
  621. // width: 32px;
  622. // height: 32px;
  623. // border-radius: 50px;
  624. // overflow: hidden;
  625. margin-right: 8px;
  626. img {
  627. width: 100%;
  628. height: 100%;
  629. }
  630. }
  631. .img {
  632. width: 32rpx;
  633. height: 32rpx;
  634. margin-left: 16rpx;
  635. img {
  636. width: 100%;
  637. height: 100%;
  638. }
  639. }
  640. }
  641. .price {
  642. color: rgba(119, 119, 119, 1);
  643. }
  644. }
  645. }
  646. }
  647. }
  648. </style>