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

220 satır
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. console.log(res)
  61. if (res.code == 200) {
  62. if(res.data!=null){
  63. app.globalData.certificationState=res.data.certificationState;
  64. wx.navigateTo({
  65. url: '../scout/scout'
  66. })
  67. }else{
  68. wx.navigateTo({
  69. url: '../scout/register/register'
  70. })
  71. }
  72. }else{
  73. this.setData({isbtn: true})
  74. }
  75. }, this);
  76. },
  77. /**
  78. * 生命周期函数--监听页面加载
  79. */
  80. onLoad: function (options) {
  81. // app.wxRequest(app.globalData.urlRoot + "/admin/certificationNoCar/getCertificationNoCarList", {
  82. // adminState: 0, page:1,count:10
  83. // }, res => {
  84. // console.log(res)
  85. // }, this);
  86. // app.wxRequest(app.globalData.urlRoot + "/admin/certificationNoCar/auditRefuse", { id:4 }, res => {
  87. // console.log(res)
  88. // }, this,"POST");
  89. // app.wxRequest(app.globalData.urlRoot + "/admin/certificationNoCar/auditPass", { id:4 }, res => {
  90. // console.log(res)
  91. // }, this,"POST");
  92. },
  93. /**
  94. * 生命周期函数--监听页面初次渲染完成
  95. */
  96. onReady: function () {
  97. this.setData({
  98. starNumber:4000
  99. })
  100. if (app.globalData.openid) {
  101. this.gettime();
  102. } else {
  103. app.globalData.openidSuccessFuc = this.gettime;
  104. }
  105. },
  106. gettime(){
  107. app.wxRequest(app.globalData.urlRoot + "userInfo/getCertificationCount", {}, res => {
  108. console.log(res)
  109. if (res.code == 200) {
  110. this.setData({
  111. stopNumber: res.data.total
  112. })
  113. if(this.data.stopNumber<10000){
  114. this.setData({
  115. numList: [4,0,0,0]
  116. })
  117. }else{
  118. this.setData({
  119. numList: [0,4,0,0,0]
  120. })
  121. }
  122. this.getNumber=setInterval(this.vCodeDownTime,20);
  123. }
  124. }, this);
  125. },
  126. vCodeDownTime(){
  127. var numb = this.data.starNumber;
  128. numb=Math.floor(this.data.starNumber+(this.data.stopNumber-4000)/80);
  129. if(numb>=this.data.stopNumber){
  130. numb=this.data.stopNumber;
  131. clearInterval(this.getNumber);
  132. }
  133. this.setData({
  134. starNumber: numb,
  135. numList:numb.toString().split("")
  136. })
  137. },
  138. getPhone (e) {
  139. console.log(e.detail)
  140. if (e.detail.errMsg=='getPhoneNumber:ok'){
  141. if(this.data.isbtn){
  142. this.setData({isbtn: false})
  143. }else{
  144. return;
  145. }
  146. app.wxRequest(app.globalData.urlRoot + "userInfo/getUserPhoneNumber", { encryptedData: e.detail.encryptedData, iv: e.detail.iv }, res => {
  147. console.log(res)
  148. if (res.code == 200) {
  149. if(res.data.result==0){
  150. this.phonebolb(res.data.decodeData.phoneNumber);
  151. app.globalData.userMobile=res.data.decodeData.phoneNumber;
  152. }else{
  153. this.setData({isbtn: true})
  154. wx.showToast({title: '获取失败',icon: "none"})
  155. }
  156. } else {
  157. this.setData({isbtn: true})
  158. wx.showToast({title: res.msg,icon: "none"})
  159. }
  160. }, this,"POST");
  161. }
  162. },
  163. /**
  164. * 生命周期函数--监听页面显示
  165. */
  166. onShow: function () {
  167. console.log(app.globalData.userMobile)
  168. if(app.globalData.userMobile==null){
  169. this.setData({phonebol: true})
  170. }else{
  171. this.setData({phonebol: false})
  172. }
  173. this.setData({isbtn: true})
  174. // wx.navigateTo({
  175. // url: '../scout/register/register'
  176. // })
  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. })