在开发者工具上的真机调试没有问题,但预览会有问题。在真实的手机上只有iphone6 和 6s没问题,其他手机就会报这个错:thirdScriptError undefined is not an object (evaluating ‘e.data.data.length’) 调接口已经走到success方法里了 打印出来的data变成这样
麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
iphone 7 Plus (除了iphone 6 和 6s的手机)
Stable v1.02.1907300
// pages/resultList/resultList.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
result: {},
navtitle: ‘英语阅读能力测评’,
barBg: ‘#fff’,
color: ‘#333’,
count: 3
},
glToCn(gl) {
switch (gl) {
case ‘K’:
return ‘美国幼儿园’;
break;
case ‘K,1st’:
return ‘美国幼儿园,一年级’;
break;
case ‘1st’:
return ‘美国一年级’;
break;
case ‘1st,2nd’:
return ‘美国一年级,二年级’;
break;
case ‘2nd’:
return ‘美国二年级’;
break;
case ‘3rd’:
return ‘美国三年级’;
break;
case ‘4th’:
return ‘美国四年级’;
break;
case ‘5th’:
return ‘美国五年级’;
break;
case ‘5th,6th’:
return ‘美国五年级,六年级’;
break;
case ‘6th’:
return ‘美国六年级’;
break;
case ‘6th+’:
return ‘美国六年级以上’;
break;
default:
return ‘美国幼儿园’
}
},
/**
* 生命周期函数–监听页面加载
*/
onLoad: function (options) {
var that = this
console.log(‘ss1’, wx.getStorageSync(‘currentLevel’))
console.log(‘userid11’, wx.getStorageSync(‘user_id’))
console.log(‘level11’, wx.getStorageSync(‘currentLevel’))
wx.request({
url: ‘https://eval.bamboo001.com/Wrong_API’,
data: {
user_id: wx.getStorageSync(‘user_id’),
level: wx.getStorageSync(‘currentLevel’)
},
method: ‘POST’,
success: function (res) {
if(res) {
console.log(‘历史结果res’, res)
for (var i = 0; i < res.data.data.length; i++) {
res.data.data[i].Grade_Level_US = that.glToCn(res.data.data[i].Grade_Level_US)
}
that.setData({
result: res.data.data
})
}
},
fail: function (err) {
console.log(‘历史结果接口失败’, err)
}
})
},
onTap: function(event){
var gl = event.currentTarget.dataset.gl,
grade = event.currentTarget.dataset.grade,
lexile = event.currentTarget.dataset.lexile,
bamboo = event.currentTarget.dataset.bamboo,
image = event.currentTarget.dataset.image
console.log(gl, grade,lexile,bamboo,image)
wx.navigateTo({
url: ‘…/testReport/testReport?gl=’ + gl + ‘&grade=’ + grade + ‘&lexile=’ + lexile + ‘&bamboo=’ + bamboo + ‘&image=’ + image
})
}
})