Use vue to realize the registration page effect vue to realize SMS verification code login

Use vue to realize the registration page effect vue to realize SMS verification code login

This article example shares the specific code of Vue to achieve the registration page effect for your reference. The specific content is as follows

1. Implementation effect diagram

2. Implementation Code

1. Implement the head

<template>
  <div class="box">
    <div class="box1">
      <span class="iconfont icon-zuojiantou back" @click="goBack"></span>
    </div>
    <div class="box6">
      <b>Mobile phone number registration</b>
    </div>
  </div>
</template>
 
<script>
export default {
  name: "Top",
  methods: {
    goBack() {
      this.$router.push("/Login");
    },
  },
};
</script>
 
<style scoped>
.box1 {
  width: 100%;
  height: 0.5rem;
  margin-bottom: 0.19rem;
}
 
span {
  font-size: 0.18rem;
  line-height: 0.5rem;
  font-size: 0.2rem;
}
 
.back {
  font-size: 0.25rem;
}
 
.box6 {
  width: 100%;
  height: 0.66rem;
  margin: auto;
}
b {
  font-size: 0.24rem;
  font-weight: normal;
}
p {
  font-size: 0.13rem;
  color: gray;
  margin-top: 0.11rem;
}
</style>

2. Implement registration content

<template>
  <div class="box">
    <div class="box1">
      <div class="phone-container">
        +86
        <input
          class="userphone"
          type=""
          v-model="usernum"
          placeholder="Please enter your mobile number"
        />
      </div>
    </div>
 
    <div class="box2">
      <h3 @click="toSendCode">Agree to the agreement and register</h3>
    </div>
    <div class="box3">
      <van-checkbox v-model="checked">
        Have read and agreed to the following agreement:
          >Taobao Platform Service Agreement, Privacy Policy, Legal Statement, Alipay Service Agreement, Tianyi Account Authentication Service Terms</b
        >
      </van-checkbox>
    </div>
  </div>
</template>
 
<script>
import axios from "axios";
import Vue from "vue";
import { Checkbox, Toast } from "vant";
 
Vue.use(Checkbox);
Vue.use(Toast);
export default {
  name: "Num",
  data: function () {
    return {
      usernum: "",
      code: "",
      checked: false,
    };
  },
  methods: {
    // Verify phone number checkPhone(phone) {
      let reg = /^1[3|4|5|7|8][0-9]{9}$/;
      return reg.test(phone);
    },
 
    toSendCode() {
      if (this.checked) {
        if (this.checkPhone(this.usernum)) {
          axios({
            url: `/auth/code/?phone=${this.usernum}`,
          }).then((res) => {
            console.log(res);
            if (res.status == 200) {
              localStorage.setItem("userPhone", this.usernum);
              Toast("Verification code sent successfully");
              this.$router.push("/inputCode");
            }
          });
        } else {
          Toast("Please check your phone number");
        }
      } else {
        Toast("Please check the user agreement first");
      }
    },
  },
};
</script>
 
<style scoped>
.box1 {
  width: 100%;
  height: 0.7rem;
}
 
.box1 b {
  margin-top: 0.25rem;
  font-weight: normal;
}
 
.phone-container {
  width: 100%;
  padding: 0.1rem 0;
  margin-bottom: 0.4rem;
  position: relative;
}
.phone-container > span {
  position: absolute;
  font-size: 0.16rem;
  color: #666;
  top: 0.21rem;
}
input {
  border: none;
  outline: none;
}
 
input::-webkit-input-placeholder {
  font-size: 0.2rem;
  color: rgb(216, 214, 214);
}
.userphone {
  display: block;
  width: 100%;
  height: 0.4rem;
  box-sizing: border-box;
  padding: 0 0.3rem;
  padding-left: 0.4rem;
  font-size: 0.2rem;
  border-bottom: 0.01rem solid #eee;
}
.box2 {
  width: 100%;
  height: 0.5rem;
  margin-top: 0.2rem;
}
 
.box2 h3 {
  width: 100%;
  height: 0.4rem;
  background-color: yellow;
  border-radius: 0.15rem;
  font-size: 0.18rem;
  text-align: center;
  line-height: 0.3rem;
  margin-top: 0.1rem;
  font-weight: 600;
  line-height: 0.4rem;
  letter-spacing: 0.02rem;
  color: rgba(87, 42, 42, 0.623);
}
 
.box3 {
  width: 100%;
  height: 0.3rem;
  margin-top: 3.4rem;
  font-size: 0.12rem;
}
 
.box3 b {
  font-weight: normal;
  color:deepskyblue;
}
</style>

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Vue implementation of verification code login method example
  • Vue implements mobile phone verification code login
  • Vue implements graphic verification code login
  • Vue implements mobile phone number and verification code login (60s countdown disabled)
  • Vue implements SMS verification code login function (process detailed explanation)
  • Vue implements sample code for sending SMS verification code login via mobile phone number

<<:  Several ways to solve the problem of floating causing the height of the parent element to collapse in CSS

>>:  Implementation of HTML command line interface

Recommend

Detailed explanation of the use of JavaScript functions

Table of contents 1. Declare a function 2. Callin...

A brief analysis of HTML space code

How much do you know about HTML? If you are learni...

How to view server hardware information in Linux

Hi, everyone; today is Double 12, have you done a...

Markup Languages ​​- What to learn after learning HTML?

Click here to return to the 123WORDPRESS.COM HTML ...

Steps to modify the MySQL database data file path under Linux

After installing the MySQL database using the rpm...

Detailed tutorial on deploying Springboot or Nginx using Kubernetes

1 Introduction After "Maven deploys Springbo...

Docker win ping fails container avoidance guide

Using win docker-desktop, I want to connect to co...

Detailed explanation of MySQL syntax, special symbols and regular expressions

Mysql commonly used display commands 1. Display t...

How to implement vertical text alignment with CSS (Summary)

The default arrangement of text in HTML is horizo...

3 functions of toString method in js

Table of contents 1. Three functions of toString ...

CentOS method to modify the default ssh port number example

The default ssh port number of Linux servers is g...

Vue implements accordion effect

This article example shares the specific code of ...

vsCode generates vue templates with one click

1. Use the shortcut Ctrl + Shift + P to call out ...

Document Object Model (DOM) in JavaScript

Table of contents 1. What is DOM 2. Select elemen...