index.vue 17 KB

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