闫增涛
2024-03-11 f4425543db1c8db8c47a34c53ef477e72cfe318e
feat(答题器): 答题器

答题器

BREAKING CHANGE: 答题器
32个文件已修改
32个文件已添加
2676 ■■■■ 已修改文件
.prettierrc 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.vscode/settings.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
app.json 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/assort/index.js 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/assort/index.wxml 52 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/assort/index.wxss 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/detail/components/learnResource/learnResource.js 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/detail/components/learnResource/learnResource.wxml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/detail/components/learnResource/learnResource.wxss 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/detail/components/note/note.js 302 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/detail/components/note/note.json 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/detail/components/note/note.wxml 66 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/detail/components/note/note.wxss 129 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/detail/components/suggest/suggest.js 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/detail/components/suggest/suggest.json 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/detail/components/suggest/suggest.wxml 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/detail/components/suggest/suggest.wxss 96 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/detail/components/teachResource/index.wxml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/detail/components/teachResource/index.wxss 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/detail/components/testResource/testResource.js 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/detail/components/testResource/testResource.wxml 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/detail/components/testResource/testResource.wxss 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/detail/components/tree/index.js 106 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/detail/components/tree/index.wxml 176 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/detail/components/tree/index.wxss 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/detail/index.js 345 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/detail/index.json 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/detail/index.wxml 196 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/detail/index.wxss 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/examination/examination.js 339 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/examination/examination.json 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/examination/examination.wxml 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/examination/examination.wxss 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/examination/questionList/index.js 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/examination/questionList/index.json 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/examination/questionList/index.wxml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/examination/questionList/index.wxss 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/examination/questionOptions/index.js 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/examination/questionOptions/index.json 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/examination/questionOptions/index.wxml 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/examination/questionOptions/index.wxss 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/examination/questionSchedule/index.js 115 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/examination/questionSchedule/index.json 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/examination/questionSchedule/index.wxml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/examination/questionSchedule/index.wxss 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/list/index.js 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/list/index.json 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/list/index.wxml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookServices/list/index.wxss 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/images/bookService/detail/cart.png 补丁 | 查看 | 原始文档 | blame | 历史
static/images/bookService/detail/compliceHover.png 补丁 | 查看 | 原始文档 | blame | 历史
static/images/bookService/detail/cuoti.png 补丁 | 查看 | 原始文档 | blame | 历史
static/images/bookService/detail/deleteHover.png 补丁 | 查看 | 原始文档 | blame | 历史
static/images/bookService/detail/edit.png 补丁 | 查看 | 原始文档 | blame | 历史
static/images/bookService/detail/feedback.png 补丁 | 查看 | 原始文档 | blame | 历史
static/images/bookService/detail/makeNote.png 补丁 | 查看 | 原始文档 | blame | 历史
static/images/bookService/detail/note-icon.png 补丁 | 查看 | 原始文档 | blame | 历史
static/images/bookService/detail/practice-icon.png 补丁 | 查看 | 原始文档 | blame | 历史
static/images/bookService/detail/wodeshoucang.png 补丁 | 查看 | 原始文档 | blame | 历史
static/images/bookService/detail/zujuan.png 补丁 | 查看 | 原始文档 | blame | 历史
static/images/bookService/examination/collect.png 补丁 | 查看 | 原始文档 | blame | 历史
static/images/bookService/examination/questionCard.png 补丁 | 查看 | 原始文档 | blame | 历史
static/images/bookService/examination/reset.png 补丁 | 查看 | 原始文档 | blame | 历史
static/images/bookService/examination/setting.png 补丁 | 查看 | 原始文档 | blame | 历史
.prettierrc
New file
@@ -0,0 +1,22 @@
{
  "overrides": [
    {
      "files": "*.wxml",
      "options": {
        "parser": "html"
      }
    },
    {
      "files": "*.wxss",
      "options": {
        "parser": "css"
      }
    },
    {
      "files": "*.wxs",
      "options": {
        "parser": "babel"
      }
    }
  ]
}
.vscode/settings.json
@@ -32,7 +32,7 @@
  },
  "editor.tabSize": 2,
  "[wxml]": {
    "editor.defaultFormatter": "wechat.miniprogram.wxml-language-features"
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[css]": {
    "editor.defaultFormatter": "HookyQR.beautify"
app.json
@@ -52,7 +52,8 @@
    "pages/personalCenter/sampleBooks/index",
    "pages/personalCenter/downloads/index",
    "pages/personalCenter/activateProduct/index",
    "pages/testLogin/index"
    "pages/testLogin/index",
    "pages/bookServices/examination/examination"
  ],
  "tabBar": {
    "custom": true,
pages/bookServices/assort/index.js
@@ -1,4 +1,5 @@
// pages/bookServices/assort/index.js
import { getPublicImage } from '../../../assets/js/middleGround/tool'
const app = getApp();
Page({
  /**
@@ -79,9 +80,7 @@
      sort: { type: 'Asc', field: 'LinkOrder' },
    };
    app.MG.store.getStoreChannelList(query).then((res) => {
      const list = res.datas.filter((item) => item.refCode != 'jsek_homepageBookService');
      this.setData({
        assortList: list,
      });
@@ -120,15 +119,14 @@
      sort: { type: 'Asc', field: 'LinkOrder' },
    };
    app.MG.store.getStoreChannelList(query).then(async (res) => {
      console.log(res, 'res');
      // 一级分类选中
      this.setData({
        startCheck: res.datas[0].refCode,
      });
      // this.setData({
      //   startCheck: res.datas[0].refCode,
      // });
      // 获取二级分类
      for (let index = 0; index < res.datas.length; index++) {
        const item = res.datas[index];
        item.icon ? item.icon = getPublicImage(item.icon, 58, 72) : item.icon = item.icon
        item.children = await this.getSecondList(item);
      }
      // 一级分类赋值
@@ -156,22 +154,41 @@
      sort: { type: 'Asc', field: 'LinkOrder' },
    };
    await app.MG.store.getStoreChannelList(query).then((res) => {
      for (let index = 0; index < res.datas.length; index++) {
        const element = res.datas[index];
        if (element.icon)
          element.icon = getPublicImage(element.icon, 58, 72)
      }
      datas = res.datas;
    });
    return datas;
  },
  tabClick(tabData) {
    const data = tabData.currentTarget.dataset.tabdata;
  tabClick(e) {
    const data = e.currentTarget.dataset.tabdata;
    this.setData({
      startCheck: data.refCode,
    });
    console.log(data);
  },
  // 跳转列表页
  goPageList(item) {
    const secondCode = `${item.currentTarget.dataset.staircode.pathLinks[0].linkPath}\\${item.currentTarget.dataset.staircode.id}`;
    wx.navigateTo({
      url: `/pages/bookServices/list/index?assorName=${this.data.assortCheck.name}&assortCode=${this.data.assortCheck.code}&stairCode=${this.data.startCheck}&secondCode=${secondCode}`,
    });
  goPageList(e) {
    const tab = e.currentTarget.dataset.tabdata
    const stair = e.currentTarget.dataset.stair
    this.setData({
      startCheck: tab.refCode
    })
    if (stair) {
      const secondCode = `${stair.pathLinks[0].linkPath}\\${stair.id}`;
      wx.navigateTo({
        url: `/pages/bookServices/list/index?assorName=${this.data.assortCheck.name}&assortCode=${this.data.assortCheck.code}&stairCode=${this.data.startCheck}&secondCode=${secondCode}`,
      });
    } else {
      wx.navigateTo({
        url: `/pages/bookServices/list/index?assorName=${this.data.assortCheck.name}&assortCode=${this.data.assortCheck.code}`,
      });
    }
  },
  navToSearchPage(e) {
    console.log(e.detail.value);
pages/bookServices/assort/index.wxml
@@ -2,13 +2,7 @@
<view class="page-header">
  <!-- 搜索框 -->
  <view class="search">
    <t-search
      t-class-input="t-search__input"
      t-class-input-container="t-search__input-container"
      placeholder="请输入关键词/书名/ISBN/作者"
      leftIcon=""
      bind:submit="navToSearchPage"
    >
    <t-search t-class-input="t-search__input" t-class-input-container="t-search__input-container" placeholder="请输入关键词/书名/ISBN/作者" leftIcon="" bind:submit="navToSearchPage" placeholder-class="placeholder" placeholder-style="font-size:28rpx;">
      <t-icon slot="left-icon" prefix="wr" name="search" size="40rpx" color="#bbb" />
    </t-search>
  </view>
@@ -18,28 +12,14 @@
  <view class="side-bar-wrapper">
    <view class="tab-left">
      <t-side-bar value="{{assortCheck.code}}" bind:change="changeAssort">
        <t-side-bar-item
          wx:for="{{assortList}}"
          wx:key="id"
          value="{{item.refCode}}"
          label="{{item.name}}"
          badge-props="{{item.badgeProps}}"
        />
        <t-side-bar-item wx:for="{{assortList}}" wx:key="id" value="{{item.refCode}}" label="{{item.name}}" badge-props="{{item.badgeProps}}" />
      </t-side-bar>
    </view>
    <view class="side-bar-content">
      <!-- 一级分类 -->
      <view class="tab-top">
        <scroll-view scroll-x="{{true}}" class="myScroll">
          <view
            wx:for="{{startList}}"
            wx:key="id"
            class="row {{startCheck == item.refCode ? 'tab-active' : ''}}"
            bind:tap="tabClick"
            data-tabData="{{item}}"
            wx:if="{{item.children.length}}"
            >{{item.name}}</view
          >
          <view wx:for="{{startList}}" wx:key="id" class="row {{startCheck == item.refCode ? 'tab-active' : ''}}" bind:tap="tabClick" data-tabData="{{item}}">{{item.name}}</view>
        </scroll-view>
      </view>
      <!-- 内容 -->
@@ -47,30 +27,20 @@
        <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="item.refCode"
          id="{{item.refCode}}"
          class="class-box"
          wx:if="{{item.children.length && !listLoading}}"
        >
        <view wx:for="{{startList}}" wx:for-item="item" wx:key="item.refCode" id="{{item.refCode}}" class="class-box" wx:if="{{!listLoading}}">
          <view class="class-name">{{item.name}}</view>
          <view class="class-content">
            <view
              wx:for="{{item.children}}"
              wx:for-item="citem"
              wx:key="id"
              class="book-box"
              bind:tap="goPageList"
              data-stairCode="{{citem}}"
            >
              <t-image src="/static/images/bookService/assort/book-img.png" mode="heightFix" width="58" height="72" />
            <view wx:for="{{item.children}}" wx:for-item="citem" wx:key="id" class="book-box" bind:tap="goPageList" data-stair="{{citem}}" data-tabData="{{item}}" wx:if="{{item.children.length}}">
              <image src="{{citem.icon ? citem.icon : '/static/images/bookService/assort/book-img.png'}}" mode="heightFix" />
              <view class="classify">{{citem.name}}</view>
            </view>
            <view wx:if="{{!item.children.length}}" class="book-box" bind:tap="goPageList" data-tabData="{{item}}">
              <image src="{{item.icon ? item.icon : '/static/images/bookService/assort/book-img.png'}}" mode="heightFix"></image>
              <text class="classify">全部</text>
            </view>
          </view>
        </view>
      </scroll-view>
    </view>
  </view>
</view>
</view>
pages/bookServices/assort/index.wxss
@@ -13,6 +13,11 @@
  left: 0;
  width: 100%;
  z-index: 99;
  font-size: 28rpx;
}
.placeholder {
  font-size: 28rpx;
}
.page-header .t-search__input-container {
@@ -108,7 +113,7 @@
.book-box {
  width: 140rpx;
  margin-right: 10rpx;
  margin: 0 10rpx 20rpx 0
}
.book-box:nth-child(3n) {
@@ -116,8 +121,8 @@
}
.book-box image {
  width: 58px;
  height: 70px;
  height: 142rpx;
  object-fit: contain;
}
.classify {
pages/bookServices/detail/components/learnResource/learnResource.js
@@ -11,13 +11,39 @@
   * 组件的初始数据
   */
  data: {
    receive: false,
    buy: false,
  },
  /**
   * 组件的方法列表
   */
  methods: {
    getFreeResource() {
      var myEventDetail = {} // detail对象,提供给事件监听函数
      var myEventOption = {
        bubbles: true,
        composed: true
      } // 触发事件的选项
      this.triggerEvent('getFreeResource', myEventDetail, myEventOption)
    },
    allAddShoppiingCar() {
      var myEventDetail = {} // detail对象,提供给事件监听函数
      var myEventOption = {
        bubbles: true,
        composed: true
      } // 触发事件的选项
      this.triggerEvent('allAddShoppiingCar', myEventDetail, myEventOption)
    },
    changeReceive(type) {
      this.setData({
        receive: type
      })
    },
    changeBuy(type) {
      this.setData({
        buy: type
      })
    }
  }
})
pages/bookServices/detail/components/learnResource/learnResource.wxml
@@ -1,14 +1,14 @@
<!--pages/bookServices/detail/components/learnResource/learnResource.wxml-->
<view class="learnResource" theme="primary">
  <t-button class="btn" theme="primary" style="height: 72rpx; font-size: 28rpx; " t-class="external-class">
  <t-button loading="{{receive}}" class="btn" theme="primary" style="height: 72rpx; font-size: 28rpx; " t-class="external-class" bind:tap="getFreeResource">
    <t-image src=" /static/images/bookService/detail/yijianlingqu.png"></t-image>
    <text>领取查看</text>
  </t-button>
  <t-button class="btn" theme="primary" style="height: 72rpx; font-size: 28rpx;">
  <t-button loading="{{buy}}" class="btn" theme="primary" style="height: 72rpx; font-size: 28rpx;" bind:tap="allAddShoppiingCar">
    <t-image src="/static/images/bookService/detail/yijiangoumai.png"></t-image>
    一键购买
  </t-button>
  <t-button class="btn" theme="primary" style="height: 72rpx; font-size: 28rpx;">
  <t-button class="btn" theme="primary" style="height: 72rpx; font-size: 28rpx;" wx:if="{{false}}">
    <t-image src="/static/images/bookService/detail/renwudan/icon.png"></t-image>
    学习任务单
  </t-button>
pages/bookServices/detail/components/learnResource/learnResource.wxss
@@ -8,7 +8,7 @@
}
.btn {
  width: 232rpx;
  width: 300rpx;
  font-size: 28rpx;
  --td-button-primary-bg-color: #fff;
  --td-button-primary-border-color: #FF6C00;
@@ -23,4 +23,5 @@
.btn image {
  width: 28rpx;
  height: 32rpx;
  margin: 25rpx 10rpx 0 0;
}
pages/bookServices/detail/components/note/note.js
@@ -1,23 +1,317 @@
// pages/bookServices/detail/components/note/note.js
const app = getApp()
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    bookInfo: {
      type: Object,
      value: {}
    }
  },
  /**
   * 组件的初始数据
   */
  data: {
    inputStyle: 'border: 2rpx solid rgba(220,220,220,1);border-radius: 12rpx; padding:16rpx',
    placeholderstyle: 'font-size:28rpx',
    flag: false, // 输入框是否显示
    submitType: "new", //  新建 or 编辑
    showNoteDialog: false,
    textvalue: '',
    noteId: '',
    showInput: false,
    submitTitle: "",
    pageCount: {
      page: 1,
      total: 0,
    },
    isMore: null,
    noteList: [],
    activeValues: 0,
    loading: false,
  },
  /**
   * 组件的方法列表
   */
  methods: {
    onReachBottom() {
      const flag = this.data.noteList.length < this.data.pageCount.total
      if (flag) {
        this.setData({
          isMore: true,
          "pageCount.page": this.data.pageCount.page + 1
        })
        this.getNoteList()
      } else {
        this.setData({
          isMore: true
        })
        setTimeout(() => {
          this.setData({
            isMore: false
          })
        }, 100)
      }
    },
    handleSubmitTitle() {
      this.setData({
        submitTitle: this.properties.bookInfo.name
      })
    },
    openDialog() {
      this.setData({
        submitTitle: this.properties.bookInfo.name,
        showNoteDialog: true
      })
    },
    closeDialog() {
      this.setData({
        flag: false,
        showNoteDialog: false,
        submitTitle: '',
        textvalue: "",
      })
    },
    textareaChange(e) {
      this.setData({
        textvalue: e.detail.value
      })
    },
    textareaBlur() {
      console.log('失去焦点');
    },
    // 标题输入框值
    inputChange(e) {
      this.setData({
        submitTitle: e.detail.value
      })
    },
    // 弹窗确定按钮
    confirmSuggest() {
      if (!this.data.submitTitle) {
        return wx.showToast({
          icon: 'error',
          title: '请填写笔记标题',
        })
      } else if (!this.data.textvalue) {
        return wx.showToast({
          icon: 'error',
          title: '请填写笔记内容',
        })
      }
      if (this.data.submitType == 'new') {
        this.makeNote()
      } else if (this.data.submitType == 'edit') {
        this.updateNote()
      }
      this.setData({
        showNoteDialog: false
      })
    },
    handleChange(e) {
      this.setData({
        activeValues: e.detail.value
      })
    },
    // 格式化笔记时间
    convertTimestamp(timestamp) {
      const isoDate = new Date(timestamp)
      const year = isoDate.getFullYear()
      const month = String(isoDate.getMonth() + 1).padStart(2, '0')
      const day = String(isoDate.getDate()).padStart(2, '0')
      const hours = String(isoDate.getHours()).padStart(2, '0')
      const minutes = String(isoDate.getMinutes()).padStart(2, '0')
      const seconds = String(isoDate.getSeconds()).padStart(2, '0')
      const formattedDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
      return formattedDate
    },
    changeLoading() {
      this.setData({
        loading:true
      })
    },
    // 获取笔记列表
    async getNoteList() {
      // this.setData({
      //   loading: true
      // })
      let topicId
      await app.MG.ugc
        .getProductUserSubmitTopic({
          productId: this.properties.bookInfo.id,
          appRefCode: app.config.appRefCode
        })
        .then((res) => {
          if (res) {
            topicId = res.id
          } else {
            return wx.showToast({
              icon: "error",
              title: '查询失败',
            })
          }
        })
      // loadings.value.bookResource = true
      let query = {
        start: 0,
        size: this.data.pageCount.page * 5,
        messageType: 'note',
        sort: {
          type: 'Desc',
          field: 'CreateDate'
        },
        appRefCode: app.config.appRefCode,
        topicIdOrRefCode: topicId + ''
      }
      await app.MG.ugc.getTopicMessageList(query).then((res) => {
        // notePage.value.total = res.totalSize
        res.datas.forEach((item) => {
          item.compliceHover = false
          item.deleteHover = false
          item.createDate = this.convertTimestamp(item.createDate)
        })
        this.setData({
          "pageCount.total": res.totalSize,
          noteList: res.datas,
          loading: false
        })
        console.log('笔记列表', res.datas);
      })
    },
    // 新建笔记接口
    async makeNote() {
      const token = wx.getStorageSync('jsek-token')
      if (!token) {
        return wx.getUserProfile({
          desc: '用户登录',
          success: (res) => {
            console.log(res);
          }
        })
      }
      let topicId
      await app.MG.ugc
        .getProductUserSubmitTopic({
          productId: this.properties.bookInfo.id,
          appRefCode: app.config.appRefCode
        })
        .then((res) => {
          if (res) {
            topicId = res.id
          } else {
            return wx.showToast({
              icon: 'error',
              title: '新建失败',
            })
          }
        })
      let query = {
        topicIdOrRefCode: topicId + '',
        name: this.data.submitTitle,
        content: this.data.textvalue,
        type: 'note',
        cmsTypeRefCode: '',
        newDataListRequest: []
      }
      await app.MG.ugc.newTopicMessage(query).then((res) => {
        wx.showToast({
          title: '新建成功',
        })
        this.closeDialog()
        this.getNoteList()
      })
    },
    // 删除笔记
    deleteNote(e) {
      const id = e.currentTarget.dataset.id
      const messageIds = []
      messageIds.push(id)
      wx.showModal({
        title: '提示',
        content: '确认删除该笔记吗?',//editable如果为true,这就是输入框的内容
        editable: false,//是否显示输入框
        placeholderText: '请输入内容吧',//输入框的默认内容
        success: (res) => {
          if (res.confirm) {
            app.MG.ugc
              .delTopicMessage({ messageIds })
              .then((res) => {
                wx.showToast({
                  title: '删除成功',
                })
                // if ((notePage.value.total % 3) - 1 == 0) {
                //   notePage.value.page -= 1
                // }
                this.getNoteList()
              })
          } else if (res.cancel) {
            console.log('用户点击取消')
          }
        }
      })
    },
    // 标题改变
    changeTitle(e) {
      this.setData({
        flag: e.currentTarget.dataset.value
      })
    },
    // 编辑按钮
    editNote(e) {
      const note = e.currentTarget.dataset.note
      this.setData({
        submitType: "edit",
        textvalue: note.content,
        submitTitle: note.name,
        noteId: note.id
      })
      this.openDialog()
    },
    // 编辑笔记接口
    updateNote() {
      const token = wx.getStorageSync('jsek-token')
      if (!token) {
        return wx.getUserProfile({
          desc: '用户登录',
          success: (res) => {
            console.log(res);
          }
        })
      }
      if (!this.data.submitTitle) {
        return wx.showToast({
          icon: 'error',
          title: '请填写笔记标题',
        })
      } else if (!this.data.textvalue) {
        return wx.showToast({
          icon: 'error',
          title: '请填写笔记内容',
        })
      }
      let query = {
        id: this.data.noteId,
        name: this.data.submitTitle,
        description: 'string',
        icon: 'string',
        type: 'note',
        content: this.data.textvalue,
        newDataRequests: [],
        updateDataRequests: []
      }
      app.MG.ugc.updateTopicMessage(query).then((res) => {
        wx.showToast({
          title: '编辑成功',
        })
        this.closeDialog()
        this.getNoteList()
      })
      this.setData({
        submitType: "new"
      })
    }
  }
})
pages/bookServices/detail/components/note/note.json
@@ -1,8 +1,15 @@
{
  "component": true,
  "usingComponents": {
    "t-image": "tdesign-miniprogram/image/image",
    "t-button": "tdesign-miniprogram/button/button",
    "t-collapse": "tdesign-miniprogram/collapse/collapse",
    "t-collapse-panel": "tdesign-miniprogram/collapse-panel/collapse-panel"
    "t-collapse-panel": "tdesign-miniprogram/collapse-panel/collapse-panel",
    "t-dialog": "tdesign-miniprogram/dialog/dialog",
    "t-textarea": "tdesign-miniprogram/textarea/textarea",
    "t-input": "tdesign-miniprogram/input/input",
    "t-loading": "tdesign-miniprogram/loading/loading",
    "t-popup": "tdesign-miniprogram/popup/popup",
    "t-icon": "tdesign-miniprogram/icon/icon"
  }
}
pages/bookServices/detail/components/note/note.wxml
@@ -1,15 +1,63 @@
<!--pages/bookServices/detail/components/note/note.wxml-->
<view class="note">
<view class="note" wx:if="{{!loading && noteList.length}}">
  <view class="note-btn">
    <t-button theme="primary" class="make-note">记笔记</t-button>
    <t-button theme="primary" class="make-note" bind:tap="openDialog" style="width: 240rpx;">
      <view slot="content">
        <t-image src="/static/images/bookService/detail/makeNote.png"></t-image>
        记笔记
      </view>
    </t-button>
  </view>
  <view class="note-content">
    <view class="wrapper">
      <t-collapse value="{{activeValues}}" bind:change="handleChange">
        <t-collapse-panel header="折叠面板标题" value="{{0}}" expandIcon>
          此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容
        </t-collapse-panel>
      </t-collapse>
    <t-collapse value="{{activeValues}}" bind:change="handleChange">
      <t-collapse-panel value="{{item.id}}" expandIcon wx:for="{{noteList}}">
        <view slot="header" class="collapse-header">
          <t-image class="note-icon" src="/static/images/bookService/detail/note-icon.png"></t-image>
          <view class="header-name">{{item.name}}</view>
        </view>
        <view>
          <view class="note-content">{{item.content}}</view>
          <view class="note-bottom">
            <view class="note-time">{{item.createDate}}</view>
            <view class="bottom-btn">
              <t-image src="/static/images/bookService/detail/compliceHover.png" class="complice" bind:tap="editNote" data-note="{{item}}"></t-image>
              <t-image src="/static/images/bookService/detail/deleteHover.png" class="delete" bind:tap="deleteNote" data-id="{{item.id}}"></t-image>
            </view>
          </view>
        </view>
      </t-collapse-panel>
    </t-collapse>
  </view>
  <view class="bottom-box">
    <t-loading wx:if="{{isMore == true}}"></t-loading>
    <text wx:if="{{isMore == false}}">没有更多了</text>
  </view>
</view>
<view class="loading-box" wx:if="{{loading}}">
  <t-loading loading="{{loading}}" size="60rpx"></t-loading>
</view>
<!-- 记笔记弹窗 -->
<t-popup visible="{{showNoteDialog}}" bind:visible-change="onVisibleChange" placement="center">
  <view class="popup">
    <view slot="title">
      <view class="title-text" wx:if="{{!flag}}">
        <text class="note-title">{{submitTitle}}</text>
        <t-image src="/static/images/bookService/detail/edit.png" class="edit-icon" bind:tap="changeTitle" data-value="{{true}}"></t-image>
      </view>
      <view wx:else>
        <t-input value="{{submitTitle}}" data-value="{{false}}" bind:enter="changeTitle" bind:blur="changeTitle" bind:change="inputChange" maxlength="{{50}}" style="{{inputStyle}}"></t-input>
      </view>
    </view>
    <view slot="content" class="content">
      <t-textarea value="{{textvalue}}" t-class="external-class" label="" placeholder="请输入笔记内容" maxcharacter="500" disableDefaultPadding="{{true}}" indicator bind:change="textareaChange" bind:blur="" style="{{inputStyle}}" placeholder-style="{{placeholderstyle}}" />
    </view>
    <view class="submit-btn">
      <t-button theme="primary" size="large" block bind:tap="confirmSuggest">提交</t-button>
    </view>
  </view>
</view>
  <t-icon t-class="close-btn" name="close-circle" size="32" color="#fff" bind:tap="closeDialog" />
</t-popup>
pages/bookServices/detail/components/note/note.wxss
@@ -1,5 +1,9 @@
/* pages/bookServices/detail/components/note/note.wxss */
.note {}
.popup {
  padding: 40rpx;
  width: 600rpx;
}
.note-btn {
  height: 140rpx;
@@ -13,7 +17,130 @@
  --td-button-primary-active-bg-color: #fff0e6;
}
.note-btn image {
  width: 28rpx;
  height: 32rpx;
  margin-top: 24rpx;
}
.note-title {
  width: 90%;
  height: 84rpx;
  line-height: 84rpx;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.make-note {
  margin: 0;
  margin-right: 40rpx;
}
.title-text {
  display: flex;
  align-items: center;
}
.edit-icon {
  margin-left: 10rpx;
  width: 30rpx;
  height: 30rpx;
}
.header {
  display: flex;
}
.note-icon {
  width: 44rpx;
  height: 48rpx;
  margin-right: 20rpx;
}
.collapse-header {
  display: flex;
}
.collapse-header .header-name {
  font-size: 32rpx;
  width: 500rpx;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.note-content {
  height: min-content;
  font-size: 28rpx;
  color: #949494;
  margin-bottom: 20rpx;
  max-height: 600rpx;
  text-align: justify;
  /* padding-bottom: 200rpx; */
}
.wrapper {
  height: 100%;
}
.note-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.bottom-btn {
  height: 40rpx;
  display: flex;
  align-items: center;
}
.note-time {
  color: #D9D9D9;
}
.complice,
.delete {
  width: 30rpx;
  height: 30rpx;
}
.delete {
  margin-left: 40rpx;
}
.loading-box {
  width: 100%;
  min-height: 550rpx;
  display: flex;
  align-items: center;
  justify-content: center;
}
.content {
  margin-top: 20rpx;
}
.close-btn {
  position: absolute;
  left: 50%;
  margin-left: -32rpx;
  bottom: calc(-1 * (48rpx + 64rpx));
}
.submit-btn {
  padding: 40rpx;
  --td-button-border-radius: 60rpx;
  --td-button-primary-bg-color: #ff6c00;
  --td-button-primary-border-color: #ff6c00;
  --td-button-primary-active-bg-color: #ff984d;
  --td-button-primary-active-border-color: #ff984d;
}
.bottom-box {
  display: flex;
  justify-content: center;
}
pages/bookServices/detail/components/suggest/suggest.js
@@ -16,13 +16,14 @@
  },
  data: {
    inputStyle: 'border: 2rpx solid rgba(220,220,220,1);border-radius: 12rpx; padding:16rpx',
    placeholderstyle: 'font-size:28rpx',
    dialogKey: '',
    showWithInput: false,
    showTextAndTitleWithInput: false,
    inputvalue: '',
    textvalue: '',
    ratevalue: 0,
    phoneError: false,
    textError: false,
  },
  methods: {
@@ -52,12 +53,6 @@
      this.setData({
        inputvalue: e.detail.value
      })
      const isPhoneNumber = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(e.detail.value);
      if (this.data.phoneError === isPhoneNumber) {
        this.setData({
          phoneError: !isPhoneNumber,
        });
      }
    },
    // 文本框改变
    textareaChange(e) {
@@ -68,10 +63,6 @@
    feedBack() {
      const token = wx.getStorageSync('jsek-token')
      if (!token) {
        // return wx.showToast({
        //   icon: 'error',
        //   title: '请先登录',
        // })
        return wx.getUserProfile({
          desc: '用户登录',
          success: (res) => {
@@ -79,6 +70,7 @@
          }
        })
      }
      this.closeDialog()
      let content = {
        source: this.data.ratevalue,
        phone: this.data.inputvalue,
@@ -100,20 +92,30 @@
          icon: 'success',
          duration: 2000
        })
        this.closeDialog()
      })
    },
    // 确定
    confirmSuggest() {
      if (!this.data.inputvalue) {
        return this.setData({
          phoneError: true
        })
      }
      if (!this.data.textvalue || this.data.ratevalue) {
      const isPhoneNumber = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(this.data.inputvalue);
      if (!this.data.ratevalue) {
        return wx.showToast({
          success: 'error',
          title: '请填写完整表单',
          icon: "error",
          title: '请选择评分',
        })
      } else if (!this.data.inputvalue) {
        return wx.showToast({
          icon: "error",
          title: '请填写联系方式',
        })
      } else if (!isPhoneNumber) {
        return wx.showToast({
          icon: "error",
          title: '请输入正确联系方式',
        })
      } else if (!this.data.textvalue) {
        return wx.showToast({
          icon: 'error',
          title: '请输入反馈反馈内容',
        })
      }
      this.feedBack()
pages/bookServices/detail/components/suggest/suggest.json
@@ -4,6 +4,10 @@
    "t-dialog": "tdesign-miniprogram/dialog/dialog",
    "t-input": "tdesign-miniprogram/input/input",
    "t-textarea": "tdesign-miniprogram/textarea/textarea",
    "t-rate": "tdesign-miniprogram/rate/rate"
    "t-rate": "tdesign-miniprogram/rate/rate",
    "t-popup": "tdesign-miniprogram/popup/popup",
    "t-icon": "tdesign-miniprogram/icon/icon",
    "t-button": "tdesign-miniprogram/button/button",
    "t-image": "tdesign-miniprogram/image/image"
  }
}
pages/bookServices/detail/components/suggest/suggest.wxml
@@ -1,10 +1,31 @@
<t-dialog visible="{{showWithInput}}" title="我要建议" confirm-btn="确定" cancel-btn="取消" bind:confirm="confirmSuggest" bind:cancel="closeDialog" class="suggest-dialog">
<!-- <t-dialog visible="{{showWithInput}}" title="我要建议" confirm-btn="确定" cancel-btn="取消" bind:confirm="confirmSuggest" bind:cancel="closeDialog" class="suggest-dialog">
  <view slot="content">
    <view class="demo-rate">
      <view class="demo-rate__title">实心评分</view>
      <view class="demo-rate__title">评分</view>
      <t-rate value="{{ratevalue}}" catch:change="onChangeRate" />
    </view>
    <t-input clearable value="{{inputvalue}}" slot="content" label="联系方式" placeholder="请输入联系方式" placeholder-class="placeholder" bind:change="inputChange" type="number" maxlength="{{11}}" tips="{{phoneError ? '手机号输入不正确' : ''}}" />
    <t-textarea value="{{textvalue}}" t-class="external-class" label="标签文字" placeholder="设置最大字符个数,一个汉字表示两个字符" maxcharacter="200" disableDefaultPadding="{{true}}" indicator bind:change="textareaChange" />
    <t-textarea value="{{textvalue}}" t-class="external-class" label="意见反馈" placeholder="请输入内容" maxcharacter="200" disableDefaultPadding="{{true}}" indicator bind:change="textareaChange" />
  </view>
</t-dialog>
</t-dialog> -->
<!-- <view class="suggest"> -->
<t-popup visible="{{showWithInput}}" bind:visible-change="onVisibleChange" placement="center">
  <view class="top-icon">
    <t-image src="/static/images/bookService/detail/feedback.png"></t-image>
  </view>
  <view slot="content" class="content">
    <view class="top-title">我要建议</view>
    <view class="demo-rate">
      <t-rate value="{{ratevalue}}" catch:change="onChangeRate" size="{{30}}" color="#FFB400" />
    </view>
    <view class="phone-input">
      <t-input clearable value="{{inputvalue}}" slot="content" label="" placeholder="请输入联系方式" placeholder-class="placeholder" bind:change="inputChange" type="number" maxlength="{{11}}" class="phone" style="{{inputStyle}}" placeholder-style="{{placeholderstyle}}" />
    </view>
    <t-textarea value="{{textvalue}}" t-class="external-class" label="" placeholder="请输入反馈内容" maxcharacter="200" disableDefaultPadding="{{true}}" indicator bind:change="textareaChange" style="{{inputStyle}}" placeholder-style="{{placeholderstyle}}" />
  </view>
  <view class="submit-btn">
    <t-button theme="primary" size="large" block bind:tap="confirmSuggest">提交</t-button>
  </view>
  <t-icon t-class="close-btn" name="close-circle" size="32" color="#fff" bind:tap="closeDialog" />
</t-popup>
<!-- </view> -->
pages/bookServices/detail/components/suggest/suggest.wxss
@@ -1,19 +1,4 @@
/* pages/bookServices/detail/components/suggest/suggest.wxss */
.suggest-dialog {
  --td-dialog-close-color: #666
}
.t-class-content {
  height: 400px;
}
.t-button--text {
  color: #333
}
.wrapper {
  margin-bottom: 32rpx;
}
.placeholder {
  color: rgba(0, 0, 0, 0.26);
@@ -38,18 +23,7 @@
  line-height: 96rpx;
}
.demo-rate {
  background-color: #fff;
  height: 96rpx;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32rpx;
  border-bottom: solid 1rpx #f0f0f0;
  border-top: solid 1rpx #f0f0f0;
  margin-top: 32rpx;
  margin-bottom: 32rpx;
}
.demo-rate__title {
  width: 200rpx;
@@ -59,4 +33,72 @@
  background-color: transparent;
  padding-left: 32rpx;
  border: 0;
}
.block {
  position: relative;
  width: 240px;
  height: 240px;
  background: #fff;
  border-radius: 16rpx;
}
.close-btn {
  position: absolute;
  left: 50%;
  margin-left: -32rpx;
  bottom: calc(-1 * (48rpx + 64rpx));
}
.wrapper {
  margin: 32rpx;
  display: block;
}
.content {
  position: relative;
  border-radius: 40rpx;
  padding: 100rpx 40rpx 0rpx 40rpx;
  width: 600rpx;
  background-image: linear-gradient(to bottom, #FFF8E5, #fffcf5);
}
.demo-rate {
  width: 350rpx;
  margin: 20rpx auto 20rpx auto;
}
.phone {
  margin-bottom: 16rpx;
  --td-input-border-radius: 20rpx;
  border-radius: 20rpx;
}
.submit-btn {
  padding: 40rpx;
  --td-button-border-radius: 60rpx;
  --td-button-primary-bg-color: #ff6c00;
  --td-button-primary-border-color: #ff6c00;
  --td-button-primary-active-bg-color: #ff984d;
  --td-button-primary-active-border-color: #ff984d;
}
.top-icon {
  top: -50rpx;
  left: 40%;
  position: absolute;
}
.top-icon image {
  width: 146rpx;
  height: 146rpx;
}
.top-title {
  width: 160rpx;
  margin: 0 auto;
  color: #0F1214;
  font-size: 40rpx;
  font-weight: bold;
}
pages/bookServices/detail/components/teachResource/index.wxml
@@ -1,7 +1,7 @@
<view class="teach-btn">
  <t-button theme="primary" style="width: 120px; height: 36px;" class="btn-upload">
    <t-image src="/static/images/bookService/detail/upload.png"></t-image>
    上传资源
<view class="teach-btn" wx:if="{{false}}">
  <t-button theme="primary" style="width: 120px; height: 36px;" class="btn-upload" wx:if="{{false}}">
    <t-image src="/static/images/bookService/detail/upload.png" style="margin-top: 20rpx;"></t-image>
    <text>上传资源</text>
  </t-button>
  <t-button theme="primary" style="width: 120px; height: 36px;">
    <t-image src="/static/images/bookService/detail/download.png"></t-image>
pages/bookServices/detail/components/teachResource/index.wxss
@@ -1,6 +1,6 @@
.teach-btn {
  display: flex;
  justify-content: flex-end;
  justify-content: flex-start;
  align-items: center;
  height: 134rpx;
  --td-button-primary-bg-color: #fff;
@@ -10,21 +10,23 @@
  --td-button-primary-active-border-color: #ff6c00;
}
.teach-btn image {
  width: 32rpx;
  height: 32rpx;
  margin-right: 6rpx;
}
.teach-btn .t-button__content {
.btn-content {
  display: flex;
  align-items: center;
}
.teach-btn image {
  width: 32rpx;
  height: 32rpx;
  margin-right: 6rpx;
  margin-top: 20rpx;
}
.applyResult {
  padding: 0 10rpx;
  width: 740rpx;
  height: 80rpx;
  width: 660rpx;
  min-height: 80rpx;
  display: flex;
  align-items: center;
  margin: 0 auto;
@@ -42,6 +44,7 @@
}
.applyPass {
  background-color: rgba(0, 128, 0, 0.16);
  border: 1px solid green;
}
@@ -51,6 +54,14 @@
  border: 1px solid #ff6c00;
}
.applyNone,
.applyReject,
.applyPass,
.applying {
  margin-top: 40rpx;
  margin-bottom: 40rpx;
}
.btn-box {
  display: flex;
}
pages/bookServices/detail/components/testResource/testResource.js
@@ -1,4 +1,5 @@
// pages/bookServices/detail/components/testResource/testResource.js
const app = getApp()
Component({
  /**
   * 组件的属性列表
@@ -7,6 +8,10 @@
    list: {
      type: Array,
      value: []
    },
    bookInfo: {
      type: Object,
      value: "",
    }
  },
@@ -21,6 +26,59 @@
   * 组件的方法列表
   */
  methods: {
    async goTest(e) {
      const value = e.currentTarget.dataset.value
      const token = wx.getStorageSync('jsek-token')
      if (!token) {
        return wx.getUserProfile({
          desc: '用户登录',
          success: (res) => {
            console.log(res);
          }
        })
      }
      // 获取章节下是否有题目
      let idPathList = []
      let query = {
        path: '*',
        queryType: '*',
        productId: this.properties.bookInfo.id,
        cmsPath: value.productLinkPath,
        pading: {
          start: 0,
          size: 999
        }
      }
      if (value.childrenFolderCount == 0) {
        return wx.showToast({
          icon: "error",
          title: '暂无数据',
        })
      } else {
        const res = await app.MG.store.getProductDetail(query)
        debugger
        res.datas.cmsDatas[0].datas.forEach((item) => {
          idPathList.push({
            id: item.id,
            name: item.name,
            productLinkPath: item.productLinkPath,
            type: item.type
          })
        })
      }
      // query: {
      //   title: bookData.value.test,
      //   bookId: route.query.bookId,
      //   productLinkPath: data.productLinkPath,
      //   answerTitle: data.name,
      //   answerType: 'option',
      //   rootCmsItemId: bookData.value.rootCmsItemId,
      //   idPathList: JSON.stringify(idPathList)
      // }
      wx.navigateTo({
        url: `/pages/bookServices/examination/examination?bookId=${this.properties.bookInfo.id}&productLinkPath=${value.productLinkPath}&rootCmsItemId=${this.properties.bookInfo.rootCmsItemId}&idPathList=${JSON.stringify(idPathList)}&answerTitle=${value.name}&answerType=${'option'}`,
      })
    }
  }
})
pages/bookServices/detail/components/testResource/testResource.wxml
@@ -1,17 +1,38 @@
<!--pages/bookServices/detail/components/testResource/testResource.wxml-->
<view class="test-resource">
  <view class="top-btn">
    <t-button class="practice-btn" theme="primary" size="medium">练习</t-button>
    <t-button class="paper-btn" theme="default" size="medium">组卷</t-button>
    <t-button class="error-btn" theme="default" size="medium">我的错题</t-button>
    <t-button class="collect-btn" theme="default" size="medium">我的收藏</t-button>
    <t-button class="practice-btn" theme="primary" size="medium" style="width: 85px;">
      <view slot="content">
        <t-image src="/static/images/bookService/detail/practice-icon.png"></t-image>
        练习
      </view>
    </t-button>
    <t-button class="paper-btn" theme="default" size="medium" style="width: 85px;">
      <view slot="content">
        <t-image src="/static/images/bookService/detail/zujuan.png"></t-image>
        组卷
      </view>
    </t-button>
    <t-button class="error-btn" theme="default" size="medium" style="padding: 0 12rpx;">
      <view slot="content">
        <t-image src="/static/images/bookService/detail/cuoti.png"></t-image>
        我的错题
      </view>
    </t-button>
    <t-button class="collect-btn" theme="default" size="medium" style="padding: 0 12rpx;">
      <view slot="content">
        <t-image src="/static/images/bookService/detail/wodeshoucang.png"></t-image>
        我的收藏
      </view>
    </t-button>
  </view>
  <view class="resource-list" wx:for="{{list}}" wx:key="item.id">
    <view class="list-title">
      <t-image src="/static/images/bookService/detail/test-icon.png"></t-image>
      <text>{{item.name}}</text>
    </view>
    <view class="practice">
    <view class="practice" bind:tap="goTest" data-value="{{item}}">
      <t-image src="/static/images/bookService/detail/lianxi-icon.png"></t-image>
    </view>
  </view>
pages/bookServices/detail/components/testResource/testResource.wxss
@@ -10,6 +10,7 @@
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #FFF6F0;
}
.list-title image {
@@ -32,6 +33,12 @@
  justify-content: space-evenly;
}
.top-btn image {
  margin-top: 20rpx;
  width: 36rpx;
  height: 36rpx;
}
.practice-btn {
  --td-button-primary-bg-color: #ff6c00;
  --td-button-primary-border-color: #ff6c00;
pages/bookServices/detail/components/tree/index.js
@@ -22,6 +22,14 @@
    applyState: {
      type: String,
      value: ''
    },
    openTeachids: {
      type: Array,
      value: ''
    },
    openLearnids: {
      type: Array,
      value: ""
    }
  },
  data: {
@@ -48,7 +56,6 @@
      }
    },
    downloadTeach(e) {
      console.log('点击了', e);
      const value = e.currentTarget.dataset.value
      var myEventDetail = {
        value,
@@ -58,6 +65,7 @@
        composed: true
      } // 触发事件的选项
      this.triggerEvent('downloadTeach', myEventDetail, myEventOption)
    },
    // 判断资源是否购买
    resourceIsBuy(data) {
@@ -72,11 +80,105 @@
    goPlayer(e) {
      const item = e.currentTarget.dataset.item
      const parent = e.currentTarget.dataset.parent
      console.log(this.properties.bookInfo);
      console.log(item.selectType);
      debugger
      wx.navigateTo({
        url: `/pages/resourceDetails/index?productLinkPath=${item.productLinkPath}&parentProductLinkPath=${parent.productLinkPath}&parentName=${parent.name}&activeId=${item.id}&bookId=${this.properties.bookInfo.id}&bookName=${this.properties.bookInfo.name}&cmsId=${this.properties.bookInfo.rootCmsItemId}`,
      })
      console.log(e);
    },
    // 拿到所有项
    getAllChildren(id) {
      let result = [];
      function findChildren(item) {
        if (item.id === id) {
          if (item.children && item.children.length > 0) {
            item.children.forEach(child => {
              findChildren(child);
            });
          }
        } else {
          if (item.children && item.children.length > 0) {
            item.children.forEach(child => {
              findChildren(child);
            });
          }
        }
        if (item.children && item.children.length > 0) {
          result.push(...item.children);
        }
      }
      this.properties.treeList.forEach(item => {
        findChildren(item);
      });
      return result;
    },
    // 拿到当前项子项
    flattenTree(tree) {
      let result = [];
      function flatten(node) {
        result.push(node);
        if (node.children && node.children.length > 0) {
          node.children.forEach(child => {
            flatten(child);
          });
        }
      }
      tree.forEach(node => {
        flatten(node);
      });
      return result
    },
    findAndUpdateItemById(tree, id) {
      function findAndUpdate(node) {
        if (node.id === id) {
          node.check = true; // 将目标项的 check 属性设置为 true
          return true; // 返回 true 表示找到了目标项
        }
        if (node.children && node.children.length > 0) {
          for (let child of node.children) {
            if (findAndUpdate(child)) {
              return true; // 如果在子节点中找到了目标项,则直接返回 true
            }
          }
        }
        return false; // 表示未找到目标项
      }
      for (let node of tree) {
        if (findAndUpdate(node)) {
          break; // 如果在顶层节点中找到了目标项,直接退出循环
        }
      }
    },
    // 变为true
    findAndUpdateItemsByIds(tree, ids) {
      function findAndUpdate(node) {
        if (ids.includes(node.id)) {
          node.checked = true; // 将目标项的 check 属性设置为 true
        }
        if (node.children && node.children.length > 0) {
          for (let child of node.children) {
            findAndUpdate(child); // 递归处理子节点
          }
        }
      }
      for (let node of tree) {
        findAndUpdate(node); // 对每个顶层节点执行查找和更新操作
      }
      return tree; // 返回修改后的完整数组
    },
    // 章节勾选
    checkResourceTitle(e) {
      const item = e.currentTarget.dataset.item
      let list = this.flattenTree([item])
      let ids = []
      list.forEach(item => {
        ids.push(item.id)
      })
      const tab = this.findAndUpdateItemsByIds([item], ids)
      console.log(ids, tab);
    }
  }
})
pages/bookServices/detail/components/tree/index.wxml
@@ -1,58 +1,168 @@
<view class="tree">
  <t-collapse defaultValue="{{activeValues}}" bind:change="handleChange">
    <t-collapse-panel wx:for="{{treeList}}" wx:for-item="item" wx:for-index="index" wx:key="id" value="{{index}}" expandIcon>
  <t-collapse default-value="{{activeValues}}" bind:change="handleChange">
    <t-collapse-panel
      wx:for="{{treeList}}"
      wx:for-item="item"
      wx:for-index="index"
      wx:key="id"
      value="{{index}}"
      expandIcon
    >
      <view slot="header" class="header-title">
        <view>
          <t-checkbox icon="rectangle" checked="{{item.checked}}" data-item="{{item}}" catch:change="checkResourceTitle" wx:if="{{tab == 'jsek_teachingResources'}}" />
        <view wx:if="{{tab == 'jsek_cloudLearning'}}">
          <t-checkbox
            icon="rectangle"
            checked="{{item.checked}}"
            data-item="{{item}}"
            bind:change="checkResourceTitle"
          />
        </view>
        <text>{{item.name}}</text>
      </view>
      <view class="list" wx:for="{{item.children}}" wx:for-item="citem" wx:for-index="cindex" wx:key="cindex">
      <view
        class="list"
        wx:for="{{item.children}}"
        wx:for-item="citem"
        wx:for-index="cindex"
        wx:key="cindex"
      >
        <!-- // 判断 无子项 且为商品item 直接显示 -->
        <view class="listItems" wx:if="{{citem.childrenFolderCount <= 0 && citem.type == 'productItem'}}">
          <view class="itemsInfo" wx:if="{{citem.name}}" data-item="{{citem}}" data-index="{{cindex}}">
            <view class="contentBox" bind:tap="goPlayer" data-item="{{citem}}" data-parent="{{item}}">
        <view
          class="listItems"
          wx:if="{{citem.childrenFolderCount <= 0 && citem.type == 'productItem'}}"
        >
          <view
            class="itemsInfo"
            wx:if="{{citem.name}}"
            data-item="{{citem}}"
            data-index="{{cindex}}"
          >
            <view
              class="contentBox"
              bind:tap="goPlayer"
              data-item="{{citem}}"
              data-parent="{{item}}"
            >
              <!-- 教学资源 云学习 图标 -->
              <view class="box-image">
                <view class="checkBox">
                  <t-checkbox icon="rectangle" checked="{{citem.checked}}" disabled="{{citem.selectType=='webpage' || citem.isDownload != 1 || citem.fileMap[citem.file].protectType == 'Private'}}" bind:change="checkResource" data-item="{{citem}}" wx:if="{{tab == 'jsek_teachingResources'}}" />
              <view
                class="box-image"
                style="{{ tab == 'jsek_teachingResources' ? 'width: 350rpx;' : 'width: 450rpx;'}}"
              >
                <view class="checkBox" wx:if="{{tab == 'jsek_cloudLearning'}}">
                  <t-checkbox
                    icon="rectangle"
                    checked="{{citem.checked}}"
                    disabled="{{citem.selectType=='webpage' || citem.isDownload != 1 || citem.fileMap[citem.file].protectType == 'Private'}}"
                    catch:change="checkResource"
                    data-item="{{citem}}"
                  />
                </view>
                <!-- 教学资源图标 -->
                <view class="teach-icon">
                  <t-image wx:if="{{citem.selectType == 'audio'}}" src="/static/images/bookService/detail/audioIcon.png" mode="aspectFill" />
                  <t-image wx:if="{{citem.selectType == 'video'}}" src="/static/images/bookService/detail/video.png" mode="aspectFill" />
                  <t-image wx:if="{{citem.selectType == 'pdf'}}" src="/static/images/bookService/detail/pdf.png" mode="aspectFill" />
                  <t-image wx:if="{{citem.selectType == 'webpage'}}" src="/static/images/bookService/detail/net.png" mode="aspectFill" />
                  <t-image wx:if="{{citem.selectType == 'picture'}}" src="/static/images/bookService/detail/picture.png" mode="aspectFill" />
                  <t-image wx:if="{{citem.selectType == 'zip'}}" src="/static/images/bookService/detail/zip.png" mode="aspectFill" />
                  <t-image wx:if="{{ citem.fileMap[citem.file].extension == 'doc' ||  citem.fileMap[citem.file].extension == 'docx'}}" src="/static/images/bookService/detail/word.png" mode="aspectFill" />
                  <t-image wx:if="{{ citem.fileMap[citem.file].extension == 'xlsx' ||  citem.fileMap[citem.file].extension == 'xlsx'}}" src="/static/images/bookService/detail/excel.png" mode="aspectFill" />
                  <t-image wx:if="{{ citem.fileMap[citem.file].extension == 'ppt' ||  citem.fileMap[citem.file].extension == 'pptx'}}" src="/static/images/bookService/detail/PPT.png" mode="aspectFill" />
                  <t-image
                    wx:if="{{citem.selectType == 'audio'}}"
                    src="/static/images/bookService/detail/audioIcon.png"
                    mode="aspectFill"
                  />
                  <t-image
                    wx:if="{{citem.selectType == 'video'}}"
                    src="/static/images/bookService/detail/video.png"
                    mode="aspectFill"
                  />
                  <t-image
                    wx:if="{{citem.selectType == 'pdf'}}"
                    src="/static/images/bookService/detail/pdf.png"
                    mode="aspectFill"
                  />
                  <t-image
                    wx:if="{{citem.selectType == 'webpage'}}"
                    src="/static/images/bookService/detail/net.png"
                    mode="aspectFill"
                  />
                  <t-image
                    wx:if="{{citem.selectType == 'picture'}}"
                    src="/static/images/bookService/detail/picture.png"
                    mode="aspectFill"
                  />
                  <t-image
                    wx:if="{{citem.selectType == 'zip'}}"
                    src="/static/images/bookService/detail/zip.png"
                    mode="aspectFill"
                  />
                  <t-image
                    wx:if="{{ citem.fileMap[citem.file].extension == 'doc' ||  citem.fileMap[citem.file].extension == 'docx'}}"
                    src="/static/images/bookService/detail/word.png"
                    mode="aspectFill"
                  />
                  <t-image
                    wx:if="{{ citem.fileMap[citem.file].extension == 'xlsx' ||  citem.fileMap[citem.file].extension == 'xlsx'}}"
                    src="/static/images/bookService/detail/excel.png"
                    mode="aspectFill"
                  />
                  <t-image
                    wx:if="{{ citem.fileMap[citem.file].extension == 'ppt' ||  citem.fileMap[citem.file].extension == 'pptx'}}"
                    src="/static/images/bookService/detail/PPT.png"
                    mode="aspectFill"
                  />
                </view>
                <!-- 云学习图标 -->
                <view>
                </view>
                <view> </view>
                <!-- 名称 -->
                <text class="name">{{citem.name}}</text>
                <text
                  class="name"
                  style="{{ tab == 'jsek_teachingResources' ? 'width: 300rpx;' : 'width: 400rpx;'}}"
                  >{{citem.name}}</text
                >
              </view>
              <!-- 教学资源类型 -->
              <view class="teachClass">
                {{citem.resourceClass}}
              </view>
              <view class="teach-btn" wx:if="{{tab == 'jsek_teachingResources'}}">
              <view class="teachClass"> {{citem.resourceClass}} </view>
              <view
                class="teach-btn"
                wx:if="{{tab == 'jsek_teachingResources'}}"
              >
                <!--  下载按钮 -->
                <t-image src="/static/images/bookService/detail/download-icon.png" width="16" height="16" class="download" data-value="{{citem}}" bind:tap="downloadTeach"></t-image>
                <t-image
                  src="/static/images/bookService/detail/download-icon.png"
                  width="16"
                  height="16"
                  class="download"
                  data-value="{{citem}}"
                  catchtap="downloadTeach"
                ></t-image>
              </view>
              <view wx:if="{{tab == 'jsek_cloudLearning'}}">
                <t-image src="/static/images/bookService/detail/shikan.png" class="testSee" wx:if="{{citem.isuy }}"></t-image>
                <t-image src="/static/images/bookService/detail/need-buy.png" class="need-buy"></t-image>
                <!-- 云学习试看图标 -->
                <t-image
                  src="/static/images/bookService/detail/shikan.png"
                  class="testSee"
                  wx:if="{{!citem.isbuy ? false : citem.freeFile ? true : false}}"
                ></t-image>
                <!-- 云学习加入购物车图标 -->
                <t-image
                  src="/static/images/bookService/detail/cart.png"
                  wx:if="{{citem.isShopCar}}"
                  class="shopCar"
                ></t-image>
                <!-- 云学习购买图标 -->
                <t-image
                  src="/static/images/bookService/detail/need-buy.png"
                  class="need-buy"
                  wx:if="{{citem.isbuy }}"
                ></t-image>
              </view>
            </view>
          </view>
        </view>
        <!-- // 判断 不是商品 有子项 递归组件 -->
        <tree wx:else bookInfo="{{bookInfo}}" treeList="{{[citem]}}" itemId="{{itemId}}" tab="{{tab}}"></tree>
        <tree
          wx:else
          bookInfo="{{bookInfo}}"
          treeList="{{[citem]}}"
          itemId="{{itemId}}"
          tab="{{tab}}"
          openTeachids="{{openTeachids}}"
          openLearnids="{{openLearnids}}"
        ></tree>
      </view>
      <view class="listItems" wx:if="{{children.length <= 0 && !loading}}">
        暂无数据
@@ -62,4 +172,4 @@
      </view>
    </t-collapse-panel>
  </t-collapse>
</view>
</view>
pages/bookServices/detail/components/tree/index.wxss
@@ -1,5 +1,7 @@
.tree {
  --td-collapse-content-padding: 32rpx 12rpx 32rpx 32rpx;
  --td-collapse-content-padding: 0rpx 12rpx 32rpx 12rpx;
  --td-collapse-header-text-color: #ff6C00;
  --td-collapse-icon-color: #ff6c00
}
.header-title {
@@ -8,9 +10,15 @@
  --td-checkbox-vertical-padding: 0
}
.t-class {
  background-color: #F7F7F7;
}
.t-class-content {
  padding: 0;
}
.contentBox {
  padding: 0 26rpx;
@@ -55,7 +63,13 @@
}
.testSee,
.need-buy {
.need-buy,
.shopCar {
  width: 38rpx;
  height: 38rpx;
}
.testSee,
.shopCar {
  margin-right: 20rpx;
}
pages/bookServices/detail/index.js
@@ -37,7 +37,10 @@
    rejectCause: "",  // 下载拒绝原因
    buyIdList: [],
    shoppingCartGetId: [], // 已购买id列表
    shoppingList: []
    shoppingList: [],
    loading: false,
    isShowTeachDownload: false,  // 提示PC下载弹窗状态
    confirmBtn: { content: '我知道了', variant: 'base' },
  },
  resetTree: function (e) {
@@ -98,12 +101,20 @@
  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() { },
  onPullDownRefresh() {
  },
  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() { },
  onReachBottom() {
    if (this.data.tabValue == 'jesk_note') {
      const child = this.selectComponent('#note')
      child.onReachBottom()
    }
  },
  /**
   * 用户点击右上角分享
@@ -200,7 +211,8 @@
        freeEpubPage: [], //epub试读百分比
      },
    };
    app.MG.store.getProductDetail(query).then((res) => {
    app.MG.store.getProductDetail(query).then(async (res) => {
      this.setData({
        bookDetail: res.datas,
        cmsDatas: res.datas.cmsDatas[0].datas,
@@ -209,9 +221,10 @@
      // 获取图书分类
      const iconType = JSON.parse(res.datas.bookClassification)[0][0];
      const classType = JSON.parse(res.datas.bookClassification)[0][1];
      const className = await this.getBookClass(iconType, classType)
      this.setData({
        'bookDetail.publicationDate': this.formatDate(this.data.bookDetail.publicationDate),
        'bookDetail.class': this.getBookClass(iconType, classType),
        'bookDetail.class': className,
        'bookDetail.price': this.numFormat(this.data.bookDetail.price),
        'bookDetail.oldPrice': this.numFormat(this.data.bookDetail.oldPrice),
        'bookDetail.paperPrice': this.numFormat(this.data.bookDetail.paperPrice),
@@ -219,17 +232,17 @@
    });
  },
  // 获取图书分类
  getBookClass(iconType, classType) {
  async getBookClass(iconType, classType) {
    let name = '';
    const query = {
      refCodes: ['bookClassification'],
    };
    app.MG.store.getProductTypeField(query).then((res) => {
    await app.MG.store.getProductTypeField(query).then((res) => {
      JSON.parse(res[0].config).option.forEach((item) => {
        if (item.value == iconType) {
          item.child.forEach((item) => {
            if (item.value == classType) {
              name = item.name;
          item.child.forEach((citem) => {
            if (citem.value == classType) {
              name = citem.name;
            }
          });
        }
@@ -298,7 +311,17 @@
          || (e.detail.value == 'questionBank' && !this.data.test.length)) {
          this.getResourceData(checkData)
        }
      }
    } else if (e.detail.label == '云笔记') {
      const token = wx.getStorageSync('jsek-token')
      const child = this.selectComponent('#note')
      child.handleSubmitTitle()
      if (token) {
        child.changeLoading()
        child.getNoteList()
      }
    }
  },
  // 获取资源所属分类
@@ -314,6 +337,9 @@
  },
  //  获取教学资源  云学习  云测试
  getResourceData(type) {
    this.setData({
      loading: true
    })
    let query = {
      path: '*',
      queryType: '*',
@@ -355,13 +381,15 @@
              })
              const list = await this.getAllResource(res.datas.cmsDatas[0].datas)
              this.setData({
                teach: list
                teach: list,
                loading: false
              })
              this.findChildIds(this.data.teach, this.data.openTeachids = [])
            } else if (type.refCode == 'jsek_cloudLearning') {
              const list = await this.getAllResource(res.datas.cmsDatas[0].datas)
              this.setData({
                learn: list
                learn: list,
                loading: false
              })
              this.findChildIds(this.data.learn, this.data.openLearnids = [])
            }
@@ -371,10 +399,9 @@
        } else if (type.refCode == 'jsek_questionBank') {
          // const list = await this.getAllResource(res.datas.cmsDatas[0].datas)
          this.setData({
            test: res.datas.cmsDatas[0].datas
            test: res.datas.cmsDatas[0].datas,
            loading: false
          })
          // this.findChildIds(this.data.test, this.data.openTestids = [])
          console.log('云测试', this.data.test);
        } else {
          console.log('其他');
        }
@@ -528,14 +555,14 @@
          const endDate = JSON.parse(applyResource.feedBack).endDate
          // const endDate = new Date(JSON.parse(applyResource.feedBack).endDate + ' 23:59:59').getTime()
          if (endDate == '永久') {
            // deadline.value = '永久'
            this.setData({
              applyState: 'Normal',
              deadline: '永久',
            })
            console.log('有效日期', this.data.deadline);
          } else {
            let endTime = new Date(endDate + ' 23:59:59').getTime()
            // deadline.value = endDate + ' 23:59:59'
            this.setData({
              deadline: endDate + ' 23:59:59'
            })
@@ -560,9 +587,8 @@
          applyState: 'none'
        })
      }
      console.log('申请通过', this.data.applyState);
    })
    console.log('有效日期', this.data.deadline);
  },
  // 申请教学资源
  applyResource() {
@@ -607,92 +633,102 @@
    //   // logIn()
    // }
  },
  // 教学资源下载前往PC提示Diialog
  closeTeachDownload() {
    this.setData({
      isShowTeachDownload: false
    })
  },
  // 下载功能
  downloadTeach(e) {
    const data = e.detail.value
    // const data
    // let role = userStore.userInfo ? userStore.userInfo.role : null
    // if (role) {
    //   if (role == 'Teacher') {
    if (this.properties.applyState == 'Normal' || this.properties.applyState == 'none') {
      // 是否允许下载
      if (data.isDownload == 1) {
        // 申请通过
        let url = app.config.requestCtx + '/file/api/ApiDownloadForAuthorize?md5='
        if (data.file) {
          // 判断是否私有
          if (data.fileMap[data.file].protectType == 'Private')
            return Message.error({
              context: this,
              offset: ['20rpx', '32rpx'],
              duration: 5000,
              content: '该文件无法下载'
            })
          url = url + data.file + '&token=' + wx.getStorageSync('jsek-token')
        } else if (data.freeFile) {
          url = url + data.freeFile + '&token=' + wx.getStorageSync('jsek-token')
        } else {
          Message.error({
            context: this,
            offset: ['20rpx', '32rpx'],
            duration: 5000,
            content: '暂无资源',
          })
        }
        this.downloadFile(url)
      } else {
        Message.error({
          context: this,
          offset: ['20rpx', '32rpx'],
          duration: 5000,
          content: '该资源无法下载',
        })
      }
    } else if (this.properties.applyState == 'WaitAudit') {
      // ElMessageBox.confirm('请先申请下载!', '尊敬的用户,您好!', {
      //   confirmButtonText: '申请',
      //   cancelButtonText: '取消',
      //   type: 'warning'
      // })
      //   .then(() => applyBookInfo())
      //   .catch()
      Message.error({
        context: this,
        offset: ['20rpx', '32rpx'],
        duration: 5000,
        content: '该资源下载申请审核中',
      })
    } else if (this.properties.applyState == 'Reject') {
      Message.error({
        context: this,
        offset: ['20rpx', '32rpx'],
        duration: 5000,
        content: '资源下载申请未通过'
      })
    } else {
      // Message.error({
      //   context: this,
      //   offset: ['20rpx', '32rpx'],
      //   duration: 5000,
      //   content: '请先申请下载'
      // })
      console.log('请先申请下载');
    }
    //   } else {
    //     ElMessageBox.confirm('请先进行教师认证!', '尊敬的用户,您好!', {
    //       confirmButtonText: '去认证',
    //       cancelButtonText: '取消',
    //       type: 'warning'
    //     })
    //       .then(() => {
    //         isShow.value = true
    this.setData({
      isShowTeachDownload: true
    })
    console.log('zhuan', this.data.isShowTeachDownload);
    //   const data = e.detail.value
    //   // const data
    //   // let role = userStore.userInfo ? userStore.userInfo.role : null
    //   // if (role) {
    //   //   if (role == 'Teacher') {
    //   if (this.properties.applyState == 'Normal' || this.properties.applyState == 'none') {
    //     // 是否允许下载
    //     if (data.isDownload == 1) {
    //       // 申请通过
    //       let url = app.config.requestCtx + '/file/api/ApiDownloadForAuthorize?md5='
    //       if (data.file) {
    //         // 判断是否私有
    //         if (data.fileMap[data.file].protectType == 'Private')
    //           return Message.error({
    //             context: this,
    //             offset: ['20rpx', '32rpx'],
    //             duration: 5000,
    //             content: '该文件无法下载'
    //           })
    //         url = url + data.file + '&token=' + wx.getStorageSync('jsek-token')
    //       } else if (data.freeFile) {
    //         url = url + data.freeFile + '&token=' + wx.getStorageSync('jsek-token')
    //       } else {
    //         Message.error({
    //           context: this,
    //           offset: ['20rpx', '32rpx'],
    //           duration: 5000,
    //           content: '暂无资源',
    //         })
    //       }
    //       this.downloadFile(url)
    //     } else {
    //       Message.error({
    //         context: this,
    //         offset: ['20rpx', '32rpx'],
    //         duration: 5000,
    //         content: '该资源无法下载',
    //       })
    //       .catch(() => { })
    //     }
    //   } else if (this.properties.applyState == 'WaitAudit') {
    //     // ElMessageBox.confirm('请先申请下载!', '尊敬的用户,您好!', {
    //     //   confirmButtonText: '申请',
    //     //   cancelButtonText: '取消',
    //     //   type: 'warning'
    //     // })
    //     //   .then(() => applyBookInfo())
    //     //   .catch()
    //     Message.error({
    //       context: this,
    //       offset: ['20rpx', '32rpx'],
    //       duration: 5000,
    //       content: '该资源下载申请审核中',
    //     })
    //   } else if (this.properties.applyState == 'Reject') {
    //     Message.error({
    //       context: this,
    //       offset: ['20rpx', '32rpx'],
    //       duration: 5000,
    //       content: '资源下载申请未通过'
    //     })
    //   } else {
    //     // Message.error({
    //     //   context: this,
    //     //   offset: ['20rpx', '32rpx'],
    //     //   duration: 5000,
    //     //   content: '请先申请下载'
    //     // })
    //     console.log('请先申请下载');
    //   }
    // } else {
    //   logIn()
    // }
    //   //   } else {
    //   //     ElMessageBox.confirm('请先进行教师认证!', '尊敬的用户,您好!', {
    //   //       confirmButtonText: '去认证',
    //   //       cancelButtonText: '取消',
    //   //       type: 'warning'
    //   //     })
    //   //       .then(() => {
    //   //         isShow.value = true
    //   //       })
    //   //       .catch(() => { })
    //   //   }
    //   // } else {
    //   //   logIn()
    //   // }
  },
  downloadFile(url) {
    wx.downloadFile({
@@ -749,7 +785,6 @@
        shoppingList: res.datas,
        shoppingCartGetId: list
      })
      console.log('购买', this.data);
    })
  },
  // 判断资源加入购物车按钮是否显示
@@ -778,7 +813,7 @@
      flattenedArray.push(node)
      // 递归处理子节点
      if (node.children && node.children.length > 0) {
        const childrenArray = handleTreeData(node.children)
        const childrenArray = this.handleTreeData(node.children)
        flattenedArray.push(...childrenArray)
      }
    })
@@ -786,18 +821,28 @@
  },
  // 云学习一键领取
  async getFreeResource() {
    // if (!localStorage.getItem('jsek-token')) {
    //   return logIn()
    // }
    let arr = handleTreeData(this.data.learn).filter((item) => resourceIsBuy(item))
    const child = this.selectComponent('#learn-resource')
    const token = wx.getStorageSync('jsek-token')
    if (!token) {
      return wx.getUserProfile({
        desc: '用户登录',
        success: (res) => {
          console.log(res);
        }
      })
    }
    let arr = this.handleTreeData(this.data.learn).filter((item) => this.resourceIsBuy(item))
    let freeIds = arr.filter((item) => {
      return item.saleMethod[0].Price == 0
    })
    if (!freeIds.length) return console.log('暂无免费资源')
    btnLoading.freeBtn = true
    if (!freeIds.length) return wx.showToast({
      icon: "error",
      title: '暂无免费资源',
    })
    child.changeReceive(true)
    let requests = []
    freeIds.forEach((item, index) => {
      if (resourceIsBuy(item)) {
      if (this.resourceIsBuy(item)) {
        requests.push({
          saleMethodId: item.saleMethod[0].Id,
          count: 1
@@ -815,14 +860,84 @@
        orderNum: initOrderRes.orderNumber
      }
      // 确认订单
      const confirmOrderRes = await MG.store.confirmOrder(parameter)
      const confirmOrderRes = await app.MG.store.confirmOrder(parameter)
      if (confirmOrderRes.orderNumber) {
        // btnLoading.freeBtn = false
        console.log('领取成共');
        child.changeReceive(false)
        wx.showToast({
          title: '领取成功',
        })
        this.getBookInfo(this.data.bookId)
      }
    } catch (error) {
      console.log(error)
    }
  }
  },
  // 云学习一键购买
  async allAddShoppiingCar() {
    const child = this.selectComponent('#learn-resource')
    const token = wx.getStorageSync('jsek-token')
    if (!token) {
      return wx.getUserProfile({
        desc: '用户登录',
        success: (res) => {
          console.log(res);
        }
      })
    }
    let shopList = this.handleTreeData(this.data.learn).filter((item) => this.resourceIsBuy(item))
    this.getShoppingCartProductGet()
    if (!shopList.length) return wx.showToast({
      icon: "error",
      title: '已全部购买',
    })
    child.changeBuy(true)
    let requests = []
    shopList.forEach((item) => {
      requests.push({
        saleMethodId: item.saleMethod[0].Id,
        count: 1,
      })
    })
    let query = {
      remarks: '云学习',
      requests,
    }
    const initOrderRes = await app.MG.store.initOrder(query)
    child.changeBuy(false)
    // 检查订单号是否存在
    if (initOrderRes.orderNumber) {
      // bookService: orderNumber.value,  少传这个 ,暂时不知道有什么用
      wx.navigateTo({
        url: `/pages/cart/paymentPage/index?&bookId=${this.data.bookDetail.id}&bookName=${this.data.bookDetail.name}&orderNum=${initOrderRes.orderNumber}`,
      })
    } else {
      // 订单号不存在,显示警告消息
      wx.showToast({
        icon: "error",
        title: '请重试',
      })
    }
  },
  // 变为所有check   true
  findAndUpdateItemsByIds(tree, ids) {
    function findAndUpdate(node) {
      if (ids.includes(node.id)) {
        node.checked = true; // 将目标项的 check 属性设置为 true
      }
      if (node.children && node.children.length > 0) {
        for (let child of node.children) {
          findAndUpdate(child); // 递归处理子节点
        }
      }
    }
    for (let node of tree) {
      findAndUpdate(node); // 对每个顶层节点执行查找和更新操作
    }
    return tree; // 返回修改后的完整数组
  },
  handleTrue() {
    // findAndUpdateItemsByIds(this.date.)
  },
})
pages/bookServices/detail/index.json
@@ -13,7 +13,9 @@
    "note": "/pages/bookServices/detail/components/note/note",
    "tree": "/pages/bookServices/detail/components/tree/index",
    "suggest": "/pages/bookServices/detail/components/suggest/suggest",
    "t-loading": "tdesign-miniprogram/loading/loading"
    "t-loading": "tdesign-miniprogram/loading/loading",
    "t-dialog": "tdesign-miniprogram/dialog/dialog"
  },
  "navigationStyle": "custom"
  "navigationStyle": "custom",
  "onReachBottomDistance": 200
}
pages/bookServices/detail/index.wxml
@@ -3,29 +3,48 @@
<view style="width: 100%; height: {{barHeight}}px; "></view>
<view class="nacigationBar" style="width: 70%; height: {{navBarHeight}}px;">
  <view>
    <t-icon name="chevron-left" size="30" data-name="{{item}}" bind:click="goBack" />
    <t-icon
      name="chevron-left"
      size="30"
      data-name="{{item}}"
      bind:click="goBack"
    />
  </view>
  <view class="navbar-title">{{options.name}}</view>
</view>
<scroll-view scroll-y="{{true}}" class="book">
<scroll-view scroll-y="{{true}}" class="book" bindscrolltolower="onReachBottom">
  <!-- 图书详情 -->
  <view class="book-box">
    <view class="book-detail">
      <view class="detail-left">
        <view class="book-img">
          <t-image src="{{bookDetail.icon}}" mode="aspectFill" width="120" height="170" aria-label="{{bookDetail.name}}" />
          <t-image
            src="{{bookDetail.icon}}"
            mode="aspectFill"
            width="120"
            height="170"
            aria-label="{{bookDetail.name}}"
          />
        </view>
        <view class="book-use">
          <view class="collect" bind:tap="setCollect">
            <view>
              <t-image src="/static/images/bookService/detail/collect.png" wx:if="{{!bookDetail.isFavourite}}"></t-image>
              <t-image src="/static/images/bookService/detail/collecting.png" wx:if="{{bookDetail.isFavourite}}"></t-image>
              <t-image
                src="/static/images/bookService/detail/collect.png"
                wx:if="{{!bookDetail.isFavourite}}"
              ></t-image>
              <t-image
                src="/static/images/bookService/detail/collecting.png"
                wx:if="{{bookDetail.isFavourite}}"
              ></t-image>
            </view>
            <view class="use-title">收藏</view>
          </view>
          <view class="suggest" bind:tap="suggestBtn">
            <view>
              <t-image src="/static/images/bookService/detail/suggest.png"></t-image>
              <t-image
                src="/static/images/bookService/detail/suggest.png"
              ></t-image>
            </view>
            <view class="use-title">我要建议</view>
          </view>
@@ -50,9 +69,13 @@
            <view class="li-title">出版时间:</view>
            <view class="li-content">{{bookDetail.publicationDate}}</view>
          </view>
          <view class="message-li">
          <view
            class="message-li"
            wx:if="{{bookDetail.class}}"
            style="height: 80rpx"
          >
            <view class="li-title">图书分类:</view>
            <view class="li-content">{{bookDetail.class}}</view>
            <view class="class-name showTow">{{bookDetail.class}}</view>
          </view>
        </view>
      </view>
@@ -63,11 +86,16 @@
        <!-- 电子书售价 -->
        <view class="electron-price">
          <view>
            <t-image src="/static/images/bookService/detail/electon-price.png"></t-image>
            <t-image
              src="/static/images/bookService/detail/electon-price.png"
            ></t-image>
          </view>
          <view class="price">
            <view class="price-text">¥{{bookDetail.price == '0.00' ? '免费' :bookDetail.price}}</view>
            <view class="price-old" wx:if="{{bookDetail.oldPrice != '0.00'}}">¥{{bookDetail.oldPrice}} <view class="line"></view>
            <view class="price-text"
              >¥{{bookDetail.price == '0.00' ? '免费' :bookDetail.price}}</view
            >
            <view class="price-old" wx:if="{{bookDetail.oldPrice != '0.00'}}"
              >¥{{bookDetail.oldPrice}} <view class="line"></view>
            </view>
          </view>
          <view> </view>
@@ -75,41 +103,131 @@
        <!-- 纸质书售价 -->
        <view class="paper-price">
          <view>
            <t-image src="/static/images/bookService/detail/paper-price.png"></t-image>
            <t-image
              src="/static/images/bookService/detail/paper-price.png"
            ></t-image>
          </view>
          <view class="price">¥{{bookDetail.paperPrice == '0.00' ? '免费' : bookDetail.paperPrice}}</view>
          <view class="price"
            >¥{{bookDetail.paperPrice == '0.00' ? '免费' :
            bookDetail.paperPrice}}</view
          >
        </view>
      </view>
      <!-- 网店 -->
      <view class="book-web">
        <t-image src="/static/images/bookService/detail/jd.png" wx:if="{{bookDetail.JDLink}}" bind:tap="goShop" data-link="{{bookDetail.tmallLink}}" data-type="jd"></t-image>
        <t-image src="/static/images/bookService/detail/tmall.png" width="32" height="22" bind:tap="goShop" data-link="{{bookDetail.tmallLink}}" wx:if="{{bookDetail.tmallLink}}"></t-image>
        <t-image src="/static/images/bookService/detail/dangdang.png" bind:tap="goShop" data-link="{{bookDetail.dangdangLink}}" wx:if="{{bookDetail.dangdangLink}}"></t-image>
        <t-image src="/static/images/bookService/detail/jd.png" bind:tap="goShop" data-link="{{bookDetail.weidianLink}}" wx:if="{{bookDetail.weidianLink}}"></t-image>
        <t-image
          src="/static/images/bookService/detail/jd.png"
          wx:if="{{bookDetail.JDLink}}"
          bind:tap="goShop"
          data-link="{{bookDetail.tmallLink}}"
          data-type="jd"
        ></t-image>
        <t-image
          src="/static/images/bookService/detail/tmall.png"
          width="32"
          height="22"
          bind:tap="goShop"
          data-link="{{bookDetail.tmallLink}}"
          wx:if="{{bookDetail.tmallLink}}"
        ></t-image>
        <t-image
          src="/static/images/bookService/detail/dangdang.png"
          bind:tap="goShop"
          data-link="{{bookDetail.dangdangLink}}"
          wx:if="{{bookDetail.dangdangLink}}"
        ></t-image>
        <t-image
          src="/static/images/bookService/detail/jd.png"
          bind:tap="goShop"
          data-link="{{bookDetail.weidianLink}}"
          wx:if="{{bookDetail.weidianLink}}"
        ></t-image>
      </view>
    </view>
  </view>
  <view class="book-resource">
    <t-tabs defaultValue="{{tabValue}}" bind:change="onTabsChange" t-class="custom-tabs" t-class-content="custom-panel" class="tab-class">
    <t-tabs
      defaultValue="{{tabValue}}"
      bind:change="onTabsChange"
      t-class="custom-tabs"
      t-class-content="custom-panel"
      class="tab-class"
    >
      <t-tab-panel label="图书简介" value="brief" style="{{tabPanelstyle}}">
        <book-brief content="{{bookDetail.content}}" authorIntroduction="{{bookDetail.authorIntroduction}}"></book-brief>
        <book-brief
          content="{{bookDetail.content}}"
          authorIntroduction="{{bookDetail.authorIntroduction}}"
        ></book-brief>
      </t-tab-panel>
      <t-tab-panel label="电子书" value="1" style="{{tabPanelstyle}}">
        电子书
      </t-tab-panel>
      <t-tab-panel label="教学资源" value="jsek_teachingResources">
        <teach-resource applyState="{{applyState}}" rejectCause="{{rejectCause}}" bind:applyResource="applyResource"></teach-resource>
        <tree bookInfo="{{bookDetail}}" treeList="{{teach}}" tab="{{tabValue}}" applyState="{{applyState}}" bind:downloadTeach="downloadTeach"></tree>
      <t-tab-panel
        label="教学资源"
        value="jsek_teachingResources"
        class="{{loading ? 'loading': ''}}"
      >
        <view wx:if="{{!loading && teach.length}}">
          <teach-resource
            applyState="{{applyState}}"
            rejectCause="{{rejectCause}}"
            bind:applyResource="applyResource"
          ></teach-resource>
          <tree
            bookInfo="{{bookDetail}}"
            treeList="{{teach}}"
            tab="{{tabValue}}"
            applyState="{{applyState}}"
            bind:downloadTeach="downloadTeach"
            openTeachids="{{openTeachids}}"
          ></tree>
        </view>
        <t-loading
          theme="circular"
          size="60rpx"
          class="loading"
          loading="{{loading}}"
        />
      </t-tab-panel>
      <t-tab-panel label="云学习" value="jsek_cloudLearning" style="{{tabPanelstyle}}">
        <learn-resource></learn-resource>
        <tree bookInfo="{{bookDetail}}" tab="{{tabValue}}" treeList="{{learn}}" buyIds="{{buyIdList}}"></tree>
      <t-tab-panel
        label="云学习"
        value="jsek_cloudLearning"
        style="{{tabPanelstyle}}"
      >
        <view wx:if="{{!loading && learn.length}}">
          <learn-resource
            bind:getFreeResource="getFreeResource"
            bind:allAddShoppiingCar="allAddShoppiingCar"
            id="learn-resource"
          ></learn-resource>
          <tree
            bookInfo="{{bookDetail}}"
            tab="{{tabValue}}"
            treeList="{{learn}}"
            buyIds="{{buyIdList}}"
            openLearnids="{{openLearnids}}"
          ></tree>
        </view>
      </t-tab-panel>
      <t-tab-panel label="云测试" value="questionBank" style="{{tabPanelstyle}}">
        <test-resource list="{{test}}"></test-resource>
      <t-tab-panel
        label="云测试"
        value="questionBank"
        style="{{tabPanelstyle}}"
      >
        <view wx:if="{{!loading && test.length}}">
          <test-resource
            list="{{test}}"
            bookInfo="{{bookDetail}}"
          ></test-resource>
        </view>
      </t-tab-panel>
      <t-tab-panel label="云笔记" value="note" style="{{tabPanelstyle}}">
        <note></note>
      <t-tab-panel label="云笔记" value="jesk_note" style="{{tabPanelstyle}}">
        <note
          bookInfo="{{bookDetail}}"
          id="note"
          class="note-list"
          bind:changeLoaidng="changeLoaidng"
        ></note>
      </t-tab-panel>
    </t-tabs>
  </view>
@@ -123,7 +241,9 @@
    </view>
    <view class="bottom-btn">
      <view>
        <t-image src="/static/images/bookService/detail/paper-book.png"></t-image>
        <t-image
          src="/static/images/bookService/detail/paper-book.png"
        ></t-image>
      </view>
      <view class="btn-text">纸质样书申请</view>
    </view>
@@ -132,4 +252,18 @@
  </view>
</scroll-view>
<!-- 我要建议弹窗 -->
<suggest class="suggest-component" id="suggest-component" bookIcon="{{bookDetail.icon}}" bookName="{{bookDetail.name}}"></suggest>
<suggest
  class="suggest-component"
  id="suggest-component"
  bookIcon="{{bookDetail.icon}}"
  bookName="{{bookDetail.name}}"
></suggest>
<!-- 教学资源下载提示弹窗 -->
<t-dialog
class="teachDownloadDialog"
  visible="{{isShowTeachDownload}}"
  title="提示"
  content="请前往PC端下载"
  confirm-btn="{{ confirmBtn }}"
  bind:confirm="closeTeachDownload"
/>
pages/bookServices/detail/index.wxss
@@ -33,9 +33,22 @@
}
.detail-right .book-name {
  width: 420rpx;
  font-weight: bold;
  font-size: 36rpx;
  color: #000000;
  margin-bottom: 30rpx;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.showTow {
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.book-message {
@@ -60,6 +73,12 @@
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.class-name {
  height: 2.5em;
  width: 280rpx;
  font-size: 28rpx;
}
.book-use {
@@ -153,6 +172,7 @@
.book-web {
  margin-left: 30rpx;
  display: flex;
}
.book-web image {
@@ -239,4 +259,26 @@
.tab-box {
  min-height: 550rpx;
}
.note-list {
  /* margin-bottom: 80rpx; */
}
.tab-class {
  --td-loading-color: #ff6c00
}
.loading {
  min-height: 550rpx;
  display: flex;
  align-items: center;
  justify-content: center;
}
.teachDownloadDialog {
  --td-button-primary-bg-color: #ff6c00;
  --td-button-primary-border-color: #ff6c00;
  --td-button-primary-active-bg-color: #ff984d;
  --td-button-primary-active-border-color: #ff984d;
}
pages/bookServices/examination/examination.js
New file
@@ -0,0 +1,339 @@
const app = getApp()
Page({
  /**
   * 页面的初始数据
   */
  data: {
    barHeight: "",
    navBarHeight: "",
    loading: false,
    answerTitle: "",  // 导航栏标题
    bookId: "",
    productLinkPath: "",
    rootCmsItemId: "",
    idPathList: [],  // 题目列表
    answerType: "",  // 答题类型
    submitStatus: false,  // 提交状态
    currentIndex: 0, // 当前答题数
    collectList: [],   //  收藏题目列表
    subjectiveNum: 0, // 主观题得分
    subjectiveGrade: 0, // 主观题总分
    total: 0,   // 题目总数
    correctNum: 0,  // 正确题目数量
    cardList: [],  // 提交项,
    questionDataList: []
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    const systInfo = wx.getSystemInfoSync();
    const menu = wx.getMenuButtonBoundingClientRect(); // 胶囊信息
    const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 导航栏高度
    this.setData({
      barHeight: systInfo.statusBarHeight,
      navBarHeight: navBarHeight,
      answerTitle: options.answerTitle,
      bookId: options.bookId,
      productLinkPath: options.productLinkPath,
      rootCmsItemId: options.rootCmsItemId,
      idPathList: JSON.parse(options.idPathList),
      answerType: options.answerType
    });
    this.init()
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
  },
  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {
  },
  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {
  },
  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {
  },
  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {
  },
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {
  },
  // 返回
  goBack() {
    wx.navigateBack();
  },
  // 初始化函数
  async init() {
    if (this.data.answerType == 'option') {
      // 测试答题
      await this.getCollectIdList() // 获取收藏id列表
      // await getErrorList() // 获取错题id列表
    }
  },
  // 获取收藏题目列表id
  getCollectIdList() {
    app.MG.identity
      .getUserKey({
        domain: 'collectData',
        keys: [this.data.rootCmsItemId]
      })
      .then(async (res) => {
        try {
          this.setData({
            collectList: JSON.parse(res[0].value)
          })
        } catch (error) {
        }
        if (this.data.answerType == 'option') {
          // 先获取用户答题记录
          await this.getAnswerInfo((res) => {
            if (res.length) {
              // 有记录,不能答题,状态设为已提交
              this.setData({
                submitStatus: true
              })
              let value = JSON.parse(res[0].value)
              // console.log('答题记录', JSON.parse(res[0].value))
              // 有答题记录,得分赋值
              if (value) {
                value.dataList.forEach((item) => {
                  if (item.name == '客观题得分' && item.path == this.data.productLinkPath)
                    this.setData({
                      subjectiveNum: item.score
                    })
                })
              }
              this.setData({
                currentIndex: value.currentIndex
              })
              // 携带答题记录 获取题目
              this.getQuestionList(value.dataList)
            } else {
              this.getQuestionList() // 获取题库题目
            }
          })
        }
      })
  },
  // 获取题库题目
  getQuestionList(oldData) {
    // 清空正确题数记录
    this.setData({
      correctNum: 0
    })
    let flag = 0
    this.data.idPathList.forEach((pathitem) => {
      const pathList = this.data.cardList
      pathList.push({
        name: pathitem.name,
        path: pathitem.productLinkPath,
        catalogName: pathitem.type,
        infoList: []
      })
      this.setData({
        cardList: pathList
      })
      // 获取题目
      let questionArr = []
      let query = {
        path: '*',
        queryType: '*',
        productId: this.data.bookId,
        cmsPath: pathitem.productLinkPath,
        itemFields: {
          // SysType: 'CmsFolder',
          Embedded_QuestionBank_Stem: [],
          Embedded_QuestionBank_AnalysisCon: [],
          Embedded_QuestionBank_Answer: [],
          Embedded_QuestionBank_Option: [],
          Embedded_QuestionBank_QuestionType: [],
          Embedded_QuestionBank_StemStyle: [],
          Embedded_QuestionBank_OptionStyle: [],
          Embedded_QuestionBank_KnowledgePoint: [],
          Embedded_QuestionBank_Difficulty: []
        },
        pading: {
          start: 0,
          size: 999
        }
      }
      app.MG.store.getProductDetail(query).then((res) => {
        this.setData({
          total: res.datas.cmsDatas[0].datas.length
        })
        // total.value += res.datas.cmsDatas[0].datas.length
        let oldList
        if (oldData) {
          // 提交过,存在答题记录
          oldList = oldData.find((item) => item.path == pathitem.productLinkPath).infoList
          this.setData({
            submitStatus: true
          })
        }
        res.datas.cmsDatas[0].datas.forEach((item, index) => {
          let oldObj = ''
          if (oldList) oldObj = oldList.find((oldItem) => oldItem.id == item.id)
          let questionObj = {
            // num: index, // 题号
            id: item.id,
            stem:
              item.Embedded_QuestionBank_QuestionType == 'completion'
                ? JSON.parse(item.Embedded_QuestionBank_Stem)
                  .stemTxt.replaceAll('<vacancy>', ',input,')
                  .split(',')
                : JSON.parse(item.Embedded_QuestionBank_Stem), // 题干
            answer: item.Embedded_QuestionBank_Answer, // 答案
            option: item.Embedded_QuestionBank_Option
              ? JSON.parse(item.Embedded_QuestionBank_Option)
              : '', // 选择题选项
            analysisCon: item.Embedded_QuestionBank_AnalysisCon, // 解析
            questionType: item.Embedded_QuestionBank_QuestionType, // 题型
            optionStyle: item.Embedded_QuestionBank_OptionStyle, // 选项显示类型
            stemStyle: item.Embedded_QuestionBank_StemStyle, // 题干显示类型
            difficulty: item.Embedded_QuestionBank_Difficulty
              ? 4 - item.Embedded_QuestionBank_Difficulty
              : 0, // 难度等级
            userAnswer: oldObj
              ? oldObj.userAnswer
              : item.Embedded_QuestionBank_QuestionType == 'completion' ||
                item.Embedded_QuestionBank_QuestionType == 'multipleChoice'
                ? []
                : '',
            isRight: oldObj ? oldObj.isRight : null,
            isComplete: oldObj ? oldObj.isComplete : false,
            isCollect: this.data.collectList.indexOf(item.id) > -1 ? true : false,
            isUnfold: '' // 控制解析的折叠面板是否展开
          }
          // 多选和填空答案肯为数组,要转换JSON格式
          if (
            questionObj.questionType == 'completion' ||
            questionObj.questionType == 'multipleChoice'
          ) {
            try {
              questionObj.answer = JSON.parse(questionObj.answer)
            } catch (error) {
              questionObj.answer = item.Embedded_QuestionBank_Answer
            }
          }
          // 填空题改造
          if (questionObj.questionType == 'completion') {
            let index = 0
            for (let i = 0; i < questionObj.stem.length; i++) {
              const item = questionObj.stem[i]
              if (item == 'input') {
                questionObj.stem[i] = {
                  num: index,
                  data: 'input'
                }
                if (!oldObj) questionObj.userAnswer[index] = ''
                index++
              }
            }
          }
          questionArr.push(questionObj)
          // 旧数据里 题目已经作答,修改已答题目数量
          // if (oldObj && oldObj.userAnswer.length > 0) countDownRef.value.changeAlready()
          // 旧数据里 题目正确 记录正确数量
          if (questionObj.isRight) {
            this.setData({
              correctNum: this.data.correctNum + 1
            })
          }
          // if (pathitem.name == '判断题') {
          //   topicList.value.judge.data = questionArr
          //   topicList.value.judge.path = pathitem.productLinkPath
          //   if (oldData) subjectiveTotal.value += 1 // 有旧数据,计算主观题数
          // } else if (pathitem.name == '填空题') {
          //   topicList.value.gap.data = questionArr
          //   topicList.value.gap.path = pathitem.productLinkPath
          //   if (oldData) subjectiveTotal.value += 1
          // } else if (pathitem.name == '多选题') {
          //   topicList.value.check.data = questionArr
          //   topicList.value.check.path = pathitem.productLinkPath
          //   if (oldData) subjectiveTotal.value += 1
          // } else if (pathitem.name == '单选题') {
          //   topicList.value.radio.data = questionArr
          //   topicList.value.radio.path = pathitem.productLinkPath
          //   if (oldData) subjectiveTotal.value += 1
          // } else if (pathitem.name == '简答题') {
          //   topicList.value.short.data = questionArr
          //   topicList.value.short.path = pathitem.productLinkPath
          // } else if (pathitem.name == '翻译题') {
          //   topicList.value.translate.data = questionArr
          //   topicList.value.translate.path = pathitem.productLinkPath
          // } else if (pathitem.name == '听力题') {
          //   topicList.value.listen.data = questionArr
          //   topicList.value.listen.path = pathitem.productLinkPath
          //   if (oldData) subjectiveTotal.value += 1
          // }
          let infoList =
            this.data.cardList[this.data.cardList.findIndex((item) => item.path == pathitem.productLinkPath)]
              .infoList
          infoList.push(questionObj)
          flag++;
          let questionList = []
          // if (flag == this.data.idPathList.length) {
          this.data.cardList.forEach(aitem => {
            aitem.infoList.forEach(bitem => {
              questionList.push(bitem)
              bitem.number = questionList.length
            })
          })
          this.setData({
            questionDataList: questionList
          })
          // }
        })
      })
    })
    this.setData({
      loading: false,
    })
    console.log('题目列表', this.data.questionDataList, this.data.cardList);
  },
  // 获取答题数据
  getAnswerInfo(callback) {
    app.MG.identity
      .getUserKey({
        domain: 'answerData',
        keys: [this.data.productLinkPath]
      })
      .then((res) => {
        if (callback) callback(res)
      })
  }
})
pages/bookServices/examination/examination.json
New file
@@ -0,0 +1,11 @@
{
  "usingComponents": {
    "question-options": "/pages/bookServices/examination/questionOptions/index",
    "question-schedule": "/pages/bookServices/examination/questionSchedule/index",
    "question-list": "/pages/bookServices/examination/questionList/index",
    "t-icon": "tdesign-miniprogram/icon/icon",
    "t-image": "tdesign-miniprogram/image/image",
    "t-button": "tdesign-miniprogram/button/button"
  },
  "navigationStyle": "custom"
}
pages/bookServices/examination/examination.wxml
New file
@@ -0,0 +1,24 @@
<!--pages/examination/examination.wxml-->
<!--导航区域 -->
<view style="width: 100%; height: {{barHeight}}px; "></view>
<view class="nacigationBar" style="width: 70%; height: {{navBarHeight}}px;">
  <view>
    <t-icon
      name="chevron-left"
      size="30"
      data-name="{{item}}"
      bind:click="goBack"
    />
  </view>
  <view class="navbar-title">{{answerTitle}}</view>
</view>
<view class="page-content">
  <question-schedule></question-schedule>
  <question-list questionList="{{questionDataList}}"></question-list>
</view>
<!-- 底部区域-->
<view class="page-bottom">
  <question-options></question-options>
</view>
pages/bookServices/examination/examination.wxss
New file
@@ -0,0 +1,23 @@
/* pages/examination/examination.wxss */
.nacigationBar {
  display: flex;
  align-items: center;
}
.navbar-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #0F1214;
  font-size: 40rpx;
  font-weight: 600;
}
.page-content {
  box-sizing: border-box;
  width: 100%;
  height: 78vh;
  padding: 20rpx;
  background-color: #F2F3F8;
}
pages/bookServices/examination/questionList/index.js
New file
@@ -0,0 +1,44 @@
// pages/bookServices/examination/questionList/index.js
const imageCdn = 'https://tdesign.gtimg.com/mobile/demos';
const swiperList = [
  `${imageCdn}/swiper1.png`,
  `${imageCdn}/swiper2.png`,
  `${imageCdn}/swiper1.png`,
  `${imageCdn}/swiper2.png`,
  `${imageCdn}/swiper1.png`,
];
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    questionList: {
      type: Array,
      value: []
    }
  },
  created() {
    console.log('组件传参', this.properties);
  },
  /**
   * 组件的初始数据
   */
  data: {
    current: 2,
    autoplay: true,
    duration: 500,
    interval: 5000,
    paginationPosition: 'bottom-right',
    swiperList,
    navigation: { type: 'fraction' },
  },
  /**
   * 组件的方法列表
   */
  methods: {
  }
})
pages/bookServices/examination/questionList/index.json
New file
@@ -0,0 +1,7 @@
{
  "component": true,
  "usingComponents": {
    "t-swiper": "tdesign-miniprogram/swiper/swiper",
  "t-swiper-nav": "tdesign-miniprogram/swiper-nav/swiper-nav"
  }
}
pages/bookServices/examination/questionList/index.wxml
New file
@@ -0,0 +1,13 @@
<!--pages/bookServices/examination/questionList/index.wxml-->
<view class="question-list">
  <!-- 题型title -->
  <view class="question-title">
    <text class="title-name">单选题</text><text class="title-score">(每题2分)</text>
  </view>
  <!-- 题目列表 -->
  <swiper>
    <swiper-item wx:for="{{questionList}}">
      <text>{{item.stem.stemTxt}}</text>
    </swiper-item>
  </swiper>
</view>
pages/bookServices/examination/questionList/index.wxss
New file
@@ -0,0 +1,25 @@
/* pages/bookServices/examination/questionList/index.wxss */
.question-list {
  width: 100%;
  height: 90%;
  padding: 20rpx;
  background-color: #ffffff;
  border-radius: 20rpx;
  margin-top: 20rpx;
}
.question-title {
  font-size: 28rpx;
  margin-bottom: 20rpx;
}
.title-name {
  padding: 6rpx;
  background-color: #ff6c00;
  color: #ffffff;
  margin-right: 10rpx;
}
.title-score {
  color: #000;
}
pages/bookServices/examination/questionOptions/index.js
New file
@@ -0,0 +1,23 @@
// pages/bookServices/examination/questionOptions/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
  },
  /**
   * 组件的初始数据
   */
  data: {
    btnStyle: "width:320rpx;border-radius:60rpx",
  },
  /**
   * 组件的方法列表
   */
  methods: {
  }
})
pages/bookServices/examination/questionOptions/index.json
New file
@@ -0,0 +1,8 @@
{
  "component": true,
  "usingComponents": {
    "t-icon": "tdesign-miniprogram/icon/icon",
    "t-image": "tdesign-miniprogram/image/image",
    "t-button": "tdesign-miniprogram/button/button"
  }
}
pages/bookServices/examination/questionOptions/index.wxml
New file
@@ -0,0 +1,24 @@
<!--pages/bookServices/examination/questionOptions/index.wxml-->
<view class="page-bottom">
  <view class="li-option">
    <t-image src="/static/images/bookService/examination/collect.png"></t-image>
    收藏
  </view>
  <view class="li-option">
    <t-image
      src="/static/images/bookService/examination/questionCard.png"
    ></t-image>
    答题卡
  </view>
  <view class="li-option">
    <t-image src="/static/images/bookService/examination/setting.png"></t-image>
    设置
  </view>
  <view class="li-option">
    <t-image src="/static/images/bookService/examination/reset.png"></t-image>
    重做
  </view>
  <view class="bottom-submit">
    <t-button theme="primary" size="large" style="{{btnStyle}}">提交</t-button>
  </view>
</view>
pages/bookServices/examination/questionOptions/index.wxss
New file
@@ -0,0 +1,31 @@
/* pages/bookServices/examination/questionOptions/index.wxss */
.page-bottom {
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  position: fixed;
  bottom: 30rpx;
  width: 100%;
  height: 180rpx;
  /* background-color: red; */
}
.li-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 24rpx;
  color: #010101;
}
.page-bottom image {
  width: 36rpx;
  height: 36rpx;
}
.bottom-submit {
  --td-button-primary-bg-color: #ff6c00;
  --td-button-primary-border-color: #FF6C00;
  --td-button-primary-active-bg-color: #ff984d;
  --td-button-primary-active-border-color: #ff984d;
}
pages/bookServices/examination/questionSchedule/index.js
New file
@@ -0,0 +1,115 @@
// pages/bookServices/examination/questionSchedule/questionSchedule.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
  },
  created() {
    // if (props.answerType == 'option') {
    // this.startCountdown()
    this.setData({
      countdownTime: 2 * 60 * 60 * 1000
    })
    // }
  },
  detached() {
    if (this.data.countdownInterval !== null) {
      clearInterval(this.data.countdownInterval)
    }
  },
  /**
   * 组件的初始数据
   */
  data: {
    countdownInterval: null,   // 计时器
    isCountdownRunning: true, // 是否倒计时
    countdownTime: "",  // 时间
    showTime: '',
  },
  observers: {
    'countdownTime': function (newValue, oldValue) {
      const showTime = this.formatTime(this.data.countdownTime)
      this.setData({
        showTime: showTime
      })
      console.log(this.data.showTime);
    }
  },
  /**
   * 组件的方法列表
   */
  methods: {
    // 格式化时间
    formatTime(ms) {
      const hours = Math.floor((ms / (1000 * 60 * 60)) % 24)
        .toString()
        .padStart(2, '0')
      const minutes = Math.floor((ms / (1000 * 60)) % 60)
        .toString()
        .padStart(2, '0')
      const seconds = Math.floor((ms / 1000) % 60)
        .toString()
        .padStart(2, '0')
      return `${hours}:${minutes}:${seconds}`
    },
    // 获取保存的倒计时时间
    getSavedTime() {
      const savedTime = wx.getStorageSync('countdownTime')
      return savedTime ? parseInt(savedTime) : null
    },
    // 保存倒计时时间到本地存储
    saveTime() {
      wx.setStorageSync('countdownTime', this.data.countdownTime.toString())
    },
    clearTime() {
      this.setData({
        countdownTime: 2 * 60 * 60 * 1000
      })
    },
    // 暂停或继续倒计时
    toggleCountdown() {
      if (countdownInterval) {
        clearInterval(this.data.countdownInterval)
        this.setData({
          countdownInterval: null,
          isCountdownRunning: false
        })
      } else {
        this.startCountdown()
        this.setData({
          isCountdownRunning: true
        })
      }
    },
    // 开始倒计时
    startCountdown() {
      // 如果计时器已经存在,先清除之前的计时器
      if (this.data.countdownInterval) {
        clearInterval(this.data.countdownInterval)
        this.setData({
          countdownInterval: null
        })
      }
      this.setData({
        countdownInterval: setInterval(() => {
          this.setData({
            countdownTime: this.data.countdownTime - 1000
          })
          if (this.data.countdownTime <= 0) {
            clearInterval(this.data.countdownInterval)
            this.setData({
              countdownTime: 0,
              isCountdownRunning: false
            })
          }
          this.saveTime()
        }, 1000)
      })
    }
  }
})
pages/bookServices/examination/questionSchedule/index.json
New file
@@ -0,0 +1,6 @@
{
  "component": true,
  "usingComponents": {
    "t-progress": "tdesign-miniprogram/progress/progress"
  }
}
pages/bookServices/examination/questionSchedule/index.wxml
New file
@@ -0,0 +1,11 @@
<!--pages/bookServices/examination/questionSchedule/questionSchedule.wxml-->
<view class="schedule">
  <view class="schedule-top">
    <view class="question-schedule">答题进度<text class="parimary-color question-num">1</text> <text>/18</text></view>
    <view class="remainder">剩余时间 <text class="parimary-color">{{showTime}}</text></view>
  </view>
  <view class="schedule-progress">
    <t-progress percentage="80" color="#ff6c00" label="" />
  </view>
</view>
pages/bookServices/examination/questionSchedule/index.wxss
New file
@@ -0,0 +1,32 @@
/* pages/bookServices/examination/questionSchedule/questionSchedule.wxss */
.schedule {
  background-color: #ffffff;
  padding: 20rpx;
  font-size: 28rpx;
  border-radius: 20rpx;
}
.schedule-top {
  display: flex;
  justify-content: space-between;
}
.question-schedule {
  color: #000;
}
.schedule-progress {
  margin-top: 20rpx;
}
.remainder {
  color: #545C63;
}
.parimary-color {
  color: #ff6c00;
}
.question-num {
  margin-left: 10rpx;
}
pages/bookServices/list/index.js
@@ -9,7 +9,11 @@
    searchValue: '',
    path: '',
    pathList: [],
    page: 1,
    pageCount: {
      page: 1,
      total: 0,
    },
    isMore: null,
    assortCheck: {
      name: '',
      code: '',
@@ -135,6 +139,24 @@
   */
  onReachBottom(e) {
    console.log('底部');
    const flag = this.data.bookList.length < this.data.pageCount.total
    if (flag) {
      this.setData({
        isMore: true,
        "pageCount.page": this.data.pageCount.page + 1
      })
      this.getBookList(this.data.path)
    } else {
      this.setData({
        isMore: true,
      })
      setTimeout(() => {
        this.setData({
          isMore: false
        })
      }, 100)
      console.log('没有更多了');
    }
  },
  /**
@@ -299,8 +321,8 @@
        height: 145,
      },
      paging: {
        start: (this.data.page - 1) * 16,
        size: 16,
        start: 0,
        size: this.data.pageCount.page * 8,
      },
      fields: {
        author: [],
@@ -313,8 +335,10 @@
    app.MG.store.getProductList(query).then((res) => {
      this.setData({
        bookList: res.datas,
        enable: false
        enable: false,
        "pageCount.total": res.total
      });
      console.log('图书列表', res, this.data.pageCount);
    });
  },
  // 一级分类切换
pages/bookServices/list/index.json
@@ -5,8 +5,8 @@
    "t-icon": "tdesign-miniprogram/icon/icon",
    "t-image": "tdesign-miniprogram/image/image",
    "t-search": "tdesign-miniprogram/search/search",
    "t-pull-down-refresh": "tdesign-miniprogram/pull-down-refresh/pull-down-refresh"
    "t-pull-down-refresh": "tdesign-miniprogram/pull-down-refresh/pull-down-refresh",
    "t-loading": "tdesign-miniprogram/loading/loading"
  },
  "navigationStyle": "custom",
  "onReachBottomDistance": 250
  "navigationStyle": "custom"
}
pages/bookServices/list/index.wxml
@@ -27,7 +27,7 @@
    </view>
  </view>
  <t-pull-down-refresh value="{{enable}}" loadingProps="{{loadingProps}}" loadingTexts="{{['下拉刷新', '松手刷新', '正在刷新', '刷新完成']}}" bind:refresh="onRefresh">
    <scroll-view scroll-y="{{true}}" class="list-container">
    <scroll-view scroll-y="{{true}}" class="list-container" bindrefresherrefresh="onPullDownRefresh" bindscrolltolower="onReachBottom">
      <view class="assort-title">
        <view class="title-box"></view>
        <view class="title-name">{{assortCheck.name}}</view>
@@ -41,6 +41,10 @@
          <view class="book-author book-color">{{item.author}}</view>
        </view>
      </view>
      <view class="bottom-box">
        <t-loading theme="circular" size="40rpx" class="wrapper" wx:if="{{isMore == true}}" />
        <text wx:if="{{isMore == false}}">没有更多了</text>
      </view>
    </scroll-view>
  </t-pull-down-refresh>
</view>
pages/bookServices/list/index.wxss
@@ -39,7 +39,7 @@
.list-container {
  height: 80vh;
  margin-top: 20rpx;
  background-color: #fff;
  /* background-color: #fff; */
}
.assort-title {
@@ -69,7 +69,7 @@
.book-box {
  box-sizing: border-box;
  width: 48%;
  background-color: #f7f7f7;
  background-color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
@@ -93,6 +93,7 @@
.book-name {
  margin-top: 24rpx;
  color: #333;
  width: 100%;
  font-size: 28rpx;
  font-weight: 700;
@@ -101,15 +102,25 @@
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-align: center;
  text-align: left;
}
.book-author {
  color: #333;
  margin-top: 16rpx;
  width: 100%;
  font-size: 24rpx;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  text-align: left;
}
.bottom-box {
  display: flex;
  justify-content: center;
  color: #999;
  height: 80rpx;
  font-size: 28rpx;
  --td-loading-color: #ff6c00
}
static/images/bookService/detail/cart.png
static/images/bookService/detail/compliceHover.png
static/images/bookService/detail/cuoti.png
static/images/bookService/detail/deleteHover.png
static/images/bookService/detail/edit.png
static/images/bookService/detail/feedback.png
static/images/bookService/detail/makeNote.png
static/images/bookService/detail/note-icon.png
static/images/bookService/detail/practice-icon.png
static/images/bookService/detail/wodeshoucang.png
static/images/bookService/detail/zujuan.png
static/images/bookService/examination/collect.png
static/images/bookService/examination/questionCard.png
static/images/bookService/examination/reset.png
static/images/bookService/examination/setting.png