user-regist.html 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <!DOCTYPE html>
  2. <html class="h100p">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>注册-创业帮</title>
  6. <meta name="keywords" content="注册-创业帮">
  7. <meta name="description" content="注册-创业帮">
  8. <meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,shrink-to-fit=no,user-scalable=no" name="viewport" viewport="cover">
  9. <meta name="apple-mobile-web-app-capable" content="yes">
  10. <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  11. <meta content="telephone=no" name="format-detection">
  12. <meta content="email=no" name="format-detection">
  13. <meta name="apple-mobile-web-app-title" content="注册-创业帮">
  14. <meta http-equiv="Cache-Control" content="no-siteapp">
  15. <link rel="stylesheet" href="./static/css/main.css">
  16. </head>
  17. <body class="bgc-back h100p nopb regist">
  18. <div id="app" v-cloak>
  19. <van-nav-bar class="bgc-back user_rank_explan_title" left-arrow @click-left="backlogin" v-if="toptitleisshow">
  20. <template #left> <img src="./static/images/left.png" alt=""></template>
  21. </van-nav-bar>
  22. <div class="regist-box-input pt8 pb32 pl32 pr32">
  23. <div class="f24 c333 b">注册创业帮</div>
  24. <div class="f12 c999 pb32" v-if="phoneissure &amp;&amp; passwordissure">请填写以下注册信息</div>
  25. <div class="f12 c999 pb32 cstrong_color" v-if="!phoneissure">手机号填写有误</div>
  26. <div class="f12 c999 pb32 cstrong_color" v-if="!passwordissure">密码长度应为6~20位</div>
  27. <div class="f12 c666 mb6">新用户注册</div>
  28. <van-field class="mb12" v-model="userinfo.Mobile" @input="checkRegist" placeholder="请输入注册手机号"></van-field>
  29. <div class="f12 c666 mb6">验证码</div>
  30. <van-field class="user-phone mb12" center clearable placeholder="请输入验证码" @input="checkRegist" v-model="userinfo.MobileCode">
  31. <template #button>
  32. <van-button class="fl" plain color="#FF502A" @click="getsmscode" v-if="codeisclick">获取验证码</van-button>
  33. <van-button class="fl" plain color="#FF502A" disabled v-else>{{countdown}}s</van-button>
  34. </template>
  35. </van-field>
  36. <div class="f12 c666 mb6">推荐码(必填)</div>
  37. <van-field class="mb12" v-model="userinfo.ReferenceCode" placeholder="请输入推荐码" @input="checkRegist"></van-field>
  38. <div class="f12 c666 mb6">登录密码</div>
  39. <van-field v-model="userinfo.LoginPwd" @input="checkRegist" :type="isShowPwd ? 'text' : 'password'" placeholder="请设置登录密码">
  40. <template #button>
  41. <van-button class="fr" @click="showPwd()"><img class="fr" :src="isShowPwd ? './static/images/show-icon@3x.png' : './static/images/noshow-icon@3x.png'" alt=""></van-button>
  42. </template>
  43. </van-field>
  44. <div class="df pt16">
  45. <van-checkbox v-model="agreement" icon-size=".426667rem" checked-color="#ec5e3b" @change="checkRegist"><span class="f14 c999">我已阅读并同意</span><span class="f14 more" @click="goservice">「创业帮服务协议」</span></van-checkbox>
  46. </div>
  47. <div class="pt16" v-cloak>
  48. <van-button type="primary" block color="#FF502A" :disabled="canRegist ? false : true" @click="regist">注册</van-button>
  49. </div>
  50. <div class="pt16 tc">
  51. <div class="f12 more">注意:用户年龄必须18-60周岁</div>
  52. </div>
  53. </div>
  54. </div>
  55. <script src="./static/js/klm-vv.min.js"></script>
  56. <script src="./static/js/klm-axios-config.js"></script>
  57. <script>
  58. // 通过 CDN 引入时不会自动注册 Lazyload 组件
  59. // 可以通过下面的方式手动注册
  60. Vue.use(vant.Lazyload);
  61. // 在 #app 标签下渲染一个按钮组件
  62. let app = new Vue({
  63. el: '#app',
  64. data() {
  65. return {
  66. toptitleisshow:false,
  67. isShowPwd: false,
  68. userinfo:{
  69. Mobile: '',
  70. ReferenceCode: '',
  71. LoginPwd:'',
  72. MobileCode:''
  73. },
  74. agreement: false,
  75. canRegist: false,
  76. phoneissure:true,
  77. passwordissure:true,
  78. codeisclick:true,
  79. countdown:60
  80. };
  81. },
  82. created() {
  83. this.toptitleisshow = toptitleisshow;
  84. },
  85. methods: {
  86. //- 是否显示密码
  87. showPwd(){
  88. this.isShowPwd = !this.isShowPwd;
  89. },
  90. //- 验证表单是否填写
  91. checkRegist(){
  92. this.canRegist = (this.userinfo.Mobile !== '' && this.userinfo.ReferenceCode !== '' && this.userinfo.LoginPwd !== '' && this.userinfo.MobileCode !== '' && this.agreement == true) ? true : false;
  93. },
  94. //- 获取验证码
  95. async getsmscode(){
  96. if(verification(this.userinfo.Mobile)) return;
  97. this.codeisclick = false;
  98. setTimeout(()=>{
  99. this.codeisclick = true;
  100. },60000);
  101. const timer = setInterval(()=>{
  102. this.countdown--;
  103. if(this.countdown === 0) {
  104. this.countdown = 60;
  105. clearInterval(timer)
  106. }
  107. },1000);
  108. const res = await postRequest('/api/v1/mobilecodecheck/sendsms',JSON.stringify({Mobile:this.userinfo.Mobile}));
  109. if(res) tips('验证码已发送,请注意查收');
  110. },
  111. //- 点击注册
  112. async regist(){
  113. if(this.userinfo.ReferenceCode.length !== 8) return tips('推荐码长度为8位');
  114. if(this.userinfo.ReferenceCode[0] !== 'K') return tips('推荐码以大写K开头');
  115. if(!verificationphonenumber(this.userinfo.Mobile)){
  116. return this.phoneissure = false;
  117. };
  118. if(this.userinfo.LoginPwd.length < 6 && this.userinfo.LoginPwd.length > 20){
  119. return this.passwordissure = false;
  120. };
  121. if(verificationpassword(this.userinfo.LoginPwd)) return;
  122. this.phoneissure = true;
  123. this.passwordissure = true;
  124. const value = JSON.stringify(this.userinfo);
  125. const res = await postRequest('/api/v1/users/register?t='+Math.random(6),value);
  126. if(res.status !== '1') return tips(res.info);
  127. tips('注册成功!');
  128. setTimeout(()=>{
  129. this.backlogin();
  130. },2000)
  131. },
  132. //- 返回登录
  133. backlogin(){
  134. PublicLib.GoBack({Level:1});
  135. },
  136. goservice(){
  137. PublicLib.Goto({Url:'user-servce-agreement'});
  138. }
  139. }
  140. });
  141. </script>
  142. </body>
  143. </html>