index.vue 17 KB

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