index.vue 16 KB

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