index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  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;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.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;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>{{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. }
  224. }
  225. });
  226. },
  227. openLeft(){
  228. this.show = true
  229. },
  230. initList() {
  231. this.paramList[0].pageNum = 1
  232. this.paramList[1].pageNum = 1
  233. this.list1 = []
  234. this.list2 = []
  235. this.courseList();
  236. this.bankList();
  237. this.educationList()
  238. },
  239. cMenu(index){
  240. this.paramList[0].pageNum = 1
  241. this.paramList[0].subjectId= index;
  242. this.list1 = []
  243. // this.menuIndex
  244. this.courseList();
  245. },
  246. cMenu1(index){
  247. this.paramList[1].pageNum = 1
  248. this.paramList[1].subjectId= index;
  249. this.list2 = []
  250. // this.menuIndex1 = index;
  251. this.bankList();
  252. },
  253. change(index){
  254. this.current = index;
  255. },
  256. //课程
  257. courseList() {
  258. var self = this;
  259. var param = this.paramList[0];
  260. this.$api.goodsList(param).then(res => {
  261. self.paramList[0].total = res.data.total;
  262. self.list1.push.apply(self.list1, res.data.rows);
  263. if (self.list1.length === res.data.total) {
  264. self.paramList[0].showStatus = true;
  265. }
  266. });
  267. },
  268. //题库
  269. bankList() {
  270. var self = this;
  271. var param = this.paramList[1];
  272. this.$api.goodsList(param).then(res => {
  273. self.paramList[1].total = res.data.total;
  274. self.list2.push.apply(self.list2, res.data.rows);
  275. if (self.list2.length === res.data.total) {
  276. self.paramList[1].showStatus = true;
  277. }
  278. });
  279. },
  280. },
  281. onReachBottom() {
  282. if (this.current == 0) {
  283. if (this.list1.length < this.paramList[0].total) {
  284. this.paramList[0].pageNum++;
  285. this.courseList();
  286. }
  287. }
  288. if (this.current == 1) {
  289. if (this.list2.length < this.paramList[1].total) {
  290. this.paramList[1].pageNum++;
  291. this.bankList();
  292. }
  293. }
  294. },
  295. computed: { ...mapGetters(['userInfo']) }
  296. };
  297. </script>
  298. <style >
  299. ::-webkit-scrollbar{
  300. width: 0;
  301. height: 0;
  302. color: transparent
  303. }
  304. page{
  305. background-color: #EAEEF1;
  306. }
  307. </style>
  308. <style scoped lang="scss">
  309. .emptyTip{
  310. color: #999999;
  311. font-size: 32rpx;
  312. text-align: center;
  313. margin-top: 20%;
  314. }
  315. .popuBox{
  316. top: 92px;
  317. width: 100%;
  318. bottom:0;
  319. position:absolute;
  320. overflow-y:scroll;
  321. overflow-x:hidden;
  322. background-color: #FFFFFF;
  323. }
  324. .activeStys2{
  325. background: #007AFF !important;
  326. color: #FFFFFF;
  327. }
  328. .tylszB{
  329. text-align: center;
  330. padding:20rpx 10rpx;
  331. background: #FFFFFF;
  332. border: 2rpx solid #EEEEEE;
  333. border-radius: 16rpx;
  334. margin-top: 15rpx;
  335. font-size: 30rpx;
  336. overflow: hidden;
  337. white-space: nowrap;
  338. text-overflow: ellipsis;
  339. }
  340. .activeStys{
  341. background: linear-gradient(90deg, rgba(1,94,234,0.2),rgba(255,255,255,.6));
  342. border-radius: 16rpx;
  343. font-weight: bold;
  344. color: #007AFF!important;
  345. }
  346. .tylsz{
  347. color: #666;
  348. font-size: 30rpx;
  349. padding:20rpx 10rpx;
  350. margin-top: 15rpx;
  351. white-space: nowrap;
  352. }
  353. .popup_t1 {
  354. padding-left: 35rpx;
  355. border-bottom: 1rpx solid #eee;
  356. height: 57rpx;
  357. margin-top: 86rpx;
  358. font-weight: bold;
  359. color: #007AFF;
  360. font-size: 27rpx;
  361. }
  362. .flex-d {
  363. height:100%;
  364. background-color: #FFFFFF;
  365. padding: 0 5%;
  366. font-size: 30rpx;
  367. }
  368. .contentZ {
  369. display: flex;
  370. height: 100%;
  371. padding: 10rpx;
  372. .lzs {
  373. width:200rpx;
  374. height: 100%;
  375. overflow-y: scroll;
  376. }
  377. .rzs {
  378. margin-left:40rpx;
  379. flex:1;
  380. height: 100%;
  381. overflow-y: scroll;
  382. }
  383. }
  384. .contentZ::-webkit-scrollbar {
  385. display: none;
  386. }
  387. .fots {
  388. height: 100rpx;
  389. display: flex;
  390. align-items: center;
  391. justify-content: space-around;
  392. border-top: 1rpx solid #eee;
  393. }
  394. .leftBtns {
  395. font-size: 30rpx;
  396. color: #007AFF;
  397. font-weight: 500;
  398. }
  399. .right_Btns {
  400. font-size: 30rpx;
  401. color: #fff;
  402. background-color: #007AFF;
  403. border-radius: 24rpx;
  404. height: 60rpx;
  405. line-height: 60rpx;
  406. text-align: center;
  407. padding: 0rpx 23rpx;
  408. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  409. }
  410. .blackFont{
  411. color: #333333;
  412. margin: 0 10rpx;
  413. }
  414. .margin30 {
  415. margin:0 20rpx 0 0;
  416. }
  417. .wk_icon{
  418. width: 24rpx;
  419. height: 24rpx;
  420. margin-right: 12rpx;
  421. }
  422. .noteTag{
  423. ont-size: 24rpx;
  424. font-family: PingFang SC;
  425. font-weight: 500;
  426. color: #999999;
  427. align-items: center;
  428. }
  429. .priceTag{
  430. font-size: 30rpx;
  431. font-family: PingFang SC;
  432. font-weight: bold;
  433. color: #FF2D55;
  434. }
  435. .titleTag{
  436. font-size: 32rpx;
  437. font-weight: bold;
  438. color: #333333;
  439. margin-left: 8rpx;
  440. }
  441. .yearTag{
  442. width: 80rpx;
  443. height: 32rpx;
  444. background: #EBF5FF;
  445. border: 2rpx solid #007AFF;
  446. border-radius: 16rpx;
  447. font-size: 24rpx;
  448. color: #007AFF;
  449. text-align: center;
  450. line-height: 32rpx;
  451. }
  452. .itemBox{
  453. background: #FFFFFF;
  454. box-shadow: 0rpx 10rpx 9rpx 1rpx rgba(165, 196, 239, 0.1);
  455. border-radius: 24rpx;
  456. width: 100%;
  457. padding: 24rpx;
  458. margin-bottom: 24rpx;
  459. }
  460. .listBox{
  461. background-color: #EAEEF1;
  462. padding: 24rpx;
  463. position: relative;
  464. top: 235rpx;
  465. }
  466. .menuSel{
  467. width: 100%;
  468. height: 70rpx;
  469. background: #EAEEF1;
  470. white-space:nowrap;
  471. overflow: hidden;
  472. }
  473. .r_sliper{
  474. padding: 0 20rpx;
  475. }
  476. .r_t1{
  477. height: 48rpx;
  478. background: #007AFF;
  479. border-radius: 16rpx;
  480. padding: 3rpx 8rpx;
  481. margin-top: 11rpx;
  482. color: #FFFFFF;
  483. }
  484. .r_t2{
  485. height: 48rpx;
  486. background: #FFFFFF;
  487. border: 2rpx solid #EEEEEE;
  488. border-radius: 16rpx;
  489. padding: 3rpx 8rpx;
  490. margin-top: 11rpx;
  491. color:#666666;
  492. }
  493. </style>