【案例】简单的账号短信登录

html 复制代码
<template>
    <div class="loginhome" :style="backgroundContentright">
        <div class="content" :style="{ position: 'absolute', 'top': '30%', left:loginwidth < 500? '15%':'40%' }">
            <table style="width:100%;height:100%;">
                <tr>
                    <td colspan="3"><div class="title"><span>系统登录</span></div></td>
                </tr>
                <tr>
                    <td colspan="3"><div><el-input type="text" style=" width:96%;margin:0 2% 0 2%;" v-model="phone" placeholder="手机号"></el-input></div></td>
                </tr>
                <tr>
                    <td colspan="3">
                        <div v-if="loginway == false">
                            <el-input show-password v-model="pass" style="width:96%;margin:0 2% 0 2%;" placeholder="密码"></el-input>
                        </div>
                        <div v-if="loginway == true">
                            <el-input  placeholder="验证码" v-model="code" style="width:96%;margin:0 2% 0 2%;" >
                                <el-button slot="suffix" style="font-weight:600;" type="text" @click="iClick">获取验证码</el-button>
                            </el-input>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td style="width:30%;"><div><span></span></div></td>
                    <td style="width:40%;"></td>
                    <td style="width:30%; "><div class="way" @click="loginway = !loginway"><span v-if="loginway == false">短信登录</span><span v-if="loginway == true">账号登录</span></div></td>
                </tr>
                <tr>
                    <td colspan="3"><div><el-button type="primary"  style="" @click="LoginSubmit()">登录</el-button></div></td>
                </tr>
            </table>
        </div>
    </div>
</template>
<script>
export default {
    data () {
        return {
            loginwidth: null,
            loginway: false,  // true 账号登录   false 短信登录
            eyeshow: false,
            pass: null, 
            phone: null, 
            code: null, 
            backgroundContentright: {
                backgroundImage:"url(" + require("@/images/002.png") + ")",   //图片所在路径,并加载
                backgroundRepeat:"np-repeat",
                backgroundSize:"100% 100%",    //图片适应大小
            },
        }
    },
    watch: {
        
    },
    mounted() {
        this.loginwidth = window.innerWidth;
        console.log(this.loginwidth);
    },
    methods: {
        // 获取验证码
        iClick(){},
        //登录
        LoginSubmit() {
            let loginway = this.loginway;
            console.log(loginway);
            if (loginway) {  // 短信登录
                console.log('短信登录');
            }
            if (!loginway) {  // 账号登录
                console.log('账号登录');
            }
        },
    }
}
</script>
<style scoped>
.loginhome { background-color: rgb(15, 15, 15); height: 100vh; width: 100%; text-align: center; font-family: '黑体'; }
.content { height: 300px; width: 300px; text-align: center; background-color: rgba(106, 141, 172, 0.473); border-radius: 5%; box-shadow: 0px 0px 5px 3px rgb(88, 193, 235); }
.title { height: 30px; line-height: 30px; font-weight: 600; }
.way { font-size:15px;text-decoration: underline; color:rgb(0, 110, 255); cursor: pointer; }
</style>
相关推荐
范特西是只猫10 个月前
uni-app 微信小程序之好看的ui登录页面(四)
ui·微信小程序·uni-app·登录页面
范特西是只猫10 个月前
uni-app 微信小程序之好看的ui登录页面(二)
ui·微信小程序·uni-app·登录页面
范特西是只猫10 个月前
uni-app 微信小程序之好看的ui登录页面(三)
ui·微信小程序·uni-app·登录页面
范特西是只猫10 个月前
uni-app 微信小程序之好看的ui登录页面(五)
微信小程序·小程序·uni-app·登录页面
高垚淼1 年前
Vue+Axios搭建二次元动态登录页面(mp4视频格式)
开发语言·前端·javascript·vue·登录页面·axios·服务器渲染
Java方文山1 年前
前端框架Layui的使用讲解(Layui搭建登录注册页面)
前端·前端框架·layui·登录页面·注册页面·自定义mvc