-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
114 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,26 @@ | ||
var util = require('../../../utils/util.js') | ||
var functions = require('../functions.js') | ||
Page({ | ||
data: { | ||
films: [] | ||
films: [], | ||
showLoading: true | ||
}, | ||
onLoad: function () { | ||
var that = this | ||
fetch('https://api.douban.com/v2/movie/coming_soon?city=%E4%B8%8A%E6%B5%B7').then(function(response){ | ||
if(response.status !== 200){ | ||
console.log("error:"+response.status); | ||
return; | ||
} | ||
response.json().then(function(data){ | ||
that.setData({ | ||
films: data.subjects | ||
}) | ||
}); | ||
}) | ||
functions.getCity(function(city){ | ||
fetch('https://api.douban.com/v2/movie/coming_soon?city=' + city).then(function(response){ | ||
if(response.status !== 200){ | ||
console.log("error:"+response.status); | ||
return; | ||
} | ||
response.json().then(function(data){ | ||
that.setData({ | ||
films: data.subjects, | ||
showLoading: false | ||
}) | ||
}); | ||
}) | ||
} | ||
) | ||
}, | ||
viewDetail: functions.viewDetail | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
baiduAK: '7VENmCeC4aaAfx3CKbSjT1K3oRucOgDK' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,33 @@ | ||
module.exports={ | ||
var store = require('./store.js') | ||
var config = require('./config.js') | ||
module.exports = { | ||
viewDetail: function(e){ | ||
var ds = e.currentTarget.dataset; | ||
wx.navigateTo({ | ||
url: '../detail/detail?id=' + ds.id + '&title=' + ds.title | ||
url: '../detail/detail?id=' + ds.id + '&title=' + ds.title | ||
}) | ||
}, | ||
getLocation: function(cb){ | ||
var location = store.location | ||
if(location){ | ||
cb(location) | ||
return; | ||
} | ||
wx.getLocation({ | ||
success: function (res) { | ||
var locationParam = res.latitude + ',' + res.longitude | ||
fetch('https://api.map.baidu.com/geocoder/v2/?ak=' + config.baiduAK + '&location=' + locationParam + '1&output=json&pois=1').then(function(response){ | ||
response.json().then(function(data){ | ||
store.location = data.result | ||
cb(data.result) | ||
}) | ||
}) | ||
} | ||
}) | ||
}, | ||
getCity: function(cb){ | ||
this.getLocation(function(location){ | ||
cb(location.addressComponent.city.replace('市', '')) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,26 @@ | ||
var util = require('../../../utils/util.js') | ||
var functions = require('../functions.js') | ||
Page({ | ||
data: { | ||
films: [] | ||
films: [], | ||
showLoading: true | ||
}, | ||
onLoad: function () { | ||
var that = this | ||
fetch('https://api.douban.com/v2/movie/in_theaters?city=%E4%B8%8A%E6%B5%B7').then(function(response){ | ||
if(response.status !== 200){ | ||
console.log("error:"+response.status); | ||
return; | ||
} | ||
response.json().then(function(data){ | ||
that.setData({ | ||
films: data.subjects | ||
}) | ||
}); | ||
functions.getCity(function(city){ | ||
fetch('https://api.douban.com/v2/movie/in_theaters?city=' + city).then(function(response){ | ||
if(response.status !== 200){ | ||
console.log("error:"+ response.status); | ||
return; | ||
} | ||
response.json().then(function(data){ | ||
that.setData({ | ||
films: data.subjects, | ||
showLoading: false | ||
}) | ||
}); | ||
}) | ||
}) | ||
|
||
}, | ||
viewDetail: functions.viewDetail | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
location: null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
# 微信小程序 - 豆瓣电影 | ||
|
||
[应用号IDE + 破解](https://github.com/gavinkwoe/weapp-ide-crack) | ||
|
||
 | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters