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

226 rindas
5.0KB

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