litian
2024-04-09 6608a6839d771d38640988e3ee496ecdd91765a4
packageDomain/pages/sampleBookList/index.js
@@ -50,6 +50,30 @@
    stairCode: '', // 一级分类选中项
    secondCode: '', // 二级分类选中项
    sort: '', // 排序
    sortList: {
      value: "default",
      options: [{
          value: "default",
          label: "默认排序",
        },
        {
          value: "name-asc",
          label: "名称正序",
        },
        {
          value: "name-desc",
          label: "名称倒叙",
        },
        {
          value: "time-asc",
          label: "出版时间正序",
        },
        {
          value: "time-desc",
          label: "出版时间倒叙",
        },
      ],
    },
    //分页
    page: 1,
    limit: 10,
@@ -170,7 +194,6 @@
    // 获取申请次数
    this.getSelectPaperBookCount()
    this.getSelectBookCount()
    console.log(this.data.electronicBookList.length, this.data.paperBookList.length, 1)
    if (wx.getStorageSync("paperBookList") || wx.getStorageSync("electronicBookList")) {
      if (wx.getStorageSync("paperBookList")) {
        this.setData({
@@ -287,7 +310,6 @@
        'stairList.options': options,
        'stairList.value': this.data.stairCode,
      });
      console.log(this.data.stairList.options)
    });
  },
  // 获取一级分类下二级分类
@@ -384,17 +406,43 @@
        queryType: '*',
      };
    }
    if (that.data.sort) {
    if (this.data.sortList.value == "name-asc") {
      sort = {
        Name: that.data.sort,
        BaseType: '',
        Name: "Asc",
        BaseType: "",
      };
    } else {
    } else if (this.data.sortList.value == "name-desc") {
      sort = {
        type: 'Desc',
        field: 'ViewCount',
        Name: "Desc",
        BaseType: "",
      };
    } else if (this.data.sortList.value == "time-asc") {
      sort = {
        PublicationDate: "Asc",
        BaseType: "DateTime",
      };
    } else if (this.data.sortList.value == "time-desc") {
      sort = {
        PublicationDate: "Desc",
        BaseType: "DateTime",
      };
    } else if (this.data.sortList.value == "default") {
      sort = {
        field: "order",
        type: "Desc",
      };
    }
    // if (that.data.sort) {
    //   sort = {
    //     Name: that.data.sort,
    //     BaseType: '',
    //   };
    // } else {
    //   sort = {
    //     type: 'Desc',
    //     field: 'ViewCount',
    //   };
    // }
    // 搜索
    let searchObj = {};
    if (that.data.searchValue) {
@@ -495,6 +543,8 @@
          })
        } else {
          that.setData({
            bookList: [],
            pageTotalCount: 0,
            skeletonLoding: false,
            loading: false
          })
@@ -553,60 +603,32 @@
  onConfirmSecond() {
    this.getBookList(false);
  },
  // 重点项目改变
  changeMajorProject(e) {
  onResetSecond() {
    this.setData({
      'majorProjectList.value': e.detail.value,
      'secondList.value': [],
    });
    this.getBookList(false);
  },
  // 重点项目重置
  resetMajorProject() {
  // 排序切换
  onSortChange(e) {
    this.setData({
      'majorProjectList.value': [],
      backTop: "#assort-title",
      "sortList.value": e.detail.value,
    });
    this.getBookList(false);
  },
  changeNewText(e) {
    this.setData({
      'newTextBook.value': e.detail.value,
    });
    this.getBookList(false);
  },
  resetNewText() {
    this.setData({
      'newTextBook.value': [],
    });
    this.getBookList(false);
  },
  // 排序按钮
  sortClick() {
    if (!this.data.sort.length) {
      this.setData({
        sort: 'Desc',
      });
    } else if (this.data.sort == 'Desc') {
      this.setData({
        sort: 'Asc',
      });
    } else if (this.data.sort == 'Asc') {
      this.setData({
        sort: '',
      });
    }
    let path;
    if (this.data.secondCode) {
      path = this.data.secondCode;
    } else if (this.data.stairCode) {
      path = `${this.data.assortCheck.code
        }\\${this.data.stairCode}`;
      path = `${this.data.assortCheck.code}\\${this.data.stairCode}`;
    } else {
      path = this.data.assortCheck.code;
    }
    this.setData({
      path: path,
    });
    this.getBookList(false);
    this.getBookList(path);
  },
  // 搜索图书
  searchBook(e) {