123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538 |
- <template>
- <div class="bookCity">
- <Header
- :headerBg="'#1F1F1F'"
- :headerBorder="'#5C5C5C'"
- :userBg="'rgba(0, 0, 0, 0.24)'"
- :LoginNavIndex="0"
- />
- <div class="banner">
- <el-carousel height="320px" trigger="click" arrow="never">
- <el-carousel-item v-for="item in 2" :key="item">
- <!-- 如果有跳转链接 则跳转 否则只展示 -->
- <!-- <a v-if="item" href="#" target="_blank">
- <el-image
- class="image"
- :src="require('../../assets/banner'+item+'.png')"
- :fit="'cover'">
- </el-image>
- </a> -->
- <el-image
- class="image"
- :src="require('../../assets/banner'+(2+item)+'.png')"
- :fit="'cover'">
- </el-image>
- </el-carousel-item>
- </el-carousel>
- </div>
- <div class="filt-box">
- <div class="filt-inner">
- <el-breadcrumb separator="/">
- <el-breadcrumb-item :to="{ path: '/' }">商城</el-breadcrumb-item>
- <el-breadcrumb-item>全部{{nameTypeCn}}</el-breadcrumb-item>
- </el-breadcrumb>
- <h2>筛选:</h2>
- <template v-if="itemType==='kecheng'">
- <div class="filt-item">
- <label>学段</label>
- <ul>
- <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)">
- <i v-if="items.study_phase===courseForm.studyValue" class="el-icon-success"></i>
- {{items.study_phase_name}}
- </li>
- </ul>
- </div>
- <div class="filt-item">
- <label>类别</label>
- <ul>
- <li :class="[itemt.value===courseForm.categoryValue?'active':'']" v-for="(itemt,indext) in categoryList" :key="indext" @click="handleClick('courseForm','categoryValue',itemt.value)">
- <i v-if="itemt.value===courseForm.categoryValue" class="el-icon-success"></i>
- {{itemt.label}}
- </li>
- </ul>
- </div>
- </template>
- <template v-else-if="itemType==='baozhi'">
- <div class="filt-item">
- <label>年份</label>
- <ul>
- <li :class="[itemy.value===baozhiForm.yearValue?'active':'']" v-for="(itemy,indexy) in yearList" :key="indexy" @click="handleClick('baozhiForm','yearValue',itemy.value)">
- <i v-if="itemy.value===baozhiForm.yearValue" class="el-icon-success"></i>
- {{itemy.label}}
- </li>
- </ul>
- </div>
- <div class="filt-item">
- <label>学段</label>
- <ul>
- <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)">
- <i v-if="items.study_phase===baozhiForm.studyValue" class="el-icon-success"></i>
- {{items.study_phase_name}}
- </li>
- </ul>
- </div>
- <div class="filt-item">
- <label>类型</label>
- <ul>
- <li :class="[itemt.value===baozhiForm.typeValue?'active':'']" v-for="(itemt,indext) in typeList" :key="indext" @click="handleClick('baozhiForm','typeValue',itemt.value)">
- <i v-if="itemt.value===baozhiForm.typeValue" class="el-icon-success"></i>
- {{itemt.label}}
- </li>
- </ul>
- </div>
- </template>
-
- <div class="filt-item">
- <label>搜索</label>
- <el-input placeholder="搜索" v-model="searchValue">
- <el-button slot="append" icon="el-icon-search" @click="handleData"></el-button>
- </el-input>
- </div>
- </div>
- </div>
- <div class="main">
- <BookListModule
- :Bookinfo="Bookinfo"
- :showAll="false"
- @changeStudy="changeStudy"
- :headerBg="'#1F1F1F'"
- :headerBorder="'#5C5C5C'"
- :userBg="'rgba(0, 0, 0, 0.24)'"
- :LoginNavIndex="0"
- />
- <el-pagination
- background
- :current-page="currentPage"
- :page-size="page_capacity"
- :page-sizes="[10, 20, 30, 40, 50]"
- :total="Bookinfo.number"
- layout="total, prev, pager, next, sizes, jumper"
- @size-change="(val)=>handleSizeChange(val,'page_capacity','currentPage')"
- @current-change="(val)=>handleCurrentChange(val,'currentPage')"
- v-if="Bookinfo.number>0&&Bookinfo.bookType!=='ZB'"
- />
- <el-pagination
- background
- :current-page="currentPages"
- :page-size="page_capacitys"
- :page-sizes="[8, 16, 24, 32, 40]"
- :total="Bookinfo.number"
- layout="total, prev, pager, next, sizes, jumper"
- @size-change="(val)=>handleSizeChange(val,'page_capacitys','currentPages')"
- @current-change="(val)=>handleCurrentChange(val,'currentPages')"
- v-else-if="Bookinfo.number>0&&Bookinfo.bookType==='ZB'"
- />
- </div>
- </div>
- </template>
- <script>
- //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
- //例如:import 《组件名称》from ‘《组件路径》';
- import Header from "../../components/Header.vue";
- import BookListModule from "@/components/common/BookAllListModule.vue"
- import { getLogin } from "@/api/ajax";
- export default {
- //import引入的组件需要注入到对象中才能使用
- components: { Header, BookListModule },
- props: {},
- data() {
- //这里存放数据
- return {
- Bookinfo:{
- BookList: [
- {
- skeleton: true
- },
- {
- skeleton: true
- },
- {
- skeleton: true
- },
- {
- skeleton: true
- },
- {
- skeleton: true
- },
- {
- skeleton: true
- },
- {
- skeleton: true
- },
- {
- skeleton: true
- },
- {
- skeleton: true
- },
- {
- skeleton: true
- }
- ],
- name: '',
- number: 0,
- numberstr: '',
- bookType: null
- },
- nameTypeCn: this.$route.query.name?decodeURIComponent(this.$route.query.name):'画刊',
- itemType:this.$route.query.type?this.$route.query.type:'huakan',
- yearList:[
- {
- value: -1,
- label: '全部'
- }
- ],
- studyList:[
- {
- study_phase: -1,
- study_phase_name: '全部'
- }
- ],
- baozhiStudyList:[],
- categoryList:[
- {
- value: 'LB',
- label: '录播'
- },
- {
- value: 'ZB',
- label: '直播'
- },
- ],
- typeList:[
- {
- value: 0,
- label: '单本'
- },
- {
- value: 1,
- label: '专辑'
- },
- ],
- courseForm:{
- studyValue: window.localStorage.getItem("courseFormstudyValue")?window.localStorage.getItem("courseFormstudyValue")*1:-1,
- categoryValue: this.$route.query.type&&this.$route.query.type==='kecheng'?window.localStorage.getItem("courseFormcategoryValue")?window.localStorage.getItem("courseFormcategoryValue"):'LB':'LB'
- },
- baozhiForm:{
- yearValue: window.localStorage.getItem("baozhiFormyearValue")?window.localStorage.getItem("baozhiFormyearValue")*1:-1,
- studyValue: window.localStorage.getItem("baozhiFormstudyValue")?window.localStorage.getItem("baozhiFormstudyValue")*1:-1,
- typeValue: window.localStorage.getItem("baozhiFormtypeValue")?window.localStorage.getItem("baozhiFormtypeValue")*1:0,
- },
- currentPage: 1, // 当前页码
- page_capacity: 10, // 每页条数
- currentPages: 1,
- page_capacitys: 8, // 每页条数
- searchValue: '',
- titleName:window.localStorage.getItem("baozhiFormstudyValueName")?window.localStorage.getItem("baozhiFormstudyValueName"):''
- }
- },
- //计算属性 类似于data概念
- computed: {},
- //监控data中数据变化
- watch: {},
- //方法集合
- methods: {
- handleClick(form,file,value,name){
- window.localStorage.setItem(form+file,value)
- if(form==='courseForm'&&file==='categoryValue'&&value==='ZB'){
- this.courseForm.studyValue = -1
- }else if(form==='courseForm'&&file==='categoryValue'&&value==='LB'){
- this.courseForm.studyValue = window.localStorage.getItem("courseFormstudyValue")?window.localStorage.getItem("courseFormstudyValue")*1:-1
- }
- if(form==='courseForm'&&file==='studyValue'&&this.courseForm.categoryValue==='ZB'){
- return false
- }
- if(name){
- this.titleName = name
- window.localStorage.setItem('baozhiFormstudyValueName',name)
- }
- this[form][file] = value
- this.currentPage = 1;
- this.currentPages = 1
- this.handleData()
- },
- handleData(){
- let MethodName = "/ShopServer/Client/ShopHomeQuery/PageQueryCourseList"
- let data = {
- page_capacity: this.courseForm.categoryValue==='ZB'?this.page_capacitys:this.page_capacity,
- cur_page: this.courseForm.categoryValue==='ZB'?this.currentPages:this.currentPage,
- search_content: this.searchValue.trim(),
- }
- if(this.itemType==='kecheng'){
- data.course_type = this.courseForm.categoryValue,
- data.study_phase = this.courseForm.studyValue
- getLogin(MethodName, data)
- .then((res) => {
- if(res.status===1){
- this.Bookinfo = {
- name: this.courseForm.categoryValue==='LB'?'课程':'直播',
- number: res.total_count,
- numberstr: '共' + res.total_count + '期',
- study: this.courseForm.studyValue,
- BookList: res.course_list,
- bookType: this.courseForm.categoryValue
- }
- }
- })
- .catch(() => {
-
- });
- }else if(this.itemType==='baozhi'){
- MethodName = "/ShopServer/Client/ShopHomeQuery/PageQueryIssueList"
- data.year_label = this.baozhiForm.yearValue
- data.study_phase = this.baozhiForm.studyValue
- data.comb_flag = this.baozhiForm.typeValue
- getLogin(MethodName, data)
- .then((res) => {
- if(res.status===1){
- this.Bookinfo = {
- name: this.titleName,
- number: res.total_count,
- numberstr: '共' + res.total_count + '期',
- study: this.baozhiForm.studyValue,
- BookList: res.issue_list,
- bookType: 'baozhi'
- }
- }
- })
- .catch(() => {
-
- });
- }
- },
- handleSizeChange(val,type,page) {
- this[type] = val
- this[page] = 1;
- this.handleData()
- },
- handleCurrentChange(val,type) {
- this[type] = val
- this.handleData()
- },
- changeStudy(form,value){
- this.currentPage = 1;
- this.currentPages = 1
- this[form].studyValue = value
- this.handleData()
- },
- // 学段列表
- getStudyList(){
- let MethodName = "/OrgServer/DictManager/GetStudyPhaseList"
- getLogin(MethodName, {})
- .then((res) => {
- if(res.status===1){
- let studyList = [
- {
- study_phase: -1,
- study_phase_name: '全部'
- }
- ]
- this.studyList = studyList.concat(res.study_phase_list)
- this.baozhiStudyList = res.study_phase_list
- 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
- this.titleName = window.localStorage.getItem("baozhiFormstudyValueName")?window.localStorage.getItem("baozhiFormstudyValueName"):res.study_phase_list[0]?res.study_phase_list[0].study_phase_name:''
- }
- })
- .catch(() => {
-
- });
- },
- // 获取年份列表
- getYearList(){
- this.yearList = [
- {
- value: -1,
- label: '全部'
- }
- ]
- let yearList = []
- let MethodName = "/ShopServer/Client/ShopHomeQuery/GetIssueYearLabelList"
- getLogin(MethodName, {})
- .then((res) => {
- if(res.status===1){
- res.year_label_list.forEach(nowYear => {
- let obj = {
- value: nowYear,
- label: nowYear
- }
- yearList.push(obj)
- })
- this.yearList = this.yearList.concat(yearList)
- }
- })
- .catch(() => {
- this.loading = false
- });
-
- }
- },
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {
- this.getStudyList()
- this.getYearList()
- this.handleData()
- },
- //生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {
- },
- //生命周期-创建之前
- beforeCreated() { },
- //生命周期-挂载之前
- beforeMount() { },
- //生命周期-更新之前
- beforUpdate() { },
- //生命周期-更新之后
- updated() { },
- //生命周期-销毁之前
- beforeDestory() { },
- //生命周期-销毁完成
- destoryed() { },
- //如果页面有keep-alive缓存功能,这个函数会触发
- activated() { }
- }
- </script>
- <style lang="scss" scoped>
- /* @import url(); 引入css类 */
- .bookCity {
- min-height: 100%;
- padding-bottom: 50px;
- .banner{
- width: 100%;
- font-size: 0;
- img{
- max-width: 100%;
- }
- .image{
- width: 100%;
- height: 100%;
- }
- }
- .filt-box{
- border-bottom: 1px solid #E5E6EB;
- background: #FFFFFF;
- .filt-inner{
- width: 1200px;
- margin: 0 auto;
- padding: 40px 0;
- h2{
- font-weight: 600;
- font-size: 16px;
- line-height: 24px;
- color: #2F3742;
- padding: 28px 0;
- margin: 0;
- }
- .filt-item{
- display: flex;
- margin-bottom: 8px;
- label{
- width: 52px;
- font-weight: 400;
- font-size: 16px;
- line-height: 32px;
- color: #2F3742;
- }
- ul{
- list-style: none;
- display: flex;
- flex-flow: wrap;
- padding: 0;
- margin: 0;
- li{
- margin: 0 8px 16px 0;
- background: #F2F3F5;
- border-radius: 2px;
- padding: 3px 11px;
- font-weight: 500;
- font-size: 16px;
- line-height: 24px;
- color: #2F3742;
- cursor: pointer;
- border: 1px solid #F2F3F5;
- height: 32px;
- box-sizing: border-box;
- display: flex;
- align-items: center;
- &:hover{
- color: #165DFF;
- }
- &.not-allow{
- cursor: not-allowed;
- background: #F2F3F5;
- color: #C1C5CD;
- }
- &.active{
- color: #165DFF;
- border-color: #165DFF;
- background: #FFFFFF;
- .el-icon-success{
- margin-right: 4px;
- font-size: 12px;
- margin-top: 2px;
- }
- }
- &.not-allow.active{
- color: #CEDCFE;
- border-color: #CEDCFE;
- }
- }
- }
- .el-input{
- width: 240px;
- height: 32px;
- background: #F2F3F5;
- border-radius: 2px;
- }
- }
- }
- }
- .main{
- width: 1200px;
- margin: 52px auto;
- }
- }
- </style>
- <style lang="scss">
- .bookCity{
- .el-breadcrumb__inner.is-link{
- color: #4E5969;
- &:hover{
- color: #165DFF;
- }
- }
- .el-breadcrumb__separator{
- color: #C9CDD4;
- }
- .el-breadcrumb__item:last-child .el-breadcrumb__inner{
- color: #1D2129;
- font-weight: 500;
- }
- .filt-box{
- input{
- height: 32px;
- line-height: 32px;
- background: #F2F3F5;
- border: none;
- }
- .el-input__icon{
- line-height: 32px;
- cursor: pointer;
- color: #4E5969 !important;
- }
- .el-input-group__append{
- background: #F2F3F5;
- border: none;
- }
- .el-button{
- padding: 9px 12px;
- }
- }
- .el-pagination{
- text-align: left;
- }
- }
- </style>
|