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

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