// pages/star/star.js const app = getApp() Page({ /** * 页面的初始数据 */ data: { imgUrl: app.globalData.urlStatic,//图片路径 maskShow: false, ruleShow:false, phonebol:false,//是否有手机号 getNumber:null,//数字跳跃 starNumber:4000,//开始人数 stopNumber:0,//结束人数 numList:[4,0,0,0], }, /** * 显示规则页 */ showRule:function(){ this.setData({ maskShow:true, ruleShow:true }) }, /** * 关闭规则页 */ hiddenRule:function(){ this.setData({ maskShow: false, ruleShow: false }) }, /** * 每日任务 */ everyDay:function(){ wx.navigateTo({ url:'../everyday/everyday' }) }, /** * 星探任务 */ scout:function(){ this.phonebolb(app.globalData.userMobile); }, phonebolb:function(_phone){ app.wxRequest(app.globalData.urlRoot + "userInfo/getCertificationInfo", {mobile:_phone}, res => { console.log(res) if (res.code == 200) { if(res.data!=null){ app.globalData.certificationState=res.data.certificationState; wx.navigateTo({ url: '../scout/scout' }) }else{ wx.navigateTo({ url: '../scout/register/register' }) } } }, this); }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { // app.wxRequest(app.globalData.urlRoot + "/admin/certificationNoCar/getCertificationNoCarList", { // adminState: 0, page:1,count:10 // }, res => { // console.log(res) // }, this); // app.wxRequest(app.globalData.urlRoot + "/admin/certificationNoCar/auditRefuse", { id:4 }, res => { // console.log(res) // }, this,"POST"); // app.wxRequest(app.globalData.urlRoot + "/admin/certificationNoCar/auditPass", { id:4 }, res => { // console.log(res) // }, this,"POST"); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { this.setData({ starNumber:4000 }) if (app.globalData.openid) { this.gettime(); } else { app.globalData.openidSuccessFuc = this.gettime; } }, gettime(){ app.wxRequest(app.globalData.urlRoot + "userInfo/getCertificationCount", {}, res => { console.log(res) if (res.code == 200) { this.setData({ stopNumber: res.data.total }) if(this.data.stopNumber<10000){ this.setData({ numList: [4,0,0,0] }) }else{ this.setData({ numList: [0,4,0,0,0] }) } this.getNumber=setInterval(this.vCodeDownTime,30); } }, this); }, vCodeDownTime(){ var numb = this.data.starNumber; numb=Math.floor(this.data.starNumber+(this.data.stopNumber-4000)/90); if(numb>=this.data.stopNumber){ numb=this.data.stopNumber; clearInterval(this.getNumber); } this.setData({ starNumber: numb, numList:numb.toString().split("") }) }, getPhone (e) { console.log(e.detail) if (e.detail.errMsg=='getPhoneNumber:ok'){ app.wxRequest(app.globalData.urlRoot + "userInfo/getUserPhoneNumber", { encryptedData: e.detail.encryptedData, iv: e.detail.iv }, res => { console.log(res) if (res.code == 200) { if(res.data.result==0){ this.phonebolb(res.data.decodeData.phoneNumber); app.globalData.userMobile=res.data.decodeData.phoneNumber; }else{ wx.showToast({title: '获取失败',icon: "none"}) } } else { wx.showToast({title: res.msg,icon: "none"}) } }, this,"POST"); } }, /** * 生命周期函数--监听页面显示 */ onShow: function () { console.log(app.globalData.userMobile) if(app.globalData.userMobile==null){ this.setData({phonebol: true}) }else{ this.setData({phonebol: false}) } }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })