| @@ -105,6 +105,7 @@ App({ | |||||
| } | } | ||||
| }, | }, | ||||
| globalData: { | globalData: { | ||||
| scene:"", | |||||
| // token | // token | ||||
| token: null, | token: null, | ||||
| // user openId | // user openId | ||||
| @@ -289,7 +289,11 @@ var config = { | |||||
| /** | /** | ||||
| * 用户更新信息 | * 用户更新信息 | ||||
| */ | */ | ||||
| updateUserInfo:"/user/updateUserInfo" | |||||
| updateUserInfo:"/user/updateUserInfo", | |||||
| /** | |||||
| * 用户更新scene | |||||
| */ | |||||
| updateScene:"/user/updateScene" | |||||
| }, | }, | ||||
| weapp: { | weapp: { | ||||
| AppId: weappId | AppId: weappId | ||||
| @@ -28,10 +28,12 @@ Page({ | |||||
| that.setData({ | that.setData({ | ||||
| scene: 0 | scene: 0 | ||||
| }) | }) | ||||
| app.globalData.scene = 0; | |||||
| } else { | } else { | ||||
| that.setData({ | that.setData({ | ||||
| scene: decodeURIComponent(options.scene) | scene: decodeURIComponent(options.scene) | ||||
| }); | }); | ||||
| app.globalData.scene = decodeURIComponent(options.scene) | |||||
| that.setData({ | that.setData({ | ||||
| newArr: this.data.scene.split(':') | newArr: this.data.scene.split(':') | ||||
| }) | }) | ||||
| @@ -347,6 +349,7 @@ Page({ | |||||
| } | } | ||||
| }); | }); | ||||
| }, | }, | ||||
| getGameOne: function(token, id) { | getGameOne: function(token, id) { | ||||
| let _this = this; | let _this = this; | ||||
| Http.get({ | Http.get({ | ||||
| @@ -70,6 +70,7 @@ Page({ | |||||
| onLoad() { | onLoad() { | ||||
| this.getLocation(); | this.getLocation(); | ||||
| this.updateUserInfo(); | 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) | |||||
| }) | |||||
| }, | |||||
| /** | /** | ||||
| * 生命周期函数--监听页面显示 | * 生命周期函数--监听页面显示 | ||||
| */ | */ | ||||