onLoad: function (options) {
var inTheatersUrl = app.globalData.doubanBase +
"/v2/movie/in_theaters" + "?start=0&count=3";
var comingSoonUrl = app.globalData.doubanBase +
"/v2/movie/coming_soon" + "?start=0&count=3";
var top250Url = app.globalData.doubanBase +
"/v2/movie/top250" + "?start=0&count=3";
this.getMovieListData(inTheatersUrl, "inTheaters", "正在热映");
this.getMovieListData(comingSoonUrl, "comingSoon", "即将上映");
this.getMovieListData(top250Url, "top250", "top250");
},
onMoreTap: function (event) {
var category = event.currentTarget.dataset.category;
wx.navigateTo({
url: "more-movies/more-movies?category=" + category
})
},
getMovieListData: function (url, settedKey, categoryTitle) {
var that = this;
wx.request({
url: url,
header: {
'content-type': 'application/xml' // 默认值
},
method: 'GET',
success: function (res) {
that.processDoubanData(res.data, settedKey, categoryTitle);
},
fail: function () {
console.log("failed");
},
complete: function () {
}
})
},
ps:用浏览器访问没问题,
4年同步微信官方迭代,累计20000+人学习, 比微信官方更火爆!
了解课程