diff --git a/app.js b/app.js index 39bf9d7..b7d82a4 100644 --- a/app.js +++ b/app.js @@ -105,6 +105,7 @@ App({ } }, globalData: { + scene:"", // token token: null, // user openId diff --git a/config/config.js b/config/config.js index 4d09bf7..0ec8864 100755 --- a/config/config.js +++ b/config/config.js @@ -289,7 +289,11 @@ var config = { /** * 用户更新信息 */ - updateUserInfo:"/user/updateUserInfo" + updateUserInfo:"/user/updateUserInfo", + /** + * 用户更新scene + */ + updateScene:"/user/updateScene" }, weapp: { AppId: weappId diff --git a/pages/index/index.js b/pages/index/index.js index b07aaee..935d80b 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -28,10 +28,12 @@ Page({ that.setData({ scene: 0 }) + app.globalData.scene = 0; } else { that.setData({ scene: decodeURIComponent(options.scene) }); + app.globalData.scene = decodeURIComponent(options.scene) that.setData({ newArr: this.data.scene.split(':') }) @@ -347,6 +349,7 @@ Page({ } }); }, + getGameOne: function(token, id) { let _this = this; Http.get({ diff --git a/pages/user/index.js b/pages/user/index.js index f9d2db9..572eb18 100644 --- a/pages/user/index.js +++ b/pages/user/index.js @@ -70,6 +70,7 @@ Page({ onLoad() { this.getLocation(); this.updateUserInfo(); + this.updateScene(); }, /** * 获得经纬度 @@ -114,6 +115,19 @@ Page({ } }) }, + /** + * 用户更新scene + */ + updateScene(){ + Http.post({ + url: config.api.updateScene, + data: { + scene: app.globalData.scene + } + }).then(res => { + console.log(res) + }) + }, /** * 生命周期函数--监听页面显示 */