东风启辰小程序端
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

227 lines
5.2KB

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