index.vue 12 KB

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