鍍金池/ 問答/網(wǎng)絡(luò)安全  HTML/ 微信小程序轉(zhuǎn)發(fā)功能

微信小程序轉(zhuǎn)發(fā)功能

問題描述

微信小程序如何請求接口成功后再去調(diào)用微信轉(zhuǎn)發(fā)的接口

問題出現(xiàn)的環(huán)境背景及自己嘗試過哪些方法

相關(guān)代碼

// 請把代碼文本粘貼到下方(請勿用圖片代替代碼)

 <button formType="submit" wx:if="{{executorDtata.length==1}}"  open-type="share">創(chuàng)建并邀請好友</button>
 
  create:function(e){
    console.log('2222222')
    var that = this;
    if (this.data.taskContent.replace(/\s+/g, '')){
      wx.request({
        url: getApp().globalData.url + '/createTack',
        data: {
          groupId: getApp().globalData.groupId,
          isRepeat: this.data.listNoId ? 1 : 0,
          taskContent: this.data.taskContent,
          executeUserId: this.data.executorZid,
          remindUserIds: this.data.remindNoZid,
          remindTime: this.data.time,
          remindWeek: this.data.listNoId,
          flag: this.data.executorDtata.length > 1 ? 0 : 1
        },
        header: {
          Authorization: getApp().globalData.token,
          // formId: e.detail.formId
          formId: 1
        },
        success: function (res) {
          if (res.data.code == 100) {
            that.onShareAppMessage()
          }
        }
      })
    }else{
      wx.showToast({
        title: '請您輸入創(chuàng)建任務(wù)',
        duration: 1000,
        icon: 'none'
      })
    }
  },
  onShareAppMessage: function(ops) {
    if (ops.from === 'button') {
      console.log('1111111111')
      return {
        title: '小哥哥圖片',
        desc: '小哥哥圖片',
        path: '/pages/join/join?inviteUserId=' + this.data.shareZid + "&groupId=" + this.data.shareGroupId,
        imageUrl: "../../images/userimg.jpg",
        success: (res) => {
          wx.reLaunch({
            url: '../task/task',
          })
        },
        fail: (res) => {
          console.log("轉(zhuǎn)發(fā)失敗", JSON.stringify(res));
        }
      }
      
    }
  },

你期待的結(jié)果是什么?實(shí)際看到的錯(cuò)誤信息又是什么?

圖片描述

回答
編輯回答
單眼皮

沒太看懂
另外onShareAppMessage接口已經(jīng)改了

2017年6月16日 00:48