| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- <template>
- <div>
- <!-- <img :src="bcg" alt="" class="pos">-->
- <div class="container" @keypress="keypress">
- <div class="bigTitle">业委会管理系统登录</div>
- <div class="module" v-if="step == 0" style="margin-top: 50px;width: 100%; display: flex;flex-direction:column;align-items: center ;">
- <div class="floor">
- <el-button style="width: 240px; height: 50px;border:1px solid rgb(64,158,225);color: rgb(64,158,225)" @click="changeType('1')">密码登录</el-button>
- </div>
- <div class="floor">
- <el-button style="width: 240px; height: 50px;border:1px solid rgb(64,158,225);color: rgb(64,158,225)" @click="changeType('2')">验证码登录</el-button>
- </div>
- </div>
- <div v-if="step == 1" class="module">
- <div class="floor">
- <div class="title">手机号</div>
- <el-input class="input" type="text" v-model="loginForm.mobile"/>
- </div>
- <div class="floor" v-if="loginForm.type == 1">
- <div class="title">密码</div>
- <el-input class="input" show-password type="text" v-model="loginForm.securityCode"/>
- </div>
- <div class="floor" v-if="loginForm.type == 2">
- <div class="title">验证码</div>
- <el-input class="codeInput" type="text" v-model="loginForm.securityCode"/>
- <el-button type="success" @click="getSecurityCode" style="width: 100px;display: flex;justify-content: center;">获取验证码</el-button>
- </div>
- <div class="floor">
- <el-button style="width: 100%" @click="handleLogin" type="success">登录</el-button>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import {Loading} from 'element-ui';
- export default {
- name: "index",
- data: () => {
- return {
- step:0,
- loginForm: {
- securityCode: "",
- mobile: '',
- type:""
- },
- codeSrc: ""
- }
- },
- created() {
- this.captchaImage();
- },
- methods: {
- changeType(type){
- this.loginForm.type = type;
- this.step = 1;
- },
- getSecurityCode(){
- let mobile = this.loginForm.mobile;
- if(mobile == ""){
- this.$message.warning("请先输入手机号码")
- return false;
- }
- this.$api.verificationCode({
- mobile
- }).then(res => {
- console.log(res)
- this.loginForm.securityCode = res.content.verificationCode;
- })
- },
- keypress(e){
- if(e.keyCode == 13){
- this.handleLogin();
- }
- },
- handleLogin() {
- this.$api.login(this.loginForm).then(res => {
- // console.log(res)
- this.$router.push("home")
- })
- }
- }
- }
- </script>
- <style scoped>
- .code {
- height: 50px;
- width: 100px;
- cursor: pointer;
- padding-left: 10px;
- box-sizing: border-box;
- }
- .floor {
- display: flex;
- margin-top: 20px;
- align-items: center;
- }
- .floor .title {
- flex-grow: 1;
- }
- .input {
- width: 240px;
- }
- .codeInput {
- width: 140px;
- }
- .container {
- position: fixed;
- left: 50%;
- top: 50%;
- transform: translate(-50%, -50%); /* 50%为自身尺寸的一半 */
- z-index: 4;
- background-color: #fff;
- width: 360px;
- height: 300px;
- padding: 30px;
- border-radius: 20px;
- }
- .pos {
- position: fixed;
- height: 100vh;
- width: 100vw;
- z-index: 3;
- }
- .bigTitle {
- font-weight: bold;
- font-size: 24px;
- text-align: center;
- }
- </style>
|