network 检测在WiFi 下似乎有问题,先不要他了

wechat_user_type
Ge Hao 8 years ago
parent 81ad935d69
commit 942a4cda8d
  1. 29
      pages/index/index.js

@ -39,10 +39,6 @@ Page({
}) })
}) })
wx.getNetworkType({
success: function(res) {
var networkType = res.networkType // 返回网络类型2g,3g,4g,wifi
if (networkType) {
product.getProducts(function(result) { product.getProducts(function(result) {
var data = getApp().store.sync(result.data) var data = getApp().store.sync(result.data)
that.setData({ that.setData({
@ -53,15 +49,20 @@ Page({
}) })
wx.setStorageSync('products', data) wx.setStorageSync('products', data)
}) })
} else {
cache = wx.getStorageSync('products') // wx.getNetworkType({
if (cache) { // success: function(res) {
that.setData({'items': cache}) // var networkType = res.networkType // 返回网络类型2g,3g,4g,wifi
} else { // if (networkType) {
that.setData({'items': []}) // } else {
} // cache = wx.getStorageSync('products')
} // if (cache) {
} // that.setData({'items': cache})
}) // } else {
// that.setData({'items': []})
// }
// }
// }
// })
} }
}) })

Loading…
Cancel
Save