东风启辰小程序端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

star.js 4.1KB

5 years ago
5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. // pages/star/star.js
  2. const app = getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. imgUrl: app.globalData.urlStatic,//图片路径
  9. maskShow: false,
  10. ruleShow:false,
  11. phonebol:false,//是否有手机号
  12. getNumber:null,//数字跳跃
  13. starNumber:4000,//开始人数
  14. stopNumber:0,//结束人数
  15. numList:[4,0,0,0],
  16. },
  17. /**
  18. * 显示规则页
  19. */
  20. showRule:function(){
  21. this.setData({
  22. maskShow:true,
  23. ruleShow:true
  24. })
  25. },
  26. /**
  27. * 关闭规则页
  28. */
  29. hiddenRule:function(){
  30. this.setData({
  31. maskShow: false,
  32. ruleShow: false
  33. })
  34. },
  35. /**
  36. * 每日任务
  37. */
  38. everyDay:function(){
  39. wx.navigateTo({
  40. url:'../everyday/everyday'
  41. })
  42. },
  43. /**
  44. * 星探任务
  45. */
  46. scout:function(){
  47. this.phonebolb(app.globalData.userMobile);
  48. },
  49. phonebolb:function(_phone){
  50. // app.wxRequest(app.globalData.urlRoot + "userInfo/getCertificationInfo", {mobile:_phone}, res => {
  51. // console.log(res)
  52. // if (res.code == 200) {
  53. // if(res.data!=null){
  54. // app.globalData.certificationState=res.data.certificationState;
  55. wx.navigateTo({
  56. url: '../scout/scout'
  57. })
  58. // }else{
  59. // wx.navigateTo({
  60. // url: '../scout/register/register'
  61. // })
  62. // }
  63. // }
  64. // }, this);
  65. },
  66. /**
  67. * 生命周期函数--监听页面加载
  68. */
  69. onLoad: function (options) {
  70. // app.wxRequest(app.globalData.urlRoot + "/admin/certificationNoCar/getCertificationNoCarList", {
  71. // adminState: 0, page:1,count:10
  72. // }, res => {
  73. // console.log(res)
  74. // }, this);
  75. // app.wxRequest(app.globalData.urlRoot + "/admin/certificationNoCar/auditRefuse", { id:4 }, res => {
  76. // console.log(res)
  77. // }, this,"POST");
  78. },
  79. /**
  80. * 生命周期函数--监听页面初次渲染完成
  81. */
  82. onReady: function () {
  83. this.setData({
  84. starNumber:4000
  85. })
  86. app.wxRequest(app.globalData.urlRoot + "userInfo/getCertificationCount", {}, res => {
  87. console.log(res)
  88. if (res.code == 200) {
  89. this.setData({
  90. stopNumber: res.data.total
  91. })
  92. if(this.data.stopNumber<10000){
  93. this.setData({
  94. numList: [4,0,0,0]
  95. })
  96. }else{
  97. this.setData({
  98. numList: [0,4,0,0,0]
  99. })
  100. }
  101. this.getNumber=setInterval(this.vCodeDownTime,30);
  102. }
  103. }, this);
  104. },
  105. vCodeDownTime(){
  106. var numb = this.data.starNumber;
  107. numb=Math.floor(this.data.starNumber+(this.data.stopNumber-4000)/90);
  108. if(numb>=this.data.stopNumber){
  109. numb=this.data.stopNumber;
  110. clearInterval(this.getNumber);
  111. }
  112. this.setData({
  113. starNumber: numb,
  114. numList:numb.toString().split("")
  115. })
  116. },
  117. getPhone (e) {
  118. console.log(e.detail)
  119. if (e.detail.errMsg=='getPhoneNumber:ok'){
  120. app.wxRequest(app.globalData.urlRoot + "userInfo/getUserPhoneNumber", { encryptedData: e.detail.encryptedData, iv: e.detail.iv }, res => {
  121. console.log(res)
  122. if (res.code == 200) {
  123. if(res.data.result==0){
  124. this.phonebolb(res.data.decodeData.phoneNumber);
  125. app.globalData.userMobile=res.data.decodeData.phoneNumber;
  126. }else{
  127. wx.showToast({title: '获取失败',icon: "none"})
  128. }
  129. } else {
  130. wx.showToast({title: res.msg,icon: "none"})
  131. }
  132. }, this,"POST");
  133. }
  134. },
  135. /**
  136. * 生命周期函数--监听页面显示
  137. */
  138. onShow: function () {
  139. console.log(app.globalData.userMobile)
  140. if(app.globalData.userMobile==null){
  141. this.setData({phonebol: true})
  142. }else{
  143. this.setData({phonebol: false})
  144. }
  145. },
  146. /**
  147. * 生命周期函数--监听页面隐藏
  148. */
  149. onHide: function () {
  150. },
  151. /**
  152. * 生命周期函数--监听页面卸载
  153. */
  154. onUnload: function () {
  155. },
  156. /**
  157. * 页面相关事件处理函数--监听用户下拉动作
  158. */
  159. onPullDownRefresh: function () {
  160. },
  161. /**
  162. * 页面上拉触底事件的处理函数
  163. */
  164. onReachBottom: function () {
  165. },
  166. /**
  167. * 用户点击右上角分享
  168. */
  169. onShareAppMessage: function () {
  170. }
  171. })