all.vue 17 KB

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