index.vue 12 KB

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