| @@ -1,6 +1,7 @@ | |||||
| { | { | ||||
| "pages": [ | "pages": [ | ||||
| "pages/index/index", | "pages/index/index", | ||||
| "pages/game/index", | |||||
| "pages/edit/edit", | "pages/edit/edit", | ||||
| "pages/cartest/cartest", | "pages/cartest/cartest", | ||||
| "pages/actdetail/actdetail", | "pages/actdetail/actdetail", | ||||
| @@ -30,7 +31,6 @@ | |||||
| "pages/passCar/couponDetail/couponDetail", | "pages/passCar/couponDetail/couponDetail", | ||||
| "pages/managelicenseplate/managelicenseplate", | "pages/managelicenseplate/managelicenseplate", | ||||
| "pages/payrule/payrule", | "pages/payrule/payrule", | ||||
| "pages/game/index", | |||||
| "pages/grade/grade" | "pages/grade/grade" | ||||
| ], | ], | ||||
| "tabBar": { | "tabBar": { | ||||
| @@ -1,4 +1,6 @@ | |||||
| // pages/index/sw/index.js | // pages/index/sw/index.js | ||||
| const Http = require("../../utils/HttpBasics"); | |||||
| var config = require("../../config/config.js"); | |||||
| Component({ | Component({ | ||||
| properties: { | properties: { | ||||
| gamedata: { | gamedata: { | ||||
| @@ -12,8 +14,49 @@ Component({ | |||||
| }, | }, | ||||
| methods:{ | methods:{ | ||||
| gotogame: function (e) { | 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, | |||||
| let that=this; | |||||
| Http.post({ | |||||
| url: config.api.checkPhoneStatus, | |||||
| data: {} | |||||
| }) | |||||
| .then(res => { | |||||
| console.log(res); | |||||
| var data = { | |||||
| couponChannelId: "" + that.data.couponChannelId, | |||||
| couponId: "" + that.data.couponId | |||||
| }; | |||||
| if (that.data.couponChannelId == null) { | |||||
| var data = { | |||||
| couponId: "" + that.data.couponId | |||||
| }; | |||||
| } | |||||
| wx.navigateTo({ | |||||
| url: '/pages/game/index?url=' + e.target.dataset.data.url + "&id=" + e.target.dataset.data.id + "&gameId=" + e.target.dataset.data.gameId, | |||||
| }) | |||||
| }) | |||||
| .catch(err => { | |||||
| if (err.code == 11005) { | |||||
| // 用户手机未授权 | |||||
| /** | |||||
| * 将值传到用户手机号授权的页面 | |||||
| * | |||||
| */ | |||||
| wx.redirectTo({ | |||||
| url: "/pages/getphoneInfo/index?path=index" | |||||
| }); | |||||
| } else if (err.code == 11006){ | |||||
| // 用户手机已加密 | |||||
| wx.redirectTo({ | |||||
| url: "/pages/phoneinput/phoneinput?path=index" | |||||
| }); | |||||
| }else { | |||||
| wx.showToast({ | |||||
| title: err.message, | |||||
| image: "../../assets/img/fail.png", | |||||
| duration: 2000, | |||||
| mask: false | |||||
| }); | |||||
| } | |||||
| }) | }) | ||||
| }, | }, | ||||
| a: function () { | a: function () { | ||||
| @@ -2,5 +2,5 @@ | |||||
| "usingComponents": { | "usingComponents": { | ||||
| }, | }, | ||||
| "navigationBarTitleText": "" | |||||
| "navigationBarTitleText": "富茂小游戏" | |||||
| } | } | ||||
| @@ -5,9 +5,13 @@ Page({ | |||||
| data: { | data: { | ||||
| canIUse: wx.canIUse("button.open-type.getPhoneNumber"), | canIUse: wx.canIUse("button.open-type.getPhoneNumber"), | ||||
| couponChannelId: "", | couponChannelId: "", | ||||
| couponId: "" | |||||
| couponId: "", | |||||
| path:null | |||||
| }, | }, | ||||
| onLoad: function (options) { | onLoad: function (options) { | ||||
| if(options.path=='index'){ | |||||
| this.path = options.path | |||||
| } | |||||
| var that = this; | var that = this; | ||||
| console.log(options); | console.log(options); | ||||
| if (options.couponChannelId && options.couponId) { | if (options.couponChannelId && options.couponId) { | ||||
| @@ -52,25 +56,31 @@ Page({ | |||||
| console.log(that.data.couponId); | console.log(that.data.couponId); | ||||
| console.log("这是从立即支付传回来的值 因为用户没有授权手机号"); | console.log("这是从立即支付传回来的值 因为用户没有授权手机号"); | ||||
| app.globalData.phone = res.data.phone; | app.globalData.phone = res.data.phone; | ||||
| wx.showToast({ | |||||
| title: res.data.msg, | |||||
| icon: "success", | |||||
| success: function (res) { | |||||
| if (that.data.couponChannelId && that.data.couponId) { | |||||
| wx.redirectTo({ | |||||
| url: "/pages/coupon/detail/index?couponChannelId=" + | |||||
| that.data.couponChannelId + | |||||
| "&couponId=" + | |||||
| that.data.couponId + | |||||
| "&flag=pay" | |||||
| }) | |||||
| } else { | |||||
| wx.switchTab({ | |||||
| url: '/pages/passCar/passCar', | |||||
| }) | |||||
| if (that.path == 'index') { | |||||
| wx.reLaunch({ | |||||
| url: "/pages/game/index" | |||||
| }) | |||||
| } else { | |||||
| wx.showToast({ | |||||
| title: res.data.msg, | |||||
| icon: "success", | |||||
| success: function (res) { | |||||
| if (that.data.couponChannelId && that.data.couponId) { | |||||
| wx.redirectTo({ | |||||
| url: "/pages/coupon/detail/index?couponChannelId=" + | |||||
| that.data.couponChannelId + | |||||
| "&couponId=" + | |||||
| that.data.couponId + | |||||
| "&flag=pay" | |||||
| }) | |||||
| } else { | |||||
| wx.switchTab({ | |||||
| url: '/pages/passCar/passCar', | |||||
| }) | |||||
| } | |||||
| } | } | ||||
| } | |||||
| }); | |||||
| }); | |||||
| } | |||||
| }, | }, | ||||
| function (error) { | function (error) { | ||||
| wx.showToast({ | wx.showToast({ | ||||
| @@ -3,10 +3,14 @@ var app = getApp(); | |||||
| const Http = require("../../utils/HttpBasics"); | const Http = require("../../utils/HttpBasics"); | ||||
| Page({ | Page({ | ||||
| data: { | data: { | ||||
| canIUse: wx.canIUse("button.open-type.getUserInfo") | |||||
| canIUse: wx.canIUse("button.open-type.getUserInfo"), | |||||
| path:null | |||||
| }, | }, | ||||
| onLoad: function(options) { | onLoad: function(options) { | ||||
| var that = this; | var that = this; | ||||
| if (options.path == 'index') { | |||||
| this.path = options.path | |||||
| } | |||||
| Http.get({ | Http.get({ | ||||
| url: config.api.marketicon, | url: config.api.marketicon, | ||||
| data: { | data: { | ||||
| @@ -24,6 +28,7 @@ Page({ | |||||
| }, | }, | ||||
| bindGetUserInfo: function(e) { | bindGetUserInfo: function(e) { | ||||
| let that=this; | |||||
| console.log(e); | console.log(e); | ||||
| var iv = e.detail.iv; | var iv = e.detail.iv; | ||||
| var encryptedData = e.detail.encryptedData; | var encryptedData = e.detail.encryptedData; | ||||
| @@ -38,11 +43,17 @@ Page({ | |||||
| }).then( | }).then( | ||||
| function(res) { | function(res) { | ||||
| console.log(res); | console.log(res); | ||||
| console.log("授权个人信息返回的数据") | |||||
| //返回主页 | |||||
| wx.switchTab({ | |||||
| url: "/pages/index/index" | |||||
| }); | |||||
| console.log("授权个人信息返回的数据", that.path) | |||||
| if(that.path=='index'){ | |||||
| wx.reLaunch({ | |||||
| url: "/pages/game/index" | |||||
| }); | |||||
| }else{ | |||||
| //返回主页 | |||||
| wx.switchTab({ | |||||
| url: "/pages/index/index" | |||||
| }); | |||||
| } | |||||
| }, | }, | ||||
| function(error) { | function(error) { | ||||
| wx.showToast({ | wx.showToast({ | ||||
| @@ -13,6 +13,7 @@ Page({ | |||||
| gamedata:{}, | gamedata:{}, | ||||
| couponId:'',//游戏返回时传回的字段 | couponId:'',//游戏返回时传回的字段 | ||||
| played:false,//从游戏页面跳回首页返回true | played:false,//从游戏页面跳回首页返回true | ||||
| havePlayEd: app.globalData.havePlayEd, | |||||
| page: 1 // 刷新进入页面时已经加载了第一页数据,onReachBottom时 page++,从第2页开始加载 | page: 1 // 刷新进入页面时已经加载了第一页数据,onReachBottom时 page++,从第2页开始加载 | ||||
| }, | }, | ||||
| swiperChange: function(e) { | swiperChange: function(e) { | ||||
| @@ -25,7 +26,6 @@ Page({ | |||||
| url: '../game/index', | url: '../game/index', | ||||
| }) | }) | ||||
| }, | }, | ||||
| /** | /** | ||||
| * 生命周期函数--监听页面初次渲染完成 | * 生命周期函数--监听页面初次渲染完成 | ||||
| */ | */ | ||||
| @@ -68,6 +68,10 @@ Page({ | |||||
| }) | }) | ||||
| }, | }, | ||||
| onShow:function(){ | onShow:function(){ | ||||
| // console.log(app.globalData.havePlayEd) | |||||
| this.setData({ | |||||
| havePlayEd: app.globalData.havePlayEd ? app.globalData.havePlayEd:false | |||||
| }) | |||||
| let num = wx.getStorageSync('couponNum'); | let num = wx.getStorageSync('couponNum'); | ||||
| if (num =='couponNum'){ | if (num =='couponNum'){ | ||||
| wx.showTabBarRedDot({ | wx.showTabBarRedDot({ | ||||
| @@ -155,7 +159,7 @@ Page({ | |||||
| } | } | ||||
| Http.setToken(res.data.token); | Http.setToken(res.data.token); | ||||
| that.checkUserCarStatus(); | that.checkUserCarStatus(); | ||||
| that.getUserInfo(); | |||||
| // that.getUserInfo(); | |||||
| that.getBannerlist(); | that.getBannerlist(); | ||||
| if (app.couponChannelListCallback) { | if (app.couponChannelListCallback) { | ||||
| app.couponChannelListCallback(app.globalData.token); | app.couponChannelListCallback(app.globalData.token); | ||||
| @@ -269,6 +273,7 @@ Page({ | |||||
| wx.getUserInfo({ | wx.getUserInfo({ | ||||
| success: res => { | success: res => { | ||||
| // 可以将 res 发送给后台解码出 unionId | // 可以将 res 发送给后台解码出 unionId | ||||
| debugger | |||||
| console.log("getUserInfo", res); | console.log("getUserInfo", res); | ||||
| } | } | ||||
| }); | }); | ||||
| @@ -7,5 +7,5 @@ | |||||
| <text>独家福利,抢完即止</text> | <text>独家福利,抢完即止</text> | ||||
| </view> | </view> | ||||
| <c-coupons id="lists" bind:myevent="onGetCode" /> | <c-coupons id="lists" bind:myevent="onGetCode" /> | ||||
| <g-entry id="listss" wx:if="{{showGame&&!played}}" gamedata="{{gamedata}}" bind:myevent="" /> | |||||
| <g-entry id="listss" wx:if="{{showGame&&!played&&!havePlayEd}}" gamedata="{{gamedata}}" bind:myevent="" /> | |||||
| </view> | </view> | ||||
| @@ -10,9 +10,13 @@ Page({ | |||||
| retry: false, | retry: false, | ||||
| time: 60, | time: 60, | ||||
| couponChannelId: null, | couponChannelId: null, | ||||
| couponId:null | |||||
| couponId:null, | |||||
| path:null | |||||
| }, | }, | ||||
| onLoad: function (options) { | onLoad: function (options) { | ||||
| if(options.path=='index'){ | |||||
| this.path = options.path | |||||
| } | |||||
| var that = this; | var that = this; | ||||
| console.log(options); | console.log(options); | ||||
| that.setData({ | that.setData({ | ||||
| @@ -39,9 +43,15 @@ Page({ | |||||
| } | } | ||||
| }) | }) | ||||
| .then(res => { | .then(res => { | ||||
| wx.redirectTo({ | |||||
| url: '/pages/coupon/detail/index?couponChannelId=' + that.data.couponChannelId + '&couponId=' + that.data.couponId + "&flag=pay", | |||||
| }) | |||||
| if(that.path!=null){ | |||||
| wx.redirectTo({ | |||||
| url: "/pages/index/index" | |||||
| }) | |||||
| }else{ | |||||
| wx.redirectTo({ | |||||
| url: '/pages/coupon/detail/index?couponChannelId=' + that.data.couponChannelId + '&couponId=' + that.data.couponId + "&flag=pay", | |||||
| }) | |||||
| } | |||||
| }) | }) | ||||
| .catch(error => { | .catch(error => { | ||||
| wx.showToast({ | wx.showToast({ | ||||
| @@ -4,7 +4,7 @@ | |||||
| "ignore": [] | "ignore": [] | ||||
| }, | }, | ||||
| "setting": { | "setting": { | ||||
| "urlCheck": false, | |||||
| "urlCheck": true, | |||||
| "es6": true, | "es6": true, | ||||
| "postcss": true, | "postcss": true, | ||||
| "minified": true, | "minified": true, | ||||