zhongshujie
3 天以前 dc19fdf86993b2ddeb6b92e2561cb01176ded889
量表优化(通过查询嵌套的关系进行判断)
6个文件已修改
82 ■■■■ 已修改文件
app.json 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
assets/js/middleGround/api/store.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/linkPage/index.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/psychologyAnswer/psychologyAnswer.js 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/psychologyAnswer/testdata/index.js 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/home/home.js 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app.json
@@ -138,6 +138,9 @@
  "permission": {
    "scope.userLocation": {
      "desc": "你的位置信息将用于小程序位置接口的效果展示"
    },
    "clipboard": {
      "desc": "用于复制内容到剪贴板"
    }
  }
}
assets/js/middleGround/api/store.js
@@ -303,7 +303,6 @@
        if (resp.length > 0) {
          const data = resp[0]
          if (data.datas.length) {
            data.datas[0].subDatas = data.datas[0].cmsDatas
            const datas = handleDetailQueryRequestData({
              productId,
packageBookService/pages/bookServices/linkPage/index.js
@@ -83,13 +83,13 @@
  copyPath() {
    wx.setClipboardData({
      data: this.data.path,
      success: () => {
      success: (res) => {
        wx.showToast({
          icon: 'success',
          title: '复制成功',
        })
      },
      fail: () => {
      fail: (res) => {
        wx.showToast({
          icon: 'error',
          title: '请重试',
packageBookService/pages/psychologyAnswer/psychologyAnswer.js
@@ -56,20 +56,40 @@
        }
      }
      const indexof = listIndex
      const questionId = questionList[indexof].id;
      const idPath = questionList[indexof].idPath;
      const bookId = questionList[indexof].bookId;
      const bookName = "大学生心理健康(第3版)(融媒体版)"
      const formPath = "questionBank"
      // 进行处理
      const query = {
        "cmsItemId": Number(questionId)
        path: "*",
        queryType: "*",
        productId: bookId,
        cmsPath: "161796",
        cmsType: "*"
      };
      app.MG.file.checkCmsItem(query)
        .then((res) => {
          const isBuys = res;
      app.MG.store.getProductDetail(query).then(async (res) => {
        const linkPathList = res.datas.cmsDatas[0].datas
        const isBuyList = res.datas.purchasedSaleMethodIdList
        let isBuy = false
        const idParhList = idPath.split("/").reverse()
        for (let index = 0; index < idParhList.length; index++) {
          const item = idParhList[index];
          const thisItem = linkPathList.find(citem => item == citem.id);
          if (thisItem.saleMethod.length > 0) {
            if (isBuyList.includes(thisItem.saleMethod[0].Id)) {
              isBuy = true
              break
            } else {
              isBuy = false
              break
            }
          }
        }
          this.setData({
            isBuy: isBuys
          isBuy: isBuy
          });
          if (!isBuys) {
        if (!isBuy) {
            wx.showModal({
              icon: 'error',
              title: '温馨提示',
@@ -88,8 +108,7 @@
          }
          // 其他逻辑
          this.initialize()
        })
        .catch((err) => {
      }).catch((err) => {
          console.error('检查题库失败:', err);
          wx.showToast({
            icon: 'error',
packageBookService/pages/psychologyAnswer/testdata/index.js
@@ -1,7 +1,7 @@
var localData = {
  "list": [{
      "name": "测测你的生活品质",
      "id": 162287,
      "idPath": "161796/162214/162217/162287",
      "bookId": 7129,
      "title": "请仔细阅读以下问题,凭你的第一感觉回答。请选择与你相符的答案,即使你感到不太确定,也要回答每个问题。(答案仅自己可见)",
      "fromType": "json",
@@ -1297,7 +1297,7 @@
    },
    {
      "name": "身体症状问卷",
      "id": 162288,
      "idPath": "161796/162214/162217/162288",
      "bookId": 7129,
      "title": "下面是与心理因素相关的身体症状列表,请根据自己上一周的情况,在相应的位置上画圈,看看工作量与身体症状之间是否存在联系。(答案仅自己可见)",
      "fromType": "json",
@@ -3325,7 +3325,7 @@
    },
    {
      "name": "一般自我效能感量表",
      "id": 162289,
      "idPath": "161796/162214/162217/162289",
      "bookId": 7129,
      "title": "<p>以下10个句子都是关于你平时对自己的一般看法,请你根据自己的实际情况,选择合适的选项。“1”表示完全不正确。“2”表示有点正确,“3”表示多数正确,“4”表示完全正确。答案没有对错之分,对每一个句子无须多考虑。(答案仅自己可见)</p>",
      "fromType": "json",
@@ -3653,7 +3653,7 @@
    },
    {
      "name": "学习动力自我诊断测试",
      "id": 162290,
      "idPath": "161796/162214/162217/162290",
      "bookId": 7129,
      "title": "这个量表主要为了帮助你了解自己在学习动机、学习兴趣、学习目标上是否存在困扰,共20个题目。请你根据自己的情况,实事求是地对每个题目做“是”或“否”的回答。(答案仅自己可见)",
      "fromType": "json",
@@ -4231,7 +4231,7 @@
    },
    {
      "name": "人际关系综合诊断表",
      "id": 162291,
      "idPath": "161796/162214/162217/162291",
      "bookId": 7129,
      "title": "本量表共28个问题,每个问题做“是”或“否”回答。请你认真完成,然后参照计分及分析方法,对测试结果做出解释。(答案仅自己可见)",
      "fromType": "json",
@@ -5001,7 +5001,7 @@
    },
    {
      "name": "婚姻稳定性测试",
      "id": 162292,
      "idPath": "161796/162214/162217/162292",
      "bookId": 7129,
      "title": "<p>你选择好终身伴侣了吗?你是怎样看待婚姻的呢?下面的婚姻稳定性测试可以帮你更好地预测未来婚姻的稳定性。</p><p>请仔细阅读每道题,选择符合你的答案。(答案仅自己可见)</p>",
      "fromType": "json",
@@ -5337,7 +5337,7 @@
    },
    {
      "name": "你的恋爱心理是否成熟?",
      "id": 162293,
      "idPath": "161796/162214/162217/162293",
      "bookId": 7129,
      "title": "请认真阅读以下各项,根据自己的真实情况作答。(答案仅自己可见)",
      "fromType": "json",
@@ -6195,7 +6195,7 @@
    },
    {
      "name": "压力心理测试",
      "id": 162294,
      "idPath": "161796/162214/162217/162294",
      "bookId": 7129,
      "title": "请回想一下自己在过去一个月内是否出现过下述情况。(答案仅自己可见)",
      "fromType": "json",
@@ -6711,7 +6711,7 @@
    },
    {
      "name": "抑郁自评量表(SDS)",
      "id": 162295,
      "idPath": "161796/162214/162217/162295",
      "bookId": 7129,
      "title": "下面有20条文字,请仔细阅读每一条,把意思弄明白后根据您最近一星期的情况选择适当的选项。“A”表示没有或很少时间有,“B”表示小部分时间有,“C”表示相当多时间有,“D”表示绝大部分时间都有。(答案仅自己可见)",
      "fromType": "json",
@@ -7367,7 +7367,7 @@
    },
    {
      "name": "了解你的职业化程度",
      "id": 162296,
      "idPath": "161796/162214/162217/162296",
      "bookId": 7129,
      "title": "职业化指一种工作状态的标准化、规范化和制度化,即在合适的时间、地点用合适的方式完成工作。职业化体现了一个人能准确地扮演好自己的职业角色,尽职尽责地完成自己的工作。作为一名即将走进职场的大学生,你的职业化程度有多高呢?请完成下列测试。(答案仅自己可见)",
      "fromType": "json",
@@ -8088,6 +8088,7 @@
    {
      "name": "职业能力测试",
      "id": 162297,
      "idPath": "161796/162214/162217/162297",
      "bookId": 7129,
      "title": "根据你的实际情况,对下面每种活动做出评定。(答案仅自己可见)",
      "fromType": "json",
@@ -10357,7 +10358,7 @@
    },
    {
      "name": "威廉斯创造力倾向量表",
      "id": 162298,
      "idPath": "161796/162214/162217/162298",
      "bookId": 7129,
      "title": "<p>这是一份帮助你了解自己创造力的表单。每一题都要做,不要花太多时间去思考;所有题目都没有正确答案,凭你读完每一句的第一印象作答;虽然没有时间限制,但尽可能以较快的速度完成,越快越好;凭自己的真实感受作答。(答案仅自己可见)</p>",
      "fromType": "json",
pages/home/home.js
@@ -140,7 +140,6 @@
        list.push({
          value: item.icon,
          link: item.jsek_link,
        })
      }
      this.setData({
@@ -472,6 +471,19 @@
    const item = e.currentTarget.dataset.book
    // 网页类型跳转到网址复制页,因为url传参不能传 带参数的网络地址,所以此处要把网络地址里的传参摘出来,放到url里
    let urlData = ''
    if (!item.jsek_link) {
      wx.showModal({
        title: '提示',
        content: '暂无内容',
        showCancel: false,
        success: (res) => {
          if (res.confirm) {
            console.log(res, '3232')
          }
        }
      })
      return false;
    }
    const flags = item.jsek_link.indexOf("?")
    if (flags > -1) {
      urlData = item.jsek_link.slice(flags + 1, item.jsek_link.length)