Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

146 rader
3.8 KiB

  1. const app = getApp()
  2. const config = require("../../config/config")
  3. const Http = require("../../utils/HttpBasics.js")
  4. const navigationBarHeight = (getApp().statusBarHeight + 44)+"px"
  5. Page({
  6. data:{
  7. imgHttps:app.globalData.imgHttps,
  8. navigationBarHeight,
  9. ttNum:"",//抖音号
  10. ttBean:"",//抖音粉丝数量
  11. userName:"",//姓名
  12. userPhone:"",//手机号
  13. codePhone:"",//手机验证码
  14. Num:60,
  15. NumFlag:false,
  16. },
  17. setTtNum(e){
  18. let value = e.detail.value
  19. this.setData({
  20. ttNum: value
  21. })
  22. },
  23. setTtBean(e){
  24. let value = e.detail.value
  25. this.setData({
  26. ttBean: value
  27. })
  28. },
  29. setUserName(e){
  30. let value = e.detail.value
  31. this.setData({
  32. userName: value
  33. })
  34. },
  35. setUserPhone(e){
  36. let value = e.detail.value
  37. this.setData({
  38. userPhone: value
  39. })
  40. },
  41. setCodePhone(e){
  42. let value = e.detail.value
  43. this.setData({
  44. codePhone: value
  45. })
  46. },
  47. getCode(){//获取验证码
  48. console.log(this.data.userPhone);
  49. let myreg = /^[1][3,4,5,7,8,9][0-9]{9}$/;
  50. if(!myreg.test(this.data.userPhone)){
  51. tt.showToast({
  52. title: '请输入正确的手机号',
  53. icon: "none"
  54. });
  55. return
  56. }
  57. Http.get({
  58. url:config.api.getCodePhone,
  59. data:{
  60. phone:this.data.userPhone
  61. }
  62. }).then(res=>{
  63. this.setData({
  64. NumFlag:true
  65. })
  66. let tiem = setInterval(()=>{
  67. console.log(this.data.Num)
  68. this.setData({
  69. Num:this.data.Num-1
  70. })
  71. if(this.data.Num<=1){
  72. clearInterval(tiem)
  73. this.setData({
  74. NumFlag:false
  75. })
  76. }
  77. },1000)
  78. tt.showToast({
  79. title: '发送成功',
  80. icon: "none"
  81. });
  82. }).catch(err=>{
  83. tt.showToast({
  84. title: err.message,
  85. icon: "none"
  86. });
  87. })
  88. },
  89. submit(){
  90. let myreg = /^[1][3,4,5,7,8,9][0-9]{9}$/;
  91. if(this.data.ttNum==""){
  92. tt.showToast({
  93. title: '请填写抖音号', // 抖音号
  94. icon: "none"
  95. });
  96. return
  97. }
  98. if(this.data.ttBean==""){
  99. tt.showToast({
  100. title: '请填写抖音粉丝数量', // 粉丝数量
  101. icon: "none"
  102. });
  103. return
  104. }
  105. if(this.data.userName==""){
  106. tt.showToast({
  107. title: '请填写姓名', // 姓名
  108. icon: "none"
  109. });
  110. return
  111. }
  112. if(!myreg.test(this.data.userPhone)){
  113. tt.showToast({
  114. title: '请输入正确的手机号',
  115. icon: "none"
  116. });
  117. return
  118. }
  119. Http.post({
  120. url:config.api.apply,
  121. data:{
  122. ttUserName:this.data.ttNum,
  123. ttCountFans:this.data.ttBean,
  124. liaisonMan:this.data.userName,
  125. liaisonPhone:this.data.userPhone,
  126. code:this.data.codePhone
  127. }
  128. }).then(res=>{
  129. tt.showToast({
  130. title: '提交成功!', // 内容
  131. success: (res) => {
  132. tt.navigateBack();
  133. }
  134. });
  135. }).catch(err=>{
  136. tt.showToast({
  137. title: err.message,
  138. icon: "none"
  139. });
  140. })
  141. }
  142. })