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

star.js 6.0KB

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