register.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. <template>
  2. <view class="register container">
  3. <view class="title">
  4. <view class="login_view">
  5. <view class="">
  6. 注册
  7. </view>
  8. <view class="">
  9. </view>
  10. </view>
  11. <view class="text">
  12. <image src="@/static/logo.png" mode="widthFix" style="width: 120rpx;"></image>
  13. </view>
  14. </view>
  15. <view class="login_content">
  16. <view class="input_item">
  17. <view class="">
  18. <input type="number" v-model="tel" placeholder="输入手机号">
  19. </view>
  20. </view>
  21. <view class="input_item">
  22. <view class="">
  23. <input type="text" v-model="codeImgVal" placeholder="输入图形验证">
  24. </view>
  25. <view class="sendcode" @click="getVerify()" style="border: 0;">
  26. <image :src="codeImgData.image" mode="widthFix" style="width: 150rpx;"></image>
  27. </view>
  28. </view>
  29. <view class="input_item">
  30. <view class="">
  31. <input type="number" v-model="code" placeholder="输入验证码">
  32. </view>
  33. <view class="sendcode" @click="sendCode()" v-if="count<=0" style="">
  34. 发送验证码
  35. </view>
  36. <view class="sendcode" v-else>
  37. {{count}}秒后重新发
  38. </view>
  39. </view>
  40. <view class="input_item">
  41. <view class="">
  42. <input type="password" v-model="pwd" placeholder="输入登录密码">
  43. </view>
  44. </view>
  45. <view class="input_item">
  46. <view class="">
  47. <input type="password" v-model="repwd" placeholder="确认密码">
  48. </view>
  49. </view>
  50. <view class="input_item">
  51. <view class="">
  52. <input type="password" v-model="paypwd" maxlength="6" placeholder="输入支付密码">
  53. </view>
  54. </view>
  55. <view class="input_item">
  56. <view class="">
  57. <input type="number" v-model="icode" placeholder="邀请码(非必填)">
  58. </view>
  59. </view>
  60. </view>
  61. <view class="login_btn bcggreen colorBlack" @click="register">
  62. 注册
  63. </view>
  64. <view class="gologin">
  65. 已有账号,<text style="color: #0C9D5B;" @click="rdt('/pages/login/login')">去登录</text>
  66. </view>
  67. </view>
  68. </template>
  69. <script>
  70. export default {
  71. components: {},
  72. data() {
  73. return {
  74. tel: "",
  75. pwd: "",
  76. repwd: "",
  77. code: "",
  78. icode: "",
  79. count: 0,
  80. paypwd: "",
  81. time: "",
  82. dw: false, //下载控制
  83. codeImgData: {},
  84. codeImgVal: '',
  85. }
  86. },
  87. onLoad(e) {
  88. if (e.code == "undefined" || e.code == null) {
  89. this.icode = ""
  90. } else {
  91. this.icode = e.code
  92. }
  93. this.dw = true
  94. this.getVerify()
  95. },
  96. onHide() {
  97. clearInterval(this.time)
  98. },
  99. methods: {
  100. getVerify() {
  101. this.api.graphVer().then(res => {
  102. this.codeImgData = res.data
  103. })
  104. },
  105. // 发送验证码
  106. sendCode() {
  107. if (!this.codeImgVal) {
  108. this.$api.pop("请输入图形验证")
  109. return;
  110. }
  111. this.api.smsCode(this.tel, this.codeImgVal, this.codeImgData.uniqid).then(res => {
  112. console.log(res)
  113. if (res.code == 1) {
  114. if (res.data.time < 115) {
  115. this.$api.pop(res.data.time + 's后重试')
  116. } else {
  117. this.$api.pop(res.info)
  118. this.count = 60
  119. setInterval(() => {
  120. if (this.count <= 0) {
  121. this.count = 0
  122. return
  123. }
  124. --this.count
  125. }, 1000)
  126. }
  127. }
  128. })
  129. },
  130. register() {
  131. if (this.icode == null || this.icode == undefined) {
  132. this.icode == ""
  133. }
  134. if (!this.tel) {
  135. this.$api.pop("请输入手机号")
  136. return
  137. }
  138. if (!this.code) {
  139. this.$api.pop("请输入验证码")
  140. return
  141. }
  142. if (!this.pwd) {
  143. this.$api.pop("请输入密码")
  144. return
  145. }
  146. if (!this.repwd) {
  147. this.$api.pop("请再次输入密码")
  148. return
  149. }
  150. if (this.pwd != this.repwd) {
  151. this.$api.pop("两次输入密码不一致")
  152. return
  153. }
  154. if (!this.paypwd) {
  155. this.$api.pop("请输入支付密码")
  156. return
  157. }
  158. if (this.icode == null || this.icode == undefined) {
  159. this.icode == ""
  160. }
  161. this.api.register(this.tel, this.pwd, this.repwd, this.code, this.icode, this.paypwd).then(res => {
  162. if (res.code == 1) {
  163. this.$api.pop("注册成功")
  164. setTimeout(() => {
  165. this.$api.rdt("/pages/login/index")
  166. }, 1500)
  167. }
  168. })
  169. }
  170. }
  171. }
  172. </script>
  173. <style scoped lang="less">
  174. .register {
  175. box-sizing: border-box;
  176. }
  177. .title {
  178. width: 600rpx;
  179. font-size: 46rpx;
  180. display: flex;
  181. align-items: center;
  182. justify-content: space-between;
  183. margin: 70rpx auto 0 auto;
  184. }
  185. .login_view {
  186. font-size: 68rpx;
  187. }
  188. .login_content {
  189. margin-top: 70rpx;
  190. margin-left: 100rpx;
  191. }
  192. .text {
  193. width: 120rpx;
  194. }
  195. .input_item {
  196. display: flex;
  197. border-bottom: 1px solid #333333;
  198. width: 550rpx;
  199. height: 70rpx;
  200. font-size: 32rpx;
  201. margin-top: 40rpx;
  202. line-height: 70rpx;
  203. color: #999999;
  204. justify-content: space-between;
  205. }
  206. /deep/ .uni-input-wrapper {
  207. color: #fff;
  208. }
  209. .input_item>view:last-child {
  210. /* margin-left: auto; */
  211. }
  212. input {
  213. min-width: 200rpx;
  214. max-width: 360rpx;
  215. height: 70rpx;
  216. line-height: 70rpx;
  217. }
  218. .sendcode {
  219. color: #fff;
  220. font-size: 28rpx;
  221. border-bottom: 1px solid #fff;
  222. height: 55rpx;
  223. }
  224. .login_btn {
  225. width: 550rpx;
  226. height: 100rpx;
  227. color: #000;
  228. background: linear-gradient(to bottom, #69FF60, #0C9D5B);
  229. font-size: 32rpx;
  230. line-height: 100rpx;
  231. margin: 0 auto;
  232. margin-top: 88rpx;
  233. text-align: center;
  234. border-radius: 138rpx;
  235. }
  236. .gologin {
  237. font-size: 28rpx;
  238. margin: 22rpx auto;
  239. text-align: center;
  240. }
  241. .blue {
  242. color: #0C9D5B;
  243. }
  244. .agreement {
  245. font-size: 28rpx;
  246. display: flex;
  247. align-items: center;
  248. justify-content: center;
  249. color: #999999;
  250. text-indent: 14rpx;
  251. margin-top: 32rpx;
  252. margin-bottom: 50rpx;
  253. }
  254. .circle {
  255. width: 24rpx;
  256. height: 24rpx;
  257. border-radius: 50%;
  258. border: 1px solid #999999;
  259. }
  260. .circle_checked {
  261. width: 24rpx;
  262. height: 24rpx;
  263. border-radius: 50%;
  264. background: #0C9D5B;
  265. border: 1px solid #0C9D5B;
  266. }
  267. </style>