From 4b6ef7d4ad9eea5ed3c98bfb0cdafd1afe263fd3 Mon Sep 17 00:00:00 2001 From: meo <18801474720@163.com> Date: Wed, 29 May 2019 10:55:57 +0800 Subject: [PATCH] =?UTF-8?q?[=E7=A0=81=E5=8F=82=E6=95=B0][=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0]:[=E7=A0=81=E5=8F=82=E6=95=B0=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E7=9A=84=E4=BF=AE=E6=94=B9]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 1 + config/config.js | 6 +++++- pages/index/index.js | 3 +++ pages/user/index.js | 14 ++++++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) 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) + }) + }, /** * 生命周期函数--监听页面显示 */