时间:2019-05-04 来源:小程序工厂
Y***:
怎么个缓存再说细点
薛***:
就是退出微信小程序在进入,数据就不断叠加叠加
缺少移动调试工具+微信小程序教程
Y***:
不能,你代码有问题
薛***:
这是为什么呢?从上一任程序员接手过来的,这个问题一直找不到解决方法
Y***:
要么你把代码发出来 要么你加我wx我帮你看看
为什么新建项目里面没有“添加 quick start”
薛***: 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
})
})
}
Y***:
你这数据都是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)