Commit 8bdedc5d authored by 杨梦雪's avatar 杨梦雪

注册发送邮箱

parent cce550be
......@@ -179,7 +179,7 @@
v-model="phone"
placeholder="请输入手机号"
size="small"
disabled="true"
:disabled="true"
/>
</el-form-item>
</el-col>
......@@ -190,7 +190,7 @@
v-model="referForm.email"
placeholder="填写电子邮箱"
size="small"
disabled="true"
:disabled="true"
/>
</el-form-item>
</el-col>
......
......@@ -109,6 +109,7 @@ export function request(config) {
const passMsgOld = '/web/auth/changePassOld';
const getCam = '/web/auth/getCam';
const registerCode = '/web/code/registerCode';
const registerEmailCode = 'web/code/registerEmailCode';
const passwordEmailCode = 'web/code/passwordEmailCode';
const passwordCode = '/web/code/passwordCode';
const changePassCode = '/web/auth/changePassCode';
......@@ -121,6 +122,7 @@ export function request(config) {
config.url.indexOf(passMsgOld) != -1 ||
config.url.indexOf(getCam) != -1 ||
config.url.indexOf(registerCode) != -1 ||
config.url.indexOf(registerEmailCode) != -1 ||
config.url.indexOf(passwordEmailCode) != -1 ||
config.url.indexOf(changePassCode) != -1 ||
config.url.indexOf(passwordCode) != -1 ||
......
......@@ -5,7 +5,16 @@ import {
} from './network'
import store from '@/store'
// 通过邮箱验证码找回密码
// 通过邮箱验证码注册
export function registerEmailCode(data) {
data['identity'] = store.state.indexIdentity;
return request({
method: 'post',
url: 'web/code/registerEmailCode',
params: data
})
}
// 通过邮箱验证码找回密码(忘记密码)
export function passwordEmailCode(data) {
data['identity'] = store.state.indexIdentity;
return request({
......
......@@ -79,6 +79,7 @@ export default {
isNexts: "",
signBackStatus: "",
invitation_code: "",//邀请码
};
},
created() {
......@@ -89,6 +90,7 @@ export default {
},
watch: {
$route: {
handler(val) {
// console.log(val, "routeval");
......
......@@ -56,7 +56,7 @@
<div class="fr" @click="register()">还没有账号?立即注册</div>
<div class="fl" @click="forgetPwd()">忘记密码?</div>
</div>
<div class="fc">忘记密码请联系管理员邮箱:ydhdservice@163.com</div>
<!-- <div class="fc">忘记密码请联系管理员邮箱:ydhdservice@163.com</div> -->
</div>
</el-form>
</div>
......
......@@ -44,6 +44,22 @@
<span v-show="!show" class="count">{{ count }} s</span>
</div>
</el-form-item> -->
<el-form-item prop="code">
<img class="img_l" src="@/assets/img/reset/code.png" alt="" />
<el-input
v-model="registerForm.code"
placeholder="请输入邮箱注册验证码"
maxlength="20"
autocomplete="off"
></el-input>
<!-- 短信验证码 -->
<div class="phoneCode">
<span class="code" v-show="showCode" @click="getCode"
>获取邮箱验证码</span
>
<span v-show="!showCode" class="count">{{ count }} s</span>
</div>
</el-form-item>
<el-form-item prop="password">
<img class="img_l" src="@/assets/img/reset/password.png" alt="" />
<el-input
......@@ -93,9 +109,14 @@
/* eslint-disable */
// 请求接口
import { registerCode, setAccountInfo } from "r/index/register";
import {
registerCode,
setAccountInfo,
registerEmailCode,
} from "r/index/register";
import { mobileCheck, checkStrong } from "@/common/utils.js";
import validator from "common/validator";
import { intervalTime } from "store/time";
export default {
name: "index-register",
......@@ -111,14 +132,15 @@ export default {
return {
inputType: "",
// 手机验证短信
// show: true,
// count: "",
// timer: null,
showCode: true,
count: "",
timer: null,
codeTime: "", //手机验证码倒计时时间
isShowPwd: true, // 控制密码显示隐藏
registerForm: {
phone: "",
// code: "",
email: "",
code: "",
password: "",
rq_password: "",
},
......@@ -147,10 +169,10 @@ export default {
},
],
// 对验证码进行校验
// code: [
// { required: true, message: "请输入验证码", trigger: "blur" },
// { min: 6, max: 20, message: "请输入正确的验证码", trigger: "blur" },
// ],
code: [
{ required: true, message: "请输入验证码", trigger: "blur" },
{ min: 6, max: 20, message: "请输入正确的验证码", trigger: "blur" },
],
// 对密码进行校验
password: [
{
......@@ -196,10 +218,11 @@ export default {
};
},
created() {
const endTime = window.localStorage.getItem("register_code_time");
const phone = window.localStorage.getItem("register_code_phone");
const code = this.$store.state.indexIdentity;
const endTime = window.localStorage.getItem("register_code_time" + code);
if (endTime && Number(endTime) > new Date().getTime()) {
this.registerForm.phone = phone;
this.resetForm.phone = phone;
this.intervalHandle(new Date(), Number(endTime));
}
},
......@@ -214,50 +237,51 @@ export default {
this.isShowPwd = !this.isShowPwd;
},
// 定时器倒计时
// intervalHandle(startTime, endTime) {
// // 时间差
// const timeLag = intervalTime(startTime, endTime);
// console.log(timeLag);
// if (!this.timer) {
// this.count = timeLag;
// this.show = false;
// this.timer = setInterval(() => {
// if (this.count > 0 && this.count <= timeLag) {
// this.count--;
// } else {
// this.show = true;
// clearInterval(this.timer);
// this.timer = null;
// }
// }, 1000);
// }
// },
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.registerForm.phone) {
// return this.$message.error("请输入手机号");
// }
// // 接口获得验证码
// registerCode({
// phone: this.registerForm.phone,
// }).then((res) => {
// console.log(res);
// if (res.data.code != 200) {
// return this.$message.error(res.data.message);
// }
// this.$message.success(res.data.message);
// window.localStorage.setItem(
// "register_code_time",
// res.data.data.now * 1000
// );
// window.localStorage.setItem(
// "register_code_phone",
// this.registerForm.phone
// );
// this.intervalHandle(new Date(), res.data.data.now * 1000);
// });
// },
getCode() {
if (!this.registerForm.email) {
return this.$message.error("请输入邮箱");
}
// if (!this.codeTime) {
// return this.$message.error("您已经获取验证码,请去邮箱中进行查看");
// }
// 接口获得验证码
registerEmailCode({
email: this.registerForm.email,
}).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(
"register_code_time" + code,
res.data.data.now * 1000
);
this.intervalHandle(new Date(), res.data.data.now * 1000);
});
},
// 表单验证
submitForm() {
......@@ -266,7 +290,7 @@ export default {
setAccountInfo({
phone: this.registerForm.phone,
email: this.registerForm.email,
// code: this.registerForm.code,
code: this.registerForm.code,
password: this.registerForm.password,
rq_password: this.registerForm.rq_password,
}).then((res) => {
......
......@@ -129,8 +129,8 @@ export default {
showCode: true,
count: "",
timer: null,
isShowPwd: true, // 控制密码显示隐藏
codeTime: "", //手机验证码倒计时时间
isShowPwd: true, // 控制密码显示隐藏
resetForm: {
phone: "",
email: "",
......@@ -163,10 +163,10 @@ export default {
},
],
// 对验证码进行校验
// code: [
// { required: true, message: "请输入验证码", trigger: "blur" },
// { min: 6, max: 20, message: "请输入正确的验证码", trigger: "blur" },
// ],
code: [
{ required: true, message: "请输入验证码", trigger: "blur" },
{ min: 6, max: 20, message: "请输入正确的验证码", trigger: "blur" },
],
// 对密码进行校验
password: [
{
......
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