index.vue 15 KB

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