8 回复
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 }) }) } |