index.vue 12 KB

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