litian
2024-03-25 93463d63f0dd81c436aa3335506611aab8356b88
packageDomain/pages/sampleBookList/applicationForm/index.js
@@ -1,4 +1,4 @@
import { worksDataBytool } from "../../../../../assets/js/toolClass.js";
import { worksDataBytool } from "../../../../assets/js/toolClass.js";
const app = getApp();
Page({
  data: {
@@ -9,6 +9,7 @@
      workInfo: null,
      schoolName: "",
      courseName: "",
      detailedAddress: ""
    },
    contactInfo: {
      fullName: "",
@@ -36,26 +37,22 @@
      })
      if (this.data.userInfo.role == 'Teacher') {
        this.setData({
          teacherInfo: {
            schoolName: JSON.parse(this.data.userInfo.data).schoolName,
            courseName: JSON.parse(this.data.userInfo.data).courseName,
          },
          contactInfo: {
            fullName: JSON.parse(this.data.userInfo.data).fullName,
            phone: JSON.parse(this.data.userInfo.data).phone,
            detailedAddress: JSON.parse(this.data.userInfo.data).detailedAddress
          }
          'teacherInfo.schoolName': JSON.parse(this.data.userInfo.data).schoolName,
          'teacherInfo.courseName': JSON.parse(this.data.userInfo.data).courseName,
          'contactInfo.fullName': JSON.parse(this.data.userInfo.data).fullName,
          'contactInfo.phone': JSON.parse(this.data.userInfo.data).phone,
          'contactInfo.detailedAddress': JSON.parse(this.data.userInfo.data).detailedAddress,
        })
      }
      if (wx.getStorageSync("paperBookList")) {
        this.setData({
          paperBookList: JSON.parse(wx.getStorageSync("paperBookList")),
          bookList: JSON.parse(wx.getStorageSync("paperBookList"))
          paperBookList: wx.getStorageSync("paperBookList"),
          bookList: wx.getStorageSync("paperBookList")
        })
      }
      if (wx.getStorageSync("electronicBookList")) {
        this.setData({
          electronicBookList: JSON.parse(wx.getStorageSync("electronicBookList"))
          electronicBookList: wx.getStorageSync("electronicBookList")
        })
      }
      this.getSelectBookCount();
@@ -90,9 +87,7 @@
    app.MG.resource.getCmsTypeByRefCode({ refCodes: ['jsek_electronicSampleBook'] }).then((res) => {
      this.setData({
        description: res[0].description,
        teacherInfo: {
          workInfo: res[0].cmsTypeLinks[0].children
        },
        'teacherInfo.workInfo': res[0].cmsTypeLinks[0].children,
      })
    })
  },
@@ -104,11 +99,10 @@
        if (res && res.length > 0) {
          this.setData({
            description: res[0].description,
            teacherInfo: {
              workInfo: res[0].cmsTypeLinks[0].children
            },
            'teacherInfo.workInfo': res[0].cmsTypeLinks[0].children,
          })
        }
        console.log(this.data.teacherInfo.workInfo, 333)
      })
  },
  //获取当前已申请次数(电子)
@@ -173,7 +167,7 @@
        }
        applyInfo = {
          ticketRefCodeOrGuid: 'electronicSampleBookapplyNum',
          roleId: userStore.userInfo.roleId,
          roleId: that.data.userInfo.roleId,
          refType: 'applyBook'
        }
      } else {
@@ -185,12 +179,13 @@
          })
          return
        }
        const mailAddress = JSON.stringify(that.data.contactInfo)
        that.setData({
          teacherInfo: {
            detailedAddress: mailAddress,
          }
          'teacherInfo.detailedAddress': mailAddress
        })
        console.log(that.data.teacherInfo.workInfo, 345)
        data = {
          topicIdOrRefCode: 'applyEntityBook',
          name: that.data.userInfo.name || '',
@@ -222,14 +217,13 @@
              })
              wx.setStorageSync("paperBookList", that.data.paperBookList);
            }
            wx.showModal({
              title: '提示!', //提示的标题
              content: '您的样书申请已提交,管理员审核中!申请状态在【个人中心—样书申请】中查询。', //提示的内容
              success: function (res) {
                if (res.confirm) {
                  wx.navigateTo({
                    url: "/packagePersonal/pages/sampleBooks/index",
                    url: "/packagePersonal/pages/sampleBooks/index?stateTab=1&tabActive=" + that.data.active,
                  });
                } else if (res.cancel) {
                }
@@ -257,25 +251,27 @@
      success: function (res) {
        if (res.confirm) {
          if (that.data.active == '1') {
            that.data.electronicBookList.forEach((obj, index) => {
            let eList = that.data.electronicBookList;
            eList.forEach((obj, index) => {
              if (obj.id == item.id) {
                that.data.electronicBookList.splice(index, 1);
                eList.splice(index, 1);
              }
            })
            that.setData({
              bookList: that.data.electronicBookList
              bookList: eList
            })
            wx.setStorageSync("electronicBookList", that.data.electronicBookList);
            wx.setStorageSync("electronicBookList", eList);
          } else {
            that.data.paperBookList.forEach((obj, index) => {
            let pList = that.data.paperBookList;
            pList.forEach((obj, index) => {
              if (obj.id == item.id) {
                that.data.paperBookList.splice(index, 1);
                pList.splice(index, 1);
              }
            })
            that.setData({
              bookList: this.data.paperBookList
              bookList: pList
            })
            wx.setStorageSync("paperBookList", that.data.paperBookList);
            wx.setStorageSync("paperBookList", pList);
          }
        } else if (res.cancel) {
        }