123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293 |
- <template>
- <view class="content">
- <view class="title-img">
- <image src="../../static/img/logo.png" mode=""></image>
- </view>
- <view class="title-LOGO">
- 艺绘
- </view>
- <view class="bg">
- <image src="../../static/img/pbbg.png" mode=""></image>
- </view>
- <view class="register-content">
- <view class="res-box">
- <image src="../../static/img/pb03.png" mode=""></image>
- <view class="input-box">
- <input class="input" type="number" v-model="phone" placeholder="请输入手机号">
- </view>
- </view>
- <view class="res-box">
- <image src="../../static/img/pb02.png" mode=""></image>
- <view class="input-box">
- <input class="input" type="password" v-model="loginPass" placeholder="请输入密码">
- </view>
- </view>
- <view class="res-box">
- <image src="../../static/img/pb01.png" mode=""></image>
- <view class="input-box">
- <input class="input" type="number" v-model="code" placeholder="请输入验证码">
- <view class="time" @click="getYzm" v-show="isHq">
- 获取验证码
- </view>
- <view class="djs" v-show="!isHq">
- {{countDown}}
- </view>
- </view>
- </view>
- </view>
- <view class="button" @click="registerTo()">
- 注册
- </view>
- <view class="tishi">
- <view class="for-pass" @click="getNavto('/pages/set/changePass')">
- 忘记密码
- </view>
- <view class="ss">
- </view>
- <view class="for-phone" @click="getNavto('/pages/public/login')" >
- 账号登录
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- register,
- verify
- } from '@/api/login.js';
- export default {
- data() {
- return {
- isHq: true,
- phone: '', //用户
- loginPass: '', //密码
- payPass: '',
- invitation: '', //邀请码
- code: '', //验证码
- time: '', //保存倒计时对象
- countDown: 60 //倒计时
- };
- },
- onLoad() {
- // 获取扫码邀请人id
- this.invitation = uni.getStorageSync('spread') || '';
- },
- methods: {
- //注册
- registerTo(){
- let obj= this
- let jiaoyan = /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/
- if (!jiaoyan.test(obj.phone)) {
- this.$api.msg('请输入正确的手机号!')
- return
- }else if(obj.phone == ''){
- this.$api.msg('请输入手机号')
- return
- }else if(obj.loginPass==''){
- this.$api.msg('请输入密码')
- return
- }else if(obj.code == ''){
- this.$api.msg('请输入验证码')
- return
- }else if(obj.code.length!=6){
- this.$api.msg('请输入正确的验证码')
- return
- }
- else{
- register({
- account:obj.phone,
- captcha:obj.code,
- password:obj.loginPass,
- spread:obj.invitation
-
- }).then(res=>{
- console.log(res,'res');
- this.$api.msg('注册成功')
- setTimeout(function(){
- uni.navigateTo({
- url:'/pages/public/login'
- })
- },1000)
- })
- }
- },
- //跳转详情
- getNavto(url){
- uni.navigateTo({
- url:url
- })
- },
- //获取验证码
- getYzm() {
- let obj = this
- let jiaoyan = /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/
- if (!jiaoyan.test(obj.phone)) {
- this.$api.msg('请输入正确的手机号!')
- return
- }
- let setTime = setInterval(
- function() {
- obj.isHq = false
- obj.countDown--;
-
- if (obj.countDown == 0) {
- clearInterval(setTime)
- // let setOut = setTimeout(() => {
- obj.isHq = true
- obj.countDown=10;
- // }, 1000)
- }
- }, 1000)
- //调用验证码接口
- verify({
- phone: obj.phone,
- type: 'register'
- })
- .then(({ data }) => {
- console.log(data,'data');
- })
- .catch(err => {
- console.log(err);
- });
-
- }
- }
- };
- </script>
- <style lang="scss">
- page,
- .content {
- min-height: 100%;
- background-color: #181818;
- .bg {
- width: 750rpx;
- height: 200rpx;
- image {
- width: 100%;
- height: 100%;
- }
- }
- .title-img {
- margin: 70rpx auto 0;
- width: 161px;
- height: 161px;
- border-radius: 50%;
- overflow: hidden;
- image {
- width: 100%;
- height: 100%;
- }
- }
- .title-LOGO {
- text-align: center;
- margin: 30rpx;
- font-size: 36px;
- font-family: PingFang SC;
- font-weight: 400;
- color: #FFFFFF;
- }
- .register-content {
- .res-box {
- height: 110rpx;
- width: 600rpx;
- align-items: center;
- display: flex;
- margin: 0 75rpx;
- border-bottom: #f3f3f3 solid 2rpx;
- image {
- width: 31rpx;
- height: 40rpx;
- }
- .input-box {
- margin-left: 40rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- .input {
- color: #9977F6;
- // line-height: 40rpx;
- }
- .time {
- width: 150rpx;
- height: 50rpx;
- line-height: 50rpx;
- text-align: center;
- border-radius: 10rpx;
- color: #FFFFFF;
- background: linear-gradient(270deg, #6E8DF7, #9977F6);
- }
- .djs {
- margin-left: 100rpx;
- width: 50rpx;
- height: 50rpx;
- line-height: 50rpx;
- text-align: center;
- border-radius: 10rpx;
- color: #FFFFFF;
- background: linear-gradient(270deg, #6E8DF7, #9977F6);
- }
- }
- }
- }
- .button {
- margin: 40rpx auto;
- text-align: center;
- width: 604rpx;
- height: 90rpx;
- background: linear-gradient(270deg, #6E8DF7, #9977F6);
- border-radius: 10rpx;
- font-size: 34rpx;
- font-weight: 500;
- color: #FFFFFF;
- line-height: 90rpx;
- }
- .tishi {
- display: flex;
- align-items: center;
- justify-content: center;
- .for-pass {
- font-size: 28rpx;
- font-weight: 500;
- color: #FFFFFF;
- }
- .ss {
- height: 26rpx;
- width: 3rpx;
- background-color: #f3f3f3;
- margin: 0 10rpx;
- }
- .for-phone {
- font-size: 28rpx;
- font-weight: 500;
- color: #FFFFFF;
- }
- }
- }
- </style>
|