收藏
回答

缓存首页问题



请求教,缓存问题怎么解决~

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

8 个回答

  • 薛怼怼
    薛怼怼
    2017-09-25

    谢谢谢谢


    2017-09-25
    有用
    回复
  • You can you up
    You can you up
    2017-09-25


    你这数据都是concat起来的啊


    还有你这几个变量都没定义也没报错么

    textares = textares.concat(res.data.data[0].content[0].data)
                  idg = idg.concat(res.data.data[0].id)
                  upic = upic.concat(res.data.data[0].upic)
                  console.log('idg', idg)
                  author = author.concat(res.data.data[0].author)
                  time = time.concat(res.data.data[0].time)



    2017-09-25
    有用
    回复
  • 薛怼怼
    薛怼怼
    2017-09-25
    onLoad: function (e) {
     
      var that = this;
      wx.getStorage({
        key: ' ',
        success: function (res) {
          upsum = res.data
          console.log(upsum)
          that.setData({
            count: upsum
          })
        }
      })
     
      wx.getStorage({
        key: 'jsopenid',
        success: function (res) {
          // success
          console.log(res)
          console.log('openid', res.data)
          openid = res.data
          wx.request({
            url: 'https://www.wandumd.com/apiapp.php?s=apiapp/article/getMemberInfo',
            data: {
              openid: openid
            },
            method: 'GET',
            success: function (res) {
              console.log("业主res:", res.data.data[0])
              if (res.data.code == 200) {
                that.setData({
                  hasLocation: true,
                  locationAddress: res.data.data[0].residential_name
                })
              }
            }
          })
          //获取首页显示
          wx.getUserInfo({
            success: function (res) {
              console.log('所有的001', res)
              console.log('昵称001', res.userInfo.nickName)
              console.log('图片001', res.userInfo.avatarUrl)
              var nickname = res.userInfo.nickName
              var pic = res.userInfo.avatarUrl
              wx.request({
                url: 'https://www.wandumd.com/apiapp.php?s=apiapp/article/index',
                data: {
                  openid: openid,
                  nickname: nickname, //昵称
                  pic: pic//头像
                },
                method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
                success: function (res) {
                  // success
                  console.log('金额:', res.data.data[0].money)
                  console.log('内容:', res.data.data[0].content[0].data)
                  console.log('作者:', res.data.data[0].author)
                  console.log('pic:', res.data.data[0].upic)
                  money = money.concat(res.data.data[0].money)
                  titles = titles.concat(res.data.data[0].title)
                  textares = textares.concat(res.data.data[0].content[0].data)
                  idg = idg.concat(res.data.data[0].id)
                  upic = upic.concat(res.data.data[0].upic)
                  console.log('idg', idg)
                  author = author.concat(res.data.data[0].author)
                  time = time.concat(res.data.data[0].time)
                  if (res.data.data[0].vote == 1) {
                    var show = ""
                    var usum = res.data.data[0].up
                    var dsum = res.data.data[0].down
                    if (usum == null) usum = 0
                    if (dsum == null) dsum = 0
                  } else {
                    var show = "none"
                  }
                  //console.log('值:',time)
                  wx.setStorage({
                    key: 'gonggaoid',
                    data: idg,
                  })
                  that.setData({
                    titles: titles,
                    textares: textares,
                    id: idg,
                    author: author,
                    money: money,
                    time: time,
                    upic: upic,
                    toshow: show,
                    count: usum,
                    counts: dsum
                  })
                }
              })
     
            }
          })
          console.log('type', type)
     
        }
      })
      //获取设备宽高
      wx.getSystemInfo({
        success: function (res) {
          that.setData({
            winWidth: res.windowWidth,
            winHeight: res.windowHeight,
     
          });
     
        }
      });
      //调用应用实例的方法获取全局数据
      app.getUserInfo(function (userInfo) {
        //更新数据
        console.log('pic', userInfo.avatarUrl)
        console.log('nickname', userInfo.nickName)
        pic = userInfo.avatarUrl,
          nickname = userInfo.nickName,
          that.setData({
            userInfo: userInfo
          })
      })
    }


    2017-09-25
    有用
    回复
  • You can you up
    You can you up
    2017-09-25

    要么你把代码发出来  要么你加我wx我帮你看看

    2017-09-25
    有用
    回复
  • 薛怼怼
    薛怼怼
    2017-09-25

    这是为什么呢?从上一任程序员接手过来的,这个问题一直找不到解决方法

    2017-09-25
    有用
    回复
  • You can you up
    You can you up
    2017-09-25

    不能,你代码有问题

    2017-09-25
    有用
    回复
  • 薛怼怼
    薛怼怼
    2017-09-25

    就是退出小程序在进入,数据就不断叠加叠加

    2017-09-25
    有用
    回复
  • You can you up
    You can you up
    2017-09-22

    怎么个缓存再说细点

    2017-09-22
    有用
    回复
登录 后发表内容