rm duplicate code
This commit is contained in:
parent
4fa07aea09
commit
b3ddf60d04
|
@ -1,8 +1,7 @@
|
|||
import Vue from 'vue';
|
||||
import Router from 'vue-router';
|
||||
const _import = require('./_import_' + process.env.NODE_ENV);
|
||||
// in development env not use Lazy Loading,because Lazy Loading large page will cause webpack hot update too slow
|
||||
// so only in production use Lazy Loading
|
||||
// in development env not use Lazy Loading,because Lazy Loading large page will cause webpack hot update too slow.so only in production use Lazy Loading
|
||||
|
||||
/* layout */
|
||||
import Layout from '../views/layout/Layout';
|
||||
|
@ -10,8 +9,6 @@ import Layout from '../views/layout/Layout';
|
|||
/* login */
|
||||
const Login = _import('login/index');
|
||||
const authRedirect = _import('login/authredirect');
|
||||
const sendPWD = _import('login/sendpwd');
|
||||
const reset = _import('login/reset');
|
||||
|
||||
/* dashboard */
|
||||
const dashboard = _import('dashboard/index');
|
||||
|
@ -80,8 +77,6 @@ Vue.use(Router);
|
|||
export const constantRouterMap = [
|
||||
{ path: '/login', component: Login, hidden: true },
|
||||
{ path: '/authredirect', component: authRedirect, hidden: true },
|
||||
{ path: '/sendpwd', component: sendPWD, hidden: true },
|
||||
{ path: '/reset', component: reset, hidden: true },
|
||||
{ path: '/404', component: Err404, hidden: true },
|
||||
{ path: '/401', component: Err401, hidden: true },
|
||||
{
|
||||
|
|
|
@ -21,9 +21,6 @@
|
|||
</el-form-item>
|
||||
<div class='tips'>admin账号为:admin@wallstreetcn.com 密码随便填</div>
|
||||
<div class='tips'>editor账号:editor@wallstreetcn.com 密码随便填</div>
|
||||
<router-link to="/sendpwd" class="forget-pwd">
|
||||
忘记密码?(或首次登录)
|
||||
</router-link>
|
||||
</el-form>
|
||||
<el-dialog title="第三方验证" :visible.sync="showDialog">
|
||||
邮箱登录成功,请选择第三方验证
|
||||
|
@ -33,9 +30,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import { isWscnEmail } from 'utils/validate';
|
||||
// import { getQueryObject } from 'utils';
|
||||
import socialSign from './socialsignin';
|
||||
|
||||
export default {
|
||||
|
|
|
@ -1,178 +0,0 @@
|
|||
<template>
|
||||
<div class="reset-container">
|
||||
<el-form autoComplete="on" :model="resetForm" :rules="resetRules" ref="resetForm" label-position="left"
|
||||
label-width="0px"
|
||||
class="card-box reset-form">
|
||||
<div>
|
||||
<router-link to="/login" class="back-icon">
|
||||
<i class="el-icon-arrow-left"></i>
|
||||
</router-link>
|
||||
<h3 class="title">重设密码</h3>
|
||||
</div>
|
||||
<el-form-item prop="email">
|
||||
<el-input name="email" type="text" v-model="resetForm.email"
|
||||
placeholder="邮箱"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="code">
|
||||
<el-input name="code" type="text" v-model="resetForm.code"
|
||||
placeholder="验证码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input name="password" :type="passwordType" v-model="resetForm.password"
|
||||
placeholder="密码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="checkPass">
|
||||
<el-input name="checkPass" :type="passwordType"
|
||||
v-model="resetForm.checkPass"
|
||||
placeholder="确认密码"></el-input>
|
||||
<i @click="togglePasswordType" class="el-icon-information"></i>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item style="width:100%;">
|
||||
<el-button type="primary" style="width:100%;" :loading="loading" @click.native.prevent="setPWD">
|
||||
修改密码
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { isWscnEmail } from 'utils/validate';
|
||||
// import { restPWD } from 'api/login';
|
||||
|
||||
export default {
|
||||
name: 'reset',
|
||||
data() {
|
||||
const validateEmail = (rule, value, callback) => {
|
||||
if (!isWscnEmail(value)) {
|
||||
callback(new Error('邮箱错误'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
const validaePass = (rule, value, callback) => {
|
||||
if (value.length < 6) {
|
||||
callback(new Error('密码不能小于6位'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
const validatePass2 = (rule, value, callback) => {
|
||||
if (value === '') {
|
||||
callback(new Error('请再次输入密码'));
|
||||
} else if (value !== this.resetForm.password) {
|
||||
callback(new Error('两次输入密码不一致!'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
return {
|
||||
resetForm: {
|
||||
email: '',
|
||||
password: '',
|
||||
checkPass: '',
|
||||
code: ''
|
||||
},
|
||||
passwordType: 'password',
|
||||
resetRules: {
|
||||
email: [
|
||||
{ required: true, trigger: 'blur', validator: validateEmail }
|
||||
],
|
||||
password: [
|
||||
{ required: true, trigger: 'blur', validator: validaePass }
|
||||
],
|
||||
checkPass: [
|
||||
{ required: true, trigger: 'blur', validator: validatePass2 }
|
||||
],
|
||||
code: [
|
||||
{ required: true, message: '必填项', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
loading: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
setPWD() {
|
||||
// this.loading = true;
|
||||
// const _this = this;
|
||||
// this.$refs.resetForm.validate(valid => {
|
||||
// if (valid) {
|
||||
// const data = {
|
||||
// email: this.resetForm.email,
|
||||
// code: this.resetForm.code,
|
||||
// new_password: this.resetForm.checkPass
|
||||
// };
|
||||
// restPWD(data).then(() => {
|
||||
// this.$message.success('密码设置成功,五秒后调整到登录页');
|
||||
// setTimeout(() => {
|
||||
// _this.$router.push({ path: '/login' })
|
||||
// }, 5 * 1000)
|
||||
// });
|
||||
// } else {
|
||||
// this.$message.error('error submit!!');
|
||||
// }
|
||||
// this.loading = false;
|
||||
// });
|
||||
},
|
||||
togglePasswordType() {
|
||||
if (this.passwordType === 'text') {
|
||||
this.passwordType = 'password'
|
||||
} else {
|
||||
this.passwordType = 'text'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style rel="stylesheet/scss" lang="scss">
|
||||
@import "src/styles/mixin.scss";
|
||||
|
||||
.reset-container {
|
||||
input:-webkit-autofill {
|
||||
-webkit-box-shadow: 0 0 0px 1000px #293444 inset !important;
|
||||
-webkit-text-fill-color: #3E3E3E !important;
|
||||
}
|
||||
@include relative;
|
||||
height: 100vh;
|
||||
background-color: #324057;
|
||||
.back-icon {
|
||||
float: left;
|
||||
margin-top: 5px;
|
||||
}
|
||||
.el-icon-information {
|
||||
position: absolute;
|
||||
right: -18px;
|
||||
top: 10px;
|
||||
}
|
||||
.reset-form {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
width: 350px;
|
||||
padding: 35px 35px 15px 35px;
|
||||
margin: 120px auto;
|
||||
}
|
||||
|
||||
.card-box {
|
||||
padding: 20px;
|
||||
box-shadow: 0 0px 8px 0 rgba(0, 0, 0, 0.06), 0 1px 0px 0 rgba(0, 0, 0, 0.02);
|
||||
-webkit-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
background-clip: padding-box;
|
||||
margin-bottom: 20px;
|
||||
background-color: #F9FAFC;
|
||||
width: 400px;
|
||||
border: 2px solid #8492A6;
|
||||
}
|
||||
|
||||
.title {
|
||||
margin: 0px auto 40px auto;
|
||||
text-align: center;
|
||||
color: #505458;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
|
@ -1,117 +0,0 @@
|
|||
<template>
|
||||
<div class="sendpwd-container">
|
||||
<el-form autoComplete="on" :model="resetForm" :rules="resetRules" ref="resetForm" label-position="left"
|
||||
label-width="0px"
|
||||
class="card-box reset-form">
|
||||
<div>
|
||||
<router-link to="/login" class="back-icon">
|
||||
<i class="el-icon-arrow-left"></i>
|
||||
</router-link>
|
||||
<h3 class="title">发送验证码至邮箱</h3>
|
||||
</div>
|
||||
<el-form-item prop="email">
|
||||
<el-input name="email" type="text" v-model="resetForm.email"
|
||||
placeholder="邮箱"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item style="width:100%;">
|
||||
<el-button type="primary" style="width:100%;" :loading="loading" @click.native.prevent="handleSendPWD">
|
||||
发送验证码至邮箱
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
<router-link to="/reset">
|
||||
<el-button type="info" style="width:100%;">
|
||||
已收到验证码,去重设密码
|
||||
</el-button>
|
||||
</router-link>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { isWscnEmail } from 'utils/validate';
|
||||
// import { sendPWD2Email } from 'api/login';
|
||||
|
||||
export default {
|
||||
name: 'reset',
|
||||
data() {
|
||||
const validateEmail = (rule, value, callback) => {
|
||||
if (!isWscnEmail(value)) {
|
||||
callback(new Error('请输入正确的邮箱'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
return {
|
||||
resetForm: {
|
||||
email: ''
|
||||
},
|
||||
resetRules: {
|
||||
email: [
|
||||
{ required: true, trigger: 'blur' },
|
||||
{ validator: validateEmail }
|
||||
]
|
||||
},
|
||||
loading: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleSendPWD() {
|
||||
this.loading = true;
|
||||
this.$refs.resetForm.validate(valid => {
|
||||
if (valid) {
|
||||
// sendPWD2Email(this.resetForm.email).then(() => {
|
||||
// this.$message.success('密码有发送至邮箱,请查收')
|
||||
// });
|
||||
} else {
|
||||
this.$message.error('错误提交!!');
|
||||
}
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style rel="stylesheet/scss" lang="scss">
|
||||
.sendpwd-container {
|
||||
height: 100vh;
|
||||
background-color: #2d3a4b;
|
||||
input:-webkit-autofill {
|
||||
-webkit-box-shadow: 0 0 0px 1000px #293444 inset !important;
|
||||
-webkit-text-fill-color: #3E3E3E !important;
|
||||
}
|
||||
.back-icon{
|
||||
float: left;
|
||||
margin-top: 5px;
|
||||
}
|
||||
.reset-form {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
width: 350px;
|
||||
padding: 35px 35px 15px 35px;
|
||||
margin: 120px auto;
|
||||
}
|
||||
|
||||
.card-box {
|
||||
padding: 20px;
|
||||
box-shadow: 0 0px 8px 0 rgba(0, 0, 0, 0.06), 0 1px 0px 0 rgba(0, 0, 0, 0.02);
|
||||
-webkit-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
background-clip: padding-box;
|
||||
margin-bottom: 20px;
|
||||
background-color: #F9FAFC;
|
||||
width: 400px;
|
||||
border: 2px solid #8492A6;
|
||||
}
|
||||
|
||||
.title {
|
||||
margin: 0px auto 40px auto;
|
||||
text-align: center;
|
||||
color: #505458;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
Loading…
Reference in New Issue