程序的意思就是调用wx.request返回结果拼接个字符串然后再用wx.request发出去,用了函数内变量temp, 全局变量app.data.globaldata都试过,怎么都不能把第一次返回结果给到第二次发送的输入变量中。谁能告诉我怎样搞,搞的我对小程序都没信心了。
// pages/ssq/ssq.js
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
newnumber1: ‘0’,
newnumber2: ‘0’,
newnumber3: ‘0’,
newnumber4: ‘0’,
newnumber5: ‘0’,
newnumber6: ‘0’,
newnumber7: ‘0’,
gb: app.globaldata
},
/**
* 生命周期函数–监听页面加载
*/
onLoad: function (options) {
var that = this
var oldnumbers = “01,04,09,21,31,33,05,0,0,0,0,0,0”
var old1 = “01,04,09,21,31,33,05,”
var temp = ‘’
wx.showLoading({
title: ‘上传中’,
})
GetGetUserData(oldnumbers).then(GetGetUserData(old1 + temp +",00,00,00,00,00")) //temp试过,app.data.globaldata都试过了,都不行。
wx.hideLoading()
//获取用户信息
function GetGetUserData (ssqdata) {
var that1 = that;
return new Promise(function (resolve, reject) {
wx.request({
url: ‘https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx’,
method: ‘POST’,
data: {
lastnumbers: ssqdata
},
header: {
‘content-type’: ‘application/json’ // 默认值
},
success: function (res) {
console.log(res.data)
that.setData({ gb: res.data })
temp = res.data
resolve();
}
})
})
}
}
})