东风启辰小程序端
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

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