index.vue 12 KB

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