|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- // pages/guess/guess.js
- const app = getApp();
- Page({
-
- /**
- * 页面的初始数据
- */
- data: {
- imgUrl: app.globalData.urlStatic,//图片路径
- yuyueShow:false,
- userType:1,
- },
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- app.globalData.nowPage = 3;
- if (app.globalData.openid) {
- this.loadFun();
- } else {
- app.globalData.openidSuccessFuc = this.loadFun;
- }
-
- },
- loadFun:function(){
- if (!app.globalData.addPageEnterState.guessPrize) {
- app.addPageEnter("7C8AAA38F8D85EFC48C2995FB6EBAC19");
- app.globalData.addPageEnterState.guessPrize = true;
- }
- this.getSecondGuessInfo();
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- if(app.globalData.getSecondGuessInfo.firstData){
- this.data.userType = 1;
- }
- },
-
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
-
- },
-
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
-
- },
-
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
-
- },
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
-
- },
- enterLucky:function(){//每日抽奖
- wx.navigateTo({
- url: '/pages/luckyStar/luckyStar'
- })
- },
- yuyueControl:function(){//预约
- this.setData({
- yuyueShow: !this.data.yuyueShow
- })
- },
- enterGuessPrize:function(){//开始竞猜
- if(this.data.userType == 1){
- wx.navigateTo({
- url: '/pages/guessSecondPrize/guessSecondPrize'
- })
- }else if(this.data.userType == 2){
- wx.navigateTo({
- url: '/pages/guessSecond/guessSecond?type=1'
- })
- }else{
- wx.navigateTo({
- url: '/pages/guessSecond/guessSecond?type=2'
- })
- }
- },
- getSecondGuessInfo:function(){
- app.wxRequest(app.globalData.urlRoot + "guessPrice/getSecondGuessInfo", {}, res => {
- if (res.code == 200) {
- app.globalData.getSecondGuessInfo = res.data;
- if(res.data.secondData || !res.data.firstData){
- this.data.userType = 1;
- }else if(res.data.firstData.lucky_result==-1){
- this.data.userType = 2;
- }else{
- this.data.userType = 3;
- }
- }
- }, this);
- }
- })
|