Commit 1c0f3c03 authored by wuwangwolihui's avatar wuwangwolihui

Merge remote-tracking branch 'origin/yingdi2.0' into yingdi2.0

parents 9eda2c8c 6e42c0ed
/* eslint-disable */
import {
request
} from './network'
// 通过邮箱验证码注册
export function registerEmailCode(data) {
return request({
method: 'post',
url: 'web/code/registerEmailCode',
params: data
})
}
// 通过邮箱验证码找回密码(忘记密码)
export function passwordEmailCode(data) {
return request({
method: 'post',
url: 'web/code/passwordEmailCode',
params: data
})
}
// 发送注册时候验证码
export function registerCode(data) {
return request({
method: 'post',
url: '/web/code/registerCode',
params: data
})
}
export function passwordCode(data) {
return request({
method: 'post',
url: '/web/code/passwordCode',
params: data
})
}
// 填写注册信息
export function setAccountInfo(data) {
return request({
method: 'post',
url: '/web/register/setAccountInfo',
data
})
}
// 获取注册信息
export function getAccountInfo(data) {
return request({
method: 'post',
url: '/web/register/getAccountInfo',
data
})
}
...@@ -15,7 +15,7 @@ export default [{ ...@@ -15,7 +15,7 @@ export default [{
} }
}, },
{ {
path: '/reset', path: '/baseReset',
name: 'base-reset', name: 'base-reset',
component: () => import(/* webpackChunkName: "reset" */ 'v/base/login/Reset.vue'), component: () => import(/* webpackChunkName: "reset" */ 'v/base/login/Reset.vue'),
meta: { meta: {
......
...@@ -204,7 +204,9 @@ router.beforeEach((to, from, next) => { ...@@ -204,7 +204,9 @@ router.beforeEach((to, from, next) => {
toLogin = "/login", toLogin = "/login",
toBaseLogin = "/baseLogin", toBaseLogin = "/baseLogin",
toRegister = "/register", toRegister = "/register",
toBaseRegister = "/baseRegister",
toReset = "/reset", toReset = "/reset",
toBaseReset = "/baseReset",
toHome = "/home", toHome = "/home",
toActive = "/active"; toActive = "/active";
let toMyInfo; let toMyInfo;
...@@ -225,7 +227,7 @@ router.beforeEach((to, from, next) => { ...@@ -225,7 +227,7 @@ router.beforeEach((to, from, next) => {
// } // }
// }); // });
return next(); return next();
} else if (to.path == toBaseLogin || to.path == toMyInfo || to.path == toHome || to.path == toActive || to.path.indexOf(toActive) != -1) { } else if (to.path == toBaseLogin ||to.path == toBaseRegister ||to.path == toBaseReset || to.path == toMyInfo || to.path == toHome || to.path == toActive || to.path.indexOf(toActive) != -1) {
return next(); return next();
} else if (to.name == "recruit") { } else if (to.name == "recruit") {
code = to.params.code; code = to.params.code;
......
<template> <template>
<div class="login-index"> <div class="login-index">
<Header></Header>
<div class="big-right"> <div class="big-right">
<div class="info-box"> <div class="info-box">
<router-view /> <router-view/>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
/* eslint-disable */ /* eslint-disable */
import Cookie from "js-cookie" import Header from "@/components/base/Header.vue";
export default { export default {
name: "loginBase", name: "loginBase",
data() { data() {
return { return {};
};
}, },
created() { components: {
Header,
this.$emit("getStatus", false);
}, },
methods: { created() {
toHome() {
let code = this.$store.state.indexIdentity;
this.$router.push("/"+code);
}
}, },
}; methods: {},
};
</script> </script>
<style scoped lang="scss"> <style lang="scss" scoped>
.login-index { @media (min-width: 1024px) {
.login-index .big-right .info-box {
width: 32%!important;
top: 60%!important;
}
}
.login-index {
position: relative; position: relative;
min-width: 1104px; min-width: 1104px;
background: #f8f8f8; background: #f8f8f8;
display: flex;
flex-flow: row;
min-height: 100%;
.big-img {
width: (500/1920 * 100%);
min-width: 350px;
min-height: 100%; min-height: 100%;
img {
width: 100%; width: 100%;
min-height: 100%;
}
}
.big-right { .big-right {
flex: 1; height: calc(100% - 80px);
position: relative;
.info-box { .info-box {
width: 520px; width: 520px;
height: auto; height: auto;
...@@ -59,5 +54,5 @@ export default { ...@@ -59,5 +54,5 @@ export default {
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
} }
} }
} }
</style> </style>
<template> <template>
<div class="container"> <div class="container">
<div class="title">账号密码登录</div> <div class="title_Login">
<div class="line"></div> <div v-if="changeLogin == 1">
<div @click="toCodeLogin" class="title">
<div :class="changeLogin == 2 ? 'change_login' : ''">验证码登录</div>
</div>
<div @click="toLogin" class="title">
<div :class="changeLogin == 1 ? 'change_login' : ''">
账号密码登录
</div>
</div>
</div>
<div v-else-if="changeLogin == 2">
<div @click="toLogin" class="title">
<div :class="changeLogin == 1 ? 'change_login' : ''">
账号密码登录
</div>
</div>
<div @click="toCodeLogin" class="title">
<div :class="changeLogin == 2 ? 'change_login' : ''">验证码登录</div>
</div>
</div>
</div>
<div>
<el-form <el-form
:model="loginForm" :model="loginForm"
:rules="loginFormRules" :rules="loginFormRules"
ref="loginFormRef"
class="demo-ruleForm" class="demo-ruleForm"
ref="loginFormRef"
> >
<el-form-item prop="phone"> <el-form-item prop="phone" ref="phone">
<img <img
alt=""
class="img_l" class="img_l"
src="../../../assets/img/login/username.png" src="../../../assets/img/login/username.png"
alt=""
/> />
<el-input <el-input
v-model="loginForm.phone"
placeholder="请输入手机号"
maxlength="11" maxlength="11"
placeholder="请输入手机号"
v-model="loginForm.phone"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="password"> <el-form-item
:prop="changeLogin == 1 ? 'password' : ''"
ref="password"
v-if="changeLogin == 1"
>
<img <img
alt=""
class="img_l" class="img_l"
src="../../../assets/img/login/password.png" src="../../../assets/img/login/password.png"
alt=""
/> />
<el-input <el-input
v-model="loginForm.password"
:type="isShowPwd ? 'password' : 'text'" :type="isShowPwd ? 'password' : 'text'"
maxlength="20" maxlength="20"
placeholder="请输入密码" placeholder="请输入密码"
v-model="loginForm.password"
></el-input> ></el-input>
<img <img
@click="changePwdStatus()" @click="changePwdStatus()"
v-if="!isShowPwd" alt=""
class="img_r" class="img_r"
src="../../../assets/img/login/eye01.png" src="../../../assets/img/login/eye01.png"
alt="" v-if="!isShowPwd"
/> />
<img <img
@click="changePwdStatus()" @click="changePwdStatus()"
v-if="isShowPwd" alt=""
class="img_r" class="img_r"
src="../../../assets/img/login/eye01.png" src="../../../assets/img/login/eye01.png"
alt="" v-if="isShowPwd"
/> />
</el-form-item> </el-form-item>
<el-form-item
:prop="changeLogin == 2 ? 'code' : ''"
ref="code"
v-else-if="changeLogin == 2"
>
<img alt="" class="img_l" src="@/assets/img/reset/code.png"/>
<el-input
maxlength="20"
placeholder="请输入短信验证码"
v-model="loginForm.code"
></el-input>
<!-- 短信验证码 -->
<div class="phoneCode">
<span @click="getCode" class="code" v-show="showCode"
>获取验证码</span
>
<span class="count" v-show="!showCode">{{ count }} s</span>
</div>
</el-form-item>
<el-form-item style="margin: 40px 0 0 0"></el-form-item> <el-form-item style="margin: 40px 0 0 0"></el-form-item>
<el-form-item> <el-form-item>
<el-button @click="submitForm()">登 录</el-button> <el-button @click="submitForm()">登 录</el-button>
</el-form-item> </el-form-item>
<div class="box"> <div class="box" v-if="changeLogin == 1">
<div> <div>
<div class="fr" @click="register()">还没有账号?立即注册</div> <div @click="register()" class="fr">还没有账号?立即注册</div>
<div class="fl" @click="forgetPwd()">忘记密码?</div> <div @click="forgetPwd()" class="fl">忘记密码?</div>
</div> </div>
<!-- <div class="fc">忘记密码请联系管理员邮箱:ydhdservice@163.com</div> --> <!-- <div class="fc">忘记密码请联系管理员邮箱:service@campcenter.cn</div> -->
</div> </div>
</el-form> </el-form>
</div> </div>
</div>
</template> </template>
<script> <script>
/* eslint-disable */ /* eslint-disable */
import Cookie from "js-cookie"; import {login, loginCode} from "r/base/login";
import { login } from "r/base/login"; import {mobileCheck} from "@/common/utils.js";
import { mobileCheck } from "@/common/utils.js"; import {intervalTime} from "store/time";
export default { export default {
name: "base-login", name: "base-login",
data() { data() {
return { return {
isShowPwd: true, // 控制密码显示隐藏 isShowPwd: true, // 控制密码显示隐藏
// 手机验证短信
showCode: true,
count: "",
timer: null,
codeTime: "", //手机验证码倒计时时间
loginForm: { loginForm: {
phone: "", phone: null,
password: "", password: null,
code: null,
}, },
// 表单验证规则对象 // 表单验证规则对象
loginFormRules: { loginFormRules: {
// 对手机号进行校验 // 对手机号进行校验
phone: [ phone: [
{ required: true, message: "请输入手机号", trigger: "blur" }, {required: true, message: "请输入手机号", trigger: "blur"},
{ {
validator: function (rule, value, callback) { validator: function (rule, value, callback) {
if (mobileCheck(value) === false) { if (mobileCheck(value) === false) {
...@@ -126,95 +179,222 @@ export default { ...@@ -126,95 +179,222 @@ export default {
}, },
}, },
], ],
// 对验证码进行校验
code: [
{required: true, message: "请输入验证码", trigger: "blur"},
{min: 6, max: 20, message: "请输入正确的验证码", trigger: "blur"},
],
}, },
changeLogin: 2,
}; };
}, },
created() { created() {
this.$emit("getStatus", false); this.$emit("getStatus", false);
const endTime = window.localStorage.getItem("login_code_time");
if (endTime && Number(endTime) > new Date().getTime()) {
this.loginForm.phone = phone;
this.intervalHandle(new Date(), Number(endTime));
}
this.commonApi(31)
}, },
methods: { methods: {
// 定时器倒计时
intervalHandle(startTime, endTime) {
// 时间差
const timeLag = intervalTime(startTime, endTime);
console.log(timeLag);
if (!this.timer) {
this.count = timeLag - 1;
this.showCode = false;
this.timer = setInterval(() => {
if (this.count > 0 && this.count <= timeLag) {
this.count--;
} else {
this.showCode = true;
clearInterval(this.timer);
this.timer = null;
}
}, 1000);
}
},
// 获取手机验证短信
getCode() {
if (!this.loginForm.phone) {
return this.$message.error("请输入手机号");
}
// if (!this.codeTime) {
// return this.$message.error("您已经获取验证码,请去邮箱中进行查看");
// }
// 接口获得验证码
loginCode({
phone: this.loginForm.phone,
}).then((res) => {
console.log(res, "passwordCode");
if (res.data.code != 200) {
return this.$message.error(res.data.message);
}
this.$message.success(res.data.message);
this.codeTime = res.data.data.now * 1000;
// console.log(this.codeTime)
let code = this.$store.state.indexIdentity;
window.localStorage.setItem(
"login_code_time",
res.data.data.now * 1000
);
this.intervalHandle(new Date(), res.data.data.now * 1000);
});
},
// 忘记账号/密码 // 忘记账号/密码
forgetPwd() { forgetPwd() {
let code = this.$store.state.indexIdentity; this.$router.push("/baseReset");
this.$router.push("/reset?code=" + code);
}, },
// 去注册 // 去注册
register() { register() {
let code = this.$store.state.indexIdentity; this.$router.push("/baseRegister");
this.$router.push("/register?code=" + code);
}, },
// 改变密码显示状态 // 改变密码显示状态
changePwdStatus() { changePwdStatus() {
this.isShowPwd = !this.isShowPwd; this.isShowPwd = !this.isShowPwd;
}, },
toLogin() {
this.loginForm = {};
this.changeLogin = 1;
this.$nextTick(() => {
this.$refs["loginFormRef"].clearValidate();
});
},
toCodeLogin() {
this.loginForm = {};
this.changeLogin = 2;
this.$nextTick(() => {
this.$refs["loginFormRef"].clearValidate();
});
},
// 登录 // 登录
submitForm() { submitForm() {
this.$refs["loginFormRef"].validate((valid) => { this.$refs["loginFormRef"].validate((valid) => {
if (!valid) return; if (!valid) return;
login({ let obj = {};
phone: this.loginForm.phone, if (this.changeLogin == 1) {
password: this.loginForm.password, obj.phone = this.loginForm.phone;
}).then((res) => { obj.password = this.loginForm.password;
} else {
obj.phone = this.loginForm.phone;
obj.code = this.loginForm.code;
}
login(obj).then((res) => {
console.log(res, "login"); console.log(res, "login");
if (res.data.code != 200) { if (res.data.code != 200) {
return this.$message.error(res.data.message); return this.$message.error(res.data.message);
} }
// this.$message.success("登录成功"); // this.$message.success("登录成功");
// 跳转到报名 // 跳转到报名
const code = this.$store.state.indexIdentity;
// token存储 // token存储
window.localStorage.setItem("index-token" + code, res.data.token); window.localStorage.setItem("base-token", res.data.token);
window.localStorage.setItem("phone" + code, this.loginForm.phone); window.localStorage.setItem("phone", this.loginForm.phone);
window.localStorage.setItem("email" + code, res.data.email); window.localStorage.setItem("email", res.data.email);
// 报名信息 // 报名信息
window.localStorage.setItem("camp_name" + code, res.data.cam.name); this.$router.replace("/signUpList");
//获取主题色
window.localStorage.setItem(
"system_color" + code,
res.data.cam.system_color
);
this.$router.replace("/signUp/examInfo?code=" + code);
}); });
}); });
}, },
}, },
}; };
</script> </script>
<style scoped lang="scss"> <style lang="scss" scoped>
.container { @media screen and (max-width: 1500px){
.container {
height: 300px !important;
padding: 30px 37px 70px 37px!important;
.title_Login {
margin: 0 !important;
.title {
font-size: 12px !important;
}
.change_login {
margin-top: 5px !important;
font-size: 18px !important;
}
}
::v-deep .el-form {
margin-top: 20px !important;
}
}
}
.flex {
display: flex;
}
.container {
height: 440px;
background: #ffffff; background: #ffffff;
box-shadow: 0px 1px 18px 0px rgba(0, 0, 0, 0.06); box-shadow: 0px 1px 18px 0px rgba(0, 0, 0, 0.06);
border-radius: 8px; border-radius: 8px;
padding: 40px 60px; padding: 40px 60px;
margin-top: 0; margin-top: 0;
overflow: hidden; overflow: hidden;
.title_Login {
position: relative;
margin: 19px 0 0 0;
text-align: center;
.title { .title {
margin: 19px 0 6px 0;
width: 132px;
height: 20px; height: 20px;
font-size: 22px; font-size: 16px;
font-weight: 500; font-weight: 500;
color: var(--color); color: var(--color);
line-height: 20px; line-height: 20px;
text-align: right;
}
.change_login {
font-size: 22px;
margin-top: 32px;
color: black;
text-align: center;
} }
.line {
width: 125px;
height: 3px;
background: var(--color);
border-radius: 2px;
} }
.el-form { .el-form {
margin-top: 60px; margin-top: 60px;
.el-form-item { .el-form-item {
position: relative; position: relative;
margin-bottom: 30px; margin-bottom: 30px;
&:last-child { &:last-child {
margin: 0; margin: 0;
} }
.phoneCode {
position: absolute;
z-index: 999;
top: 50%;
right: 25px;
transform: translate(0, -50%);
cursor: pointer;
.code {
font-size: 14px;
font-weight: 600;
color: var(--color);
}
}
img.img_l { img.img_l {
position: absolute; position: absolute;
left: 25px; left: 25px;
...@@ -222,6 +402,7 @@ export default { ...@@ -222,6 +402,7 @@ export default {
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
z-index: 1000; z-index: 1000;
} }
img.img_r { img.img_r {
position: absolute; position: absolute;
right: 15px; right: 15px;
...@@ -229,6 +410,7 @@ export default { ...@@ -229,6 +410,7 @@ export default {
transform: translate(0, -50%); transform: translate(0, -50%);
z-index: 1000; z-index: 1000;
} }
::v-deep .el-input__inner { ::v-deep .el-input__inner {
height: 50px; height: 50px;
line-height: 50px; line-height: 50px;
...@@ -237,13 +419,16 @@ export default { ...@@ -237,13 +419,16 @@ export default {
color: #4d4d4d; color: #4d4d4d;
border: 0; border: 0;
border-bottom: 2px solid #d9d9d9; border-bottom: 2px solid #d9d9d9;
&:focus { &:focus {
border-bottom-color: var(--color); border-bottom-color: var(--color);
} }
} }
::v-deep .el-form-item__error { ::v-deep .el-form-item__error {
color: #e0823d; color: #e0823d;
} }
.el-button { .el-button {
width: 100%; width: 100%;
height: 60px; height: 60px;
...@@ -259,11 +444,13 @@ export default { ...@@ -259,11 +444,13 @@ export default {
border: none; border: none;
} }
} }
.box { .box {
height: 18px; height: 18px;
// display: block; // display: block;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.fl { .fl {
float: right; float: right;
height: 18px; height: 18px;
...@@ -271,11 +458,13 @@ export default { ...@@ -271,11 +458,13 @@ export default {
color: #999999; color: #999999;
margin-top: -10px; margin-top: -10px;
cursor: pointer; cursor: pointer;
&:hover { &:hover {
color: var(--color); color: var(--color);
text-decoration: underline; text-decoration: underline;
} }
} }
.fr { .fr {
float: left; float: left;
height: 18px; height: 18px;
...@@ -283,11 +472,13 @@ export default { ...@@ -283,11 +472,13 @@ export default {
color: #999999; color: #999999;
margin-top: -10px; margin-top: -10px;
cursor: pointer; cursor: pointer;
&:hover { &:hover {
color: var(--color); color: var(--color);
text-decoration: underline; text-decoration: underline;
} }
} }
.fc { .fc {
font-size: 4px; font-size: 4px;
float: right; float: right;
...@@ -303,5 +494,5 @@ export default { ...@@ -303,5 +494,5 @@ export default {
} }
} }
} }
} }
</style> </style>
...@@ -16,26 +16,26 @@ ...@@ -16,26 +16,26 @@
v-model="registerForm.phone" v-model="registerForm.phone"
placeholder="请输入手机号" placeholder="请输入手机号"
maxlength="11" maxlength="11"
autocomplete="off"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="email"> <!-- <el-form-item prop="email">
<img class="img_l" src="@/assets/img/reset/username.png" alt="" /> <img class="img_l" src="@/assets/img/reset/username.png" alt="" />
<el-input <el-input
v-model="registerForm.email" v-model="registerForm.email"
placeholder="请输入邮箱" placeholder="请输入邮箱"
autocomplete="off"
></el-input> ></el-input>
</el-form-item> </el-form-item> -->
<!-- <el-form-item prop="code"> <el-form-item prop="code">
<img class="img_l" src="@/assets/img/reset/code.png" alt="" /> <img class="img_l" src="@/assets/img/reset/code.png" alt="" />
<el-input <el-input
v-model="registerForm.code" v-model="registerForm.code"
placeholder="请输入短信验证码" placeholder="请输入短信验证码"
maxlength="20" maxlength="20"
autocomplete="off"
></el-input> --> ></el-input>
<!-- 短信验证码 --> <!-- 短信验证码 -->
<!-- <div class="phoneCode"> <!-- <div class="phoneCode">
<span class="code" v-show="show" @click="getCode" <span class="code" v-show="show" @click="getCode"
...@@ -44,18 +44,18 @@ ...@@ -44,18 +44,18 @@
<span v-show="!show" class="count">{{ count }} s</span> <span v-show="!show" class="count">{{ count }} s</span>
</div> </div>
</el-form-item> --> </el-form-item> -->
<el-form-item prop="code"> <!-- <el-form-item prop="code">
<img class="img_l" src="@/assets/img/reset/code.png" alt="" /> <img class="img_l" src="@/assets/img/reset/code.png" alt="" />
<el-input <el-input
v-model="registerForm.code" v-model="registerForm.code"
placeholder="请输入邮箱注册验证码" placeholder="请输入邮箱注册验证码"
maxlength="6" maxlength="6"
autocomplete="off"
></el-input> ></el-input> -->
<!-- 短信验证码 --> <!-- 短信验证码 -->
<div class="phoneCode"> <div class="phoneCode">
<span class="code" v-show="showCode" @click="getCode" <span class="code" v-show="showCode" @click="getCode"
>获取邮箱验证码</span >获取验证码</span
> >
<span v-show="!showCode" class="count">{{ count }} s</span> <span v-show="!showCode" class="count">{{ count }} s</span>
</div> </div>
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
v-model="registerForm.rq_password" v-model="registerForm.rq_password"
placeholder="请再次输入登录密码" placeholder="请再次输入登录密码"
maxlength="20" maxlength="20"
autocomplete="off"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item style="margin: 40px 0 0 0"></el-form-item> <el-form-item style="margin: 40px 0 0 0"></el-form-item>
...@@ -106,20 +106,18 @@ ...@@ -106,20 +106,18 @@
</template> </template>
<script> <script>
/* eslint-disable */ /* eslint-disable */
// 请求接口 import {
import {
registerCode, registerCode,
setAccountInfo, setAccountInfo,
registerEmailCode, registerEmailCode,
} from "r/index/register"; } from "r/base/register";
import { mobileCheck, checkStrong } from "@/common/utils.js"; import { mobileCheck, checkStrong } from "@/common/utils.js";
import validator from "common/validator"; import validator from "common/validator";
import { intervalTime } from "store/time"; import { intervalTime } from "store/time";
export default { export default {
name: "index-register", name: "base-register",
data() { data() {
const pwdCheck = async (rule, value, callback) => { const pwdCheck = async (rule, value, callback) => {
if (value !== this.registerForm.password) { if (value !== this.registerForm.password) {
...@@ -139,7 +137,7 @@ export default { ...@@ -139,7 +137,7 @@ export default {
isShowPwd: true, // 控制密码显示隐藏 isShowPwd: true, // 控制密码显示隐藏
registerForm: { registerForm: {
phone: "", phone: "",
email: "", // email: "",
code: "", code: "",
password: "", password: "",
rq_password: "", rq_password: "",
...@@ -161,13 +159,13 @@ export default { ...@@ -161,13 +159,13 @@ export default {
}, },
], ],
// 对邮箱验证 // 对邮箱验证
email: [ // email: [
{ required: true, message: "请输入邮箱", trigger: "blur" }, // { required: true, message: "请输入邮箱", trigger: "blur" },
{ // {
validator: validator.validateEmail, // validator: validator.validateEmail,
trigger: "blur", // trigger: "blur",
}, // },
], // ],
// 对验证码进行校验 // 对验证码进行校验
code: [ code: [
{ required: true, message: "请输入验证码", trigger: "blur" }, { required: true, message: "请输入验证码", trigger: "blur" },
...@@ -218,19 +216,17 @@ export default { ...@@ -218,19 +216,17 @@ export default {
}; };
}, },
created() { created() {
const code = this.$store.state.indexIdentity; const endTime = window.localStorage.getItem("register_code_time" );
const endTime = window.localStorage.getItem("register_code_time" + code);
if (endTime && Number(endTime) > new Date().getTime()) { if (endTime && Number(endTime) > new Date().getTime()) {
this.resetForm.phone = phone; this.resetForm.phone = phone;
this.intervalHandle(new Date(), Number(endTime)); this.intervalHandle(new Date(), Number(endTime));
} }
this.commonApi(30)
}, },
methods: { methods: {
// 去注册 // 去注册
toLogin() { toLogin() {
let code = this.$store.state.indexIdentity; this.$router.push("/baseLogin");
this.$router.push("/login?code=" + code);
}, },
// 改变密码显示状态 // 改变密码显示状态
changePwdStatus() { changePwdStatus() {
...@@ -257,16 +253,15 @@ export default { ...@@ -257,16 +253,15 @@ export default {
}, },
// 获取手机验证短信 // 获取手机验证短信
getCode() { getCode() {
if (!this.registerForm.email) { if (!this.registerForm.phone) {
return this.$message.error("请输入邮箱"); return this.$message.error("请输入邮箱");
} }
// if (!this.codeTime) { // if (!this.codeTime) {
// return this.$message.error("您已经获取验证码,请去邮箱中进行查看"); // return this.$message.error("您已经获取验证码,请去邮箱中进行查看");
// } // }
// 接口获得验证码 // 接口获得验证码
registerEmailCode({ registerCode({
phone: this.registerForm.phone,
email: this.registerForm.email,
}).then((res) => { }).then((res) => {
console.log(res, "passwordCode"); console.log(res, "passwordCode");
if (res.data.code != 200) { if (res.data.code != 200) {
...@@ -275,9 +270,8 @@ export default { ...@@ -275,9 +270,8 @@ export default {
this.$message.success(res.data.message); this.$message.success(res.data.message);
this.codeTime = res.data.data.now * 1000; this.codeTime = res.data.data.now * 1000;
// console.log(this.codeTime) // console.log(this.codeTime)
let code = this.$store.state.indexIdentity;
window.localStorage.setItem( window.localStorage.setItem(
"register_code_time" + code, "register_code_time" ,
res.data.data.now * 1000 res.data.data.now * 1000
); );
this.intervalHandle(new Date(), res.data.data.now * 1000); this.intervalHandle(new Date(), res.data.data.now * 1000);
...@@ -290,7 +284,7 @@ export default { ...@@ -290,7 +284,7 @@ export default {
if (!valid) return; if (!valid) return;
setAccountInfo({ setAccountInfo({
phone: this.registerForm.phone, phone: this.registerForm.phone,
email: this.registerForm.email, // email: this.registerForm.email,
code: this.registerForm.code, code: this.registerForm.code,
password: this.registerForm.password, password: this.registerForm.password,
rq_password: this.registerForm.rq_password, rq_password: this.registerForm.rq_password,
...@@ -300,32 +294,29 @@ export default { ...@@ -300,32 +294,29 @@ export default {
return this.$message.error(res.data.message); return this.$message.error(res.data.message);
} }
// this.$message.success(res.data.message); // this.$message.success(res.data.message);
let code = this.$store.state.indexIdentity;
// token存储 // token存储
window.localStorage.setItem("index-token" + code, res.data.token); window.localStorage.setItem("index-token" , res.data.token);
window.localStorage.setItem("phone" + code, this.registerForm.phone); window.localStorage.setItem("phone" , this.registerForm.phone);
window.localStorage.setItem("email" + code, this.registerForm.email);//邮箱 // window.localStorage.setItem("email" + code, this.registerForm.email);
// 报名信息 // 报名信息
window.localStorage.setItem("camp_name" + code, res.data.cam.name); window.localStorage.setItem("camp_name" , res.data.cam.name);
//获取主题色 //获取主题色
window.localStorage.setItem( window.localStorage.setItem(
"system_color" + code, "system_color" ,
res.data.cam.system_color res.data.cam.system_color
); );
// 跳转到报名 // 跳转到报名
this.$router.replace("/signUpList" );
this.$router.push("/signUp/examInfo?code=" + code);
}); });
}); });
}, },
}, },
}; };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
// 注册输入 // 注册输入
.container { .container {
background: #ffffff; background: #ffffff;
box-shadow: 0px 1px 18px 0px rgba(0, 0, 0, 0.06); box-shadow: 0px 1px 18px 0px rgba(0, 0, 0, 0.06);
border-radius: 8px; border-radius: 8px;
...@@ -334,8 +325,8 @@ export default { ...@@ -334,8 +325,8 @@ export default {
overflow: hidden; overflow: hidden;
.title { .title {
margin: 19px 0 6px 0; // margin: 19px 0 6px 0;
width: 132px; // width: 132px;
height: 20px; height: 20px;
font-size: 22px; font-size: 22px;
font-weight: 500; font-weight: 500;
...@@ -343,12 +334,12 @@ export default { ...@@ -343,12 +334,12 @@ export default {
line-height: 20px; line-height: 20px;
} }
.line { // .line {
width: 103px; // width: 103px;
height: 3px; // height: 3px;
background: var(--color); // background: var(--color);
border-radius: 2px; // border-radius: 2px;
} // }
::v-deep .el-form { ::v-deep .el-form {
margin-top: 60px; margin-top: 60px;
...@@ -449,23 +440,23 @@ export default { ...@@ -449,23 +440,23 @@ export default {
} }
} }
} }
} }
@media screen and (max-width: 1601px) { @media screen and (max-width: 1601px) {
.container { .container {
right: 18%; right: 18%;
} }
} }
@media screen and (max-width: 1501px) { @media screen and (max-width: 1501px) {
.container { .container {
right: 16%; right: 16%;
} }
} }
@media screen and (max-width: 1401px) { @media screen and (max-width: 1401px) {
.container { .container {
right: 14%; right: 14%;
} }
} }
</style> </style>
...@@ -16,25 +16,23 @@ ...@@ -16,25 +16,23 @@
v-model="resetForm.phone" v-model="resetForm.phone"
placeholder="请输入手机号" placeholder="请输入手机号"
maxlength="11" maxlength="11"
autocomplete="off"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="email"> <!-- <el-form-item prop="email">
<img class="img_l" src="@/assets/img/reset/username.png" alt="" /> <img class="img_l" src="@/assets/img/reset/username.png" alt="" />
<el-input <el-input
v-model="resetForm.email" v-model="resetForm.email"
placeholder="请输入邮箱" placeholder="请输入邮箱"
autocomplete="off"
></el-input> ></el-input>
</el-form-item> </el-form-item> -->
<!-- <el-form-item prop="code"> <el-form-item prop="code">
<img class="img_l" src="@/assets/img/reset/code.png" alt="" /> <img class="img_l" src="@/assets/img/reset/code.png" alt="" />
<el-input <el-input
v-model="resetForm.code" v-model="resetForm.code"
placeholder="请输入短信验证码" placeholder="请输入短信验证码"
maxlength="20" maxlength="20"
autocomplete="off" ></el-input>
></el-input> -->
<!-- 短信验证码 --> <!-- 短信验证码 -->
<!-- <div class="phoneCode"> <!-- <div class="phoneCode">
<span class="code" v-show="showCode" @click="getCode" <span class="code" v-show="showCode" @click="getCode"
...@@ -43,18 +41,18 @@ ...@@ -43,18 +41,18 @@
<span v-show="!showCode" class="count">{{ count }} s</span> <span v-show="!showCode" class="count">{{ count }} s</span>
</div> </div>
</el-form-item> --> </el-form-item> -->
<el-form-item prop="code"> <!-- <el-form-item prop="code">
<img class="img_l" src="@/assets/img/reset/code.png" alt="" /> <img class="img_l" src="@/assets/img/reset/code.png" alt="" />
<el-input <el-input
v-model="resetForm.code" v-model="resetForm.code"
placeholder="请输入邮箱验证码" placeholder="请输入邮箱验证码"
maxlength="6" maxlength="6"
autocomplete="off"
></el-input> ></el-input> -->
<!-- 短信验证码 --> <!-- 短信验证码 -->
<div class="phoneCode"> <div class="phoneCode">
<span class="code" v-show="showCode" @click="getCode" <span class="code" v-show="showCode" @click="getCode"
>获取邮箱验证码</span >获取验证码</span
> >
<span v-show="!showCode" class="count">{{ count }} s</span> <span v-show="!showCode" class="count">{{ count }} s</span>
</div> </div>
...@@ -88,7 +86,6 @@ ...@@ -88,7 +86,6 @@
v-model="resetForm.rq_password" v-model="resetForm.rq_password"
placeholder="请再次输入新的登录密码" placeholder="请再次输入新的登录密码"
maxlength="20" maxlength="20"
autocomplete="off"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item style="margin: 40px 0 0 0"></el-form-item> <el-form-item style="margin: 40px 0 0 0"></el-form-item>
...@@ -105,16 +102,16 @@ ...@@ -105,16 +102,16 @@
</template> </template>
<script> <script>
/* eslint-disable */ /* eslint-disable */
// 请求接口 // 请求接口
import { passwordEmailCode } from "r/index/register"; import { passwordCode } from "r/base/register";
import { changePassCode } from "r/index/login"; import { changePassCode } from "r/base/login";
import { mobileCheck } from "@/common/utils.js"; import { mobileCheck } from "@/common/utils.js";
import { intervalTime } from "store/time"; import { intervalTime } from "store/time";
import validator from "common/validator"; import validator from "common/validator";
export default { export default {
name: "index-reset", name: "base-reset",
data() { data() {
const pwdCheck = async (rule, value, callback) => { const pwdCheck = async (rule, value, callback) => {
if (value !== this.resetForm.password) { if (value !== this.resetForm.password) {
...@@ -132,7 +129,7 @@ export default { ...@@ -132,7 +129,7 @@ export default {
isShowPwd: true, // 控制密码显示隐藏 isShowPwd: true, // 控制密码显示隐藏
resetForm: { resetForm: {
phone: "", phone: "",
email: "", // email: "",
code: "", code: "",
password: "", password: "",
rq_password: "", rq_password: "",
...@@ -154,13 +151,13 @@ export default { ...@@ -154,13 +151,13 @@ export default {
}, },
], ],
// 对邮箱验证 // 对邮箱验证
email: [ // email: [
{ required: true, message: "请输入邮箱", trigger: "blur" }, // { required: true, message: "请输入邮箱", trigger: "blur" },
{ // {
validator: validator.validateEmail, // validator: validator.validateEmail,
trigger: "blur", // trigger: "blur",
}, // },
], // ],
// 对验证码进行校验 // 对验证码进行校验
code: [ code: [
{ required: true, message: "请输入验证码", trigger: "blur" }, { required: true, message: "请输入验证码", trigger: "blur" },
...@@ -211,9 +208,8 @@ export default { ...@@ -211,9 +208,8 @@ export default {
}; };
}, },
created() { created() {
const code = this.$store.state.indexIdentity; const endTime = window.localStorage.getItem("restet_code_time" );
const endTime = window.localStorage.getItem("restet_code_time" + code); const phone = window.localStorage.getItem("restet_code_phone" );
const phone = window.localStorage.getItem("restet_code_phone" + code);
if (endTime && Number(endTime) > new Date().getTime()) { if (endTime && Number(endTime) > new Date().getTime()) {
this.resetForm.phone = phone; this.resetForm.phone = phone;
this.intervalHandle(new Date(), Number(endTime)); this.intervalHandle(new Date(), Number(endTime));
...@@ -222,8 +218,7 @@ export default { ...@@ -222,8 +218,7 @@ export default {
methods: { methods: {
// 去注册 // 去注册
toLogin() { toLogin() {
let code = this.$store.state.indexIdentity; this.$router.push("/baseLogin" );
this.$router.push("/login?code=" + code);
}, },
// 改变密码显示状态 // 改变密码显示状态
changePwdStatus() { changePwdStatus() {
...@@ -250,16 +245,16 @@ export default { ...@@ -250,16 +245,16 @@ export default {
}, },
// 获取手机验证短信 // 获取手机验证短信
getCode() { getCode() {
if (!this.resetForm.email) { if (!this.resetForm.phone) {
return this.$message.error("请输入邮箱"); return this.$message.error("请输入手机号");
} }
// if (!this.codeTime) { // if (!this.codeTime) {
// return this.$message.error("您已经获取验证码,请去邮箱中进行查看"); // return this.$message.error("您已经获取验证码,请去邮箱中进行查看");
// } // }
// 接口获得验证码 // 接口获得验证码
passwordEmailCode({ passwordCode({
phone: this.resetForm.phone, phone: this.resetForm.phone,
email: this.resetForm.email, // email: this.resetForm.email,
}).then((res) => { }).then((res) => {
console.log(res, "passwordCode"); console.log(res, "passwordCode");
if (res.data.code != 200) { if (res.data.code != 200) {
...@@ -268,9 +263,8 @@ export default { ...@@ -268,9 +263,8 @@ export default {
this.$message.success(res.data.message); this.$message.success(res.data.message);
this.codeTime = res.data.data.now * 1000; this.codeTime = res.data.data.now * 1000;
// console.log(this.codeTime) // console.log(this.codeTime)
let code = this.$store.state.indexIdentity;
window.localStorage.setItem( window.localStorage.setItem(
"restet_code_time" + code, "restet_code_time" ,
res.data.data.now * 1000 res.data.data.now * 1000
); );
this.intervalHandle(new Date(), res.data.data.now * 1000); this.intervalHandle(new Date(), res.data.data.now * 1000);
...@@ -294,23 +288,22 @@ export default { ...@@ -294,23 +288,22 @@ export default {
} }
this.$message.success(res.data.message); this.$message.success(res.data.message);
// token存储 // token存储
let code = this.$store.state.indexIdentity;
// window.localStorage.setItem("index-token" + code, res.token); // window.localStorage.setItem("index-token" + code, res.token);
window.localStorage.setItem( window.localStorage.setItem(
"restet_code_phone" + code, "restet_code_phone" ,
this.resetForm.phone this.resetForm.phone
); );
this.$router.push("/login?code=" + code); this.$router.replace("/baseLogin");
}); });
}); });
}, },
}, },
}; };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
// 注册输入 // 注册输入
.container { .container {
background: #ffffff; background: #ffffff;
box-shadow: 0px 1px 18px 0px rgba(0, 0, 0, 0.06); box-shadow: 0px 1px 18px 0px rgba(0, 0, 0, 0.06);
border-radius: 8px; border-radius: 8px;
...@@ -319,21 +312,22 @@ export default { ...@@ -319,21 +312,22 @@ export default {
overflow: hidden; overflow: hidden;
.title { .title {
margin: 19px 0 6px 0; // margin: 19px 0 6px 0;
width: 132px; // width: 132px;
height: 20px; height: 20px;
font-size: 22px; font-size: 22px;
font-weight: 500; font-weight: 500;
color: var(--color); color: var(--color);
line-height: 20px; line-height: 20px;
text-align: center;
} }
.line { // .line {
width: 83px; // width: 83px;
height: 3px; // height: 3px;
background: var(--color); // background: var(--color);
border-radius: 2px; // border-radius: 2px;
} // }
::v-deep .el-form { ::v-deep .el-form {
margin-top: 60px; margin-top: 60px;
...@@ -434,23 +428,23 @@ export default { ...@@ -434,23 +428,23 @@ export default {
} }
} }
} }
} }
@media screen and (max-width: 1601px) { @media screen and (max-width: 1601px) {
.container { .container {
right: 18%; right: 18%;
} }
} }
@media screen and (max-width: 1501px) { @media screen and (max-width: 1501px) {
.container { .container {
right: 16%; right: 16%;
} }
} }
@media screen and (max-width: 1401px) { @media screen and (max-width: 1401px) {
.container { .container {
right: 14%; right: 14%;
} }
} }
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment