闫增涛
2024-04-09 82a02197268268e0da3a682e1d8aa2040012c6ec
答题器底部按钮显示优化,详情页数据赋值优化
4个文件已修改
131 ■■■■ 已修改文件
packageBookService/pages/bookServices/detail/index.js 124 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/examination/examination.js 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/examination/examination.wxml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/examination/questionOptions/index.js 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/index.js
@@ -1,7 +1,9 @@
// pages/bookServices/detail/index.js
import Toast from "tdesign-miniprogram/toast";
import tool from "../../../../assets/js/toolClass";
import { loginInfo } from "../../../../assets/js/login";
import {
  loginInfo
} from "../../../../assets/js/login";
const app = getApp();
Page({
  /**
@@ -358,11 +360,20 @@
    app.MG.store.getProductDetail(query).then(async (res) => {
      this.setData({
        bookDetail: res.datas,
        cmsDatas: res.datas.cmsDatas[0].datas,
        buyIdList: res.datas.purchasedSaleMethodIdList,
        relatedBookPath: JSON.parse(res.datas.datas.ProductLinkInfo)[0]
          .LinkPath,
      });
      if (res.datas.cmsDatas && res.datas.cmsDatas.length) {
        this.setData({
          cmsDatas: res.datas.cmsDatas[0].datas,
        })
      }
      if (res.datas.datas.ProductLinkInfo) {
        if (JSON.parse(res.datas.datas.ProductLinkInfo).length) this.setData({
          relatedBookPath: JSON.parse(res.datas.datas.ProductLinkInfo)[0]
            .LinkPath,
        })
      }
      this.getSubTtem();
      // 获取图书分类
      let className = "";
@@ -443,10 +454,9 @@
        this.setData({
          bookItemDetail: res.datas[0],
          selectedIds: res.datas[0].defaultSaleMethod.id,
          bookBuy:
            res.datas[0].purchasedSaleMethodIdList.indexOf(
              res.datas[0].defaultSaleMethodId
            ) > -1,
          bookBuy: res.datas[0].purchasedSaleMethodIdList.indexOf(
            res.datas[0].defaultSaleMethodId
          ) > -1,
          "bookDetail.price": this.numFormat(res.datas[0].price),
        });
        let times = new Date(res.datas[0].defaultSaleMethod.endDate).getTime();
@@ -509,10 +519,9 @@
        }
        this.setData({
          selectedIds: this.data.bookDetail.defaultSaleMethodId,
          bookBuy:
            this.data.bookDetail.purchasedSaleMethodIdList.indexOf(
              this.data.bookDetail.defaultSaleMethodId
            ) > -1,
          bookBuy: this.data.bookDetail.purchasedSaleMethodIdList.indexOf(
            this.data.bookDetail.defaultSaleMethodId
          ) > -1,
        });
        let times = new Date(
          this.data.bookDetail.defaultSaleMethod.endDate
@@ -616,7 +625,9 @@
  },
  // 跳转网店
  goShop(e) {
    const { link } = e.currentTarget.dataset;
    const {
      link
    } = e.currentTarget.dataset;
    wx.navigateTo({
      url: `/packageBookService/pages/bookServices/webpage/index?url=${link}`,
    });
@@ -918,13 +929,11 @@
      );
      if (!determine) {
        let query = {
          requests: [
            {
              saleMethodId: this.data.selectedIds,
              storeEventId: null,
              agentCode: "电子书",
            },
          ],
          requests: [{
            saleMethodId: this.data.selectedIds,
            storeEventId: null,
            agentCode: "电子书",
          }, ],
        };
        const addRes = app.MG.store.addShoppingCart(query);
        this.showSuccessToast();
@@ -965,14 +974,11 @@
      let bookOrdersId = "";
      let query = {
        remarks: "电子书",
        requests: [
          {
            saleMethodId: this.data.bookItemDetail.defaultSaleMethodId
              ? this.data.bookItemDetail.defaultSaleMethodId
              : this.data.bookDetail.defaultSaleMethodId,
            count: 1,
          },
        ],
        requests: [{
          saleMethodId: this.data.bookItemDetail.defaultSaleMethodId ?
            this.data.bookItemDetail.defaultSaleMethodId : this.data.bookDetail.defaultSaleMethodId,
          count: 1,
        }, ],
      };
      // 发起订单初始化请求并等待结果
      const res = await app.MG.store.initOrder(query);
@@ -1114,14 +1120,12 @@
          cmsTypeRefCode: "",
          newDataListRequest: [],
          name: this.data.bookDetail.name, // name为申请的书本名称
          content: JSON.stringify([
            {
              name: this.data.bookDetail.name,
              id: this.data.bookDetail.id,
              // defaultSaleMethodId: bookData.value.defaultSaleMethodId,
              icon: this.data.bookDetail.icon,
            },
          ]),
          content: JSON.stringify([{
            name: this.data.bookDetail.name,
            id: this.data.bookDetail.id,
            // defaultSaleMethodId: bookData.value.defaultSaleMethodId,
            icon: this.data.bookDetail.icon,
          }, ]),
        };
        app.MG.ugc.newTopicMessage(query).then(async (res) => {
          if (res) {
@@ -1139,8 +1143,7 @@
          confirmColor: "#ff6c00",
          cancelColor: "#949494",
          complete: (res) => {
            if (res.cancel) {
            }
            if (res.cancel) {}
            if (res.confirm) {
              wx.navigateTo({
                url: "/packageDomain/pages/teacherCertification/index",
@@ -1156,8 +1159,7 @@
        confirmColor: "#ff6c00",
        cancelColor: "#949494",
        complete: (res) => {
          if (res.cancel) {
          }
          if (res.cancel) {}
          if (res.confirm) {
            wx.navigateTo({
              url: "/packageDomain/pages/teacherCertification/index",
@@ -1187,8 +1189,7 @@
        confirmColor: "#ff6c00",
        cancelColor: "#949494",
        complete: (res) => {
          if (res.cancel) {
          }
          if (res.cancel) {}
          if (res.confirm) {
            wx.navigateTo({
              url: "/packageDomain/pages/teacherCertification/index",
@@ -1560,9 +1561,9 @@
        if (new RegExp("(" + k + ")").test(fmt)) {
          fmt = fmt.replace(
            RegExp.$1,
            RegExp.$1.length == 1
              ? o[k]
              : ("00" + o[k]).substr(("" + o[k]).length)
            RegExp.$1.length == 1 ?
            o[k] :
            ("00" + o[k]).substr(("" + o[k]).length)
          );
        }
      }
@@ -1618,12 +1619,10 @@
    try {
      let query = {
        remarks: "组卷",
        requests: [
          {
            saleMethodId: this.data.mockData.id,
            count: 1,
          },
        ],
        requests: [{
          saleMethodId: this.data.mockData.id,
          count: 1,
        }, ],
      };
      if (this.data.flag) {
        this.setData({
@@ -1673,13 +1672,11 @@
    });
    // 记录购买时间,并设状态state为1,表示刚购买完成组卷
    app.MG.identity.setUserKey({
      setKeyRequests: [
        {
          domain: "mockData",
          key: this.data.bookDetail.id + "",
          value: JSON.stringify(this.data.mockData.mockList),
        },
      ],
      setKeyRequests: [{
        domain: "mockData",
        key: this.data.bookDetail.id + "",
        value: JSON.stringify(this.data.mockData.mockList),
      }, ],
    });
  },
  // 获取相关图书
@@ -1775,8 +1772,7 @@
      return false;
    }
    wx.navigateTo({
      url:
        "/packageBookService/pages/components/webView/index?md5=" +
      url: "/packageBookService/pages/components/webView/index?md5=" +
        this.data.fileInfo.md5 +
        "&fileName=" +
        this.data.fileInfo.bookName +
@@ -1954,8 +1950,7 @@
              wx.navigateTo({
                url: "/packageDomain/pages/teacherCertification/index",
              });
            } else if (res.cancel) {
            }
            } else if (res.cancel) {}
          },
        });
      }
@@ -2027,8 +2022,7 @@
              wx.navigateTo({
                url: "/packageDomain/pages/teacherCertification/index",
              });
            } else if (res.cancel) {
            }
            } else if (res.cancel) {}
          },
        });
      }
@@ -2113,4 +2107,4 @@
      teach: tree,
    });
  },
});
});
packageBookService/pages/bookServices/examination/examination.js
@@ -463,7 +463,6 @@
      loading: true,
    });
    const child = this.selectComponent("#question-options");
    debugger
    if (
      this.data.answerType == "option" ||
      this.data.answerType == "errorQuestion" ||
@@ -697,7 +696,6 @@
              this.setData({
                currentIndex: value.currentIndex,
              });
              console.log(this.data.submitStatus);
              // 携带答题记录 获取题目
              await this.getQuestionList(value.dataList);
            } else {
packageBookService/pages/bookServices/examination/examination.wxml
@@ -70,7 +70,7 @@
<view
  class="page-bottom"
  style="background-color:{{isNight ? '#202020' : ''}}"
  wx:if="{{answerType == 'mock' ||  answerType == 'option' || (answerType == 'errorQuestion' && !loading) || (answerType == 'collectQuestion' && !loading) }}"
  wx:if="{{answerType !== 'errorQuestion' || (answerType == 'errorQuestion' && !loading)}}"
>
  <question-options
    id="question-options"
packageBookService/pages/bookServices/examination/questionOptions/index.js
@@ -75,7 +75,7 @@
            2 * 60 * 60 * 1000 - this.properties.countdownTime
          ),
        });
      } else if (this.properties.answerType == "option") {
      } else if (this.properties.answerType == "mock") {
        this.setData({
          useTime: this.formatTime(
            this.properties.mockSumTime - this.properties.countdownTime
@@ -87,6 +87,7 @@
        (this.properties.answerType == "option" ||
          this.properties.answerType == "mock") && !this.properties.submitStatus
      ) {
        debugger
        this.timeout();
      }
    },