litian
2024-03-22 aacb4b111141c9b37397b528eae1668245ac93b2
样书
12个文件已修改
648 ■■■■■ 已修改文件
assets/js/toolClass.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/index.js 402 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/index.wxml 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/index.wxss 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageDomain/pages/sampleBookList/applicationForm/index.js 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageDomain/pages/sampleBookList/applicationForm/index.wxss 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packagePersonal/pages/myCollection/index.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
packagePersonal/pages/userSetting/index.js 125 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packagePersonal/pages/userSetting/index.wxml 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packagePersonal/pages/userSetting/index.wxss 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/personalCenter/components/user-center-card/index.wxml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/personalCenter/index.js 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
assets/js/toolClass.js
@@ -163,6 +163,7 @@
      })
    )
  }
  res.forEach((item) => {
    const obj = {
      baseType: item.typeField.baseType,
packageBookService/pages/bookServices/detail/index.js
@@ -16,6 +16,7 @@
      name: '',
    },
    bookDetail: {},
    bookItemDetail: {},
    link: {
      jd: '',
      tamll: '',
@@ -53,7 +54,19 @@
    },
    flag: true,
    applyResourceLoading: false,
    noResources: false
    noResources: false,
    selectedIds: "",//商品或子商品销售方式
    bookBuy: false, //商品或子商品是否购买
    expire: false,//商品或子商品销售方式是否过期
    noFile: false, //商品或子商有无电子书文件
    num: 0, //样书申请单数量
    alreadyPaperBookList: [], //已申请纸质样书
    alreadyElectronicBookList: [], //已申请电子样书
    paperBookList: [], //样书单纸质书
    electronicBookList: [], //样书单电子书
    paperBookCount: 0, //纸质书剩余次数
    ebookCount: 0, //电子书剩余次数
    userInfo: {},
  },
@@ -81,6 +94,7 @@
        name: options.name,
      },
    });
    this.getBookInfo(options.id);
    this.getResourceClass() // 获取资源所属分类
    const token = wx.getStorageSync('jsek-token')
@@ -89,6 +103,24 @@
      this.getApplyInfo(options.id)
      this.getMockData()
    }
    if (wx.getStorageSync(app.config.userInfoKey)) {
      this.setData({
        userInfo: JSON.parse(wx.getStorageSync(app.config.userInfoKey))
      })
    }
    if (wx.getStorageSync("paperBookList")) {
      this.setData({
        paperBookList: wx.getStorageSync("paperBookList"),
      })
    }
    if (wx.getStorageSync("electronicBookList")) {
      this.setData({
        electronicBookList: wx.getStorageSync("electronicBookList"),
      })
    }
    this.setData({
      num: this.data.paperBookList.length + this.data.electronicBookList.length
    })
  },
  /**
@@ -238,6 +270,7 @@
        cmsDatas: res.datas.cmsDatas[0].datas,
        buyIdList: res.datas.purchasedSaleMethodIdList
      });
      this.getSubTtem();
      // 获取图书分类
      const iconType = JSON.parse(res.datas.bookClassification)[0][0];
      const classType = JSON.parse(res.datas.bookClassification)[0][1];
@@ -274,6 +307,76 @@
      console.log('图书信息', this.data.bookDetail);
    });
  },
  //请求子商品的文件
  getSubTtem() {
    const obj = {
      path: '*',
      queryType: 'SubProduct',
      sort: {
        type: 'Desc',
        field: 'CreateDate'
      },
      paging: {
        start: 0,
        size: 6
      },
      mainProductId: this.data.bookDetail.id,
      fields: {
        author: [],
        bookshelf_pdf: [],
        bookshelf_protectedEpub: [],
        bookshelf_freeEpub: [], //epub试读百分比
        bookshelf_probationPage: [] //pdf试读页数
      }
    }
    app.MG.store.getProductList(obj).then((res) => {
      if (res.datas && res.datas.length > 0) {
        this.setData({
          bookItemDetail: res.datas[0],
          selectedIds: res.datas[0].defaultSaleMethod.id,
          bookBuy: res.datas[0].purchasedSaleMethodIdList.indexOf(res.datas[0].defaultSaleMethodId) > -1
        });
        console.log(this.data.bookItemDetail, 'bookItemData.value');
        let times = new Date(res.datas[0].defaultSaleMethod.endDate).getTime()
        let startTime = new Date(res.datas[0].defaultSaleMethod.beginDate).getTime()
        if (times < new Date().getTime() || new Date().getTime() < startTime) {
          this.setData({
            expire: true
          });
        } else {
          this.setData({
            expire: false
          });
        }
        if (res.datas[0].bookshelf_pdf || res.datas[0].bookshelf_protectedEpub) {
          this.setData({
            noFile: true
          });
        }
      } else {
        if (this.data.bookDetail.pdf || this.data.bookDetail.protectedEpub) {
          this.setData({
            noFile: true
          });
        }
        this.setData({
          selectedIds: this.data.bookDetail.defaultSaleMethodId,
          bookBuy: this.data.bookDetail.purchasedSaleMethodIdList.indexOf(this.data.bookDetail.defaultSaleMethodId) > -1
        });
        let times = new Date(this.data.bookDetail.defaultSaleMethod.endDate).getTime()
        let startTime = new Date(this.data.bookDetail.defaultSaleMethod.beginDate).getTime()
        if (times < new Date().getTime() || new Date().getTime() < startTime) {
          this.setData({
            expire: true
          });
        } else {
          this.setData({
            expire: false
          });
        }
      }
    })
  },
  // 获取图书分类
  async getBookClass(iconType, classType) {
@@ -567,7 +670,6 @@
  // 图书添加购物车
  async addBookShopcCar() {
    const token = wx.getStorageSync('jsek-token')
    if (!token) {
      return wx.getUserProfile({
@@ -591,15 +693,14 @@
      shoppingCartGetId.push(item.saleMethod.id)
    })
    console.log(shoppingCartGetId, 'shoppingCartGetId');
    console.log(this.data.bookDetail.defaultSaleMethodId, 'this.data.bookDetail.defaultSaleMethodId');
    const determine = shoppingCartGetId.some((item) => item == this.data.bookDetail.defaultSaleMethodId)
    console.log(this.data.selectedIds, '销售方式id');
    const determine = shoppingCartGetId.some((item) => item == this.data.selectedIds)
    console.log(determine);
    if (!determine) {
      let query = {
        requests: [
          {
            saleMethodId: this.data.bookDetail.defaultSaleMethodId,
            saleMethodId: this.data.selectedIds,
            storeEventId: null,
            agentCode: '电子书'
          }
@@ -633,12 +734,13 @@
  async buyBook() {
    if (!this.data.expire) {
    let bookOrdersId = ''
    let query = {
      remarks: '电子书',
      requests: [
        {
          saleMethodId: this.data.bookDetail.defaultSaleMethodId,
            saleMethodId: this.data.bookItemDetail.defaultSaleMethodId ? this.data.bookItemDetail.defaultSaleMethodId : this.data.bookDetail.defaultSaleMethodId,
          count: 1
        }
      ]
@@ -657,7 +759,13 @@
    } else {
      console.log(222);
    }
    } else {
      wx.showToast({
        title: "商品不在有效期",
        icon: 'none',
        duration: 1000,
      })
    }
  },
  // 获取教学资源下载是否申请通过
@@ -1227,10 +1335,7 @@
    }
    else if (this.data.tabValue == 'jsek_cloudLearning') {
      const tree = this.selectComponent('#tree')
      tree.onCloudShoppingCart()
    } else if (this.data.tabValue == 'questionBank') {
      this.buyMock()
    } else {
@@ -1238,4 +1343,279 @@
    }
  },
  //样书申请
  //申请电子样书
  appplyElectronicBook() {
    console.log(this.data.bookDetail)
    if (this.data.bookDetail.isApplyBook == 2 || this.data.bookDetail.isApplyBook == 4) {
      let role = this.data.userInfo != null ? this.data.userInfo.role : null
      if (role) {
        if (role == 'Teacher') {
          if (this.data.noFile) {
            this.getSelectBookCount()
          } else {
            wx.showToast({
              title: "暂无电子书文件,请联系管理员!",
              icon: 'none',
              duration: 1000,
            })
          }
        } else {
          wx.showModal({
            title: '尊敬的用户,您好!', //提示的标题
            content: '请先进行教师认证?', //提示的内容
            success: function (res) {
              if (res.confirm) {
                wx.navigateTo({
                  url: "/packageDomain/pages/teacherCertification/index",
                });
              } else if (res.cancel) {
              }
            }
          })
        }
      }
    }
  },
  //申请纸质样书
  appplyPaperBook() {
    if (this.data.bookDetail.isApplyBook == 3 || this.data.bookDetail.isApplyBook == 4) {
      let role = this.data.userInfo != null ? this.data.userInfo.role : null
      if (role) {
        if (role == 'Teacher') {
          this.getSelectPaperBookCount()
        } else {
          wx.showModal({
            title: '尊敬的用户,您好!', //提示的标题
            content: '请先进行教师认证?', //提示的内容
            success: function (res) {
              if (res.confirm) {
                wx.navigateTo({
                  url: "/packageDomain/pages/teacherCertification/index",
                });
              } else if (res.cancel) {
              }
            }
          })
        }
      }
    }
  },
  //获取当前已申请次数(纸质)
  getSelectPaperBookCount() {
    app.MG.app
      .getTicketResult({
        ticketRefCodeOrGuid: 'paperSampleBookapplyNum',
        roleId: this.data.userInfo.roleId
      })
      .then((res) => {
        this.setData({
          paperBookCount: res.totalCount - res.usedCount
        })
        this.getAlreadyBookList(this.data.bookDetail, 'pBook')
      })
  },
  //获取当前已申请次数(电子)
  getSelectBookCount() {
    app.MG.app
      .getTicketResult({
        ticketRefCodeOrGuid: 'electronicSampleBookapplyNum',
        roleId: this.data.userInfo.roleId
      })
      .then((res) => {
        this.setData({
          ebookCount: res.totalCount - res.usedCount
        })
        this.getAlreadyBookList(this.data.bookDetail, 'eBook')
      })
  },
  //获取已申请的样书列表
  getAlreadyBookList(item, type) {
    let topicIdOrRefCode = null
    if (type == 'eBook') {
      topicIdOrRefCode = 'applyBook'
    } else {
      topicIdOrRefCode = 'applyEntityBook'
    }
    const data = {
      start: 0,
      size: 9999,
      topicIdOrRefCode,
      appRefCode: app.config.appRefCode,
      sort: {
        type: 'Desc',
        field: 'CreateDate'
      }
    }
    app.MG.ugc.getTopicMessageList(data).then((res) => {
      let itemAttr = null
      let isHas = false
      itemAttr = {
        id: item.id,
        title: item.name || '--',
        icon: item.icon,
        checked: false,
        defaultSaleMethodId: item.defaultSaleMethodId,
        md5: item.datas.Icon,
        author: item.author || '--',
        price: item.price || '--',
        isbn: item.isbn || '--',
        publicationDate: item.publicationDate
      }
      res.datas.map((item) => {
        if (item.feedBack) {
          item.feedBack = JSON.parse(item.feedBack)
          if (item.feedBack.endDate) {
            const currentDate = new Date()
            let times = new Date(item.feedBack.endDate + ' 23:59:59').getTime()
            if (times < currentDate.getTime()) {
              item.isExpiry = true
            }
          }
        }
        if (item.content) {
          item.content = JSON.parse(item.content)
          item.content.map((e) => (item.productId = e.id))
        }
      })
      let objVal = null
      if (type != 'eBook') {
        objVal = res.datas.find(
          (i) => i.productId == item.id && i.state != 'Reject' && i.state == 'WaitAudit'
        )
      } else {
        objVal = res.datas.find((i) => i.productId == item.id && i.state != 'Reject')
      }
      if (objVal && !objVal.isExpiry && type == 'eBook') {
        wx.showToast({
          title: "您已申请该样书",
          icon: 'none',
          duration: 1000,
        })
      } else if (objVal && type != 'eBook') {
        wx.showToast({
          title: "您已申请该样书",
          icon: 'none',
          duration: 1000,
        })
      } else {
        if (type == 'eBook') {
          if (this.data.ebookCount > 0) {
            const eBookData = this.data.electronicBookList
            if (eBookData.length == 2) {
              wx.showToast({
                title: "每次最多只可申请2本样书",
                icon: 'none',
                duration: 1000,
              })
              return false
            }
            if (eBookData.length > 0) {
              for (let i = 0; i < eBookData.length; i++) {
                if (eBookData[i].id == item.id) {
                  isHas = true
                }
              }
              if (!isHas) {
                wx.showToast({
                  title: "添加成功,在样书申请单等您哦~",
                  icon: "none",
                  duration: 1000,
                })
                this.setData({
                  electronicBookList: [...this.data.electronicBookList, ...[itemAttr]],
                  num: this.data.electronicBookList.length + this.data.paperBookList.length
                })
                wx.setStorageSync("electronicBookList", this.data.electronicBookList);
              } else {
                wx.showToast({
                  title: "该书已在清单列表中",
                  icon: "none",
                  duration: 1000,
                })
              }
            } else {
              wx.showToast({
                title: "添加成功,在样书申请单等您哦~",
                icon: "none",
                duration: 1000,
              })
              this.setData({
                electronicBookList: [itemAttr],
                num: 1 + this.data.paperBookList.length
              })
              wx.setStorageSync("electronicBookList", [itemAttr]);
            }
          } else {
            wx.showToast({
              title: "您的电子样书申请次数已用尽,若要继续,请联系管理员!",
              icon: "none",
              duration: 1000,
            })
          }
        } else {
          if (this.data.paperBookCount > 0) {
            const pBookData = this.data.paperBookList
            if (pBookData.length == 2) {
              wx.showToast({
                title: "每次最多只可申请2本样书",
                icon: 'none',
                duration: 1000,
              })
              return false
            }
            if (pBookData.length > 0) {
              for (let i = 0; i < pBookData.length; i++) {
                if (pBookData[i].id == item.id) {
                  isHas = true
                }
              }
              if (!isHas) {
                wx.showToast({
                  title: "添加成功,在样书申请单等您哦~",
                  icon: 'none',
                  duration: 1000,
                })
                this.setData({
                  paperBookList: [...this.data.paperBookList, ...[itemAttr]],
                  num: this.data.paperBookList.lenght + this.data.electronicBookList.length
                })
                wx.setStorageSync("paperBookList", this.data.paperBookList);
              } else {
                wx.showToast({
                  title: "该书已在清单列表中",
                  icon: "none",
                  duration: 1000,
                })
              }
            } else {
              wx.showToast({
                title: "添加成功,在样书申请单等您哦~",
                icon: 'none',
                duration: 1000,
              })
              this.setData({
                paperBookList: [itemAttr],
                num: 1 + this.data.electronicBookList.length
              })
              wx.setStorageSync("paperBookList", [itemAttr]);
            }
          } else {
            wx.showToast({
              title: "您的纸质样书申请次数已用尽,若要继续,请联系管理员!",
              icon: 'none',
              duration: 1000,
            })
          }
        }
      }
    })
  },
  //去样书申请单
  goApply() {
    wx.navigateTo({
      url: "/packageDomain/pages/sampleBookList/applicationForm/index",
    });
  },
})
packageBookService/pages/bookServices/detail/index.wxml
@@ -137,13 +137,13 @@
  </view>
  <!-- 购买按钮 -->
  <view class="box-bottom">
    <view class="bottom-btn">
    <view class="bottom-btn" bind:tap="appplyElectronicBook">
      <view>
        <t-image src="/static/images/bookService/detail/ebook.png"></t-image>
      </view>
      <view class="btn-text">电子样书申请</view>
    </view>
    <view class="bottom-btn">
    <view class="bottom-btn" bind:tap="appplyPaperBook">
      <view>
        <t-image src="/static/images/bookService/detail/paper-book.png"></t-image>
      </view>
@@ -157,3 +157,10 @@
<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" />
<view class="applyBox" bindtap="goApply">
  <view class="box">
    <t-image src="/static/images/home/yangshuForm.png" mode="heightFix" class="img" />
    <view class="num" wx:if="{{num > 0}}">{{num}}</view>
  </view>
</view>
packageBookService/pages/bookServices/detail/index.wxss
@@ -227,7 +227,7 @@
}
.box-bottom image {
  width: 36rpx;
  width: 38rpx;
  height: 44rpx;
}
@@ -301,3 +301,39 @@
.noData {
  height: 100%;
}
.applyBox {
  width: 184rpx;
  height: 184rpx;
  position: fixed;
  bottom: 20%;
  right: 0;
}
.applyBox .box {
  width: 184rpx;
  height: 184rpx;
  color: #fff;
  position: relative;
}
.applyBox .box .t-image {
  width: 100%;
  height: 100%;
}
.num {
  background-color: #FD3D16;
  color: #fff;
  border: 2rpx solid #FFFFFF;
  font-size: 24rpx;
  line-height: 30rpx;
  font-weight: 400;
  width: 48rpx;
  height: 32rpx;
  text-align: center;
  border-radius: 9px;
  position: absolute;
  top: 30rpx;
  left: 118rpx;
}
packageDomain/pages/sampleBookList/applicationForm/index.js
@@ -9,6 +9,7 @@
      workInfo: null,
      schoolName: "",
      courseName: "",
      detailedAddress: ""
    },
    contactInfo: {
      fullName: "",
@@ -101,6 +102,7 @@
            'teacherInfo.workInfo': res[0].cmsTypeLinks[0].children,
          })
        }
        console.log(this.data.teacherInfo.workInfo, 333)
      })
  },
  //获取当前已申请次数(电子)
@@ -177,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 || '',
@@ -214,7 +217,6 @@
              })
              wx.setStorageSync("paperBookList", that.data.paperBookList);
            }
            wx.showModal({
              title: '提示!', //提示的标题
              content: '您的样书申请已提交,管理员审核中!申请状态在【个人中心—样书申请】中查询。', //提示的内容
packageDomain/pages/sampleBookList/applicationForm/index.wxss
@@ -6,6 +6,11 @@
  width: 100%;
}
.page-content {
  padding-bottom: env(safe-area-inset-bottom);
}
.t-tabs__track {
  display: none;
packagePersonal/pages/myCollection/index.js
@@ -167,7 +167,7 @@
                icon: 'success',
                duration: 1000,
              })
              this.getDataList(false)
              that.getDataList(false)
            });
        } else if (res.cancel) {
          console.log('用户点击了取消')
packagePersonal/pages/userSetting/index.js
@@ -1,4 +1,6 @@
const app = getApp()
import tool from "../../../assets/js/toolClass.js";
import FormData from '../../../utils/formdata/index.js';
Page({
  /**
@@ -10,6 +12,8 @@
    userInfoBox: false,
    editType: '',
    userInfoForm: {
      icon: '',
      nickName: '',
      phone: '',
      email: '',
      captcha: '',
@@ -49,6 +53,7 @@
      // 用户信息优先级:教师认证 > 微信 > 学生(注册时默认)
      if (res) {
        let defaultUser = {};
        let nickNameData = res.infoList.find((item) => item.type == 'nickName')
        let teacherRole = res.roleLinks.find((item) => item.role.refCode == 'teacher')
        let teacherInfos = res.infoList.find((item) => item.type == 'teacherInfo')
        let secretData = res.secretList.find(i => i.type == 'LoginNameAndPassword')
@@ -58,8 +63,8 @@
        if (teacherRole && teacherInfos) {
          defaultUser = {
            ...teacherInfos,
            fullName: teacherInfos.fullName,
            icon: teacherInfos.icon,
            nickName: nickNameData ? JSON.parse(nickNameData.data).nickName : teacherInfos.name,
            icon: nickNameData ? JSON.parse(nickNameData.data).icon : WeChatInfo ? WeChatInfo.icon : '',
            userId: res.userId,
            role: 'Teacher',
            roleId: teacherRole.role.id,
@@ -69,16 +74,16 @@
        } else if (WeChatInfo) {
          defaultUser = {
            ...WeChatInfo,
            fullName: WeChatInfo.name,
            icon: WeChatInfo.icon,
            nickName: nickNameData ? JSON.parse(nickNameData.data).nickName : WeChatInfo.name,
            icon: JSON.parse(nickNameData.data).icon ? JSON.parse(nickNameData.data).icon : WeChatInfo.icon,
            userId: res.userId,
            phoneNumber: phoneInfo?.credential,
            Email: emailInfo?.credential
          }
        } else if (secretData) {
          defaultUser = {
            fullName: secretData.credential,
            icon: "",
            nickName: nickNameData ? JSON.parse(nickNameData.data).nickName : secretData.credential,
            icon: JSON.parse(nickNameData.data).icon ? JSON.parse(nickNameData.data).icon : '',
            userId: res.userId,
            phoneNumber: phoneInfo?.credential,
            Email: emailInfo?.credential
@@ -99,7 +104,8 @@
        userInfoBox: true,
        editType: info,
        "userInfoForm.captcha": "",
        "userInfoForm.code": ""
        "userInfoForm.code": "",
        "userInfoForm.nickName": ''
      });
    }
    this.getImgCapcha()
@@ -110,7 +116,86 @@
      countDown: 0,
    });
  },
  editIconInfo(e) {
    var that = this;
    wx.chooseMedia({
      // count: 1, // 默认9
      sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
      sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
      success: function (res) {
        // 返回选定照片的本地文件路径列表,tempFilePath也可以作为img标签的src属性显示图片
        console.log(res.tempFiles[0])
        tool.getFileMd5(res.tempFiles[0]).then((e) => {
          console.log(e, 4)
          let formData = new FormData();
          formData.append('Md5', e);
          formData.append('FileName', e);
          formData.append('FileType', res.tempFiles[0].fileType);
          formData.appendFile("file", res.tempFiles[0].tempFilePath);
          const data = formData.getData();
          let _token = wx.getStorageSync(app.config.tokenKey);
          let header = {};
          if (_token == null) {
            header["Authorization"] = `Basic ${Base64.encode(website.clientId + ":" + website.clientSecret)}`;
          } else {
            header["Authorization"] = `Bearer ` + _token;
          }
          new Promise((resolve, reject) => {
            wx.request({
              url: app.config.requestCtx + '/file/api/ApiUpload',
              method: 'POST',
              header: {
                'content-type': data.contentType,
                ...header
              },
              data: data.buffer,
              success(res) {
                console.log(res)
                if (res.statusCode == 200) {
                  resolve(res.data);
                  if (res.data) {
                    that.setData({
                      'userInfoForm.icon': app.config.requestCtx + `/file/GetPreViewImage?md5=` + e,
                    });
                    let userTypeInfo = {
                      requests: [
                        {
                          data: JSON.stringify({ nickName: that.data.userInfo.nickName, icon: that.data.userInfoForm.icon }),
                          name: '用户昵称头像',
                          type: 'nickName'
                        }
                      ]
                    }
                    app.MG.identity.setAppUserInfo(userTypeInfo).then((res) => {
                      if (res) {
                        wx.showToast({
                          title: "修改成功",
                          icon: 'success',
                          duration: 1000,
                        })
                        this.getUserInfo()
                        this.setData({
                          userInfoBox: false,
                        });
                      }
                    })
                  }
                } else {
                  reject('运行时错误,请稍后再试');
                }
              }
            })
          })
        })
      }
    });
  },
  onNameInput(e) {
    this.setData({
      "userInfoForm.nickName": e.detail.value,
    });
  },
  //输入手机号
  onPhoneInput(e) {
    console.log(e)
@@ -247,7 +332,31 @@
  },
  confirmInfo() {
    if (this.data.changeType == 'phone') {
    if (this.data.editType == 'nickName') {
      let userTypeInfo = {
        requests: [
          {
            data: JSON.stringify({ nickName: this.data.userInfoForm.nickName, icon: this.data.userInfo.icon }),
            name: '用户昵称头像',
            type: 'nickName'
          }
        ]
      }
      app.MG.identity.setAppUserInfo(userTypeInfo).then((res) => {
        if (res) {
          wx.showToast({
            title: "修改成功",
            icon: 'success',
            duration: 1000,
          })
          this.getUserInfo()
          this.setData({
            userInfoBox: false,
          });
        }
      })
    } else if (this.data.editType == 'phone') {
      let query = {
        phoneNumber: this.data.userInfoForm.phone,
        phoneCaptcha: this.data.userInfoForm.code
packagePersonal/pages/userSetting/index.wxml
@@ -2,13 +2,15 @@
  <view class="itemList">
    <view class="label">头像</view>
    <view class="contentImg">
      <t-avatar image="{{defaultAvatarUrl}}" class="user-center-card__header__avatar" />
      <t-avatar image="{{userInfo.icon}}" class="user-center-card__header__avatar" />
    </view>
    <view class="iconEdit" data-info="{{'icon'}}" bindtap="editIconInfo">
    <t-icon name="chevron-right" size="40rpx" color="#C2C2C2" />
    </view>
  </view>
  <view class="itemList">
    <view class="label">用户名</view>
    <view class="content">{{userInfo.fullName || '微信用户'}}</view>
    <view class="content" data-info="{{'nickName'}}" bindtap="editUserInfo">{{userInfo.nickName || '微信用户'}}</view>
    <t-icon name="chevron-right" size="40rpx" color="#C2C2C2" />
  </view>
  <view class="itemList">
@@ -24,6 +26,14 @@
  <t-popup visible="{{userInfoBox}}" bind:visible-change="onVisibleChange" placement="bottom">
    <view class="block">
      <view class="body">
        <view class="from-item" wx:if="{{editType == 'nickName'}}">
          <view class="label"> 昵称: </view>
          <view class="item-content">
            <view class="inputBox1">
              <t-input placeholder="输入用户名" borderless value="{{userInfoForm.nickName}}" bindchange="onNameInput" />
            </view>
          </view>
        </view>
        <view class="from-item" wx:if="{{editType == 'phone'}}">
          <view class="label"> 手机号: </view>
          <view class="item-content">
@@ -40,7 +50,7 @@
            </view>
          </view>
        </view>
        <view class="from-item">
        <view class="from-item" wx:if="{{editType !== 'nickName'}}">
          <view class="label"> 图形验证码: </view>
          <view class="item-content">
            <view class="inputBox">
packagePersonal/pages/userSetting/index.wxss
@@ -32,6 +32,10 @@
  overflow: hidden;
}
.iconEdit {
  padding: 40rpx 0;
}
.content {
  flex: 1;
  color: #5C5C5C;
@@ -59,10 +63,10 @@
}
.block .body .from-item .label {
  width: 170rpx;
  width: 200rpx;
  height: 72rpx;
  line-height: 72rpx;
  font-size: 28rpx;
  font-size: 32rpx;
}
.block .body .from-item .item-content {
@@ -72,14 +76,17 @@
}
.inputBox1 {
  width: 540rox;
  height: 72rpx;
  border: 2rpx solid #D9D9D9;
  flex: 1;
}
.inputBox1 .t-input {
  width: 440rpx !important;
}
.block .body .inputBox {
  width: 280rpx;
  width: 250rpx;
  height: 72rpx;
  border: 2rpx solid #D9D9D9;
}
@@ -90,17 +97,17 @@
.imgCode {
  height: 72rpx;
  width: 200rpx;
  width: 190rpx;
}
.code {
  width: 200rpx;
  width: 190rpx;
  height: 72rpx;
  margin-left: 20rpx;
}
.btn {
  width: 200rpx;
  width: 190rpx;
  height: 72rpx;
  padding: 0 10rpx !important;
  background: #ff6c00;
pages/personalCenter/components/user-center-card/index.wxml
@@ -17,7 +17,7 @@
    <view class="user-center-card__header">
      <t-avatar image="{{userInfo.icon || defaultAvatarUrl}}" class="user-center-card__header__avatar" />
      <view>
        <view class="user-center-card__header__name">{{userInfo.fullName || '微信用户'}}</view>
        <view class="user-center-card__header__name">{{userInfo.nickName || '微信用户'}}</view>
        <view class="userTypeBox">
          <text>{{userInfo.userType}}</text>
          <text class="edit" bindtap="editUserType">修改</text>
@@ -36,7 +36,7 @@
    <view class="user-center-card__header">
      <t-avatar t-class="avatar" mode="aspectFill" class="user-center-card__header__avatar" image="{{userInfo.icon || defaultAvatarUrl}}" />
      <view>
        <view class="user-center-card__header__name">{{userInfo.fullName || '微信用户'}}</view>
        <view class="user-center-card__header__name">{{userInfo.nickName || '微信用户'}}</view>
        <view class="userTypeBox">
          <text>{{userInfo.userType}}</text>
          <text bindtap="editUserType">修改</text>
pages/personalCenter/index.js
@@ -175,6 +175,7 @@
          type = '-'
        }
        let defaultUser = {};
        let nickNameData = res.infoList.find((item) => item.type == 'nickName')
        let teacherRole = res.roleLinks.find((item) => item.role.refCode == 'teacher')
        let teacherInfos = res.infoList.find((item) => item.type == 'teacherInfo')
        let secretData = res.secretList.find(i => i.type == 'LoginNameAndPassword')
@@ -182,8 +183,8 @@
        if (teacherRole && teacherInfos) {
          defaultUser = {
            ...teacherInfos,
            fullName: teacherInfos.fullName,
            icon: teacherInfos.icon,
            nickName: nickNameData ? JSON.parse(nickNameData.data).nickName : teacherInfos.name,
            icon: nickNameData ? JSON.parse(nickNameData.data).icon : WeChatInfo ? WeChatInfo.icon : '',
            userId: res.userId,
            role: 'Teacher',
            roleId: teacherRole.role.id,
@@ -196,8 +197,8 @@
        } else if (WeChatInfo) {
          defaultUser = {
            ...WeChatInfo,
            fullName: WeChatInfo.name,
            icon: WeChatInfo.icon,
            nickName: nickNameData ? JSON.parse(nickNameData.data).nickName : WeChatInfo.name,
            icon: JSON.parse(nickNameData.data).icon ? JSON.parse(nickNameData.data).icon : WeChatInfo.icon,
            userId: res.userId,
            userType: type
          }
@@ -206,8 +207,8 @@
          });
        } else if (secretData) {
          defaultUser = {
            fullName: secretData.credential,
            icon: "",
            nickName: nickNameData ? JSON.parse(nickNameData.data).nickName : secretData.credential,
            icon: JSON.parse(nickNameData.data).icon ? JSON.parse(nickNameData.data).icon : "",
            userId: res.userId,
            userType: type
          }