13404089107
2025-05-08 51cca32d236262be90f2d39b8889fa343f1adfa1
pages/invite/invite.js
@@ -9,44 +9,44 @@
   * 页面的初始数据
   */
  data: {
    userInfo:wx.getStorageSync('userInfo'),
    detail:{},
    userInfo: wx.getStorageSync('userInfo'),
    detail: {},
  },
  goRecord(){
  goRecord() {
    wx.navigateTo({
      url: '/pages/inviteRecord/inviteRecord',
    })
  },
  downLoadCode(){
  downLoadCode() {
    wx.downloadFile({
      url: this.data.detail.code,
      success(res) {
       if(res.statusCode ==200){
         let tempFilePath = res.tempFilePath;
              wx.saveImageToPhotosAlbum({
                filePath: tempFilePath,
                success (res) {
                  console.log('保存成功', res);
                },
                fail (err) {
                  if (err.errMsg === "saveImageToPhotosAlbum:fail cancel") {
                    console.log('用户取消保存');
                  } else {
                    console.log('保存失败', err);
                  }
                }
              });
       }else{
         wx.showToast({
           title: '下载失败',
           icon:'none'
         })
       }
      success(res) {
        if (res.statusCode == 200) {
          let tempFilePath = res.tempFilePath;
          wx.saveImageToPhotosAlbum({
            filePath: tempFilePath,
            success(res) {
              console.log('保存成功', res);
            },
            fail(err) {
              if (err.errMsg === "saveImageToPhotosAlbum:fail cancel") {
                console.log('用户取消保存');
              } else {
                console.log('保存失败', err);
              }
            }
          });
        } else {
          wx.showToast({
            title: '下载失败',
            icon: 'none'
          })
        }
      }
    })
  },
  /**
@@ -54,14 +54,14 @@
   */
  onLoad(options) {
    unit.post(app.globalData.Url + "/api/user/getCode")
    .then((res) => {
      console.log('shuju',res);
     if(res.data.code==200){
       this.setData({
         detail:res.data.data
       })
     }
    })
      .then((res) => {
        console.log('shuju', res);
        if (res.data.code == 200) {
          this.setData({
            detail: res.data.data
          })
        }
      })
  },