litian
2024-03-29 437634b6c3f4fb1fd05a64f62feb0d8501e0360d
packagePersonal/pages/userSetting/index.js
@@ -97,8 +97,9 @@
  },
  //修改用户类型
  editUserInfo(e) {
    console.log(e)
    let { info } = e.currentTarget.dataset
    let {
      info
    } = e.currentTarget.dataset
    if (!this.data.userInfoBox) {
      this.setData({
        userInfoBox: true,
@@ -124,9 +125,7 @@
      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);
@@ -150,7 +149,6 @@
              },
              data: data.buffer,
              success(res) {
                console.log(res)
                if (res.statusCode == 200) {
                  resolve(res.data);
                  if (res.data) {
@@ -158,13 +156,14 @@
                      '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'
                        }
                      ]
                      "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) {
@@ -198,8 +197,9 @@
  },
  //输入手机号
  onPhoneInput(e) {
    console.log(e)
    const { phoneError } = this.data;
    const {
      phoneError
    } = this.data;
    const isPhoneNumber = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(e.detail.value);
    if (phoneError === isPhoneNumber) {
      this.setData({
@@ -210,7 +210,9 @@
  },
  onEmailInput(e) {
    const { emailError } = this.data;
    const {
      emailError
    } = this.data;
    const isPhoneNumber = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/.test(e.detail.value);
    if (emailError === isPhoneNumber) {
      this.setData({
@@ -296,7 +298,6 @@
  },
  getEmailCode() {
    console.log(this.data.userInfoForm.email)
    if (this.data.userInfoForm.email && this.data.userInfoForm.captcha) {
      app.MG.identity
        .getEmailCode({
@@ -334,13 +335,14 @@
  confirmInfo() {
    if (this.data.editType == 'nickName') {
      let userTypeInfo = {
        requests: [
          {
            data: JSON.stringify({ nickName: this.data.userInfoForm.nickName, icon: this.data.userInfo.icon }),
            name: '用户昵称头像',
            type: 'nickName'
          }
        ]
        "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) {