东风启辰小程序端
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

219 líneas
4.9KB

  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. isbtn:true,//防重复点击
  17. },
  18. /**
  19. * 显示规则页
  20. */
  21. showRule:function(){
  22. this.setData({
  23. maskShow:true,
  24. ruleShow:true
  25. })
  26. },
  27. /**
  28. * 关闭规则页
  29. */
  30. hiddenRule:function(){
  31. this.setData({
  32. maskShow: false,
  33. ruleShow: false
  34. })
  35. },
  36. /**
  37. * 每日任务
  38. */
  39. everyDay:function(){
  40. if(this.data.isbtn){
  41. this.setData({isbtn: false})
  42. }else{
  43. return;
  44. }
  45. wx.navigateTo({url:'../everyday/everyday'})
  46. },
  47. /**
  48. * 星探任务
  49. */
  50. scout:function(){
  51. if(this.data.isbtn){
  52. this.setData({isbtn: false})
  53. }else{
  54. return;
  55. }
  56. this.phonebolb(app.globalData.userMobile);
  57. },
  58. phonebolb:function(_phone){
  59. app.wxRequest(app.globalData.urlRoot + "userInfo/getCertificationInfo", {mobile:_phone}, res => {
  60. if (res.code == 200) {
  61. if(res.data!=null){
  62. app.globalData.certificationState=res.data.certificationState;
  63. wx.navigateTo({
  64. url: '../scout/scout'
  65. })
  66. }else{
  67. wx.navigateTo({
  68. url: '../scout/register/register'
  69. })
  70. }
  71. }else{
  72. this.setData({isbtn: true})
  73. }
  74. }, this);
  75. },
  76. /**
  77. * 生命周期函数--监听页面加载
  78. */
  79. onLoad: function (options) {
  80. // app.wxRequest(app.globalData.urlRoot + "/admin/certificationNoCar/getCertificationNoCarList", {
  81. // adminState: 0, page:1,count:10
  82. // }, res => {
  83. // console.log(res)
  84. // }, this);
  85. // app.wxRequest(app.globalData.urlRoot + "/admin/certificationNoCar/auditRefuse", { id:4 }, res => {
  86. // console.log(res)
  87. // }, this,"POST");
  88. // app.wxRequest(app.globalData.urlRoot + "/admin/certificationNoCar/auditPass", { id:4 }, res => {
  89. // console.log(res)
  90. // }, this,"POST");
  91. },
  92. /**
  93. * 生命周期函数--监听页面初次渲染完成
  94. */
  95. onReady: function () {
  96. this.setData({
  97. starNumber:4000
  98. })
  99. if (app.globalData.openid) {
  100. this.gettime();
  101. } else {
  102. app.globalData.openidSuccessFuc = this.gettime;
  103. }
  104. },
  105. gettime(){
  106. app.wxRequest(app.globalData.urlRoot + "userInfo/getCertificationCount", {}, res => {
  107. console.log(res)
  108. if (res.code == 200) {
  109. this.setData({
  110. stopNumber: res.data.total
  111. })
  112. if(this.data.stopNumber<10000){
  113. this.setData({
  114. numList: [4,0,0,0]
  115. })
  116. }else{
  117. this.setData({
  118. numList: [0,4,0,0,0]
  119. })
  120. }
  121. this.getNumber=setInterval(this.vCodeDownTime,20);
  122. }
  123. }, this);
  124. },
  125. vCodeDownTime(){
  126. var numb = this.data.starNumber;
  127. numb=Math.floor(this.data.starNumber+(this.data.stopNumber-4000)/80);
  128. if(numb>=this.data.stopNumber){
  129. numb=this.data.stopNumber;
  130. clearInterval(this.getNumber);
  131. }
  132. this.setData({
  133. starNumber: numb,
  134. numList:numb.toString().split("")
  135. })
  136. },
  137. getPhone (e) {
  138. console.log(e.detail)
  139. if (e.detail.errMsg=='getPhoneNumber:ok'){
  140. if(this.data.isbtn){
  141. this.setData({isbtn: false})
  142. }else{
  143. return;
  144. }
  145. app.wxRequest(app.globalData.urlRoot + "userInfo/getUserPhoneNumber", { encryptedData: e.detail.encryptedData, iv: e.detail.iv }, res => {
  146. console.log(res)
  147. if (res.code == 200) {
  148. if(res.data.result==0){
  149. this.phonebolb(res.data.decodeData.phoneNumber);
  150. app.globalData.userMobile=res.data.decodeData.phoneNumber;
  151. }else{
  152. this.setData({isbtn: true})
  153. wx.showToast({title: '获取失败',icon: "none"})
  154. }
  155. } else {
  156. this.setData({isbtn: true})
  157. wx.showToast({title: res.msg,icon: "none"})
  158. }
  159. }, this,"POST");
  160. }
  161. },
  162. /**
  163. * 生命周期函数--监听页面显示
  164. */
  165. onShow: function () {
  166. console.log(app.globalData.userMobile)
  167. if(app.globalData.userMobile==null){
  168. this.setData({phonebol: true})
  169. }else{
  170. this.setData({phonebol: false})
  171. }
  172. this.setData({isbtn: true})
  173. // wx.navigateTo({
  174. // url: '../scout/register/register'
  175. // })
  176. },
  177. /**
  178. * 生命周期函数--监听页面隐藏
  179. */
  180. onHide: function () {
  181. },
  182. /**
  183. * 生命周期函数--监听页面卸载
  184. */
  185. onUnload: function () {
  186. },
  187. /**
  188. * 页面相关事件处理函数--监听用户下拉动作
  189. */
  190. onPullDownRefresh: function () {
  191. },
  192. /**
  193. * 页面上拉触底事件的处理函数
  194. */
  195. onReachBottom: function () {
  196. },
  197. /**
  198. * 用户点击右上角分享
  199. */
  200. onShareAppMessage: function () {
  201. return app.sharePack();
  202. }
  203. })