index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750
  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. },
  540. computed: { ...mapGetters(["userInfo"]) },
  541. };
  542. </script>
  543. <style >
  544. ::-webkit-scrollbar {
  545. width: 0;
  546. height: 0;
  547. color: transparent;
  548. }
  549. page {
  550. background-color: #eaeef1;
  551. }
  552. </style>
  553. <style scoped lang="scss">
  554. .emptyTip {
  555. color: #999999;
  556. font-size: 32rpx;
  557. text-align: center;
  558. margin-top: 20%;
  559. }
  560. .popuBox {
  561. top: 92px;
  562. width: 100%;
  563. bottom: 0;
  564. position: absolute;
  565. overflow-y: scroll;
  566. overflow-x: hidden;
  567. background-color: #ffffff;
  568. }
  569. .activeStys2 {
  570. background: #007aff !important;
  571. color: #ffffff;
  572. }
  573. .tylszB {
  574. text-align: center;
  575. padding: 20rpx 10rpx;
  576. background: #ffffff;
  577. border: 2rpx solid #eeeeee;
  578. border-radius: 16rpx;
  579. margin-top: 15rpx;
  580. font-size: 30rpx;
  581. overflow: hidden;
  582. white-space: nowrap;
  583. text-overflow: ellipsis;
  584. }
  585. .activeStys {
  586. background: linear-gradient(
  587. 90deg,
  588. rgba(1, 94, 234, 0.2),
  589. rgba(255, 255, 255, 0.6)
  590. );
  591. border-radius: 16rpx;
  592. font-weight: bold;
  593. color: #007aff !important;
  594. }
  595. .tylsz {
  596. color: #666;
  597. font-size: 30rpx;
  598. padding: 20rpx 10rpx;
  599. margin-top: 15rpx;
  600. white-space: nowrap;
  601. }
  602. .popup_t1 {
  603. padding-left: 35rpx;
  604. border-bottom: 1rpx solid #eee;
  605. height: 57rpx;
  606. margin-top: 86rpx;
  607. font-weight: bold;
  608. color: #007aff;
  609. font-size: 27rpx;
  610. }
  611. .flex-d {
  612. height: 100%;
  613. background-color: #ffffff;
  614. padding: 0 5%;
  615. font-size: 30rpx;
  616. }
  617. .contentZ {
  618. display: flex;
  619. height: 100%;
  620. padding: 10rpx;
  621. .lzs {
  622. width: 200rpx;
  623. height: 100%;
  624. overflow-y: scroll;
  625. }
  626. .rzs {
  627. margin-left: 40rpx;
  628. flex: 1;
  629. height: 100%;
  630. overflow-y: scroll;
  631. }
  632. }
  633. .contentZ::-webkit-scrollbar {
  634. display: none;
  635. }
  636. .fots {
  637. height: 100rpx;
  638. display: flex;
  639. align-items: center;
  640. justify-content: space-around;
  641. border-top: 1rpx solid #eee;
  642. }
  643. .leftBtns {
  644. font-size: 30rpx;
  645. color: #007aff;
  646. font-weight: 500;
  647. }
  648. .right_Btns {
  649. font-size: 30rpx;
  650. color: #fff;
  651. background-color: #007aff;
  652. border-radius: 24rpx;
  653. height: 60rpx;
  654. line-height: 60rpx;
  655. text-align: center;
  656. padding: 0rpx 23rpx;
  657. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  658. }
  659. .blackFont {
  660. color: #333333;
  661. margin: 0 10rpx;
  662. }
  663. .margin30 {
  664. margin: 0 20rpx 0 0;
  665. }
  666. .wk_icon {
  667. width: 24rpx;
  668. height: 24rpx;
  669. margin-right: 12rpx;
  670. }
  671. .noteTag {
  672. ont-size: 24rpx;
  673. font-family: PingFang SC;
  674. font-weight: 500;
  675. color: #999999;
  676. align-items: center;
  677. }
  678. .priceTag {
  679. font-size: 30rpx;
  680. font-family: PingFang SC;
  681. font-weight: bold;
  682. color: #ff2d55;
  683. }
  684. .titleTag {
  685. font-size: 32rpx;
  686. font-weight: bold;
  687. color: #333333;
  688. margin-left: 8rpx;
  689. }
  690. .yearTag {
  691. width: 80rpx;
  692. height: 32rpx;
  693. background: #ebf5ff;
  694. border: 2rpx solid #007aff;
  695. border-radius: 16rpx;
  696. font-size: 24rpx;
  697. color: #007aff;
  698. text-align: center;
  699. line-height: 32rpx;
  700. }
  701. .itemBox {
  702. background: #ffffff;
  703. box-shadow: 0rpx 10rpx 9rpx 1rpx rgba(165, 196, 239, 0.1);
  704. border-radius: 24rpx;
  705. width: 100%;
  706. padding: 24rpx;
  707. margin-bottom: 24rpx;
  708. }
  709. .listBox {
  710. background-color: #eaeef1;
  711. padding: 24rpx;
  712. position: relative;
  713. top: 235rpx;
  714. }
  715. .menuSel {
  716. width: 100%;
  717. height: 70rpx;
  718. background: #eaeef1;
  719. white-space: nowrap;
  720. overflow: hidden;
  721. }
  722. .r_sliper {
  723. padding: 0 20rpx;
  724. }
  725. .r_t1 {
  726. height: 48rpx;
  727. background: #007aff;
  728. border-radius: 16rpx;
  729. padding: 3rpx 8rpx;
  730. margin-top: 11rpx;
  731. color: #ffffff;
  732. }
  733. .r_t2 {
  734. height: 48rpx;
  735. background: #ffffff;
  736. border: 2rpx solid #eeeeee;
  737. border-radius: 16rpx;
  738. padding: 3rpx 8rpx;
  739. margin-top: 11rpx;
  740. color: #666666;
  741. font-size: 30rpx;
  742. }
  743. </style>