index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756
  1. <template>
  2. <view>
  3. <u-navbar
  4. :is-back="false"
  5. title="选课中心"
  6. :border-bottom="false"
  7. title-color="#333333"
  8. back-icon-color="#ffffff"
  9. >
  10. <view class="slot-wrap">
  11. <image
  12. src="/static/logo2.png"
  13. style="width: 178rpx; height: 31rpx; margin-left: 30rpx"
  14. ></image>
  15. </view>
  16. </u-navbar>
  17. <view v-show="!show">
  18. <view
  19. style="
  20. position: fixed;
  21. width: 100%;
  22. z-index: 999;
  23. background-color: #ffffff;
  24. "
  25. >
  26. <u-line color="#D6D6DB" />
  27. <view
  28. style="
  29. display: flex;
  30. justify-content: space-between;
  31. height: 78rpx;
  32. line-height: 78rpx;
  33. padding: 0 30rpx;
  34. font-size: 28rpx;
  35. "
  36. >
  37. <view
  38. style="
  39. color: #666666;
  40. white-space: nowrap;
  41. width: 80%;
  42. overflow-x: hidden;
  43. "
  44. >{{ selObj.eName }}:{{ selObj.pName }}-{{ selObj.bName }}</view
  45. >
  46. <view
  47. style="color: #007aff; width: 20%; font-size: 32rpx"
  48. @click="openLeft()"
  49. >重新选择</view
  50. >
  51. </view>
  52. <u-line color="#D6D6DB" />
  53. <view style="display: flex; align-items: center">
  54. <view style="margin: 0 auto"
  55. ><u-tabs
  56. :list="list"
  57. :current="current"
  58. @change="change"
  59. :scrollable="false"
  60. ></u-tabs
  61. ></view>
  62. </view>
  63. <u-line color="#D6D6DB" />
  64. <view class="menuSel" v-show="current == 0">
  65. <scroll-view class="r_sliper" scroll-x="true">
  66. <view
  67. v-for="(item, index) in sList"
  68. :key="index"
  69. style="margin-right: 20rpx; display: inline-block"
  70. >
  71. <view
  72. :class="paramList[0].subjectId == item.id ? 'r_t1' : 'r_t2'"
  73. @click="cMenu(item.id)"
  74. >
  75. {{ item.subjectName }}
  76. </view>
  77. </view>
  78. </scroll-view>
  79. </view>
  80. <view class="menuSel" v-show="current == 1">
  81. <scroll-view class="r_sliper" scroll-x="true">
  82. <view
  83. v-for="(item, index) in sList"
  84. :key="index"
  85. style="margin-right: 20rpx; display: inline-block"
  86. >
  87. <view
  88. :class="paramList[1].subjectId == item.id ? 'r_t1' : 'r_t2'"
  89. @click="cMenu1(item.id)"
  90. >
  91. {{ item.subjectName }}
  92. </view>
  93. </view>
  94. </scroll-view>
  95. </view>
  96. <view class="menuSel" v-show="current == 2">
  97. <scroll-view class="r_sliper" scroll-x="true">
  98. <view
  99. v-for="(item, index) in sList"
  100. :key="index"
  101. style="margin-right: 20rpx; display: inline-block"
  102. >
  103. <view
  104. :class="paramList[2].subjectId == item.id ? 'r_t1' : 'r_t2'"
  105. @click="cMenu2(item.id)"
  106. >
  107. {{ item.subjectName }}
  108. </view>
  109. </view>
  110. </scroll-view>
  111. </view>
  112. </view>
  113. <view v-show="current == 0">
  114. <view class="listBox">
  115. <navigator
  116. hover-class="none"
  117. :url="'/pages3/course/detail?id=' + item.goodsId"
  118. v-for="(item, index) in list1"
  119. :key="index"
  120. >
  121. <view class="itemBox">
  122. <image
  123. :src="$method.splitImgHost(item.coverUrl, true)"
  124. style="height: 367rpx; width: 100%; border-radius: 24rpx"
  125. ></image>
  126. <view
  127. style="display: flex; margin-top: 13rpx; align-items: center"
  128. >
  129. <view class="yearTag" v-if="item.year">{{ item.year }}</view>
  130. <view class="titleTag">{{ item.goodsName }}</view>
  131. </view>
  132. <view
  133. style="
  134. display: flex;
  135. justify-content: space-between;
  136. margin-top: 13rpx;
  137. "
  138. >
  139. <view class="noteTag"
  140. ><image
  141. src="/static/icon/wk_icon1.png"
  142. class="wk_icon"
  143. ></image>
  144. 共 <text class="blackFont">{{ item.courseNum }}</text>
  145. <text class="margin30">课程</text>
  146. <text class="blackFont">{{ item.classHours || "-" }}</text>
  147. 学时</view
  148. >
  149. <view class="priceTag">¥ {{ item.standPrice.toFixed(2) }}</view>
  150. </view>
  151. </view>
  152. </navigator>
  153. <view class="emptyTip" v-if="list1.length == 0"
  154. >暂未上架相关网课~</view
  155. >
  156. </view>
  157. </view>
  158. <view v-show="current == 1">
  159. <view class="listBox">
  160. <navigator
  161. hover-class="none"
  162. :url="'/pages2/bank/detail?id=' + item.goodsId"
  163. v-for="(item, index) in list2"
  164. :key="index"
  165. >
  166. <view class="itemBox">
  167. <image
  168. :src="$method.splitImgHost(item.coverUrl, true)"
  169. style="height: 367rpx; width: 100%; border-radius: 24rpx"
  170. ></image>
  171. <view
  172. style="display: flex; margin-top: 13rpx; align-items: center"
  173. >
  174. <view class="yearTag" v-if="item.year">{{ item.year }}</view>
  175. <view
  176. class="titleTag"
  177. style="display: flex; justify-content: space-between; flex: 1"
  178. >
  179. <view style="flex: 1">{{ item.goodsName }}</view>
  180. <view class="priceTag"
  181. >¥ {{ item.standPrice.toFixed(2) }}</view
  182. >
  183. </view>
  184. </view>
  185. <view
  186. style="
  187. display: flex;
  188. justify-content: space-between;
  189. margin-top: 13rpx;
  190. "
  191. v-if="false"
  192. >
  193. <view class="noteTag"
  194. ><image
  195. src="/static/icon/wk_icon1.png"
  196. class="wk_icon"
  197. ></image>
  198. 共 <text class="blackFont">6</text>
  199. <view class="margin30">张卷</view>
  200. <text class="blackFont">120</text>道题
  201. </view>
  202. <view class="priceTag">¥ {{ item.standPrice.toFixed(2) }}</view>
  203. </view>
  204. </view>
  205. </navigator>
  206. <view class="emptyTip" v-if="list2.length == 0"
  207. >暂未上架相关题库~</view
  208. >
  209. </view>
  210. </view>
  211. <view v-show="current == 2">
  212. <view class="listBox">
  213. <navigator
  214. hover-class="none"
  215. :url="'/pages5/liveDetail/index?id=' + item.goodsId"
  216. v-for="(item, index) in list3"
  217. :key="index"
  218. >
  219. <view class="itemBox">
  220. <image
  221. :src="$method.splitImgHost(item.coverUrl, true)"
  222. style="height: 367rpx; width: 100%; border-radius: 24rpx"
  223. ></image>
  224. <view
  225. style="display: flex; margin-top: 13rpx; align-items: center"
  226. >
  227. <view class="yearTag" v-if="item.year">{{ item.year }}</view>
  228. <view
  229. class="titleTag"
  230. style="display: flex; justify-content: space-between; flex: 1"
  231. >
  232. <view style="flex: 1">{{ item.goodsName }}</view>
  233. <view class="priceTag"
  234. >¥ {{ item.standPrice.toFixed(2) }}</view
  235. >
  236. </view>
  237. </view>
  238. <view
  239. style="
  240. display: flex;
  241. justify-content: space-between;
  242. margin-top: 13rpx;
  243. "
  244. v-if="false"
  245. >
  246. <view class="noteTag">
  247. <image
  248. src="/static/icon/wk_icon1.png"
  249. class="wk_icon"
  250. ></image>
  251. <view class="priceTag"
  252. >¥ {{ item.standPrice.toFixed(2) }}</view
  253. >
  254. </view>
  255. </view>
  256. </view>
  257. </navigator>
  258. <view class="emptyTip" v-if="list3.length == 0"
  259. >暂未上架相关直播~</view
  260. >
  261. </view>
  262. </view>
  263. </view>
  264. <view v-show="show" class="popuBox">
  265. <view class="flex-d">
  266. <view class="contentZ">
  267. <view class="lzs">
  268. <view
  269. class="tylsz"
  270. v-for="(item, index) in eList"
  271. :key="index"
  272. @click="item.id === 0 ? activeAll(1) : active1(item)"
  273. :class="item.id === selObj.eId ? 'activeStys' : ''"
  274. >{{ item.educationName }}</view
  275. >
  276. </view>
  277. <view class="rzs">
  278. <view
  279. class="tylszB"
  280. v-for="(item, index) in bList"
  281. :key="index"
  282. @click="item.id === 0 ? activeAll(2) : active2(item)"
  283. :class="item.id === selObj.bId ? 'activeStys2' : ''"
  284. >{{ item.projectName }}-{{ item.businessName }}</view
  285. >
  286. </view>
  287. </view>
  288. </view>
  289. </view>
  290. </view>
  291. </template>
  292. <script>
  293. import { mapGetters } from "vuex";
  294. export default {
  295. components: {},
  296. data() {
  297. return {
  298. show: false,
  299. list: [
  300. {
  301. name: "网课",
  302. },
  303. {
  304. name: "题库通",
  305. },
  306. {
  307. name: "直播课",
  308. },
  309. ],
  310. array: [
  311. "全部",
  312. "建设工程施工管理",
  313. "机电全科",
  314. "机电工程管理与实",
  315. "机电全科",
  316. "全科",
  317. ],
  318. current: 0,
  319. menuIndex: 0,
  320. menuIndex1: 0,
  321. paramList: [
  322. {
  323. pageNum: 1,
  324. pageSize: 10,
  325. total: 0,
  326. showStatus: 0,
  327. goodsType: 1,
  328. subjectId: 0,
  329. },
  330. {
  331. pageNum: 1,
  332. pageSize: 10,
  333. total: 0,
  334. showStatus: 0,
  335. goodsType: 2,
  336. subjectId: 0,
  337. },
  338. {
  339. pageNum: 1,
  340. pageSize: 10,
  341. total: 0,
  342. showStatus: 0,
  343. goodsType: 6,
  344. subjectId: 0,
  345. },
  346. ],
  347. list1: [],
  348. list2: [],
  349. list3: [],
  350. eList: [],
  351. bList: [],
  352. sList: [],
  353. selObj: {
  354. eName: "",
  355. pName: "",
  356. bName: "",
  357. eId: 0,
  358. bId: 0,
  359. pId: 0,
  360. },
  361. };
  362. },
  363. onPullDownRefresh() {
  364. let that = this;
  365. this.initList();
  366. setTimeout(function () {
  367. uni.stopPullDownRefresh();
  368. }, 500);
  369. },
  370. onLoad(option) {
  371. let eduStr = uni.getStorageSync("eduObj");
  372. console.log(eduStr, 987);
  373. if (eduStr) {
  374. this.selObj = JSON.parse(eduStr);
  375. this.subjectList({
  376. businessId: this.selObj.bId,
  377. projectId: this.selObj.pId,
  378. educationId: this.selObj.eId,
  379. });
  380. this.mergeBusiness();
  381. } else {
  382. this.show = true;
  383. }
  384. this.initList();
  385. },
  386. methods: {
  387. mergeBusiness() {
  388. this.paramList[0].educationTypeId = this.selObj.eId;
  389. this.paramList[0].businessId = this.selObj.bId;
  390. this.paramList[0].subjectId = 0;
  391. this.paramList[1].educationTypeId = this.selObj.eId;
  392. this.paramList[1].businessId = this.selObj.bId;
  393. this.paramList[1].subjectId = 0;
  394. this.paramList[2].educationTypeId = this.selObj.eId;
  395. this.paramList[2].businessId = this.selObj.bId;
  396. this.paramList[2].subjectId = 0;
  397. },
  398. subjectList(data) {
  399. var self = this;
  400. this.$api.subjectList(data).then((res) => {
  401. if (res.data.code == 200) {
  402. self.sList = res.data.rows;
  403. let allItem = { id: 0, subjectName: "全部" };
  404. self.sList.unshift(allItem);
  405. }
  406. });
  407. },
  408. active2(item) {
  409. this.selObj.bId = item.id;
  410. this.show = false;
  411. this.selObj.pId = item.projectId;
  412. this.selObj.bName = item.businessName;
  413. this.selObj.pName = item.projectName;
  414. uni.setStorageSync("eduObj", JSON.stringify(this.selObj));
  415. this.subjectList({
  416. businessId: item.id,
  417. projectId: item.projectId,
  418. educationId: this.selObj.eId,
  419. });
  420. this.mergeBusiness();
  421. //初始化
  422. this.initList();
  423. },
  424. businessList(data) {
  425. var self = this;
  426. this.$api.businessList(data).then((res) => {
  427. if (res.data.code == 200) {
  428. self.bList = res.data.rows;
  429. console.log(self.bList, 66);
  430. }
  431. });
  432. },
  433. active1(item) {
  434. this.selObj.eId = item.id;
  435. this.selObj.eName = item.educationName;
  436. this.businessList({ educationId: item.id });
  437. },
  438. educationList() {
  439. var self = this;
  440. this.$api.educationTypeList().then((res) => {
  441. if (res.data.code == 200) {
  442. self.eList = res.data.rows;
  443. if (self.selObj.eId) {
  444. self.businessList({ educationId: self.selObj.eId });
  445. } else {
  446. this.active1(self.eList[0]);
  447. }
  448. }
  449. });
  450. },
  451. openLeft() {
  452. this.show = true;
  453. },
  454. initList() {
  455. this.paramList[0].pageNum = 1;
  456. this.paramList[1].pageNum = 1;
  457. this.list1 = [];
  458. this.list2 = [];
  459. this.list3 = [];
  460. this.courseList();
  461. this.bankList();
  462. this.liveList();
  463. this.educationList();
  464. },
  465. cMenu(index) {
  466. this.paramList[0].pageNum = 1;
  467. this.paramList[0].subjectId = index;
  468. this.list1 = [];
  469. // this.menuIndex
  470. this.courseList();
  471. },
  472. cMenu1(index) {
  473. this.paramList[1].pageNum = 1;
  474. this.paramList[1].subjectId = index;
  475. this.list2 = [];
  476. // this.menuIndex1 = index;
  477. this.bankList();
  478. },
  479. cMenu2(index) {
  480. this.paramList[2].pageNum = 1;
  481. this.paramList[2].subjectId = index;
  482. this.list3 = [];
  483. // this.menuIndex1 = index;
  484. this.liveList();
  485. },
  486. change(index) {
  487. this.current = index;
  488. },
  489. //课程
  490. courseList() {
  491. var self = this;
  492. var param = this.paramList[0];
  493. this.$api.goodsList(param).then((res) => {
  494. self.paramList[0].total = res.data.total;
  495. self.list1.push.apply(self.list1, res.data.rows);
  496. if (self.list1.length === res.data.total) {
  497. self.paramList[0].showStatus = true;
  498. }
  499. });
  500. },
  501. //题库
  502. bankList() {
  503. var self = this;
  504. var param = this.paramList[1];
  505. this.$api.goodsList(param).then((res) => {
  506. self.paramList[1].total = res.data.total;
  507. self.list2.push.apply(self.list2, res.data.rows);
  508. if (self.list2.length === res.data.total) {
  509. self.paramList[1].showStatus = true;
  510. }
  511. });
  512. },
  513. //直播
  514. liveList() {
  515. var self = this;
  516. var param = this.paramList[2];
  517. this.$api.goodsList(param).then((res) => {
  518. self.paramList[2].total = res.data.total;
  519. self.list3.push.apply(self.list3, res.data.rows);
  520. if (self.list3.length === res.data.total) {
  521. self.paramList[2].showStatus = true;
  522. }
  523. });
  524. },
  525. },
  526. onReachBottom() {
  527. if (this.current == 0) {
  528. if (this.list1.length < this.paramList[0].total) {
  529. this.paramList[0].pageNum++;
  530. this.courseList();
  531. }
  532. }
  533. if (this.current == 1) {
  534. if (this.list2.length < this.paramList[1].total) {
  535. this.paramList[1].pageNum++;
  536. this.bankList();
  537. }
  538. }
  539. if (this.current == 2) {
  540. if (this.list3.length < this.paramList[2].total) {
  541. this.paramList[2].pageNum++;
  542. this.liveList();
  543. }
  544. }
  545. },
  546. computed: { ...mapGetters(["userInfo"]) },
  547. };
  548. </script>
  549. <style >
  550. ::-webkit-scrollbar {
  551. width: 0;
  552. height: 0;
  553. color: transparent;
  554. }
  555. page {
  556. background-color: #eaeef1;
  557. }
  558. </style>
  559. <style scoped lang="scss">
  560. .emptyTip {
  561. color: #999999;
  562. font-size: 32rpx;
  563. text-align: center;
  564. margin-top: 20%;
  565. }
  566. .popuBox {
  567. top: 92px;
  568. width: 100%;
  569. bottom: 0;
  570. position: absolute;
  571. overflow-y: scroll;
  572. overflow-x: hidden;
  573. background-color: #ffffff;
  574. }
  575. .activeStys2 {
  576. background: #007aff !important;
  577. color: #ffffff;
  578. }
  579. .tylszB {
  580. text-align: center;
  581. padding: 20rpx 10rpx;
  582. background: #ffffff;
  583. border: 2rpx solid #eeeeee;
  584. border-radius: 16rpx;
  585. margin-top: 15rpx;
  586. font-size: 30rpx;
  587. overflow: hidden;
  588. white-space: nowrap;
  589. text-overflow: ellipsis;
  590. }
  591. .activeStys {
  592. background: linear-gradient(
  593. 90deg,
  594. rgba(1, 94, 234, 0.2),
  595. rgba(255, 255, 255, 0.6)
  596. );
  597. border-radius: 16rpx;
  598. font-weight: bold;
  599. color: #007aff !important;
  600. }
  601. .tylsz {
  602. color: #666;
  603. font-size: 30rpx;
  604. padding: 20rpx 10rpx;
  605. margin-top: 15rpx;
  606. white-space: nowrap;
  607. }
  608. .popup_t1 {
  609. padding-left: 35rpx;
  610. border-bottom: 1rpx solid #eee;
  611. height: 57rpx;
  612. margin-top: 86rpx;
  613. font-weight: bold;
  614. color: #007aff;
  615. font-size: 27rpx;
  616. }
  617. .flex-d {
  618. height: 100%;
  619. background-color: #ffffff;
  620. padding: 0 5%;
  621. font-size: 30rpx;
  622. }
  623. .contentZ {
  624. display: flex;
  625. height: 100%;
  626. padding: 10rpx;
  627. .lzs {
  628. width: 200rpx;
  629. height: 100%;
  630. overflow-y: scroll;
  631. }
  632. .rzs {
  633. margin-left: 40rpx;
  634. flex: 1;
  635. height: 100%;
  636. overflow-y: scroll;
  637. }
  638. }
  639. .contentZ::-webkit-scrollbar {
  640. display: none;
  641. }
  642. .fots {
  643. height: 100rpx;
  644. display: flex;
  645. align-items: center;
  646. justify-content: space-around;
  647. border-top: 1rpx solid #eee;
  648. }
  649. .leftBtns {
  650. font-size: 30rpx;
  651. color: #007aff;
  652. font-weight: 500;
  653. }
  654. .right_Btns {
  655. font-size: 30rpx;
  656. color: #fff;
  657. background-color: #007aff;
  658. border-radius: 24rpx;
  659. height: 60rpx;
  660. line-height: 60rpx;
  661. text-align: center;
  662. padding: 0rpx 23rpx;
  663. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  664. }
  665. .blackFont {
  666. color: #333333;
  667. margin: 0 10rpx;
  668. }
  669. .margin30 {
  670. margin: 0 20rpx 0 0;
  671. }
  672. .wk_icon {
  673. width: 24rpx;
  674. height: 24rpx;
  675. margin-right: 12rpx;
  676. }
  677. .noteTag {
  678. ont-size: 24rpx;
  679. font-family: PingFang SC;
  680. font-weight: 500;
  681. color: #999999;
  682. align-items: center;
  683. }
  684. .priceTag {
  685. font-size: 30rpx;
  686. font-family: PingFang SC;
  687. font-weight: bold;
  688. color: #ff2d55;
  689. }
  690. .titleTag {
  691. font-size: 32rpx;
  692. font-weight: bold;
  693. color: #333333;
  694. margin-left: 8rpx;
  695. }
  696. .yearTag {
  697. width: 80rpx;
  698. height: 32rpx;
  699. background: #ebf5ff;
  700. border: 2rpx solid #007aff;
  701. border-radius: 16rpx;
  702. font-size: 24rpx;
  703. color: #007aff;
  704. text-align: center;
  705. line-height: 32rpx;
  706. }
  707. .itemBox {
  708. background: #ffffff;
  709. box-shadow: 0rpx 10rpx 9rpx 1rpx rgba(165, 196, 239, 0.1);
  710. border-radius: 24rpx;
  711. width: 100%;
  712. padding: 24rpx;
  713. margin-bottom: 24rpx;
  714. }
  715. .listBox {
  716. background-color: #eaeef1;
  717. padding: 24rpx;
  718. position: relative;
  719. top: 235rpx;
  720. }
  721. .menuSel {
  722. width: 100%;
  723. height: 70rpx;
  724. background: #eaeef1;
  725. white-space: nowrap;
  726. overflow: hidden;
  727. }
  728. .r_sliper {
  729. padding: 0 20rpx;
  730. }
  731. .r_t1 {
  732. height: 48rpx;
  733. background: #007aff;
  734. border-radius: 16rpx;
  735. padding: 3rpx 8rpx;
  736. margin-top: 11rpx;
  737. color: #ffffff;
  738. }
  739. .r_t2 {
  740. height: 48rpx;
  741. background: #ffffff;
  742. border: 2rpx solid #eeeeee;
  743. border-radius: 16rpx;
  744. padding: 3rpx 8rpx;
  745. margin-top: 11rpx;
  746. color: #666666;
  747. font-size: 30rpx;
  748. }
  749. </style>