become_promoter.html 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <!-- +---------------------------------------------------------------------- -->
  2. <!-- | CRMEB [ CRMEB赋能开发者,助力企业发展 ] -->
  3. <!-- +---------------------------------------------------------------------- -->
  4. <!-- | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved. -->
  5. <!-- +---------------------------------------------------------------------- -->
  6. <!-- | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 -->
  7. <!-- +---------------------------------------------------------------------- -->
  8. <!-- | Author: CRMEB Team <admin@crmeb.com> -->
  9. <!-- +---------------------------------------------------------------------- -->
  10. {extend name="public/container"}
  11. {block name='head_top'}
  12. <style>
  13. body{background-color:#fff;}
  14. </style>
  15. {/block}
  16. {block name='title'}开启学习旅程{/block}
  17. {block name="content"}
  18. <div class="become-promoter" id="app">
  19. <div style="text-align: center">
  20. <img :src="logo" height="120">
  21. </div>
  22. <div class="phone">
  23. <ul class="list">
  24. <li class="item"><input type="text" placeholder="输入手机号" v-model="phone"></li>
  25. <li class="item itemCode acea-row row-between-wrapper">
  26. <input type="number" placeholder="输入验证码" v-model="code_num">
  27. <button class="code acea-row row-center-wrapper" :disabled="active" :class="active == true?'on':''" @click="code" v-text="timetext">获取验证码</button>
  28. </li>
  29. </ul>
  30. <div class="bnt acea-row row-center-wrapper" @click="save_promoter">加入学习</div>
  31. </div>
  32. <quick-menu></quick-menu>
  33. </div>
  34. {/block}
  35. {block name="foot"}
  36. <script>
  37. var spread_uid={$spread_uid},logo='{$home_logo}';
  38. require(['vue','helper','store','reg-verify','{__WAP_PATH}zsff/js/quick.js'],function(Vue,$h,app,$reg) {
  39. new Vue({
  40. el: '#app',
  41. data: {
  42. active:false,
  43. timetext:'获取验证码',
  44. phone:'',
  45. code_num:'',
  46. logo: logo
  47. },
  48. methods:{
  49. save_promoter:function(){
  50. var that=this;
  51. if(!this.phone) return $h.pushMsgOnce('请输入手机号码');
  52. if(!$reg.isPhone(this.phone)) return $h.pushMsgOnce('您输入的手机号码不正确');
  53. if(!that.code_num) return $h.pushMsgOnce('请输入验证码');
  54. $h.loadFFF();
  55. app.basePost($h.U({c:'spread',a:'save_promoter',q:{spread_uid:spread_uid}}),{phone:this.phone,code:this.code_num},function (res) {
  56. $h.loadClear();
  57. $h.pushMsg(res.data.msg, function () {
  58. window.location.assign($h.U({c:'index',a:'index'}));
  59. });
  60. },function () {
  61. $h.loadClear();
  62. });
  63. },
  64. code:function () {
  65. var that = this;
  66. if(!that.phone) return $h.pushMsgOnce('请输入手机号码');
  67. if(!$reg.isPhone(that.phone)) return $h.pushMsgOnce('请输入正确的手机号码');
  68. that.active = true;
  69. var n = 60;
  70. app.baseGet($h.U({c:'auth_api',a:'code',q:{phone:that.phone}}),function (res){
  71. var data=res.data.data;
  72. if(data.Message=='OK' || data.Code=='OK'){
  73. var run =setInterval(function(){
  74. n--;
  75. if(n<0){
  76. clearInterval(run);
  77. }
  78. that.timetext = "剩余 "+n+"s";
  79. if(that.timetext<"剩余 "+0+"s"){
  80. that.active = false;
  81. that.timetext = "重发";
  82. }
  83. },1000);
  84. }else{
  85. $h.pushMsgOnce(data.Message);
  86. that.active =false;
  87. }
  88. },function (res) {
  89. that.active =false;
  90. });
  91. }
  92. }
  93. });
  94. })
  95. </script>
  96. {/block}