|
|
@@ -1,39 +1,54 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <vue-particles class="particles"
|
|
|
- color="#ffffff"
|
|
|
- :particleOpacity="0.3"
|
|
|
- :particlesNumber="80"
|
|
|
- shapeType="circle"
|
|
|
- :particleSize="3"
|
|
|
- linesColor="#ffffff"
|
|
|
- :linesWidth="1"
|
|
|
- :lineLinked="true"
|
|
|
- :lineOpacity="0.2"
|
|
|
- :linesDistance="150"
|
|
|
- :moveSpeed="2"
|
|
|
- :hoverEffect="true"
|
|
|
- hoverMode="grab"
|
|
|
- :clickEffect="true"
|
|
|
- clickMode="repulse">
|
|
|
- </vue-particles>
|
|
|
+ <vue-particles
|
|
|
+ class="particles"
|
|
|
+ color="#ffffff"
|
|
|
+ :particleOpacity="0.3"
|
|
|
+ :particlesNumber="80"
|
|
|
+ shapeType="circle"
|
|
|
+ :particleSize="3"
|
|
|
+ linesColor="#ffffff"
|
|
|
+ :linesWidth="1"
|
|
|
+ :lineLinked="true"
|
|
|
+ :lineOpacity="0.2"
|
|
|
+ :linesDistance="150"
|
|
|
+ :moveSpeed="2"
|
|
|
+ :hoverEffect="true"
|
|
|
+ hoverMode="grab"
|
|
|
+ :clickEffect="true"
|
|
|
+ clickMode="repulse"
|
|
|
+ ></vue-particles>
|
|
|
<el-card class="login-panel" :body-style="{ padding: '0px', height: '100%' }">
|
|
|
<div class="login-container">
|
|
|
- <img src="../assets/972.png">
|
|
|
+ <img src="../assets/972.png" />
|
|
|
<div class="form">
|
|
|
<div class="title">走遍中国小程序后台</div>
|
|
|
<el-form :model="formData" size="medium" :rules="rules" ref="form">
|
|
|
- <el-form-item>
|
|
|
- </el-form-item>
|
|
|
+ <el-form-item></el-form-item>
|
|
|
<el-form-item prop="username">
|
|
|
- <el-input v-model="formData.username" prefix-icon="el-icon-user" placeholder="用户名"></el-input>
|
|
|
+ <el-input
|
|
|
+ v-model="formData.username"
|
|
|
+ prefix-icon="el-icon-user"
|
|
|
+ placeholder="用户名"
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item prop="password">
|
|
|
- <el-input v-model="formData.password" prefix-icon="el-icon-lock" placeholder="密码" type="password"></el-input>
|
|
|
+ <el-input
|
|
|
+ v-model="formData.password"
|
|
|
+ prefix-icon="el-icon-lock"
|
|
|
+ placeholder="密码"
|
|
|
+ type="password"
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<el-checkbox v-model="formData.remember" class="remember-checkbox">7天内免登录</el-checkbox>
|
|
|
- <el-button style="width:100%; margin-top:15px;" size="medium" type="primary" @click="login" :loading="loading">登录</el-button>
|
|
|
+ <el-button
|
|
|
+ style="width:100%; margin-top:15px;"
|
|
|
+ size="medium"
|
|
|
+ type="primary"
|
|
|
+ @click="login"
|
|
|
+ :loading="loading"
|
|
|
+ >登录</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-card>
|
|
|
@@ -60,11 +75,29 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
login() {
|
|
|
- this.$refs.form.validate().then((valide) => {
|
|
|
+ this.$refs.form.validate().then(valide => {
|
|
|
if (valide) {
|
|
|
this.loading = true;
|
|
|
- this.axios.get('http://www.baidu.com');
|
|
|
- this.$router.replace('/');
|
|
|
+ this.$http
|
|
|
+ .post('auth/loginByUserPwd', {
|
|
|
+ username: this.formData.username,
|
|
|
+ password: this.formData.password,
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ this.loading = false;
|
|
|
+ if (res.success) {
|
|
|
+ localStorage.setItem('token', res.data.token);
|
|
|
+ this.$store.commit('updateUserInfo', res.data);
|
|
|
+ this.$router.replace({
|
|
|
+ name: 'home',
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.error);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ console.log(e);
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
},
|