• 微信端处理服务器端返回值


    在wx上建立global的变量,然后request的时候,发送出去

    关键代码,在请求体外

    const app = getApp();

    在请求体内

     historyId:app.globalData.zhanbuYao.data.historyId,


    在方法体第一行的console.log 可以看到,取值的路径。

    zhanbuView:util.throttle(function(e){
     //console.log(e);
    // //获取到它的绑定id
    // console.log(e.target.dataset.yao);
    // console.log(e.target.dataset.author);
    const app = getApp();
    //console.log(app);   //打印取值路径
    wx.request(
      
      {
      url: 'https://www.xxxx.com/Wx/zhanbuView',
    //  url: 'http://127.0.0.1:8080/Wx/zhanbuView' , 
      
    data:{
        yaoId:e.target.dataset.yao,
        author:e.target.dataset.author,
       // historyId:e.target.
       historyId:app.globalData.zhanbuYao.data.historyId,
        
      },
      header:{
        'content-type':'application/x-www-form-urlencoded'
      },
      success:(res)=>{
       // console.log(res.data);
        //console.log(res.data.zhouyiAuthor.name);
        const app = getApp();
        this.setData({Shiyou:app.globalData.zhanbuShiyou});
     //   console.log(Shiyou);
        
            app.globalData.zhanbuViewAuthor=res.data.zhouyiAuthor.name,
            app.globalData.zhanbuViewAuthorInfo=res.data.zhouyiAuthor.info,
          
            app.globalData.zhanbuViewContent=res.data.content,
            app.globalData.zhanbuViewXiang=res.data.xiang,
            app.globalData.zhanbuViewYaoId=e.target.dataset.yao
            wx.navigateTo({
              url: '../zhanbuView/zhanbuView',
              complete: (res) => {},
             // events: events,
              fail: (res) => {},
              success: (result) => {},
            })
    
    
      }
  • 相关阅读:
    mono for android学习过程系列教程(6)
    mono for android学习过程系列教程(5)
    mono for android学习过程系列教程(4)
    mono for android学习过程系列教程(3)
    mono for android学习过程系列教程(2)
    mono for android学习过程系列教程(1)
    随笔索引
    中国大学MOOC中的后台文件传输
    知乎控件分享(一)
    知乎UWP 预览
  • 原文地址:https://www.cnblogs.com/sdgtxuyong/p/14647597.html
Copyright © 2020-2023  润新知