index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  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 style="width: 160px;margin: 0 auto;"><u-tabs :list="list" item-width="150" font-size="24" bar-width="110" :current="current" @change="change" active-color="#007AFF"></u-tabs></view> -->
  19. </view>
  20. <u-line color="#D6D6DB" />
  21. <view class="menuSel" v-show="current==0">
  22. <scroll-view class="r_sliper" scroll-x="true" >
  23. <view v-for="(item,index) in sList" :key="index" style="margin-right: 20rpx;display:inline-block">
  24. <view :class="paramList[0].subjectId==item.id?'r_t1':'r_t2'" @click="cMenu(item.id)">
  25. {{item.subjectName}}
  26. </view>
  27. </view>
  28. </scroll-view>
  29. </view>
  30. <view class="menuSel" v-show="current==1">
  31. <scroll-view class="r_sliper" scroll-x="true" >
  32. <view v-for="(item,index) in sList" :key="index" style="margin-right: 20rpx;display:inline-block">
  33. <view :class="paramList[1].subjectId==item.id?'r_t1':'r_t2'" @click="cMenu1(item.id)">
  34. {{item.subjectName}}
  35. </view>
  36. </view>
  37. </scroll-view>
  38. </view>
  39. </view>
  40. <view v-show="current==0">
  41. <view class="listBox">
  42. <navigator :url="'/pages2/course/detail?id='+item.goodsId" v-for="(item,index) in list1" :key="index" >
  43. <view class="itemBox">
  44. <image :src="$method.splitImgHost(item.coverUrl, true)" style="height: 316rpx;width: 100%;border-radius: 24rpx;"></image>
  45. <view style="display: flex;margin-top: 13rpx;">
  46. <view class="yearTag">{{item.year}}</view>
  47. <view class="titleTag">{{item.goodsName}}</view>
  48. </view>
  49. <view style="display: flex;justify-content: space-between;margin-top: 13rpx;">
  50. <view class="noteTag"><image src="/static/icon/wk_icon1.png" class="wk_icon"></image>
  51. 共 <text class="blackFont">6</text> 科 <text class="blackFont">120</text> 节 <text class="blackFont">60</text> 学时</view>
  52. <view class="priceTag">¥ {{item.standPrice}}</view>
  53. </view>
  54. </view>
  55. </navigator>
  56. <view class="emptyTip" v-if="list2.length==0">暂未上架相关网课~</view>
  57. </view>
  58. </view>
  59. <view v-show="current==1">
  60. <view class="listBox">
  61. <navigator :url="'/pages2/bank/detail?id='+item.goodsId" v-for="(item,index) in list2" :key="index" >
  62. <view class="itemBox">
  63. <image :src="$method.splitImgHost(item.coverUrl, true)" style="height: 316rpx;width: 100%;border-radius: 24rpx;"></image>
  64. <view style="display: flex;margin-top: 13rpx;">
  65. <view class="yearTag">{{item.year}}</view>
  66. <view class="titleTag">{{item.goodsName}}</view>
  67. </view>
  68. <view style="display: flex;justify-content: space-between;margin-top: 13rpx;">
  69. <view class="noteTag"><image src="/static/icon/wk_icon1.png" class="wk_icon"></image>
  70. 共 <text class="blackFont">6</text> 张卷 <text class="blackFont">120</text>道题 </view>
  71. <view class="priceTag">¥ {{item.standPrice}}</view>
  72. </view>
  73. </view>
  74. </navigator>
  75. <view class="emptyTip" v-if="list2.length==0">暂未上架相关题库~</view>
  76. </view>
  77. </view>
  78. </view>
  79. <view v-show="show" class="popuBox">
  80. <view class="flex-d" >
  81. <view class="contentZ">
  82. <view class="lzs" >
  83. <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>
  84. </view>
  85. <view class="lzs" >
  86. <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>
  87. </view>
  88. </view>
  89. <!-- <view class="fots">
  90. <view class="leftBtns" @click="initLists">重置筛选</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>
  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. height: 66rpx;
  326. line-height: 66rpx;
  327. background: #FFFFFF;
  328. border: 2rpx solid #EEEEEE;
  329. border-radius: 16rpx;
  330. padding: 0 10rpx;
  331. margin-top: 15rpx;
  332. white-space: nowrap;
  333. }
  334. .activeStys{
  335. background: linear-gradient(90deg, rgba(1,94,234,0.2),rgba(255,255,255,.6));
  336. border-radius: 16rpx;
  337. color: #007AFF!important;
  338. }
  339. .tylsz{
  340. height: 66rpx;
  341. line-height: 66rpx;
  342. color: #666;
  343. font-weight: 400;
  344. font-weight: bold;
  345. padding:0 30rpx;
  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. background-color: #FFFFFF;
  360. padding: 0 5%;
  361. font-size: 30rpx;
  362. }
  363. .contentZ {
  364. overflow-y: auto;
  365. display: flex;
  366. height: 100%;
  367. padding: 10rpx;
  368. }
  369. .contentZ::-webkit-scrollbar {
  370. display: none;
  371. }
  372. .fots {
  373. height: 100rpx;
  374. display: flex;
  375. align-items: center;
  376. justify-content: space-around;
  377. border-top: 1rpx solid #eee;
  378. }
  379. .leftBtns {
  380. font-size: 30rpx;
  381. color: #007AFF;
  382. font-weight: 500;
  383. }
  384. .right_Btns {
  385. font-size: 30rpx;
  386. color: #fff;
  387. background-color: #007AFF;
  388. border-radius: 24rpx;
  389. height: 60rpx;
  390. line-height: 60rpx;
  391. text-align: center;
  392. padding: 0rpx 23rpx;
  393. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  394. }
  395. .blackFont{
  396. color: #333333;
  397. margin: 0 4rpx;
  398. }
  399. .wk_icon{
  400. width: 24rpx;
  401. height: 24rpx;
  402. margin-right: 12rpx;
  403. }
  404. .noteTag{
  405. ont-size: 24rpx;
  406. font-family: PingFang SC;
  407. font-weight: 500;
  408. color: #999999;
  409. align-items: center;
  410. }
  411. .priceTag{
  412. font-size: 30rpx;
  413. font-family: PingFang SC;
  414. font-weight: bold;
  415. color: #FF2D55;
  416. }
  417. .titleTag{
  418. font-size: 32rpx;
  419. font-weight: bold;
  420. color: #333333;
  421. margin-left: 8rpx;
  422. }
  423. .yearTag{
  424. width: 80rpx;
  425. height: 32rpx;
  426. background: #EBF5FF;
  427. border: 2rpx solid #007AFF;
  428. border-radius: 16rpx;
  429. font-size: 24rpx;
  430. color: #007AFF;
  431. text-align: center;
  432. line-height: 32rpx;
  433. }
  434. .itemBox{
  435. background: #FFFFFF;
  436. box-shadow: 0rpx 10rpx 9rpx 1rpx rgba(165, 196, 239, 0.1);
  437. border-radius: 24rpx;
  438. width: 100%;
  439. padding: 20rpx;
  440. margin-bottom: 20rpx;
  441. }
  442. .listBox{
  443. background-color: #EAEEF1;
  444. padding: 30rpx;
  445. position: relative;
  446. top: 235rpx;
  447. }
  448. .menuSel{
  449. width: 100%;
  450. height: 70rpx;
  451. background: #EAEEF1;
  452. white-space:nowrap;
  453. overflow: hidden;
  454. }
  455. .r_sliper{
  456. padding: 0 20rpx;
  457. }
  458. .r_t1{
  459. height: 48rpx;
  460. background: #007AFF;
  461. border-radius: 16rpx;
  462. padding: 3rpx 8rpx;
  463. margin-top: 11rpx;
  464. color: #FFFFFF;
  465. }
  466. .r_t2{
  467. height: 48rpx;
  468. background: #FFFFFF;
  469. border: 2rpx solid #EEEEEE;
  470. border-radius: 16rpx;
  471. padding: 3rpx 8rpx;
  472. margin-top: 11rpx;
  473. color: #666666;
  474. }
  475. </style>