index.vue 13 KB

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