index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  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 class="check_title">{{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 v-model="current" :list="tabbarlist" :mid-button="true" :mid-button-size="50" class="tab_items"></tab-bar> -->
  136. </view>
  137. </template>
  138. <script>
  139. // import TabBar from '@/components/u-tabbar/u-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. current: 1,
  204. tabbarlist: this.$store.state.tabLists
  205. };
  206. },
  207. onPullDownRefresh(){
  208. let that = this
  209. this.initList();
  210. setTimeout(function(){
  211. uni.stopPullDownRefresh()
  212. },500)
  213. },
  214. onLoad(option) {
  215. let eduStr = uni.getStorageSync('eduObj')
  216. if(eduStr){
  217. this.selObj = JSON.parse(eduStr)
  218. this.subjectList({businessId:this.selObj.bId,projectId:this.selObj.pId,educationId:this.selObj.eId})
  219. this.mergeBusiness()
  220. }else{
  221. this.show = true
  222. }
  223. this.initList();
  224. },
  225. methods: {
  226. mergeBusiness(){
  227. this.paramList[0].educationTypeId = this.selObj.eId
  228. this.paramList[0].businessId = this.selObj.bId
  229. this.paramList[0].subjectId = 0
  230. this.paramList[1].educationTypeId = this.selObj.eId
  231. this.paramList[1].businessId = this.selObj.bId
  232. this.paramList[1].subjectId = 0
  233. this.paramList[2].educationTypeId = this.selObj.eId
  234. this.paramList[2].businessId = this.selObj.bId
  235. this.paramList[2].subjectId = 0
  236. },
  237. subjectList(data) {
  238. var self = this;
  239. this.$api.subjectList(data).then(res => {
  240. if(res.data.code==200){
  241. self.sList = res.data.rows
  242. let allItem = {id:0,subjectName:'全部'}
  243. self.sList.unshift(allItem)
  244. }
  245. });
  246. },
  247. active2(item){
  248. this.selObj.bId = item.id
  249. this.show = false
  250. this.selObj.pId = item.projectId
  251. this.selObj.bName = item.businessName
  252. this.selObj.pName = item.projectName
  253. uni.setStorageSync('eduObj', JSON.stringify(this.selObj));
  254. this.subjectList({businessId:item.id,projectId:item.projectId,educationId:this.selObj.eId})
  255. this.mergeBusiness()
  256. //初始化
  257. this.initList();
  258. },
  259. businessList(data) {
  260. var self = this;
  261. this.$api.businessList(data).then(res => {
  262. if(res.data.code==200){
  263. self.bList = res.data.rows
  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. .check_title {
  414. font-size: 32rpx;
  415. font-weight: 500;
  416. color: #333;
  417. white-space: nowrap;
  418. width: 75%;
  419. overflow-x: hidden;
  420. }
  421. }
  422. .contents {
  423. position: relative;
  424. left: 0;
  425. top: 320rpx;
  426. }
  427. .emptyTip{
  428. color: #999999;
  429. font-size: 32rpx;
  430. text-align: center;
  431. margin-top: 20%;
  432. }
  433. .popuBox{
  434. top: 92px;
  435. width: 100%;
  436. bottom:0;
  437. position:absolute;
  438. overflow-y:scroll;
  439. overflow-x:hidden;
  440. background-color: #FFFFFF;
  441. }
  442. .activeStys2{
  443. background: #007AFF !important;
  444. color: #FFFFFF;
  445. }
  446. .tylszB{
  447. text-align: center;
  448. padding:20rpx 10rpx;
  449. background: #FFFFFF;
  450. border: 2rpx solid #EEEEEE;
  451. border-radius: 16rpx;
  452. margin-top: 15rpx;
  453. font-size: 30rpx;
  454. overflow: hidden;
  455. white-space: nowrap;
  456. text-overflow: ellipsis;
  457. }
  458. .activeStys{
  459. background: linear-gradient(90deg, rgba(1,94,234,0.2),rgba(255,255,255,.6));
  460. border-radius: 16rpx;
  461. font-weight: bold;
  462. color: #007AFF!important;
  463. }
  464. .tylsz{
  465. color: #666;
  466. font-size: 30rpx;
  467. padding:20rpx 10rpx;
  468. margin-top: 15rpx;
  469. white-space: nowrap;
  470. }
  471. .popup_t1 {
  472. padding-left: 35rpx;
  473. border-bottom: 1rpx solid #eee;
  474. height: 57rpx;
  475. margin-top: 86rpx;
  476. font-weight: bold;
  477. color: #007AFF;
  478. font-size: 27rpx;
  479. }
  480. .flex-d {
  481. height:100%;
  482. background-color: #FFFFFF;
  483. padding: 0 5%;
  484. font-size: 30rpx;
  485. }
  486. .contentZ {
  487. display: flex;
  488. height: 100%;
  489. padding: 10rpx;
  490. .lzs {
  491. width:200rpx;
  492. height: 100%;
  493. overflow-y: scroll;
  494. }
  495. .rzs {
  496. margin-left:40rpx;
  497. flex:1;
  498. height: 100%;
  499. overflow-y: scroll;
  500. }
  501. }
  502. .contentZ::-webkit-scrollbar {
  503. display: none;
  504. }
  505. .fots {
  506. height: 100rpx;
  507. display: flex;
  508. align-items: center;
  509. justify-content: space-around;
  510. border-top: 1rpx solid #eee;
  511. }
  512. .leftBtns {
  513. font-size: 30rpx;
  514. color: #007AFF;
  515. font-weight: 500;
  516. }
  517. .right_Btns {
  518. font-size: 30rpx;
  519. color: #fff;
  520. background-color: #007AFF;
  521. border-radius: 24rpx;
  522. height: 60rpx;
  523. line-height: 60rpx;
  524. text-align: center;
  525. padding: 0rpx 23rpx;
  526. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  527. }
  528. .blackFont{
  529. color: #333333;
  530. margin: 0 10rpx;
  531. }
  532. .margin30 {
  533. margin:0 20rpx 0 0;
  534. }
  535. .wk_icon{
  536. width: 24rpx;
  537. height: 24rpx;
  538. margin-right: 12rpx;
  539. }
  540. .noteTag{
  541. font-size: 24rpx;
  542. font-family: PingFang SC;
  543. font-weight: 500;
  544. color: #999999;
  545. align-items: center;
  546. }
  547. .priceTag{
  548. font-size: 32rpx;
  549. font-family: PingFang SC;
  550. font-weight: bold;
  551. color: #FC3F3F;
  552. }
  553. .titleTag{
  554. font-size: 32rpx;
  555. font-weight: bold;
  556. color: #333333;
  557. margin-left: 8rpx;
  558. }
  559. .yearTag{
  560. width: 80rpx;
  561. height: 32rpx;
  562. background: #EBF5FF;
  563. border: 2rpx solid #007AFF;
  564. border-radius: 16rpx;
  565. font-size: 24rpx;
  566. color: #007AFF;
  567. text-align: center;
  568. line-height: 32rpx;
  569. }
  570. .itemBox{
  571. background: #FFFFFF;
  572. border-radius: 24rpx;
  573. width: 100%;
  574. padding: 23rpx 22rpx 32rpx 22rpx;
  575. margin-bottom: 24rpx;
  576. box-shadow: 0rpx 0rpx 20rpx 1rpx rgba(1,99,235,0.1000);
  577. }
  578. .listBox{
  579. background-color: #EAEEF1;
  580. padding: 24rpx 24rpx 150rpx 24rpx;
  581. position: relative;
  582. // top: 235rpx;
  583. }
  584. .menuSel{
  585. width: 100%;
  586. // height: 70rpx;
  587. padding: 30rpx 0rpx;
  588. background: #EAEEF1;
  589. white-space:nowrap;
  590. overflow: hidden;
  591. }
  592. .r_sliper{
  593. padding: 0 20rpx;
  594. }
  595. .r_t1{
  596. // height: 48rpx;
  597. background: #007AFF;
  598. border-radius: 8rpx;
  599. padding: 9rpx 21rpx;
  600. // margin-top: 11rpx;
  601. color: #FFFFFF;
  602. }
  603. .r_t2{
  604. // height: 48rpx;
  605. background: #FFFFFF;
  606. border: 2rpx solid #EEEEEE;
  607. border-radius: 8rpx;
  608. padding: 9rpx 21rpx;
  609. // margin-top: 11rpx;
  610. color:#666666;
  611. font-size: 30rpx;
  612. }
  613. </style>