标签:url ica res parentId sys pre system 开发 ima
onLoad: function(options) { //执行同步 return new Promise(function (resolve, reject) { wx.checkSession({ success: function (res) { resolve(res); }, fail: function (res) { //同步代码好了,执行要执行的代码代码 var that = this; wx.request({ url: Util.exeCatalog(), //仅为示例,并非真实的接口地址 data: { ParentId: 129, }, method: ‘GET‘, header: { ‘content-type‘: ‘application/json‘ // 默认值 }, success(res) { var qa = res.data;//获取json数据 var qaarr = [];//定义数组 for (var i in qa) { var qacontentarr = [];//定义数组 wx.request({ url: Util.exeContent(), //仅为示例,并非真实的接口地址 data: { CatalogId: qa[i].CatalogId }, method: ‘GET‘, header: { ‘content-type‘: ‘application/json‘ // 默认值 }, success(ress) { qacontentarr = []; var qacontent = ress.data;//获取json数据 for (var i in qacontent) { var qaarrjson = {}; qaarrjson[‘zi‘] = qacontent[i].Title; qaarrjson[‘li‘] = qacontent[i].Description; qacontentarr.push(qaarrjson); } } }) var qaarrjson = {}; qaarrjson[‘id‘] = i; qaarrjson[‘hidden‘] = true; qaarrjson[‘title‘] = qa[i].CatalogName; qaarrjson[‘contentH‘] = qacontentarr; qaarrjson[‘image‘] = ‘/images/js.png‘; qaarr.push(qaarrjson); } that.setData({ systemList: qaarr }) } }) } }) }) }
同步代码
onLoad: function(options) { //执行同步 return new Promise(function (resolve, reject) { wx.checkSession({ success: function (res) { resolve(res); }, fail: function (res) { //执行的方法 } }) })
}
标签:url ica res parentId sys pre system 开发 ima
原文地址:https://www.cnblogs.com/zpblogs/p/11323008.html