Browse Source

报纸分页 详情

natasha 1 year ago
parent
commit
b6f1d99483

+ 2 - 24
src/components/common/BookAllListModule.vue

@@ -8,9 +8,9 @@
             </span>
             <b>{{Bookinfo.numberstr}}</b>
         </div>
-        <div class="title-right" v-if="showAll">
+        <!-- <div class="title-right" v-if="showAll">
             <a class="lookmore" @click="lookmore"><span>查看全部</span><i class="el-icon-arrow-right"></i></a>
-        </div>
+        </div> -->
       </div>
       <div class="list">
         <div
@@ -30,17 +30,6 @@
           />
         </div>
       </div>
-      <el-pagination
-        background
-        :current-page="currentPage"
-        :page-size="10"
-        :page-sizes="[1, 10, 20, 30, 40, 50]"
-        :total="Bookinfo.number"
-        layout="sizes, prev, pager, next, jumper"
-        @current-change="handleCurrentChange"
-        @size-change="handleSizeChange"
-        v-if="showPage"
-      />
       <!-- <div class="listlive">
         <div
           v-for="(item,index) in Bookinfo.BookList"
@@ -92,8 +81,6 @@ export default {
                 name: '课程',
             },
         },
-        currentPage: 1, // 当前页码
-        page_capacity: 10, // 每页条数
     }
   },
   //计算属性 类似于data概念
@@ -106,15 +93,6 @@ export default {
     lookmore(){
         this.$emit("changeStudy",this.Bookinfo.study)
     },
-    // 切换每页条数
-    handleSizeChange(val) {
-      this.currentPage = 1;
-      this.page_capacity = val;
-    },
-    // 切换页码
-    handleCurrentChange(val) {
-      this.currentPage = val;
-    },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {

+ 7 - 6
src/components/common/BookCard.vue

@@ -6,7 +6,7 @@
     ></div> -->
     <el-image
         class="image"
-        :src="item.cover_image_url?item.cover_image_url:item.type1==='baozhi'?require('../../assets/baozhi'+(Math.floor(Math.random()*2)+1)+'.png'):require('../../assets/kecheng'+(Math.floor(Math.random()*3)+1)+'.png')"
+        :src="item.cover_image_url?item.cover_image_url:item.course_type==='baozhi'?require('../../assets/baozhi'+(Math.floor(Math.random()*2)+1)+'.png'):require('../../assets/kecheng'+(Math.floor(Math.random()*3)+1)+'.png')"
         :fit="'contain'">
     </el-image>
     <div class="bottom">
@@ -40,7 +40,7 @@ export default {
   name: "BookCard",
   //import引入的组件需要注入到对象中才能使用
   components: {},
-  props: ["item", "height","type","LoginNavIndex","userBg","headerBorder","headerBg","previousPage","cardType","isBuy"],
+  props: ["item", "height","type","LoginNavIndex","userBg","headerBorder","headerBg","previousPage","isBuy"],
   filters:{
     cutMoneyFiter
   },
@@ -71,7 +71,7 @@ export default {
   //方法集合
   methods: {
     changeData(data) {
-      var datasort = data.sort((a, b) => a.date.localeCompare(b.date));// 大重_-----Set 中的元素只会出现一次
+      var datasort = data.sort((a, b) => a.date.localeCompare(b.date));
       var timeArr = new Set(datasort.map(it => it.date))
       let newarr = []
       let rateArr = []
@@ -99,13 +99,14 @@ export default {
       return { newarr, timeArr, rateArr }
     },
     handleLink(){
-        let url  = this.LoginNavIndex +'&&&'+ this.userBg +'&&&'+ this.headerBorder +'&&&'+ this.headerBg + '&&&' + this.previousPage
+        let url  = this.LoginNavIndex +'&&&1&&&2&&&3&&&' + this.previousPage
         this.$router.push({
             path: "/bookItem",
             query: {
                 headerConfig: encodeURIComponent(url),
-                cardType:this.cardType,
-                isBuy:this.isBuy
+                isBuy:this.isBuy,
+                cardType: this.item.course_type,
+                id: this.item.id
             },
         });
     }

+ 2 - 2
src/components/common/BookListModule.vue

@@ -37,7 +37,6 @@
             :userBg="userBg"
             :LoginNavIndex="LoginNavIndex"
             :previousPage="previousPage"
-            :cardType="name"
           />
         </div>
       </div>
@@ -85,7 +84,8 @@ export default {
         this.$router.push({
           path: "/bookStore/all",
           query: {
-            name: encodeURIComponent(this.typeList[this.name].name)
+            name: encodeURIComponent(this.typeList[this.name].name),
+            type: this.name
           }
         })
     },

+ 100 - 59
src/views/bookShelf/bookItem.vue

@@ -23,22 +23,22 @@
             </a>
         </div>
     </div>
-    <div class="main-top">
+    <div class="main-top" v-if="info">
         <div class="main-top-inner">
             <el-carousel class="swiper-container" trigger="click" arrow="never" height="414px">
-                <el-carousel-item v-for="(item1, index) in data.imgList" :key="index">
+                <!-- <el-carousel-item v-for="(item1, index) in data.imgList" :key="index"> -->
                     <el-image
                         class="image"
-                        :src="item1"
+                        :src="info.cover_image_url?info.cover_image_url:bookType==='baozhi'?require('../../assets/baozhi'+(Math.floor(Math.random()*2)+1)+'.png'):require('../../assets/kecheng'+(Math.floor(Math.random()*3)+1)+'.png')"
                         :fit="'contain'">
                     </el-image>
-                </el-carousel-item>
+                <!-- </el-carousel-item> -->
             </el-carousel>
             <div class="book-info-right">
-                <h1 class="title">{{data.title}}</h1>
+                <h1 class="title">{{info.name}}</h1>
                 <!-- <b class="org">{{data.org}}</b><span class="date">2023.07.01-2023.07.21</span> -->
                 <div class="label-box">
-                    <label v-for="(itemL,indexL) in data.tagList" :key="indexL" :style="{background:tagBg[indexL%3],color:tagColor[indexL%3]}">
+                    <label v-for="(itemL,indexL) in info.label_name_list" :key="indexL" :style="{background:tagBg[indexL%3],color:tagColor[indexL%3]}">
                         {{ '# ' + itemL }}
                     </label>
                 </div>
@@ -47,10 +47,10 @@
                     <span class="author">{{'BY '+data.describe.author}}</span>
                     <p class="describe">{{data.describe.describe}}</p>
                 </div> -->
-                <div class="info-box">
+                <div class="info-box" v-if="bookType==='baozhi'">
                     <div class="info-item">
                         <label>出版社</label>
-                        <span>二十一世纪英文报</span>
+                        <span>{{info.org_name}}</span>
                     </div>
                     <div class="info-item">
                         <label>字数</label>
@@ -77,6 +77,32 @@
                         <span>基础版</span>
                     </div>
                 </div>
+                <div class="info-box" v-if="bookType==='LB'">
+                    <div class="info-item">
+                        <label>出版社</label>
+                        <span>{{info.org_name}}</span>
+                    </div>
+                    <div class="info-item" v-if="bookType==='LB'">
+                        <label>教师</label>
+                        <span>{{info.teacher_name_list.join('、')}}</span>
+                    </div>
+                    <div class="info-item">
+                        <label>类型</label>
+                        <span>录播课</span>
+                    </div>
+                    <div class="info-item">
+                        <label>课时</label>
+                        <span>{{courseList.length+' 课时'}}</span>
+                    </div>
+                    <div class="info-item">
+                        <label>有效期</label>
+                        <span>{{info.effective_month_count + ' 个月'}}</span>
+                    </div>
+                    <div class="info-item">
+                        <label>学段</label>
+                        <span>{{info.study_phase_name}}</span>
+                    </div>
+                </div>
                 <div class="price-box" v-if="!data.isBuy">
                     <span class="price">¥{{data.price|cutMoneyFiter}}</span>
                     <span class="oldPrice">¥{{data.oldPrice|cutMoneyFiter}}</span>
@@ -97,7 +123,12 @@
             </div>
         </div>
     </div>
-    <div class="main-center">
+    <div class="main-center" v-if="info">
+        <el-tabs type="card" style="margin-bottom:24px;">
+            <el-tab-pane label="简介">
+                <div v-html="info.intro"></div>
+            </el-tab-pane>
+        </el-tabs>
         <el-tabs type="card">
             <!-- <el-tab-pane :label="bookType==='course'?'课程简介':'简介'">
                 
@@ -142,9 +173,9 @@
                     :cardType="bookType">
                 </tree-list>
             </el-tab-pane>
-            <el-tab-pane label="课节" v-if="bookType==='kecheng'">
+            <el-tab-pane label="课程目录" v-if="bookType==='LB'">
                 <course-list 
-                    :data="data.courseList" 
+                    :data="courseList" 
                     :isBuy="data.isBuy" 
                     :headerBg="headerBg"
                     :headerBorder="headerBorder"
@@ -186,6 +217,7 @@ import Payment from "./components/Payment.vue"
 import TreeList from "./components/TreeList"
 import CourseList from "./components/CourseList.vue"
 import { cutMoneyFiter } from '@/utils/defined';
+import { getLogin } from "@/api/ajax";
 
 export default {
   //import引入的组件需要注入到对象中才能使用
@@ -331,44 +363,6 @@ export default {
                     ]
                 }
             ],
-            courseList:[
-                {
-                    number:'1',
-                    title:'课程介绍',
-                    teacher:'王琦',
-                    length:'8分钟'
-                },
-                {
-                    number:'2',
-                    title:'基本阅读技能',
-                    teacher:'王琦',
-                    length:'10分钟'
-                },
-                {
-                    number:'3',
-                    title:'高级阅读技能',
-                    teacher:'王琦',
-                    length:'10分钟'
-                },
-                {
-                    number:'4',
-                    title:'主题语境·人与自然',
-                    teacher:'王琦',
-                    length:'10分钟'
-                },
-                {
-                    number:'5',
-                    title:'课程主题语境·人与自我介绍',
-                    teacher:'王琦',
-                    length:'14分钟'
-                },
-                {
-                    number:'6',
-                    title:'主题语境·人与自我',
-                    teacher:'王琦',
-                    length:'10分钟'
-                },
-            ]
         },
         guessList: [{
             src: require('../../assets/bookcard-image.png'),
@@ -411,13 +405,16 @@ export default {
             author: "作者",
             score: 3,
         }
-      ],
-      tagBg:['#C9EBFF','#FFFAC9','#D7C9FF'], // 标签背景色
-      tagColor:['#006DAA','#AA8500','#7849C4'], // 标签字体颜色
-      paymentShow: false, // 支付弹窗
-      payWay:'dui',
-      bookType: this.$route.query.cardType?this.$route.query.cardType:'baozhi', // 书籍类型
-      bannerFlag: true // 是否展示广告
+        ],
+        tagBg:['#C9EBFF','#FFFAC9','#D7C9FF'], // 标签背景色
+        tagColor:['#006DAA','#AA8500','#7849C4'], // 标签字体颜色
+        paymentShow: false, // 支付弹窗
+        payWay:'dui',
+        bookType: this.$route.query.cardType?this.$route.query.cardType:'baozhi', // 书籍类型
+        bannerFlag: true, // 是否展示广告
+        id: this.$route.query.id?this.$route.query.id:'',
+        info: null, // 信息
+        courseList:[]
     }
   },
   //计算属性 类似于data概念
@@ -442,9 +439,52 @@ export default {
     handleClose(){
         this.paymentShow = false
     },
-    // 换一批
-    handleChangeBatch(){
-
+    // 详情
+    getInfo(){
+        let MethodName = "/CourseServer/Client/LBCourseQuery/GetLBCourseInfo";
+        let data = null
+        if(this.bookType==='LB'){
+            data = {
+                id: this.id,
+                is_contain_cs_item: "true",
+                cs_item_sort_mode: "ASCE"
+            }
+        }
+        getLogin(MethodName, data)
+        .then((res) => {
+            if(res.status===1){
+                this.info = res.lb_course
+                this.courseList = this.handleCourseLength(res.cs_item_list)
+            }
+        })
+        .catch(() => {
+            
+        }); 
+    },
+    // 处理授课时长 小于1分钟的按1分钟 之后个位数四舍五入
+    handleCourseLength(list){
+        let listArr = JSON.parse(JSON.stringify(list))
+        listArr.forEach(item => {
+            if(item.file_media_duration){
+                if(item.file_media_duration<60){
+                    item.timeCn = '1分钟'
+                }else if(item.file_media_duration<600){
+                    item.timeCn = Math.ceil(item.file_media_duration/60)+'分钟'
+                }else{
+                    let first = Math.ceil(item.file_media_duration/60).toString().substring(0,Math.ceil(item.file_media_duration/60).toString().length-1)*1
+                    let last = Math.ceil(item.file_media_duration/60).toString().substring(Math.ceil(item.file_media_duration/60).toString().length-1)*1
+                    if(last<5){
+                        item.timeCn = first+'0分钟'
+                    }else{
+                        item.timeCn = (first+1)+'0分钟'
+                    }
+                    
+                }
+            }else{
+                item.timeCn = '-'
+            }
+        });
+        return listArr
     }
   },
   //生命周期 - 创建完成(可以访问当前this实例)
@@ -457,6 +497,7 @@ export default {
         this.headerBg = arr[3] ? arr[3] : '#1F1F1F'
         this.previousPage = arr[4] ? arr[4] : '商城'
     }
+    this.getInfo()
   },
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {

+ 4 - 4
src/views/bookShelf/components/CourseList.vue

@@ -1,10 +1,10 @@
 <template>
   <ul class="courseList">
     <li v-for="(item,index) in data" :key="index" :class="[index===data.length-1?'noborder':'',isBuy||index<4?'buy':'']" @click="handleLink(item,isBuy||index<4,index)">
-        <span class="number">{{item.number + '.'}}</span>
-        <b class="title">{{item.title}}</b>
-        <span class="teacher">{{'主讲教师'+item.teacher}}</span>
-        <span class="time-length">{{item.length}}</span>
+        <span class="number">{{index+1 + '.'}}</span>
+        <b class="title">{{item.name}}</b>
+        <span class="teacher">{{'主讲教师'+item.teacher_name}}</span>
+        <span class="time-length">{{item.timeCn}}</span>
         <i class="el-icon-lock" v-if="!(isBuy||index<4)"></i>
         <i class="el-icon-arrow-right" v-else></i>
     </li>

+ 1 - 1
src/views/bookShelf/index.vue

@@ -56,7 +56,7 @@
             :userBg="'rgba(0, 0, 0, 0.24)'"
             :LoginNavIndex="1"
             :previousPage="'书架'"
-            :cardType="item.type"
+            :cardType="item.course_type"
             :isBuy="true"
           />
         </div>

+ 224 - 263
src/views/bookStore/all.vue

@@ -32,36 +32,59 @@
                 <el-breadcrumb-item>全部{{nameTypeCn}}</el-breadcrumb-item>
             </el-breadcrumb>
             <h2>筛选:</h2>
-            <div class="filt-item">
-                <label>年份</label>
-                <ul>
-                    <li :class="[itemy.value===form.yearValue?'active':'']" v-for="(itemy,indexy) in yearList" :key="indexy" @click="handleClick('yearValue',itemy.value)">
-                        <i v-if="itemy.value===form.yearValue" class="el-icon-success"></i>
-                        {{itemy.label}}
-                    </li>
-                </ul>
-            </div>
-            <div class="filt-item">
-                <label>学段</label>
-                <ul>
-                    <li :class="[items.value===form.studyValue?'active':'']" v-for="(items,indexs) in studyList" :key="indexs" @click="handleClick('studyValue',items.value)">
-                        <i v-if="items.value===form.studyValue" class="el-icon-success"></i>
-                        {{items.label}}
-                    </li>
-                </ul>
-            </div>
-            <div class="filt-item">
-                <label>类型</label>
-                <ul>
-                    <li :class="[itemt.value===form.typeValue?'active':'']" v-for="(itemt,indext) in typeList" :key="indext" @click="handleClick('typeValue',itemt.value)">
-                        <i v-if="itemt.value===form.typeValue" class="el-icon-success"></i>
-                        {{itemt.label}}
-                    </li>
-                </ul>
-            </div>
+            <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="form.searchValue">
+                <el-input placeholder="搜索" v-model="searchValue">
                     <el-button slot="append" icon="el-icon-search" @click="handleData"></el-button>
                 </el-input>
             </div>
@@ -71,22 +94,22 @@
       <BookListModule
         :Bookinfo="Bookinfo"
         :showAll="false"
-        :showPage="form.studyValue==Bookinfo.study"
-        v-if="!form.studyValue||form.studyValue==Bookinfo.study"
         @changeStudy="changeStudy"
         :headerBg="'#1F1F1F'"
         :headerBorder="'#5C5C5C'"
         :userBg="'rgba(0, 0, 0, 0.24)'"
         :LoginNavIndex="0"
       />
-      <BookListModule
-        :Bookinfo="Bookinfo2"
-        :showAll="false"
-        v-if="false"
-        :headerBg="'#1F1F1F'"
-        :headerBorder="'#5C5C5C'"
-        :userBg="'rgba(0, 0, 0, 0.24)'"
-        :LoginNavIndex="0"
+      <el-pagination
+        background
+        :current-page="currentPage"
+        :page-size="10"
+        :page-sizes="[1, 10, 20, 30, 40, 50]"
+        :total="Bookinfo.number"
+        layout="total, prev, pager, next, sizes, jumper"
+        @current-change="handleCurrentChange"
+        @size-change="handleSizeChange"
+        v-if="Bookinfo.number>0"
       />
     </div>
   </div>
@@ -97,6 +120,7 @@
 //例如:import 《组件名称》from ‘《组件路径》';
 import Header from "../../components/Header.vue";
 import BookListModule from "@/components/common/BookAllListModule.vue"
+import { getLogin } from "@/api/ajax";
 
 export default {
   //import引入的组件需要注入到对象中才能使用
@@ -106,243 +130,59 @@ export default {
     //这里存放数据
     return {
       Bookinfo:{
-        BookList: [{
-        src: require('../../assets/baozhi2.png'),
-        name: "第96期",
-        price: "23.00",
-        oldprice: "33.00",
-        author: "TEENS",
-        score: 3,
-        progress: "90%"
-      },
-      {
-        src: require('../../assets/baozhi1.png'),
-        name: "第87期",
-        price: "27.00",
-        oldprice: "43.00",
-        author: "2022-04-15",
-        score: 3,
-      },
-      {
-        src: require('../../assets/baozhi1.png'),
-        name: "第86期 ",
-        price: "19.00",
-        oldprice: "27.00",
-        author: "TEENS",
-        score: 3,
-      },
-      {
-        src: require('../../assets/baozhi1.png'),
-        name: "第85期",
-        price: "28.90",
-        oldprice: "39.00",
-        author: "TEENS",
-        score: 3,
-      },
-      {
-        src: require('../../assets/baozhi2.png'),
-        name: "第84期",
-        price: "23.00",
-        oldprice: "30.00",
-        author: "TEENS",
-        score: 3,
-      },
-      {
-        src: require('../../assets/baozhi2.png'),
-        name: "第96期",
-        price: "23.00",
-        oldprice: "33.00",
-        author: "TEENS",
-        score: 3,
-        progress: "90%"
-      },
-      {
-        src: require('../../assets/baozhi1.png'),
-        name: "第87期",
-        price: "27.00",
-        oldprice: "43.00",
-        author: "2022-04-15",
-        score: 3,
-      },
-      {
-        src: require('../../assets/baozhi2.png'),
-        name: "第86期 ",
-        price: "19.00",
-        oldprice: "27.00",
-        author: "TEENS",
-        score: 3,
-      },
-      {
-        src: require('../../assets/baozhi2.png'),
-        name: "第85期",
-        price: "28.90",
-        oldprice: "39.00",
-        author: "TEENS",
-        score: 3,
-      },
-      {
-        src: require('../../assets/baozhi1.png'),
-        name: "第84期",
-        price: "23.00",
-        oldprice: "30.00",
-        author: "TEENS",
-        score: 3,
-      }
-      ],
-        name: '报纸',
-        number: 96,
-        numberstr: '共96期',
-        study: 'value1'
-      },
-      Bookinfo2:{
-        BookList: [{
-            src: require('../../assets/bookcard-image.png'),
-            name: "名称名称名称名称名称名称名称名称名称名称名称名称",
-            price: "3.00",
-            oldprice: "3.00",
-            author: "作者",
-            score: 3,
-            progress: "90%",
-            time:'2023/4/16 19:00'
-        },
-        {
-            src: require('../../assets/bookcard-image.png'),
-            name: "名称名称名称名称名称名称名称名称名称名称名称名称",
-            price: "3.00",
-            oldprice: "3.00",
-            author: "作者",
-            score: 3,
-            time:'2023/4/16 19:00'
-        },
-        {
-            src: require('../../assets/bookcard-image.png'),
-            name: "名称名称名称名称名称名称名称名称名称名称名称名称",
-            price: "3.00",
-            oldprice: "3.00",
-            author: "作者",
-            score: 3,
-            time:'2023/4/16 19:00'
-        },
-        {
-            src: require('../../assets/bookcard-image.png'),
-            name: "名称名称名称名称名称名称名称名称名称名称名称名称",
-            price: "3.00",
-            oldprice: "3.00",
-            author: "作者",
-            score: 3,
-            time:'2023/4/16 19:00'
-        },
-        {
-            src: require('../../assets/bookcard-image.png'),
-            name: "名称名称名称名称名称名称名称名称名称名称名称名称",
-            price: "3.00",
-            oldprice: "3.00",
-            author: "作者",
-            score: 3,
-            time:'2023/4/16 19:00'
-        }
-        ],
-        name: '初一',
-        number: 805,
-        numberstr: '共805个',
-        study: 'value2'
+        BookList: [],
+        name: '',
+        number: 0,
+        numberstr: '',
       },
       nameTypeCn: this.$route.query.name?decodeURIComponent(this.$route.query.name):'画刊',
-      nameTypeList: ['画刊','报纸','练习册','课程'],
+      itemType:this.$route.query.type?this.$route.query.type:'huakan',
       yearList:[
         {
-            value: '',
+            value: -1,
             label: '全部'
-        },{
-            value: '2023',
-            label: '2023'
-        },{
-            value: '2022',
-            label: '2022'
-        },{
-            value: '2021',
-            label: '2021'
-        },{
-            value: '2020',
-            label: '2020'
-        },{
-            value: '2019',
-            label: '2019'
-        },{
-            value: '2018',
-            label: '2018'
-        },{
-            value: '2017',
-            label: '2017'
-        },{
-            value: '2016',
-            label: '2016'
-        },{
-            value: '2015',
-            label: '2015'
-        },{
-            value: '2014',
-            label: '2014'
-        },{
-            value: '2013',
-            label: '2013'
-        },{
-            value: '2012',
-            label: '2012'
-        },{
-            value: '2011',
-            label: '2011'
-        },{
-            value: '2010',
-            label: '2010'
-        },{
-            value: '2009',
-            label: '2009'
-        },{
-            value: '2008',
-            label: '2008'
-        },
+        }
       ],
       studyList:[
         {
-            value: '',
-            label: '全部'
-        },{
-            value: 'value1',
-            label: '小学'
-        },{
-            value: 'value2',
-            label: '初一'
-        },{
-            value: 'value3',
-            label: '初二'
-        },{
-            value: 'value4',
-            label: '初三'
-        },{
-            value: 'value5',
-            label: '高一'
-        },{
-            value: 'value6',
-            label: '高二'
+            study_phase: -1,
+            study_phase_name: '全部'
+        }
+      ],
+      baozhiStudyList:[],
+      categoryList:[
+        {
+            value: 'LB',
+            label: '录播'
+        },
+        {
+            value: 'ZB',
+            label: '直播'
         },
       ],
       typeList:[
         {
-            value: 'value1',
+            value: 0,
             label: '单本'
         },
         {
-            value: 'value2',
-            label: '合刊'
+            value: 1,
+            label: '专辑'
         },
       ],
-      form:{
-        yearValue: '',
-        studyValue: '',
-        typeValue: 'value1',
-        searchValue: ''
-      }
+      courseForm:{
+        studyValue: window.localStorage.getItem("courseFormstudyValue")?window.localStorage.getItem("courseFormstudyValue")*1:-1,
+        categoryValue: window.localStorage.getItem("courseFormcategoryValue")?window.localStorage.getItem("courseFormcategoryValue"):'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, // 每页条数
+      searchValue: '',
+      titleName:''
     }
   },
   //计算属性 类似于data概念
@@ -351,19 +191,128 @@ export default {
   watch: {},
   //方法集合
   methods: {
-    handleClick(file,value){
-        this.form[file] = value
+    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.handleData()
     },
     handleData(){
+        let MethodName = "/ShopServer/Client/ShopHomeQuery/PageQueryCourseList"
+        let data = {
+            page_capacity: this.page_capacity,
+            cur_page: 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
+                    }
+                }
+            })
+            .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
+                    }
+                }
+            })
+            .catch(() => {
+                
+            }); 
+        }
+    },
+    // 切换每页条数
+    handleSizeChange(val) {
+      this.currentPage = 1;
+      this.page_capacity = val;
+      this.handleData()
+    },
+    // 切换页码
+    handleCurrentChange(val) {
+      this.currentPage = val;
+      this.handleData()
+    },
+    changeStudy(form,value){
+        this.currentPage = 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(() => {
+            
+        }); 
     },
-    changeStudy(value){
-        this.form.studyValue = value
+    // 获取年份列表
+    getYearList(){
+        let nowYear = new Date().getFullYear()
+        let yearList = []
+        for(let i = 0; i < 20; i++){
+            let obj = {
+                value: nowYear - i,
+                label: nowYear - i
+            }
+            yearList.push(obj)
+        }
+        this.yearList = this.yearList.concat(yearList)
     }
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {
-
+    this.getStudyList()
+    this.getYearList()
+    this.handleData()
   },
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
@@ -449,6 +398,11 @@ export default {
                     &:hover{
                         color: #165DFF;
                     }
+                    &.not-allow{
+                        cursor: not-allowed;
+                        background: #F2F3F5;
+                        color: #C1C5CD;
+                    }
                     &.active{
                         color: #165DFF;
                         border-color: #165DFF;
@@ -459,6 +413,10 @@ export default {
                             margin-top: 2px;
                         }
                     }
+                    &.not-allow.active{
+                        color: #CEDCFE;
+                        border-color: #CEDCFE;
+                    }
                 }
             }
             .el-input{
@@ -511,5 +469,8 @@ export default {
             padding: 9px 12px;
         }
     }
+    .el-pagination{
+        text-align: left;
+    }
 }
 </style>

+ 6 - 4
src/views/bookStore/index.vue

@@ -27,7 +27,7 @@
         <!-- <img src="../../assets/banner1.png" /> -->
     </div>
     <div class="main">
-      <BookListModule
+      <!-- <BookListModule
         name="huakan"
         :list="BookList"
         :headerBg="'#1F1F1F'"
@@ -35,7 +35,7 @@
         :userBg="'rgba(0, 0, 0, 0.24)'"
         :LoginNavIndex="0"
         :previousPage="'画刊'"
-      />
+      /> -->
       <BookListModule
         name="baozhi"
         :list="IssueList"
@@ -44,6 +44,7 @@
         :userBg="'rgba(0, 0, 0, 0.24)'"
         :LoginNavIndex="0"
         :previousPage="'报纸'"
+        v-if="IssueList.length>0"
       />
       <!-- <BookListModule
         name="xiti"
@@ -62,6 +63,7 @@
         :userBg="'rgba(0, 0, 0, 0.24)'"
         :LoginNavIndex="0"
         :previousPage="'课程'"
+        v-if="LBCourseList.length>0"
       />
       <div class="banner-box-close" v-if="bannerFlag">
         <a v-if="1==2" href="#" target="_blank">
@@ -240,7 +242,7 @@ export default {
         .then((res) => {
             if(res.status===1){
                 res.lb_course_list.forEach(item => {
-                    item.type1="kecheng"
+                    item.course_type="LB"
                 });
                 this.LBCourseList = res.lb_course_list
             }
@@ -259,7 +261,7 @@ export default {
         .then((res) => {
             if(res.status===1){
                 res.issue_list.forEach(item => {
-                    item.type1="baozhi"
+                    item.course_type="baozhi"
                 });
                 this.IssueList = res.issue_list
             }