register.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <template>
  2. <view class="page">
  3. <view class="p-header flex-col align-center justify-center">
  4. <image src="/static/login_logo.png" mode="widthFix" class="img"></image>
  5. <!-- <image src="/static/home_logo.png" mode="widthFix" class="ic"></image> -->
  6. </view>
  7. <view class="p-form">
  8. <view class="c-item align-center">
  9. <image src="/static/log_tel.png" mode="widthFix" class="i-ic"></image>
  10. <view class="i-inpt">
  11. <input type="number" class="inpt" placeholder="请输入手机号" v-model="mobile"/>
  12. </view>
  13. </view>
  14. <view class="c-item align-center">
  15. <image src="/static/log_yan.png" mode="widthFix" class="i-ic"></image>
  16. <view class="i-inpt">
  17. <input type="number" class="inpt" placeholder="请输入验证码" v-model="code"/>
  18. </view>
  19. <view class="code-wrap" @tap="chgeCode">
  20. <phoneCode ref="codeRef" :mobile="mobile" event="register" />
  21. </view>
  22. </view>
  23. <view class="c-item align-center">
  24. <image src="/static/log_mima.png" mode="widthFix" class="i-ic"></image>
  25. <view class="i-inpt">
  26. <input type="password" class="inpt" placeholder="请输入密码" v-model="password"/>
  27. </view>
  28. </view>
  29. <view class="c-item align-center last-c-item">
  30. <image src="/static/log_mima.png" mode="widthFix" class="i-ic"></image>
  31. <view class="i-inpt">
  32. <input type="password" class="inpt" placeholder="请再次确认密码" v-model="repassword"/>
  33. </view>
  34. </view>
  35. <!--
  36. <view class="c-item align-center last-c-item">
  37. <image src="/static/log_yao.png" mode="widthFix" class="i-ic"></image>
  38. <view class="i-inpt">
  39. <input type="text" class="inpt" placeholder="请输入邀请码(选填)" v-model="invite_no"/>
  40. </view>
  41. </view>
  42. -->
  43. </view>
  44. <submit-btn @submit="submit" ref="submitRef">
  45. <template v-slot:btns="{isSubmitted}">
  46. <view class="p-btn" :class="{'disabled':isSubmitted}">
  47. 立即注册
  48. </view>
  49. </template>
  50. </submit-btn>
  51. <!-- <view class="p-login" @tap="navTo('/pages/login/login')">已注册,去登录</view> -->
  52. </view>
  53. </template>
  54. <script>
  55. import phoneCode from './components/phoneCode.vue'
  56. export default {
  57. components:{
  58. phoneCode,
  59. },
  60. data() {
  61. return {
  62. // isAgree:true,
  63. mobile:'',
  64. code:'',
  65. password:'',
  66. repassword:'',
  67. invite_no:'',
  68. };
  69. },
  70. onLoad(opt) {
  71. // this.openid = this.$Route.query.openid;
  72. // this.accessToken = this.$Route.query.accessToken;
  73. if(opt.code){
  74. this.invite_no = opt.code;
  75. }
  76. },
  77. methods:{
  78. chgeCode(){
  79. this.$refs.codeRef.getCode();
  80. },
  81. async submit(){
  82. // console.log('submit---');
  83. // return;
  84. // if(! this.isAgree){
  85. // this.$tools.msg('您尚未同意协议')
  86. // return;
  87. // }else
  88. if(! this.$tools.match(this.mobile,'mobile')){
  89. return;
  90. }else if(!this.$tools.match(this.code,'code') ){
  91. return;
  92. }else if(!this.$tools.match(this.password,'pwd') ){
  93. return;
  94. }else if(!this.repassword){
  95. this.$tools.msg('请输入确认密码')
  96. return;
  97. }else if( this.repassword !== this.password){
  98. this.$tools.msg('两次密码不一致')
  99. return;
  100. }
  101. let sendData={
  102. mobile:this.mobile,
  103. code:this.code,
  104. password: this.password,
  105. repassword: this.repassword,
  106. invite_no: this.invite_no,
  107. }
  108. let res=await this.$request('user.register',sendData);
  109. // let userInfo = res.data.userinfo || {};
  110. // localStorage.setItem('token',userInfo.token)
  111. this.$tools.msg(res.msg);
  112. this.$refs.submitRef.chgeStatus();
  113. setTimeout(()=>{
  114. this.navTo('/pages/login/login')
  115. },800)
  116. },
  117. },
  118. }
  119. </script>
  120. <style lang="scss">
  121. page{
  122. background-color: #fff;
  123. }
  124. .page{
  125. // min-height: 100vh;
  126. width: 100%;
  127. // padding-bottom: 100rpx;
  128. }
  129. .p-header{
  130. width: 750rpx;
  131. // height: 470rpx;
  132. height: 400rpx;
  133. position: relative;
  134. .img{
  135. // width: 160rpx;
  136. // height: 160rpx;
  137. width: 300rpx;
  138. height: 300rpx;
  139. }
  140. // .ic{
  141. // margin-top: 16rpx;
  142. // width: 112rpx;
  143. // height: 38rpx;
  144. // }
  145. }
  146. .p-form{
  147. width: 630rpx;
  148. margin: 0 auto;
  149. .c-pwd{
  150. height: 63rpx;
  151. line-height: 63rpx;
  152. width: 100%;
  153. text-align: right;
  154. font-size: 24rpx;
  155. font-family: PingFang SC;
  156. font-weight: 500;
  157. color: #333333;
  158. }
  159. .c-item{
  160. width: 100%;
  161. height: 84rpx;
  162. background-color: #F1F1F1;
  163. padding: 0 26rpx;
  164. margin-bottom: 30rpx;
  165. border-radius: 8rpx;
  166. }
  167. .i-ic{
  168. width: 30rpx;
  169. height: 30rpx;
  170. margin-right: 17rpx;
  171. }
  172. .i-inpt{
  173. flex:1;
  174. .inpt{
  175. width: 100%;
  176. height: 84rpx;
  177. line-height: 84rpx;
  178. color:#333;
  179. font-size: 30rpx;
  180. }
  181. .code-inpt{
  182. flex:1;
  183. margin-right: 20rpx;
  184. height: 103rpx;
  185. line-height: 103rpx;
  186. color:#333;
  187. font-size: 26rpx;
  188. }
  189. .phone-code{
  190. width: 200rpx;
  191. height: 60rpx;
  192. background: #0D91FF;
  193. box-shadow: 0rpx 6rpx 10rpx 0rpx rgba(13, 145, 255, 0.28);
  194. border-radius: 30rpx;
  195. line-height: 60rpx;
  196. text-align: center;
  197. font-size: 26rpx;
  198. color: #FFFFFF;
  199. }
  200. }
  201. // .i-code{
  202. // width: 180rpx;
  203. // height: 70rpx;
  204. // }
  205. }
  206. .last-c-item{
  207. margin-bottom: 80rpx !important;
  208. }
  209. .p-btn{
  210. margin: 0 auto;
  211. width: 630rpx;
  212. height: 84rpx;
  213. border-radius: 8rpx;
  214. line-height: 84rpx;
  215. text-align: center;
  216. font-size: 34rpx;
  217. font-family: PingFang SC;
  218. font-weight: 500;
  219. background-color: $base-color;
  220. color: #fff;
  221. border-radius: 40rpx;
  222. &.disabled{
  223. background-color: #eee;
  224. box-shadow: none;
  225. border: none;
  226. }
  227. }
  228. .p-login{
  229. color:$base-color;
  230. font-size: 28rpx;
  231. height: 80rpx;
  232. line-height: 80rpx;
  233. text-align: right;
  234. width: 630rpx;
  235. margin:16rpx auto 0;
  236. font-weight: bold;
  237. padding-right: 10rpx;
  238. }
  239. .p-reg{
  240. margin-top: 30rpx;
  241. font-size: 28rpx;
  242. font-family: PingFang SC;
  243. font-weight: 500;
  244. text-align: center;
  245. width: 100%;
  246. .stxt{
  247. color: #999999;
  248. }
  249. .mtxt{
  250. color: #333;
  251. }
  252. }
  253. .p-tips{
  254. position: absolute;
  255. z-index: 2;
  256. bottom: 30rpx;
  257. left: 0;
  258. width: 100%;
  259. .ic{
  260. width: 30rpx;
  261. height: 30rpx;
  262. margin-right: 22rpx;
  263. }
  264. .txt{
  265. color:#999999;
  266. font-size: 24rpx;
  267. font-family: PingFang SC;
  268. font-weight: 500;
  269. }
  270. .link{
  271. color:#333333;
  272. font-size: 24rpx;
  273. font-family: PingFang SC;
  274. font-weight: 500;
  275. }
  276. }
  277. </style>