all.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  1. <template>
  2. <div class="bookCity">
  3. <Header
  4. :headerBg="'#1F1F1F'"
  5. :headerBorder="'#5C5C5C'"
  6. :userBg="'rgba(0, 0, 0, 0.24)'"
  7. :LoginNavIndex="0"
  8. />
  9. <div class="banner">
  10. <el-carousel height="320px" trigger="click" arrow="never">
  11. <el-carousel-item v-for="item in 2" :key="item">
  12. <!-- 如果有跳转链接 则跳转 否则只展示 -->
  13. <!-- <a v-if="item" href="#" target="_blank">
  14. <el-image
  15. class="image"
  16. :src="require('../../assets/banner'+item+'.png')"
  17. :fit="'cover'">
  18. </el-image>
  19. </a> -->
  20. <el-image
  21. class="image"
  22. :src="require('../../assets/banner'+(2+item)+'.png')"
  23. :fit="'cover'">
  24. </el-image>
  25. </el-carousel-item>
  26. </el-carousel>
  27. </div>
  28. <div class="filt-box">
  29. <div class="filt-inner">
  30. <el-breadcrumb separator="/">
  31. <el-breadcrumb-item :to="{ path: '/' }">商城</el-breadcrumb-item>
  32. <el-breadcrumb-item>全部{{nameTypeCn}}</el-breadcrumb-item>
  33. </el-breadcrumb>
  34. <h2>筛选:</h2>
  35. <template v-if="itemType==='kecheng'">
  36. <div class="filt-item">
  37. <label>学段</label>
  38. <ul>
  39. <li :class="[items.study_phase===courseForm.studyValue?'active':'',courseForm.categoryValue==='ZB'?'not-allow':'']" v-for="(items,indexs) in studyList" :key="indexs" @click="handleClick('courseForm','studyValue',items.study_phase)">
  40. <i v-if="items.study_phase===courseForm.studyValue" class="el-icon-success"></i>
  41. {{items.study_phase_name}}
  42. </li>
  43. </ul>
  44. </div>
  45. <div class="filt-item">
  46. <label>类别</label>
  47. <ul>
  48. <li :class="[itemt.value===courseForm.categoryValue?'active':'']" v-for="(itemt,indext) in categoryList" :key="indext" @click="handleClick('courseForm','categoryValue',itemt.value)">
  49. <i v-if="itemt.value===courseForm.categoryValue" class="el-icon-success"></i>
  50. {{itemt.label}}
  51. </li>
  52. </ul>
  53. </div>
  54. </template>
  55. <template v-else-if="itemType==='baozhi'">
  56. <div class="filt-item">
  57. <label>年份</label>
  58. <ul>
  59. <li :class="[itemy.value===baozhiForm.yearValue?'active':'']" v-for="(itemy,indexy) in yearList" :key="indexy" @click="handleClick('baozhiForm','yearValue',itemy.value)">
  60. <i v-if="itemy.value===baozhiForm.yearValue" class="el-icon-success"></i>
  61. {{itemy.label}}
  62. </li>
  63. </ul>
  64. </div>
  65. <div class="filt-item">
  66. <label>学段</label>
  67. <ul>
  68. <li :class="[items.study_phase===baozhiForm.studyValue?'active':'']" v-for="(items,indexs) in baozhiStudyList" :key="indexs" @click="handleClick('baozhiForm','studyValue',items.study_phase,items.study_phase_name)">
  69. <i v-if="items.study_phase===baozhiForm.studyValue" class="el-icon-success"></i>
  70. {{items.study_phase_name}}
  71. </li>
  72. </ul>
  73. </div>
  74. <div class="filt-item">
  75. <label>类型</label>
  76. <ul>
  77. <li :class="[itemt.value===baozhiForm.typeValue?'active':'']" v-for="(itemt,indext) in typeList" :key="indext" @click="handleClick('baozhiForm','typeValue',itemt.value)">
  78. <i v-if="itemt.value===baozhiForm.typeValue" class="el-icon-success"></i>
  79. {{itemt.label}}
  80. </li>
  81. </ul>
  82. </div>
  83. </template>
  84. <div class="filt-item">
  85. <label>搜索</label>
  86. <el-input placeholder="搜索" v-model="searchValue">
  87. <el-button slot="append" icon="el-icon-search" @click="handleData"></el-button>
  88. </el-input>
  89. </div>
  90. </div>
  91. </div>
  92. <div class="main">
  93. <BookListModule
  94. :Bookinfo="Bookinfo"
  95. :showAll="false"
  96. @changeStudy="changeStudy"
  97. :headerBg="'#1F1F1F'"
  98. :headerBorder="'#5C5C5C'"
  99. :userBg="'rgba(0, 0, 0, 0.24)'"
  100. :LoginNavIndex="0"
  101. />
  102. <el-pagination
  103. background
  104. :current-page="currentPage"
  105. :page-size="page_capacity"
  106. :page-sizes="[10, 20, 30, 40, 50]"
  107. :total="Bookinfo.number"
  108. layout="total, prev, pager, next, sizes, jumper"
  109. @size-change="(val)=>handleSizeChange(val,'page_capacity','currentPage')"
  110. @current-change="(val)=>handleCurrentChange(val,'currentPage')"
  111. v-if="Bookinfo.number>0&&Bookinfo.bookType!=='ZB'"
  112. />
  113. <el-pagination
  114. background
  115. :current-page="currentPages"
  116. :page-size="page_capacitys"
  117. :page-sizes="[8, 16, 24, 32, 40]"
  118. :total="Bookinfo.number"
  119. layout="total, prev, pager, next, sizes, jumper"
  120. @size-change="(val)=>handleSizeChange(val,'page_capacitys','currentPages')"
  121. @current-change="(val)=>handleCurrentChange(val,'currentPages')"
  122. v-else-if="Bookinfo.number>0&&Bookinfo.bookType==='ZB'"
  123. />
  124. </div>
  125. </div>
  126. </template>
  127. <script>
  128. //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  129. //例如:import 《组件名称》from ‘《组件路径》';
  130. import Header from "../../components/Header.vue";
  131. import BookListModule from "@/components/common/BookAllListModule.vue"
  132. import { getLogin } from "@/api/ajax";
  133. export default {
  134. //import引入的组件需要注入到对象中才能使用
  135. components: { Header, BookListModule },
  136. props: {},
  137. data() {
  138. //这里存放数据
  139. return {
  140. Bookinfo:{
  141. BookList: [
  142. {
  143. skeleton: true
  144. },
  145. {
  146. skeleton: true
  147. },
  148. {
  149. skeleton: true
  150. },
  151. {
  152. skeleton: true
  153. },
  154. {
  155. skeleton: true
  156. },
  157. {
  158. skeleton: true
  159. },
  160. {
  161. skeleton: true
  162. },
  163. {
  164. skeleton: true
  165. },
  166. {
  167. skeleton: true
  168. },
  169. {
  170. skeleton: true
  171. }
  172. ],
  173. name: '',
  174. number: 0,
  175. numberstr: '',
  176. bookType: null
  177. },
  178. nameTypeCn: this.$route.query.name?decodeURIComponent(this.$route.query.name):'画刊',
  179. itemType:this.$route.query.type?this.$route.query.type:'huakan',
  180. yearList:[
  181. {
  182. value: -1,
  183. label: '全部'
  184. }
  185. ],
  186. studyList:[
  187. {
  188. study_phase: -1,
  189. study_phase_name: '全部'
  190. }
  191. ],
  192. baozhiStudyList:[],
  193. categoryList:[
  194. {
  195. value: 'LB',
  196. label: '录播'
  197. },
  198. {
  199. value: 'ZB',
  200. label: '直播'
  201. },
  202. ],
  203. typeList:[
  204. {
  205. value: 0,
  206. label: '单本'
  207. },
  208. {
  209. value: 1,
  210. label: '专辑'
  211. },
  212. ],
  213. courseForm:{
  214. studyValue: window.localStorage.getItem("courseFormstudyValue")?window.localStorage.getItem("courseFormstudyValue")*1:-1,
  215. categoryValue: this.$route.query.type&&this.$route.query.type==='kecheng'?window.localStorage.getItem("courseFormcategoryValue")?window.localStorage.getItem("courseFormcategoryValue"):'LB':'LB'
  216. },
  217. baozhiForm:{
  218. yearValue: window.localStorage.getItem("baozhiFormyearValue")?window.localStorage.getItem("baozhiFormyearValue")*1:-1,
  219. studyValue: window.localStorage.getItem("baozhiFormstudyValue")?window.localStorage.getItem("baozhiFormstudyValue")*1:-1,
  220. typeValue: window.localStorage.getItem("baozhiFormtypeValue")?window.localStorage.getItem("baozhiFormtypeValue")*1:0,
  221. },
  222. currentPage: 1, // 当前页码
  223. page_capacity: 10, // 每页条数
  224. currentPages: 1,
  225. page_capacitys: 8, // 每页条数
  226. searchValue: '',
  227. titleName:window.localStorage.getItem("baozhiFormstudyValueName")?window.localStorage.getItem("baozhiFormstudyValueName"):''
  228. }
  229. },
  230. //计算属性 类似于data概念
  231. computed: {},
  232. //监控data中数据变化
  233. watch: {},
  234. //方法集合
  235. methods: {
  236. handleClick(form,file,value,name){
  237. window.localStorage.setItem(form+file,value)
  238. if(form==='courseForm'&&file==='categoryValue'&&value==='ZB'){
  239. this.courseForm.studyValue = -1
  240. }else if(form==='courseForm'&&file==='categoryValue'&&value==='LB'){
  241. this.courseForm.studyValue = window.localStorage.getItem("courseFormstudyValue")?window.localStorage.getItem("courseFormstudyValue")*1:-1
  242. }
  243. if(form==='courseForm'&&file==='studyValue'&&this.courseForm.categoryValue==='ZB'){
  244. return false
  245. }
  246. if(name){
  247. this.titleName = name
  248. window.localStorage.setItem('baozhiFormstudyValueName',name)
  249. }
  250. this[form][file] = value
  251. this.currentPage = 1;
  252. this.currentPages = 1
  253. this.handleData()
  254. },
  255. handleData(){
  256. let MethodName = "/ShopServer/Client/ShopHomeQuery/PageQueryCourseList"
  257. let data = {
  258. page_capacity: this.courseForm.categoryValue==='ZB'?this.page_capacitys:this.page_capacity,
  259. cur_page: this.courseForm.categoryValue==='ZB'?this.currentPages:this.currentPage,
  260. search_content: this.searchValue.trim(),
  261. }
  262. if(this.itemType==='kecheng'){
  263. data.course_type = this.courseForm.categoryValue,
  264. data.study_phase = this.courseForm.studyValue
  265. getLogin(MethodName, data)
  266. .then((res) => {
  267. if(res.status===1){
  268. this.Bookinfo = {
  269. name: this.courseForm.categoryValue==='LB'?'课程':'直播',
  270. number: res.total_count,
  271. numberstr: '共' + res.total_count + '期',
  272. study: this.courseForm.studyValue,
  273. BookList: res.course_list,
  274. bookType: this.courseForm.categoryValue
  275. }
  276. }
  277. })
  278. .catch(() => {
  279. });
  280. }else if(this.itemType==='baozhi'){
  281. MethodName = "/ShopServer/Client/ShopHomeQuery/PageQueryIssueList"
  282. data.year_label = this.baozhiForm.yearValue
  283. data.study_phase = this.baozhiForm.studyValue
  284. data.comb_flag = this.baozhiForm.typeValue
  285. getLogin(MethodName, data)
  286. .then((res) => {
  287. if(res.status===1){
  288. this.Bookinfo = {
  289. name: this.titleName,
  290. number: res.total_count,
  291. numberstr: '共' + res.total_count + '期',
  292. study: this.baozhiForm.studyValue,
  293. BookList: res.issue_list,
  294. bookType: 'baozhi'
  295. }
  296. }
  297. })
  298. .catch(() => {
  299. });
  300. }
  301. },
  302. handleSizeChange(val,type,page) {
  303. this[type] = val
  304. this[page] = 1;
  305. this.handleData()
  306. },
  307. handleCurrentChange(val,type) {
  308. this[type] = val
  309. this.handleData()
  310. },
  311. changeStudy(form,value){
  312. this.currentPage = 1;
  313. this.currentPages = 1
  314. this[form].studyValue = value
  315. this.handleData()
  316. },
  317. // 学段列表
  318. getStudyList(){
  319. let MethodName = "/OrgServer/DictManager/GetStudyPhaseList"
  320. getLogin(MethodName, {})
  321. .then((res) => {
  322. if(res.status===1){
  323. let studyList = [
  324. {
  325. study_phase: -1,
  326. study_phase_name: '全部'
  327. }
  328. ]
  329. this.studyList = studyList.concat(res.study_phase_list)
  330. this.baozhiStudyList = res.study_phase_list
  331. this.baozhiForm.studyValue = window.localStorage.getItem("baozhiFormstudyValue")?window.localStorage.getItem("baozhiFormstudyValue")*1:res.study_phase_list[0]?res.study_phase_list[0].study_phase:-1
  332. this.titleName = window.localStorage.getItem("baozhiFormstudyValueName")?window.localStorage.getItem("baozhiFormstudyValueName"):res.study_phase_list[0]?res.study_phase_list[0].study_phase_name:''
  333. }
  334. })
  335. .catch(() => {
  336. });
  337. },
  338. // 获取年份列表
  339. getYearList(){
  340. this.yearList = [
  341. {
  342. value: -1,
  343. label: '全部'
  344. }
  345. ]
  346. let yearList = []
  347. let MethodName = "/ShopServer/Client/ShopHomeQuery/GetIssueYearLabelList"
  348. getLogin(MethodName, {})
  349. .then((res) => {
  350. if(res.status===1){
  351. res.year_label_list.forEach(nowYear => {
  352. let obj = {
  353. value: nowYear,
  354. label: nowYear
  355. }
  356. yearList.push(obj)
  357. })
  358. this.yearList = this.yearList.concat(yearList)
  359. }
  360. })
  361. .catch(() => {
  362. this.loading = false
  363. });
  364. }
  365. },
  366. //生命周期 - 创建完成(可以访问当前this实例)
  367. created() {
  368. this.getStudyList()
  369. this.getYearList()
  370. this.handleData()
  371. },
  372. //生命周期 - 挂载完成(可以访问DOM元素)
  373. mounted() {
  374. },
  375. //生命周期-创建之前
  376. beforeCreated() { },
  377. //生命周期-挂载之前
  378. beforeMount() { },
  379. //生命周期-更新之前
  380. beforUpdate() { },
  381. //生命周期-更新之后
  382. updated() { },
  383. //生命周期-销毁之前
  384. beforeDestory() { },
  385. //生命周期-销毁完成
  386. destoryed() { },
  387. //如果页面有keep-alive缓存功能,这个函数会触发
  388. activated() { }
  389. }
  390. </script>
  391. <style lang="scss" scoped>
  392. /* @import url(); 引入css类 */
  393. .bookCity {
  394. min-height: 100%;
  395. padding-bottom: 50px;
  396. .banner{
  397. width: 100%;
  398. font-size: 0;
  399. img{
  400. max-width: 100%;
  401. }
  402. .image{
  403. width: 100%;
  404. height: 100%;
  405. }
  406. }
  407. .filt-box{
  408. border-bottom: 1px solid #E5E6EB;
  409. background: #FFFFFF;
  410. .filt-inner{
  411. width: 1200px;
  412. margin: 0 auto;
  413. padding: 40px 0;
  414. h2{
  415. font-weight: 600;
  416. font-size: 16px;
  417. line-height: 24px;
  418. color: #2F3742;
  419. padding: 28px 0;
  420. margin: 0;
  421. }
  422. .filt-item{
  423. display: flex;
  424. margin-bottom: 8px;
  425. label{
  426. width: 52px;
  427. font-weight: 400;
  428. font-size: 16px;
  429. line-height: 32px;
  430. color: #2F3742;
  431. }
  432. ul{
  433. list-style: none;
  434. display: flex;
  435. flex-flow: wrap;
  436. padding: 0;
  437. margin: 0;
  438. li{
  439. margin: 0 8px 16px 0;
  440. background: #F2F3F5;
  441. border-radius: 2px;
  442. padding: 3px 11px;
  443. font-weight: 500;
  444. font-size: 16px;
  445. line-height: 24px;
  446. color: #2F3742;
  447. cursor: pointer;
  448. border: 1px solid #F2F3F5;
  449. height: 32px;
  450. box-sizing: border-box;
  451. display: flex;
  452. align-items: center;
  453. &:hover{
  454. color: #165DFF;
  455. }
  456. &.not-allow{
  457. cursor: not-allowed;
  458. background: #F2F3F5;
  459. color: #C1C5CD;
  460. }
  461. &.active{
  462. color: #165DFF;
  463. border-color: #165DFF;
  464. background: #FFFFFF;
  465. .el-icon-success{
  466. margin-right: 4px;
  467. font-size: 12px;
  468. margin-top: 2px;
  469. }
  470. }
  471. &.not-allow.active{
  472. color: #CEDCFE;
  473. border-color: #CEDCFE;
  474. }
  475. }
  476. }
  477. .el-input{
  478. width: 240px;
  479. height: 32px;
  480. background: #F2F3F5;
  481. border-radius: 2px;
  482. }
  483. }
  484. }
  485. }
  486. .main{
  487. width: 1200px;
  488. margin: 52px auto;
  489. }
  490. }
  491. </style>
  492. <style lang="scss">
  493. .bookCity{
  494. .el-breadcrumb__inner.is-link{
  495. color: #4E5969;
  496. &:hover{
  497. color: #165DFF;
  498. }
  499. }
  500. .el-breadcrumb__separator{
  501. color: #C9CDD4;
  502. }
  503. .el-breadcrumb__item:last-child .el-breadcrumb__inner{
  504. color: #1D2129;
  505. font-weight: 500;
  506. }
  507. .filt-box{
  508. input{
  509. height: 32px;
  510. line-height: 32px;
  511. background: #F2F3F5;
  512. border: none;
  513. }
  514. .el-input__icon{
  515. line-height: 32px;
  516. cursor: pointer;
  517. color: #4E5969 !important;
  518. }
  519. .el-input-group__append{
  520. background: #F2F3F5;
  521. border: none;
  522. }
  523. .el-button{
  524. padding: 9px 12px;
  525. }
  526. }
  527. .el-pagination{
  528. text-align: left;
  529. }
  530. }
  531. </style>