闫增涛
2024-07-11 93aadab3e592ccb4d2f7ff00f4bd79d6e7a7daec
详情页接口优化,图书列表页骨架屏优化
6个文件已修改
90 ■■■■ 已修改文件
packageBookService/pages/bookServices/detail/index.js 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/examination/examination.js 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/assort/index.js 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/assort/index.json 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/assort/index.wxml 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/assort/index.wxss 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/index.js
@@ -187,7 +187,7 @@
      title: options.name,
    })
    this.getBookInfo(options.id);
    this.getResourceClass(); // 获取资源所属分类
    // this.getResourceClass(); // 获取资源所属分类
    const token = wx.getStorageSync(app.config.tokenKey);
    if (token) {
      this.getShoppingCartProductGet();
@@ -405,14 +405,19 @@
      this.getSubTtem();
      // 获取图书分类
      if (res.datas.bookClassification) {
        let classData = []
        const bookClassification = JSON.parse(res.datas.bookClassification);
        if (Array.isArray(bookClassification) && bookClassification.length) {
          for (let index = 0; index < bookClassification.length; index++) {
            const element = bookClassification[index];
            const iconType = element[0];
            const classType = element[1];
            await this.getBookClass(iconType, classType);
            classData.push({
              iconType,
              classType
            })
          }
          await this.getBookClass(classData);
        }
      }
@@ -571,14 +576,19 @@
    });
  },
  // 获取图书分类
  async getBookClass(iconType, classType) {
  async getBookClass(list) {
    let name = "";
    const query = {
      refCodes: ["bookClassification"],
    };
    await app.MG.store.getProductTypeField(query).then((res) => {
      for (let aindex = 0; aindex < list.length; aindex++) {
        const aitem = list[aindex];
        const iconType = aitem.iconType
        const classType = aitem.classType
      JSON.parse(res[0].config).option.forEach((item) => {
        if (item.value == iconType) {
            if (item.child && item.child.length) {
          item.child.forEach((citem) => {
            if (citem.value == classType) {
              const flag = this.data.bookClass.findIndex((ditem) => ditem == citem.name)
@@ -592,7 +602,11 @@
            }
          });
        }
          }
      });
      }
    });
  },
  // 收藏
@@ -671,7 +685,7 @@
      const checkData = this.data.cmsDatas.find(
        (item) => item.refCode == e.detail.value
      );
      if (!this.data.resourceClassList.length) this.getResourceClass()
      if (checkData) {
        if (e.detail.value == "jsek_cloudLearning") {
          this.setData({
packageBookService/pages/bookServices/examination/examination.js
@@ -1043,6 +1043,9 @@
            questionDataList: questionList,
            cardList: cardUpdatedList,
          });
          console.log(
            '题目', this.data.questionDataList
          );
        });
      });
    }
pages/bookServices/assort/index.js
@@ -25,6 +25,37 @@
    bookList: [],
    loading: false,
    listLoding: false,
    stairListLoading: false,
    rowCol: [{
        width: '50%',
      },
      {
        width: '100%'
      },
      {
        width: '80%'
      },
      {
        width: '100%'
      }, {
        width: '100%'
      },
      {
        width: '100%'
      },
      {
        width: '50%'
      },
      {
        width: '100%'
      },
      {
        width: '80%'
      },
      {
        width: '100%'
      },
    ],
  },
  /**
@@ -87,6 +118,7 @@
  getAssortList() {
    this.setData({
      loading: true,
      listLoding: true,
    });
    const query = {
      path: "*",
@@ -134,7 +166,8 @@
  // 获取一级分类
  getStairList(path) {
    this.setData({
      listLoding: true,
      stairListLoading: true,
      startList: []
    });
    const query = {
      path,
@@ -160,11 +193,13 @@
          (item.icon = getPublicImage(item.icon, 500)) :
          (item.icon = item.icon);
        item.children = await this.getSecondList(item);
      }
      // 一级分类赋值
      this.setData({
        startList: res.datas,
        listLoding: false,
        stairListLoading: false,
        "startCheck.id": res.datas[0].id,
        "startCheck..code": "",
      });
pages/bookServices/assort/index.json
@@ -12,6 +12,7 @@
    "t-radio-group": "tdesign-miniprogram/radio-group/radio-group",
    "t-button": "tdesign-miniprogram/button/button",
    "t-loading": "tdesign-miniprogram/loading/loading",
    "t-image": "tdesign-miniprogram/image/image"
    "t-image": "tdesign-miniprogram/image/image",
    "t-skeleton": "tdesign-miniprogram/skeleton/skeleton"
  }
}
pages/bookServices/assort/index.wxml
@@ -60,20 +60,13 @@
            class="class-list"
            scroll-into-view="{{ 'list' + startCheck.id}}"
          >
            <view wx:if="{{listLoading}}">
              <t-loading
                theme="spinner"
                size="400rpx"
                loading="{{listLoading}}"
              ></t-loading>
            </view>
            <view
              wx:for="{{startList}}"
              wx:for-item="item"
              wx:key="id"
              id="{{ 'list' + item.id}}"
              class="class-box"
              wx:if="{{!listLoading}}"
              wx:if="{{!stairListLoading}}"
            >
              <view class="class-name">{{item.name}}</view>
              <view class="class-content">
@@ -111,6 +104,17 @@
                </view>
              </view>
            </view>
            <view
              wx:if="{{stairListLoading}}"
              style="width: 100%; height: min-content"
            >
              <t-skeleton
                row-col="{{rowCol}}"
                theme="paragraph"
                animation="gradient"
                loading="{{stairListLoading}}"
              ></t-skeleton>
            </view>
            <view class="bottom-box"> </view>
          </scroll-view>
        </view>
pages/bookServices/assort/index.wxss
@@ -186,3 +186,8 @@
  font-size: 28rpx;
  --td-loading-color: #ff6c00
}
.stairList-skeleton {
  width: 100%;
  height: 100%;
}