闫增涛
2024-03-21 c4e651ac030ef5fe8870f6974fcc4658d42986c6
图书列表,详情页、答题器样式修改,代码合并上传测试服
15个文件已修改
154 ■■■■ 已修改文件
custom-tab-bar/index.wxml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/components/brief/index.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/components/note/note.js 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/components/note/note.json 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/components/note/note.wxml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/components/testResource/testResource.wxml 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/components/testResource/testResource.wxss 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/index.js 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/index.wxml 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/index.wxss 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/examination/examination.js 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/examination/examination.wxml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/examination/questionList/index.js 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/examination/questionList/index.wxml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/examination/questionList/index.wxss 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
custom-tab-bar/index.wxml
@@ -1,5 +1,5 @@
<t-tab-bar value="{{active}}" bindchange="onChange" split="{{false}}">
  <t-tab-bar-item wx:for="{{list}}" wx:for-item="item" wx:for-index="index" wx:key="{{item.id}}">
  <t-tab-bar-item wx:for="{{list}}" wx:for-item="item" wx:for-index="index" wx:key="id">
    <view class="custom-tab-bar-wrapper">
      <!-- <t-icon prefix="wr" name="{{item.icon}}" size="48rpx" />
      <view class="text">{{ item.text }}</view> -->
packageBookService/pages/bookServices/detail/components/brief/index.js
@@ -9,4 +9,5 @@
      value: '',
    },
  },
});
packageBookService/pages/bookServices/detail/components/note/note.js
@@ -32,6 +32,7 @@
    noteList: [],
    activeValues: 0,
    loading: false,
    noList: false,
  },
  /**
   * 组件的方法列表
@@ -136,9 +137,10 @@
    },
    // 获取笔记列表
    async getNoteList() {
      // this.setData({
      //   loading: true
      // })
      this.setData({
        loading: true,
        noList: false
      })
      console.log(this.properties.bookInfo.id, 'this.properties.bookInfo.id');
      let topicId
      await app.MG.ugc
@@ -169,6 +171,13 @@
        topicIdOrRefCode: topicId + ''
      }
      await app.MG.ugc.getTopicMessageList(query).then((res) => {
        if (!res.datas.length) {
          return this.setData({
            noList: true,
            loading: false,
            noteList: res.datas,
          })
        }
        // notePage.value.total = res.totalSize
        res.datas.forEach((item) => {
          item.compliceHover = false
@@ -180,7 +189,6 @@
          noteList: res.datas,
          loading: false
        })
        console.log('笔记列表', res.datas);
      })
    },
    // 新建笔记接口
packageBookService/pages/bookServices/detail/components/note/note.json
@@ -10,6 +10,7 @@
    "t-input": "tdesign-miniprogram/input/input",
    "t-loading": "tdesign-miniprogram/loading/loading",
    "t-popup": "tdesign-miniprogram/popup/popup",
    "t-icon": "tdesign-miniprogram/icon/icon"
    "t-icon": "tdesign-miniprogram/icon/icon",
    "t-empty": "tdesign-miniprogram/empty/empty"
  }
}
packageBookService/pages/bookServices/detail/components/note/note.wxml
@@ -1,5 +1,5 @@
<!--pages/bookServices/detail/components/note/note.wxml-->
<view class="note" wx:if="{{!loading && noteList.length}}">
<view class="note">
  <view class="note-btn">
    <t-button theme="primary" class="make-note" bind:tap="openDialog" style="width: 240rpx;">
      <view slot="content">
@@ -10,7 +10,7 @@
  </view>
  <view class="note-content">
    <t-collapse value="{{activeValues}}" bind:change="handleChange">
    <t-collapse value="{{activeValues}}" bind:change="handleChange" wx:if="{{!loading && noteList.length}}">
      <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>
@@ -28,7 +28,9 @@
        </view>
      </t-collapse-panel>
    </t-collapse>
    <view wx:if="{{noList}}" class="noData">
      <t-empty icon="folder-open" description="暂无数据" />
    </view>
  </view>
  <view class="bottom-box">
    <t-loading wx:if="{{isMore == true}}"></t-loading>
packageBookService/pages/bookServices/detail/components/testResource/testResource.wxml
@@ -1,7 +1,7 @@
<!--pages/bookServices/detail/components/testResource/testResource.wxml-->
<view class="test-resource">
  <view class="top-btn">
    <t-radio-group class="test-radio" t-class="horizontal-box" value="{{radioItem}}" bind:change="onRadioChange" style="margin: 0px">
    <t-radio-group class="test-radio" t-class="horizontal-box" value="{{radioItem}}" bind:change="onRadioChange" style="margin: 0 10rpx 0 0">
      <view class="card {{radioItem == 'test' ? 'card--active' : ''}}">
        <t-radio value="test" icon="none" borderless style="height: 80rpx">
          <view class="radio-content" slot="content">
@@ -11,11 +11,10 @@
        </t-radio>
      </view>
      <view class="card {{radioItem == 'mock' ? 'card--active' : ''}}">
        <t-radio value="mock" icon="none" borderless>
        <t-radio value="mock" icon="none" borderless style="height: 74rpx">
          <view class="radio-content" slot="content">
            <t-image src="{{ radioItem == 'mock' ? '/static/images/bookService/detail/checkpaper.png' : '/static/images/bookService/detail/zujuan.png'}}"></t-image>
            <text style="color: {{radioItem == 'mock' ? '#fff':''}};">
              组卷</text>
            <text style="color: {{radioItem == 'mock' ? '#fff':''}};">组卷</text>
          </view>
        </t-radio>
      </view>
@@ -34,7 +33,7 @@
    </t-button>
  </view>
  <!-- 练习列表 -->
  <view class="resource-list" wx:for="{{list}}" wx:key="item.id" wx:if="{{radioItem == 'test'}}">
  <view class="resource-list" wx:for="{{list}}" wx:key="id" wx:if="{{radioItem == 'test'}}">
    <view class="list-title">
      <t-image src="/static/images/bookService/detail/test-icon.png"></t-image>
      <text>{{item.name}}</text>
@@ -50,7 +49,7 @@
  <view wx:if="{{mockData.mockList.length}}">
    <view class="mack-num">已组卷{{mockData.mockList.length}}次</view>
    <view class="mock-list">
      <view class="mock-list-box" wx:for="{{mockData.mockList}}" data-item="{{item}}" bind:tap="goMackPaper">
      <view class="mock-list-box" wx:for="{{mockData.mockList}}" wx:key="id" data-item="{{item}}" bind:tap="goMackPaper">
        <view class="mock-title">{{item.name}}</view>
        <view class="mock-message">
          <view class="message-box">
packageBookService/pages/bookServices/detail/components/testResource/testResource.wxss
@@ -31,6 +31,7 @@
.top-btn {
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  padding: 0 0 20rpx 15rpx;
  border-bottom: 1px solid #EFF0F1;
}
@@ -57,6 +58,10 @@
.practice-btn text {
  font-size: 28rpx;
}
.error-btn {
  margin-left: 10rpx;
}
.paper-btn,
@@ -178,11 +183,6 @@
  align-items: center;
}
.mack-state {
  width: 94rpx;
  height: 42rpx;
}
.mock-score {
  font-size: 28rpx;
  color: #ff6c00;
@@ -194,10 +194,12 @@
}
.state-pad {
  width: 80rpx;
  white-space: nowrap;
  width: 90rpx;
  border-radius: 10rpx;
  display: inline-block;
  padding: 10rpx;
  text-align: center;
}
.complete {
packageBookService/pages/bookServices/detail/index.js
@@ -52,7 +52,8 @@
      mockList: [] // 用户组卷提交信息
    },
    flag: true,
    applyResourceLoading: false
    applyResourceLoading: false,
    noResources: false
  },
@@ -344,7 +345,8 @@
  },
  onTabsChange(e) {
    this.setData({
      tabValue: e.detail.value
      tabValue: e.detail.value,
      noResources: false
    })
    if (e.detail.label == '教学资源' || e.detail.label == '云学习' || e.detail.label == '云测试') {
      const checkData = this.data.cmsDatas.find(item => item.refCode == e.detail.value)
@@ -354,7 +356,10 @@
          || (e.detail.value == 'questionBank' && !this.data.test.length)) {
          this.getResourceData(checkData)
        }
      } else {
        this.setData({
          noResources: true
        })
      }
    } else if (e.detail.label == '云笔记') {
      const token = wx.getStorageSync('jsek-token')
@@ -381,7 +386,8 @@
  //  获取教学资源  云学习  云测试
  getResourceData(type) {
    this.setData({
      loading: true
      loading: true,
      noResources: false
    })
    let query = {
      path: '*',
@@ -408,6 +414,12 @@
    app.MG.store
      .getProductDetail(query)
      .then(async (res) => {
        if (!res.datas.cmsDatas[0].datas.length) {
          return this.setData({
            noResources: true,
            loading: false
          })
        }
        // 云测试,递归请求里层数据
        if (type.refCode == 'questionBank') {
          const data = res.datas.cmsDatas[0].datas.filter(
@@ -427,14 +439,12 @@
                teach: list,
                loading: false
              })
              console.log('教学资源', this.data.teach);
              this.findChildIds(this.data.teach, this.data.openTeachids = [])
            } else if (type.refCode == 'jsek_cloudLearning') {
              res.datas.cmsDatas[0].datas.forEach(item => {
                item.checked = false
              })
              const list = await this.getAllResource(res.datas.cmsDatas[0].datas)
              console.log(list, 'list');
              this.setData({
                learn: list,
                loading: false
packageBookService/pages/bookServices/detail/index.wxml
@@ -104,25 +104,31 @@
        电子书
      </t-tab-panel>
      <t-tab-panel label="教学资源" value="jsek_teachingResources" class="{{loading ? 'loading': ''}}">
        <view wx:if="{{!loading && teach.length}}">
        <view wx:if="{{!loading && teach.length && !noResources}}">
          <teach-resource applyState="{{applyState}}" rejectCause="{{rejectCause}}" bind:applyResource="applyResource" applyResourceLoading="{{applyResourceLoading}}"></teach-resource>
          <tree bookInfo="{{bookDetail}}" treeList="{{teach}}" tab="{{tabValue}}" applyState="{{applyState}}" bind:downloadTeach="downloadTeach" openTeachids="{{openTeachids}}" wx:if="{{teach.length}}"></tree>
        </view>
        <t-loading theme="circular" size="60rpx" class="loading" loading="{{loading}}" />
        <!-- <view wx:if="{{!teach.length && !loading}}" class="noData">
        <view wx:if="{{noResources}}" class="noData">
          <t-empty icon="folder-open" description="暂无数据" />
        </view> -->
        </view>
      </t-tab-panel>
      <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 id="tree" bookInfo="{{bookDetail}}" tab="{{tabValue}}" treeList="{{learn}}" buyIds="{{buyIdList}}" openLearnids="{{openLearnids}}"></tree>
        </view>
        <view wx:if="{{noResources}}" class="noData">
          <t-empty icon="folder-open" description="暂无数据" />
        </view>
      </t-tab-panel>
      <t-tab-panel label="云测试" value="questionBank" style="{{tabPanelstyle}}">
        <view wx:if="{{!loading && test.length}}">
          <test-resource list="{{test}}" bookInfo="{{bookDetail}}" mockData="{{mockData}}"></test-resource>
        </view>
        <view wx:if="{{noResources}}" class="noData">
          <t-empty icon="folder-open" description="暂无数据" />
        </view>
      </t-tab-panel>
      <t-tab-panel label="云笔记" value="jesk_note" style="{{tabPanelstyle}}">
        <note bookInfo="{{bookDetail}}" id="note" class="note-list" bind:changeLoaidng="changeLoaidng"></note>
packageBookService/pages/bookServices/detail/index.wxss
@@ -200,7 +200,8 @@
/* 图书资源 */
.book-resource {
  min-height: 640rpx;
  /* min-height: 640rpx; */
  min-height: calc(100vh - 960rpx);
  margin-top: 20rpx;
  background-color: #fff !important;
}
@@ -298,6 +299,5 @@
}
.noData {
  /* width: 500rpx;
  height: 500rpx; */
  height: 100%;
}
packageBookService/pages/bookServices/examination/examination.js
@@ -48,6 +48,15 @@
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    // wx.enableAlertBeforeUnload({
    //   message: "未提交,是否退出答题?",
    //   success: function (res) {
    //     console.log('确定', res);
    //   },
    //   fail: function (err) {
    //     console.log("失败:", err);
    //   },
    // });
    const systInfo = wx.getSystemInfoSync();
    const menu = wx.getMenuButtonBoundingClientRect(); // 胶囊信息
    const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 导航栏高度
@@ -75,7 +84,6 @@
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {
  },
  /**
@@ -101,13 +109,12 @@
   * 生命周期函数--监听页面隐藏
   */
  onHide() {
  },
  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {
  onUnload(e) {
    if (this.data.countdownInterval !== null) {
      clearInterval(this.data.countdownInterval)
    }
@@ -132,8 +139,29 @@
   */
  onShareAppMessage() {
  },
  // 监听watch
  watch(context, variableName, callback) {
    let value = context.data[variableName]; // 获取被监听属性的当前值
    // 使用 Object.defineProperty 方法在数据对象上定义属性的 getter 和 setter
    Object.defineProperty(context.data, variableName, {
      configurable: true, // 可配置
      enumerable: true, // 可枚举
      get: function () {
        return value; // 返回属性的当前值
      },
      set: function (newVal) {
        const oldVal = value; // 记录属性的旧值
        value = newVal; // 更新属性的值
        callback.call(context, newVal, oldVal); // 调用回调函数,传递新值和旧值
      }
    });
  },
  // 返回
  goBack() {
    console.log(this.data.submitStatus);
    wx.navigateBack();
  },
  //设置背景色
@@ -201,10 +229,11 @@
    this.setData({
      currentIndex: e.detail.index
    })
    if (this.data.answerType == 'collectQuestion' || this.data.answerType == 'errorQuestion') {
    let index = e.detail.index - 1 >= 0 ? e.detail.index - 1 : 0
    let flag = this.isHaveAnswer(this.data.questionDataList[index].userAnswer)
    if (flag) this.handleQuestion(e.detail.index)
    }
  },
  // 点击答题卡跳转题目
  goQuestion(e) {
@@ -295,6 +324,8 @@
  },
  // 提交逻辑
  submitPaper() {
    // 关闭退出页面监听
    wx.disableAlertBeforeUnload()
    this.setData({
      submitStatus: true
    })
@@ -495,6 +526,7 @@
              let value = JSON.parse(res[0].value)
              // 有答题记录,得分赋值
              if (value) {
                wx.disableAlertBeforeUnload()
                this.setData({
                  submitStatus: true
                })
@@ -508,6 +540,7 @@
              this.setData({
                currentIndex: value.currentIndex
              })
              console.log(this.data.submitStatus);
              // 携带答题记录 获取题目
              await this.getQuestionList(value.dataList)
            } else {
packageBookService/pages/bookServices/examination/examination.wxml
@@ -36,6 +36,7 @@
  <question-list
    wx:if="{{!loading}}"
    isNight="{{isNight}}"
    answerType="{{answerType}}"
    currentIndex="{{currentIndex}}"
    questionList="{{questionDataList}}"
    submitStatus="{{submitStatus}}"
packageBookService/pages/bookServices/examination/questionList/index.js
@@ -19,6 +19,10 @@
    isNight:{
      type:Boolean,
      value:false
    },
    answerType:{
      type:Boolean,
      value:''
    }
  },
  created() {
@@ -45,7 +49,6 @@
  methods: {
    // 切换题目
    changeSwiper(e) {
      console.log(e);
      this.setData({
        showIndex: e.detail.current
      })
packageBookService/pages/bookServices/examination/questionList/index.wxml
@@ -6,7 +6,7 @@
  </view>
  <!-- 题目列表 -->
  <swiper class="swiper" bind:change="changeSwiper" current="{{currentIndex}}">
    <swiper-item wx:for="{{questionList}}" wx:key="{{item.id}}">
    <swiper-item wx:for="{{questionList}}" wx:key="{{id}}">
      <!-- 题干 -->
      <view class="question-stem title-score" style="color: {{isNight ? '#fff' : '#000'}};">
        <!-- 题号 -->
@@ -40,7 +40,7 @@
        <t-radio-group wx:if="{{item.questionType == 'singleChoice' || item.questionType == 'judge'}}" defaultValue="{{item.userAnswer}}" disabled="{{item.isComplete}}" bind:change="onChangeRadio" class="radio-group" data-value="{{item.option}}" data-id="{{item.id}}">
          <view wx:for="{{item.option}}" wx:for-item="contentItem" wx:for-index="contentIndex" wx:key="contentIndex">
            <t-radio value="{{contentItem.value}}" icon="none" placement="right" borderless>
              <view class="radio-item {{item.answer == contentItem.value && item.answer == item.userAnswer  ? 'radio-correct' : item.userAnswer == contentItem.value && item.userAnswer != item.answer ?'radio-error' :''}}">
              <view class="radio-item {{item.userAnswer == contentItem.value ? 'radio-active' : ''}} {{(answerType == 'collectQuestion' || answerType == 'errorQuestion') && (item.answer == contentItem.value && item.answer == item.userAnswer  ? 'radio-correct' : item.userAnswer == contentItem.value && item.userAnswer != item.answer ?'radio-error' :'')}}">
                <!-- 仅文字 -->
                <text wx:if="{{item.optionStyle == 'Txt'}}">{{contentItem.value}}、{{contentItem.txt}}</text>
                <!-- 仅图片 -->
@@ -59,8 +59,8 @@
                  <text>{{contentItem.value}}、</text>
                  <rich-text nodes="{{contentItem.txt}}"></rich-text>
                </view>
                <text wx:if="{{item.answer == contentItem.value && item.answer == item.userAnswer}}">对</text>
                <text wx:if="{{item.userAnswer == contentItem.value && item.userAnswer != item.answer}}">错</text>
                <text wx:if="{{(answerType == 'collectQuestion' || answerType == 'errorQuestion') && (item.answer == contentItem.value && item.answer == item.userAnswer)}}">对</text>
                <text wx:if="{{(answerType == 'collectQuestion' || answerType == 'errorQuestion') && (item.userAnswer == contentItem.value && item.userAnswer != item.answer)}}">错</text>
              </view>
            </t-radio>
          </view>
packageBookService/pages/bookServices/examination/questionList/index.wxss
@@ -51,6 +51,10 @@
  background-color: #F9F9F9;
}
.radio-active {
  background-color: #ff6c00;
}
.radio-correct {
  background-color: #EAF7EE;
}