2020-06-07 10:28:34 +08:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<div class="login">
|
2020-06-10 11:19:26 +08:00
|
|
|
<img src="@/assets/images/login-bg.png" alt="">
|
2020-06-07 10:28:34 +08:00
|
|
|
</div>
|
|
|
|
<div class="login-box">
|
|
|
|
<img src="@/assets/images/logo.png" alt="">
|
|
|
|
<div class="login-info">
|
|
|
|
<input type="number" placeholder="请输入手机号" v-model="loginInfo.username">
|
2020-06-19 16:58:06 +08:00
|
|
|
<input type="password" placeholder="请输入密码" v-model="loginInfo.password">
|
2020-06-07 10:28:34 +08:00
|
|
|
<button @click="submitLogin">登录</button>
|
|
|
|
<div class="forget-register">
|
2020-06-10 11:19:26 +08:00
|
|
|
<!--<router-link to="/">忘记密码>></router-link>-->
|
2020-06-07 10:28:34 +08:00
|
|
|
<router-link to="/register" class="register">立即注册>></router-link>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-06-19 16:58:06 +08:00
|
|
|
<div class="loading" v-if="isLoading">
|
|
|
|
<div class="loading-box">
|
|
|
|
<img src="@/assets/images/loading.gif" alt="">
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-06-07 10:28:34 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import axios from 'axios'
|
2020-07-11 14:45:34 +08:00
|
|
|
import common from '@/common/components/common.js'
|
2022-11-23 23:32:15 +08:00
|
|
|
import md5 from 'md5'
|
2020-06-07 10:28:34 +08:00
|
|
|
import layer from 'vue-layer'
|
|
|
|
export default {
|
|
|
|
name: 'Login',
|
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
loginInfo: {
|
|
|
|
username: '',
|
2020-06-19 16:58:06 +08:00
|
|
|
password: ''
|
2020-06-07 10:28:34 +08:00
|
|
|
},
|
|
|
|
restTime: 120,
|
2020-06-19 16:58:06 +08:00
|
|
|
wait: false,
|
2020-07-11 14:45:34 +08:00
|
|
|
isLoading: false,
|
|
|
|
url: common.url
|
2020-06-07 10:28:34 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
submitLogin: function () {
|
|
|
|
var self = this
|
2020-06-19 16:58:06 +08:00
|
|
|
self.isLoading = true
|
2022-11-23 23:32:15 +08:00
|
|
|
axios.post(self.url + 'app/sign/default', {
|
|
|
|
username: self.loginInfo.username,
|
|
|
|
password: md5(md5(md5(self.loginInfo.password)))
|
|
|
|
}, {
|
2020-06-07 10:28:34 +08:00
|
|
|
headers: {
|
|
|
|
'Access-Control-Allow-Origin': '*'
|
|
|
|
}
|
|
|
|
}).then(function (res) {
|
|
|
|
if (res.status === 200) {
|
2020-06-19 16:58:06 +08:00
|
|
|
self.isLoading = false
|
2020-06-16 15:06:45 +08:00
|
|
|
window.sessionStorage.setItem('token', res.data.data)
|
2020-06-07 10:28:34 +08:00
|
|
|
self.$layer.msg('登录成功')
|
|
|
|
setTimeout(function () {
|
|
|
|
self.$router.go(-1)
|
2022-11-23 23:32:15 +08:00
|
|
|
}, 1000)
|
2020-06-07 10:28:34 +08:00
|
|
|
}
|
2020-07-03 15:52:11 +08:00
|
|
|
}).catch(function (error) {
|
|
|
|
self.$layer.msg(error.response.data.msg)
|
|
|
|
self.isLoading = false
|
2020-06-07 10:28:34 +08:00
|
|
|
})
|
|
|
|
},
|
|
|
|
getVerificationCode: function () {
|
|
|
|
var self = this
|
2020-06-19 16:58:06 +08:00
|
|
|
self.isLoading = true
|
2020-06-07 10:28:34 +08:00
|
|
|
if (self.loginInfo.username) {
|
2020-07-11 14:45:34 +08:00
|
|
|
axios.get(self.url + 'usercenter/api/sms/getverificationcode/' + self.loginInfo.username).then(function (res) {
|
2020-06-07 10:28:34 +08:00
|
|
|
if (res.status === 200) {
|
|
|
|
self.wait = true
|
2020-06-19 16:58:06 +08:00
|
|
|
self.isLoading = false
|
2020-06-07 10:28:34 +08:00
|
|
|
var timer = setInterval(function () {
|
|
|
|
self.restTime--
|
|
|
|
if (self.restTime === 0) {
|
|
|
|
self.wait = false
|
2020-06-17 19:14:48 +08:00
|
|
|
self.restTime = 120
|
2020-06-07 10:28:34 +08:00
|
|
|
clearInterval(timer)
|
|
|
|
}
|
|
|
|
}, 1000)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
alert('请输入手机号')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" rel="stylesheet/stylus" scoped>
|
2020-06-10 11:19:26 +08:00
|
|
|
@import "~styles/public.styl"
|
2020-06-07 10:28:34 +08:00
|
|
|
.login
|
|
|
|
width 100%
|
|
|
|
min-width 1200px
|
|
|
|
img
|
|
|
|
width 100%
|
|
|
|
height 434px
|
|
|
|
.login-box
|
|
|
|
position fixed
|
|
|
|
top 50%
|
|
|
|
left 50%
|
|
|
|
transform translate(-50%, -50%)
|
|
|
|
background #fff
|
|
|
|
border-radius 10px
|
|
|
|
box-shadow 0 0 2px 2px #e0e0e0
|
|
|
|
padding 35px 70px
|
|
|
|
width 540px
|
|
|
|
box-sizing border-box
|
|
|
|
img
|
|
|
|
width 100%
|
|
|
|
.login-info
|
|
|
|
width 336px
|
|
|
|
margin 15px auto 0
|
|
|
|
border-top 1px solid #e0e0e0
|
|
|
|
padding-top 20px
|
|
|
|
input
|
|
|
|
width 100%
|
|
|
|
height 40px
|
|
|
|
padding 0 10px
|
|
|
|
box-sizing border-box
|
|
|
|
border-radius 6px
|
|
|
|
border solid 1px #e0e0e0
|
|
|
|
color #333
|
|
|
|
font-size 14px
|
|
|
|
margin-bottom 10px
|
|
|
|
&.yzm
|
|
|
|
width 53%
|
|
|
|
button
|
|
|
|
width 100%
|
|
|
|
height 40px
|
|
|
|
border-radius 6px
|
2020-06-10 11:19:26 +08:00
|
|
|
background $main-color
|
2020-06-07 10:28:34 +08:00
|
|
|
color #ffffff
|
|
|
|
font-size 20px
|
|
|
|
border none
|
|
|
|
outline none
|
|
|
|
cursor pointer
|
|
|
|
&.get-yzm
|
|
|
|
width: 42%
|
|
|
|
margin-left 3%
|
|
|
|
vertical-align middle
|
|
|
|
font-size 16px
|
|
|
|
&.wait
|
|
|
|
background #eeeeee
|
|
|
|
color #fff
|
|
|
|
.forget-register
|
|
|
|
margin-top 20px
|
|
|
|
a
|
|
|
|
color #999
|
|
|
|
font-size 16px
|
|
|
|
&.register
|
|
|
|
float right
|
2020-06-19 16:58:06 +08:00
|
|
|
.loading
|
|
|
|
position fixed
|
|
|
|
top 0
|
|
|
|
left 0
|
|
|
|
right 0
|
|
|
|
bottom 0
|
|
|
|
background rgba(0,0,0,0.6)
|
|
|
|
.loading-box
|
|
|
|
padding 50px
|
|
|
|
background rgba(255,255,255,0.6)
|
|
|
|
border-radius 10px
|
|
|
|
position absolute
|
|
|
|
top 50%
|
|
|
|
left 50%
|
|
|
|
transform translate(-50%, -50%)
|
2020-06-07 10:28:34 +08:00
|
|
|
input[type="number"]{ -moz-appearance: textfield; }
|
|
|
|
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; }
|
|
|
|
</style>
|