diff --git a/app.json b/app.json index 73cb302..fc272a3 100644 --- a/app.json +++ b/app.json @@ -31,8 +31,7 @@ "pages/managelicenseplate/managelicenseplate", "pages/payrule/payrule", "pages/game/index", - "pages/grade/grade", - "pages/index/gameentry/gentry" + "pages/grade/grade" ], "tabBar": { "color": "#9F9F9F", diff --git a/components/gameentry/gentry.js b/components/gameentry/gentry.js new file mode 100644 index 0000000..3a1d955 --- /dev/null +++ b/components/gameentry/gentry.js @@ -0,0 +1,35 @@ +// pages/index/sw/index.js +Component({ + properties: { + gamedata: { + type: Object, + value: {} + } + }, + data: { + flag: false, + gameUrl: '' + }, + methods:{ + gotogame: function (e) { + wx.navigateTo({ + url: '/pages/game/index?url=' + e.target.dataset.data.url + "&id=" + e.target.dataset.data.id + "&gameId=" + e.target.dataset.data.gameId, + }) + }, + a: function () { + this.setData({ flag: false }) + }, + closeGame: function () { + this.setData({ flag: true }) + }, + }, + onReady: function () { + console.log(this.gamedata, 999999999) + }, + onLoad: function (options) { + console.log(this.gamedata, 999999999) + }, + onShow: function () { + console.log(this.gamedata, 999999999) + } +}); \ No newline at end of file diff --git a/pages/index/gameentry/gentry.json b/components/gameentry/gentry.json similarity index 100% rename from pages/index/gameentry/gentry.json rename to components/gameentry/gentry.json diff --git a/pages/index/gameentry/gentry.wxml b/components/gameentry/gentry.wxml similarity index 62% rename from pages/index/gameentry/gentry.wxml rename to components/gameentry/gentry.wxml index 3622f69..767b98e 100644 --- a/pages/index/gameentry/gentry.wxml +++ b/components/gameentry/gentry.wxml @@ -3,7 +3,7 @@ - + \ No newline at end of file diff --git a/pages/index/gameentry/gentry.wxss b/components/gameentry/gentry.wxss similarity index 100% rename from pages/index/gameentry/gentry.wxss rename to components/gameentry/gentry.wxss diff --git a/pages/game/index.js b/pages/game/index.js index c72605e..26d7a6c 100644 --- a/pages/game/index.js +++ b/pages/game/index.js @@ -4,7 +4,7 @@ let app = getApp(); Page({ data: { token:'', - url:'https://game.youlane.cn/luckCard/index.html' + url:'' }, bindGetMsg(e){ console.log(e,1234565432) @@ -36,18 +36,18 @@ Page({ if (options.share){ // wx.onShareAppMessage(); }else{ - Http.get({ - url: config.api.getGame, - data: { - token: app.globalData.token, - } - }) - .then(res => { - console.log(res.data, 333); - }) + // Http.get({ + // url: config.api.getGame, + // data: { + // token: app.globalData.token, + // } + // }) + // .then(res => { + // console.log(res.data, 333); + // }) this.setData({ - url:"https://game.youlane.cn/luckCard/index.html?token="+app.globalData.token, - // url: "http://10.11.195.31:8080/luckCard/?token=" + app.globalData.token + // url: options.url + "?token=" + app.globalData.token + "&gameId=" + options.gameId + "&id=" + options.id, + url: "http://10.11.195.31:8080/luckCard/" + "?token=" + app.globalData.token + "&gameId=" + options.gameId + "&id=" + options.id, }); } } diff --git a/pages/index/gameentry/gentry.js b/pages/index/gameentry/gentry.js deleted file mode 100644 index 567a2f2..0000000 --- a/pages/index/gameentry/gentry.js +++ /dev/null @@ -1,18 +0,0 @@ - -var app = getApp() -Page({ - data: { - flag: false - }, - gotogame: function () { - wx.navigateTo({ - url: '../game/index', - }) - }, - a: function () { - this.setData({ flag: false }) - }, - closeGame: function () { - this.setData({ flag: true }) - } -}) \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js index 17913f1..6344361 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -10,6 +10,9 @@ Page({ desc:'', scrollTop: 0, showGame:false, + gamedata:{}, + couponId:'',//游戏返回时传回的字段 + played:false,//从游戏页面跳回首页返回true page: 1 // 刷新进入页面时已经加载了第一页数据,onReachBottom时 page++,从第2页开始加载 }, swiperChange: function(e) { @@ -27,6 +30,12 @@ Page({ * 生命周期函数--监听页面初次渲染完成 */ onLoad: function(options) { + console.log(options,2222222) + if(options.played=="true"){ + this.setData({ + played:true + }) + } var that = this; console.log(options); console.log("这是options") @@ -34,8 +43,8 @@ Page({ that.setData({ scene:scene }); - console.log(that.data.scene) - console.log(scene); + // console.log(that.data.scene) + // console.log(scene); app.getLocation(); if (options.couponChannelId && options.couponId){ that.userLogin(options.couponChannelId, options.couponId); @@ -49,9 +58,9 @@ Page({ } }) .then(res=>{ - console.log(res.data.weapNote); + // console.log(res.data.weapNote); let weapNote = JSON.parse(res.data.weapNote); - console.log(weapNote.firstpage); + // console.log(weapNote.firstpage); that.setData({ desc: weapNote.firstpage.desc, title: weapNote.firstpage.title @@ -72,11 +81,11 @@ Page({ onPullDownRefresh: function(e) { let that = this; that.userLogin(); - console.log(this.data.code); + // console.log(this.data.code); if (that.data.code == 0 || that.data.code == undefined) { that.selectComponent("#lists").getList(0, 1); wx.stopPullDownRefresh(); - console.log("下拉刷新"); + // console.log("下拉刷新"); } else { that.selectComponent("#lists").getList(that.data.code, 1); wx.stopPullDownRefresh(); @@ -103,7 +112,7 @@ Page({ }) => { wx.getSystemInfo({ success: function (res) { - console.log(JSON.stringify(res)) + // console.log(JSON.stringify(res)) that.setData({ systemInfo: JSON.stringify(res) }) @@ -142,6 +151,7 @@ Page({ that.setData({ showGame: true }) + that.getGameOne(res.data.token) } Http.setToken(res.data.token); that.checkUserCarStatus(); @@ -176,7 +186,20 @@ Page({ } }); }, - + getGameOne:function(token){ + let _this=this; + Http.get({ + url: config.api.getGame, + data:{ + token: token + } + }).then(res => { + console.log(res.data,77777) + _this.setData({ + gamedata:res.data + }) + }) + }, /** * banner */ @@ -189,7 +212,6 @@ Page({ pageSize: 7 } }).then(res => { - console.log(res); that.setData({ list: res.data.list }); @@ -231,7 +253,6 @@ Page({ app.globalData.parkVendor = res.data.vendor; if (res.data.token != "undefined") { app.globalData.etcpToken = res.data.token; - console.log("etcpToken", app.globalData.etcpToken); } }); } @@ -243,7 +264,6 @@ Page({ // 获取用户信息 wx.getSetting({ success: res => { - console.log("getSetting", res); if (res.authSetting["scope.userInfo"]) { // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框 wx.getUserInfo({ @@ -263,7 +283,7 @@ Page({ that.setData({ page: that.data.page }); - console.log("我是第" + that.data.page + "几页") + // console.log("我是第" + that.data.page + "几页") //父组件获得子组件的方法 //如果code == 0 if (that.data.code == 0 || that.data.code == undefined) { diff --git a/pages/index/index.json b/pages/index/index.json index 2151e63..101cd23 100644 --- a/pages/index/index.json +++ b/pages/index/index.json @@ -3,7 +3,7 @@ "c-banner": "../../components/banner/index", "c-rushToBuy": "./rushToBuy/index", "c-coupons": "./coupons/index", - "g-entry": "./gameentry/gentry" + "g-entry": "../../components/gameentry/gentry" }, "navigationBarTitleText": "首页", "enablePullDownRefresh": true diff --git a/pages/index/index.wxml b/pages/index/index.wxml index cb27007..58a66cb 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -7,5 +7,5 @@ 独家福利,抢完即止 - + \ No newline at end of file