东风启辰小程序端
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.

197 lines
4.4KB

  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. // app.wxRequest(app.globalData.urlRoot + "/admin/certificationNoCar/auditPass", { id:4 }, res => {
  79. // console.log(res)
  80. // }, this,"POST");
  81. },
  82. /**
  83. * 生命周期函数--监听页面初次渲染完成
  84. */
  85. onReady: function () {
  86. this.setData({
  87. starNumber:4000
  88. })
  89. if (app.globalData.openid) {
  90. this.gettime();
  91. } else {
  92. app.globalData.openidSuccessFuc = this.gettime;
  93. }
  94. },
  95. gettime(){
  96. app.wxRequest(app.globalData.urlRoot + "userInfo/getCertificationCount", {}, res => {
  97. console.log(res)
  98. if (res.code == 200) {
  99. this.setData({
  100. stopNumber: res.data.total
  101. })
  102. if(this.data.stopNumber<10000){
  103. this.setData({
  104. numList: [4,0,0,0]
  105. })
  106. }else{
  107. this.setData({
  108. numList: [0,4,0,0,0]
  109. })
  110. }
  111. this.getNumber=setInterval(this.vCodeDownTime,30);
  112. }
  113. }, this);
  114. },
  115. vCodeDownTime(){
  116. var numb = this.data.starNumber;
  117. numb=Math.floor(this.data.starNumber+(this.data.stopNumber-4000)/90);
  118. if(numb>=this.data.stopNumber){
  119. numb=this.data.stopNumber;
  120. clearInterval(this.getNumber);
  121. }
  122. this.setData({
  123. starNumber: numb,
  124. numList:numb.toString().split("")
  125. })
  126. },
  127. getPhone (e) {
  128. console.log(e.detail)
  129. if (e.detail.errMsg=='getPhoneNumber:ok'){
  130. app.wxRequest(app.globalData.urlRoot + "userInfo/getUserPhoneNumber", { encryptedData: e.detail.encryptedData, iv: e.detail.iv }, res => {
  131. console.log(res)
  132. if (res.code == 200) {
  133. if(res.data.result==0){
  134. this.phonebolb(res.data.decodeData.phoneNumber);
  135. app.globalData.userMobile=res.data.decodeData.phoneNumber;
  136. }else{
  137. wx.showToast({title: '获取失败',icon: "none"})
  138. }
  139. } else {
  140. wx.showToast({title: res.msg,icon: "none"})
  141. }
  142. }, this,"POST");
  143. }
  144. },
  145. /**
  146. * 生命周期函数--监听页面显示
  147. */
  148. onShow: function () {
  149. console.log(app.globalData.userMobile)
  150. if(app.globalData.userMobile==null){
  151. this.setData({phonebol: true})
  152. }else{
  153. this.setData({phonebol: false})
  154. }
  155. },
  156. /**
  157. * 生命周期函数--监听页面隐藏
  158. */
  159. onHide: function () {
  160. },
  161. /**
  162. * 生命周期函数--监听页面卸载
  163. */
  164. onUnload: function () {
  165. },
  166. /**
  167. * 页面相关事件处理函数--监听用户下拉动作
  168. */
  169. onPullDownRefresh: function () {
  170. },
  171. /**
  172. * 页面上拉触底事件的处理函数
  173. */
  174. onReachBottom: function () {
  175. },
  176. /**
  177. * 用户点击右上角分享
  178. */
  179. onShareAppMessage: function () {
  180. }
  181. })