收藏
回答

微信小程序订阅消息的page带参数,跳转到详情页为什么获取不到参数?

云开发的微信小程序订阅消息,page不带参数的时候,详情页可以正常跳转,带参数之后page:"/pages/network/neiwang/neiwangapply?applyer="+event.applyer,能正常跳转到neiwangapply这个页面,但是获取不到apply这个参数的值,获取的方法是在neiwangapply这个页面的onload采用options.applyer,一直获取不到,求帮助


回答关注问题邀请回答
收藏

3 个回答

  • 大菠萝
    大菠萝
    2023-04-27

    这个问题解决了吗

    2023-04-27
    有用
    回复
  • qhb
    qhb
    2021-08-23
    // miniprogram/pages/network/ipapply/ipapply.js
    var time = require('../../../common');
    Page({
    
    
      /**
       * 页面的初始数据
       */
      data: {
        index:0,
        index1:0,
        array:['请选择楼层','1-6楼','7楼','8楼','9楼','10楼','11-14楼','15-19楼','裙楼'],
        array1:['请选择类型','内网','外网'],
        objectArray: [
          {
            id-1,
            name'请选择楼层'
          },
          {
            id0,
            name'1-6楼'
          },
          {
            id1,
            name'7楼'
          },
          {
            id2,
            name'8楼'
          },
          {
            id3,
            name'9楼'
          }
          ,
          {
            id4,
            name'10楼'
          }
          ,
          {
            id5,
            name'11-14楼'
          }
          ,
          {
            id6,
            name'15-19楼'
          }
          ,
          {
            id7,
            name'裙楼'
          }
        ],
        objectArray1: [
          {
            id:-1,
            name:'请选择类型'
          }
          ,
          {
            id:0,
            name:'内网'
          }
          ,
          {
            id:1,
            name:'外网'
          }
        ],
        applydate:new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate(),
        applyer:'',
        dept:'',
        level:'',
        memo:'是否为路由器地址或其他',
        page:''
      },
      indexchange:function(e){
        this.setData({
          index:e.detail.value,
          level:this.data.array[this.data.index]
        })
      },
      indexchange1:function(e){
        this.setData({
          index1:e.detail.value,
          level:this.data.array1[this.data.index1]
        })
      },
      applyerinput:function(e){
        this.setData({
          applyer:e.detail.value
        })
      },
     memoinput:function(e){
        this.setData({
          memo:e.detail.value
        })
      },
      datechange:function(e){
        this.setData({
          applydate:e.detail.value
        })
      },
      submit:function(e){
        if(this.data.index==0||this.data.index1==0||this.data.applyer==''){
          wx.showModal({
            title:'提示',
            content:'请输入完整申请信息'
          })
        }
        else{
          var that=this
          console.log(new Date(that.data.applydate))
          console.log(that.data.array[that.data.index])
          if(that.data.index1==1){
            that.setData({
            //  page:'/pages/network/neiwang/neiwangapply?index='+that.data.index1+'&dept='+that.data.dept+'&applyer='+that.data.applyer+'&memo='+that.data.memo
            page:'/pages/network/neiwang/neiwangapply?applyer='+that.data.applyer
            })
          }
          else{
            that.setData({
              page:'/pages/network/waiwang/waiwangapply?applyer='+that.data.applyer
            })
          }
          wx.cloud.callFunction({
            name:'ipapplyeradd',
            data:{
              apply_type:that.data.array1[that.data.index1],
             apply_level:that.data.array[that.data.index],
             applyer:that.data.applyer,
            apply_reason:that.data.memo,
            apply_date:that.data.applydate,
            },
            success:function(res){
              wx.showModal({
                title:'提示',
                content:'申请成功,待审批',
                success:function(suc){
                  if(suc.confirm){
                    wx.requestSubscribeMessage({
                      tmplIds: ['5J3WjQR4u5p9ngOmwcaIQBujnTidOode1C_JhGL3OAY','rwCuVp2NAyncSnevjnTuDLaevjM0Cioq8sz_PSUhiFg'],
                      success:function(eee){
                        wx.cloud.callFunction({
                          name:'ipapplynote',//下发函数
                          data:{
                            thing4:that.data.array1[that.data.index1]+'申请',
                            thing7:that.data.array[that.data.index],
                            thing8:that.data.applyer,
                            thing9:that.data.memo,
                            time10:time.formatTime(new Date()),
                            page:that.data.page,
                            applyer:that.data.applyer
                          },
                          success:function(rrr){
                            console.log(rrr)
                          },
                          fail:function(error){
                            console.log(error)
                          }
                        })
                      },
                      fail:function(err){
                        console.log(err)
                      }
                    })
                  }
                }
              })
            }
          })
        }
      },
     
    
    2021-08-23
    有用
    回复
  • ShowFaker
    ShowFaker
    2021-08-23

    event.applye 你这个有值吗

    2021-08-23
    有用
    回复 16
    • qhb
      qhb
      2021-08-23
      有值啊,从page传到云函数这边都是正常的,”/pages/network/neiwang/neiwangapply?applyer=777”,但是这个777我在订阅消息后详情页获取不到
      2021-08-23
      回复
    • ShowFaker
      ShowFaker
      2021-08-23回复qhb
      你分享一下你前端代码
      2021-08-23
      回复
    • qhb
      qhb
      2021-08-23回复ShowFaker
      2021-08-23
      回复
    • ShowFaker
      ShowFaker
      2021-08-23回复qhb
      代码片段会弄吗
      2021-08-23
      回复
    • qhb
      qhb
      2021-08-23回复ShowFaker
      2021-08-23
      回复
    查看更多(11)
登录 后发表内容