忘了写到哪了
This commit is contained in:
10
src/views/website/home/index.vue
Normal file
10
src/views/website/home/index.vue
Normal file
@ -0,0 +1,10 @@
|
||||
<template>
|
||||
<div>
|
||||
{{ msg }}
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
|
||||
const msg = ref("hekko");
|
||||
</script>
|
353
src/views/website/login/index.vue
Normal file
353
src/views/website/login/index.vue
Normal file
@ -0,0 +1,353 @@
|
||||
<template>
|
||||
<div class="login">
|
||||
<div class="content">
|
||||
<img class="loginImg" src="@/assets/images/login.png" alt="" srcset="" />
|
||||
<div class="login-form">
|
||||
<el-tabs v-model="loginForm.mode" v-if="isLogin == 1">
|
||||
<el-tab-pane label="账号密码登录" name="102"></el-tab-pane>
|
||||
<el-tab-pane label="手机快捷登录" name="101"></el-tab-pane>
|
||||
</el-tabs>
|
||||
<div v-if="isLogin == 1">
|
||||
<el-form ref="loginRef" :model="loginForm" :rules="loginRules">
|
||||
<el-form-item prop="username">
|
||||
<el-input
|
||||
v-model="loginForm.username"
|
||||
type="text"
|
||||
auto-complete="off"
|
||||
placeholder="手机号"
|
||||
>
|
||||
<template #prefix>
|
||||
<svg-icon
|
||||
icon-class="user"
|
||||
class="el-input__icon input-icon"
|
||||
/>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password" v-if="loginForm.mode == 102">
|
||||
<el-input
|
||||
v-model="loginForm.password"
|
||||
type="password"
|
||||
auto-complete="off"
|
||||
placeholder="密码"
|
||||
@keyup.enter="handleLogin"
|
||||
>
|
||||
<template #prefix>
|
||||
<svg-icon
|
||||
icon-class="password"
|
||||
class="el-input__icon input-icon"
|
||||
/>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="captcha" v-if="loginForm.mode == 101">
|
||||
<el-input
|
||||
v-model="loginForm.captcha"
|
||||
auto-complete="off"
|
||||
placeholder="验证码"
|
||||
style="width: 65%"
|
||||
@keyup.enter="handleLogin"
|
||||
>
|
||||
<template #prefix>
|
||||
<svg-icon
|
||||
icon-class="validCode"
|
||||
class="el-input__icon input-icon"
|
||||
/>
|
||||
</template>
|
||||
</el-input>
|
||||
<WebGetCode v-model:mobile="loginForm.username" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-checkbox v-model="loginForm.rememberMe">记住账号</el-checkbox>
|
||||
</el-form-item>
|
||||
<el-form-item style="width: 100%">
|
||||
<el-button
|
||||
class="x_btns"
|
||||
:loading="loading"
|
||||
size="default"
|
||||
type="primary"
|
||||
style="width: 100%"
|
||||
@click.prevent="handleLogin"
|
||||
>
|
||||
<span v-if="!loading">登 录</span>
|
||||
<span v-else>登 录 中...</span>
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div style="overflow: hidden">
|
||||
<div style="float: left" v-if="isLogin == 1">
|
||||
<span class="text_col pointer" :to="'/login'" @click="isLogin = 3"
|
||||
>忘记密码</span
|
||||
>
|
||||
</div>
|
||||
<div style="float: right" v-if="register">
|
||||
<span @click="isLogin = 2" style="color: #0054ff" class="pointer"
|
||||
>注册</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-form
|
||||
v-if="isLogin == 1"
|
||||
:model="registerForm"
|
||||
status-icon
|
||||
:rules="isCheckRules"
|
||||
ref="isCheck"
|
||||
>
|
||||
<el-form-item prop="isCheck">
|
||||
<div style="margin-top: 43px">
|
||||
<div class="text_col">
|
||||
<div>其他登录方式</div>
|
||||
<img
|
||||
class="pointer"
|
||||
src="../../../assets/images/weixin.png"
|
||||
alt=""
|
||||
/>
|
||||
</div>
|
||||
<el-checkbox
|
||||
v-model="registerForm.isCheck"
|
||||
style="margin-top: 43px"
|
||||
>
|
||||
<span class="text_col">登录即同意</span
|
||||
><span style="color: #0054ff">《协议》</span>
|
||||
</el-checkbox>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<Register v-model:isLogin="isLogin" v-else-if="isLogin == 2" />
|
||||
<Retrieve v-model:isLogin="isLogin" v-else-if="isLogin == 3" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 底部 -->
|
||||
<div class="foot">Copyright © 2007-2021 中科云 版权所有</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import Cookies from "js-cookie";
|
||||
import { encrypt, decrypt } from "@/utils/jsencrypt";
|
||||
import md5 from "js-md5";
|
||||
import Register from "../register";
|
||||
import Retrieve from "../retrieve";
|
||||
import WebGetCode from "@/components/webGetCode";
|
||||
import useUserStore from "@/store/modules/user";
|
||||
// const store = useStore();
|
||||
const router = useRouter();
|
||||
const userStore = useUserStore();
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
const isLogin = ref(1);
|
||||
console.log(md5);
|
||||
const loginForm = ref({
|
||||
username: "18212342345",
|
||||
password: "12342345",
|
||||
rememberMe: false,
|
||||
mode: "102",
|
||||
captcha: "",
|
||||
});
|
||||
|
||||
const registerForm = ref({
|
||||
isCheck: true,
|
||||
});
|
||||
|
||||
const disabled = ref(true);
|
||||
const buttonName = ref("获取验证码");
|
||||
const isDisabled = ref(false);
|
||||
const time = ref(10);
|
||||
|
||||
const loginRules = {
|
||||
username: [{ required: true, trigger: "blur", message: "请输入您的手机号" }],
|
||||
password: [{ required: true, trigger: "blur", message: "请输入您的密码" }],
|
||||
// captcha: [{ required: true, trigger: "change", message: "请输入验证码" }],
|
||||
};
|
||||
|
||||
const isCheck = (rule, value, callback) => {
|
||||
if (!value) {
|
||||
callback(new Error("请阅读并勾选"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
const isCheckRules = {
|
||||
isCheck: [{ required: true, validator: isCheck, trigger: "change" }],
|
||||
};
|
||||
|
||||
// const codeUrl = ref("");
|
||||
const loading = ref(false);
|
||||
// 注册开关
|
||||
const register = ref(true);
|
||||
const redirect = ref(undefined);
|
||||
|
||||
function handleLogin() {
|
||||
proxy.$refs.loginRef.validate((valid) => {
|
||||
proxy.$refs.isCheck.validate((valid2) => {
|
||||
if (valid && valid2) {
|
||||
loading.value = true;
|
||||
|
||||
if (loginForm.value.rememberMe) {
|
||||
Cookies.set("username", loginForm.value.username, { expires: 30 });
|
||||
Cookies.set("password", loginForm.value.password, {
|
||||
expires: 30,
|
||||
});
|
||||
Cookies.set("rememberMe", loginForm.value.rememberMe, {
|
||||
expires: 30,
|
||||
});
|
||||
} else {
|
||||
// 否则移除
|
||||
Cookies.remove("username");
|
||||
Cookies.remove("password");
|
||||
Cookies.remove("rememberMe");
|
||||
}
|
||||
|
||||
// 调用action的登录方法
|
||||
let formData = Object.assign({}, loginForm.value);
|
||||
formData.password = md5(formData.password);
|
||||
console.log("123435");
|
||||
formData.mode = formData.mode - 0;
|
||||
userStore
|
||||
.login(formData)
|
||||
.then(() => {
|
||||
router.push({ path: redirect.value || "/" });
|
||||
})
|
||||
.catch(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function getCookie() {
|
||||
const username = Cookies.get("username");
|
||||
const password = Cookies.get("password");
|
||||
const rememberMe = Cookies.get("rememberMe");
|
||||
loginForm.value = {
|
||||
username: username === undefined ? loginForm.value.username : username,
|
||||
password: password === undefined ? loginForm.value.password : password,
|
||||
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe),
|
||||
mode: loginForm.value.mode,
|
||||
};
|
||||
}
|
||||
getCookie();
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.login {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: #b1ccff;
|
||||
.content {
|
||||
// padding: 0 250px;
|
||||
// padding: 0 30px;
|
||||
width: 1400px;
|
||||
margin: 0 auto;
|
||||
flex: 1;
|
||||
background: #b1ccff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.loginImg {
|
||||
width: 705px;
|
||||
height: 458px;
|
||||
}
|
||||
}
|
||||
.foot {
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
background: #fff;
|
||||
font-size: 14px;
|
||||
font-family: Source Han Sans CN;
|
||||
font-weight: 500;
|
||||
color: #666666;
|
||||
}
|
||||
}
|
||||
.title {
|
||||
margin: 0px auto 30px auto;
|
||||
text-align: center;
|
||||
color: #707070;
|
||||
}
|
||||
|
||||
.login-form {
|
||||
width: 516px;
|
||||
min-width: 455px;
|
||||
// height: 517px;
|
||||
background: #ffffff;
|
||||
box-sizing: border-box;
|
||||
padding: 30px 33px;
|
||||
.tit {
|
||||
padding: 30px 0;
|
||||
text-align: center;
|
||||
font-size: 20px;
|
||||
font-family: Source Han Sans CN;
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
}
|
||||
.el-tab-pane {
|
||||
padding-top: 10px;
|
||||
}
|
||||
.el-input {
|
||||
height: 38px;
|
||||
input {
|
||||
height: 38px;
|
||||
}
|
||||
}
|
||||
.input-icon {
|
||||
height: 39px;
|
||||
width: 14px;
|
||||
margin-left: 2px;
|
||||
}
|
||||
::v-deep .el-tabs__active-bar {
|
||||
background-color: #0054ff;
|
||||
}
|
||||
::v-deep .el-tabs__item {
|
||||
color: #666666;
|
||||
font-size: 16px;
|
||||
&.is-active {
|
||||
font-weight: 500;
|
||||
color: #0054ff;
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.login-tip {
|
||||
font-size: 13px;
|
||||
text-align: center;
|
||||
color: #bfbfbf;
|
||||
}
|
||||
.login-code {
|
||||
width: 30%;
|
||||
height: 38px;
|
||||
float: right;
|
||||
img {
|
||||
cursor: pointer;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
.el-login-footer {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
font-family: Arial;
|
||||
font-size: 12px;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
.login-code-img {
|
||||
height: 36px;
|
||||
}
|
||||
.text_col {
|
||||
color: #999999;
|
||||
img {
|
||||
width: 30px;
|
||||
margin: 10px 0 0 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
235
src/views/website/register/index.vue
Normal file
235
src/views/website/register/index.vue
Normal file
@ -0,0 +1,235 @@
|
||||
<template>
|
||||
<el-form
|
||||
ref="registerRef"
|
||||
:model="registerForm"
|
||||
:rules="registerRules"
|
||||
class="register-form"
|
||||
>
|
||||
<h3 class="title">注册</h3>
|
||||
<el-form-item prop="username">
|
||||
<el-input
|
||||
v-model="registerForm.username"
|
||||
type="text"
|
||||
maxlength="11"
|
||||
auto-complete="off"
|
||||
placeholder="手机号"
|
||||
>
|
||||
<template #prefix
|
||||
><svg-icon icon-class="user" class="el-input__icon input-icon"
|
||||
/></template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input
|
||||
v-model="registerForm.password"
|
||||
type="password"
|
||||
auto-complete="off"
|
||||
placeholder="密码"
|
||||
@keyup.enter="handleRegister"
|
||||
>
|
||||
<template #prefix
|
||||
><svg-icon icon-class="password" class="el-input__icon input-icon"
|
||||
/></template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="repeat_pass">
|
||||
<el-input
|
||||
v-model="registerForm.repeat_pass"
|
||||
type="password"
|
||||
auto-complete="off"
|
||||
placeholder="确认密码"
|
||||
@keyup.enter="handleRegister"
|
||||
>
|
||||
<template #prefix
|
||||
><svg-icon icon-class="password" class="el-input__icon input-icon"
|
||||
/></template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="captcha" style="margin-bottom: 0">
|
||||
<el-input
|
||||
v-model="registerForm.captcha"
|
||||
auto-complete="off"
|
||||
placeholder="验证码"
|
||||
style="width: 65%"
|
||||
@keyup.enter="handleRegister"
|
||||
>
|
||||
<template #prefix
|
||||
><svg-icon icon-class="validCode" class="el-input__icon input-icon"
|
||||
/></template>
|
||||
</el-input>
|
||||
<webGetCode v-model:username="registerForm.username" />
|
||||
</el-form-item>
|
||||
<el-form-item prop="isCheck" style="margin: 10px 0; height: 28px">
|
||||
<el-checkbox v-model="registerForm.isCheck">
|
||||
<span style="color: #999999">勾选即同意</span
|
||||
><span style="color: #0054ff">《协议》</span>
|
||||
</el-checkbox>
|
||||
</el-form-item>
|
||||
<el-form-item style="width: 100%; margin-top: 35px">
|
||||
<el-button
|
||||
class="x_btns"
|
||||
:loading="loading"
|
||||
size="default"
|
||||
type="primary"
|
||||
style="width: 100%"
|
||||
@click.prevent="handleRegister"
|
||||
>
|
||||
<span v-if="!loading">注 册</span>
|
||||
<span v-else>注 册 中...</span>
|
||||
</el-button>
|
||||
<div style="float: right">
|
||||
<span
|
||||
class="x_blue pointer"
|
||||
@click="handleLogin"
|
||||
style="font-size: 16px"
|
||||
>登录</span
|
||||
>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ElMessageBox } from "element-plus";
|
||||
import { register } from "@/api/login";
|
||||
import webGetCode from "@/components/webGetCode";
|
||||
import md5 from "js-md5";
|
||||
|
||||
const props = defineProps({
|
||||
isLogin: Number,
|
||||
});
|
||||
|
||||
const emit = defineEmits();
|
||||
|
||||
function handleLogin() {
|
||||
emit("update:isLogin", 1);
|
||||
}
|
||||
|
||||
const router = useRouter();
|
||||
const { proxy } = getCurrentInstance();
|
||||
const registerRef = ref();
|
||||
const registerForm = ref({
|
||||
username: "",
|
||||
password: "",
|
||||
repeat_pass: "",
|
||||
captcha: "",
|
||||
isCheck: true,
|
||||
});
|
||||
|
||||
const equalToPassword = (rule, value, callback) => {
|
||||
if (registerForm.value.password !== value) {
|
||||
callback(new Error("两次输入的密码不一致"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
const isCheck = (rule, value, callback) => {
|
||||
if (!value) {
|
||||
callback(new Error("请阅读并勾选"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
|
||||
const registerRules = {
|
||||
username: [
|
||||
{ required: true, message: "手机号不能为空", trigger: "blur" },
|
||||
{
|
||||
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
|
||||
message: "请输入正确的手机号码",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
password: [
|
||||
{ required: true, trigger: "blur", message: "请输入您的密码" },
|
||||
{
|
||||
min: 5,
|
||||
max: 20,
|
||||
message: "用户密码长度必须介于 5 和 20 之间",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
repeat_pass: [
|
||||
{ required: true, trigger: "blur", message: "请再次输入您的密码" },
|
||||
{ required: true, validator: equalToPassword, trigger: "blur" },
|
||||
],
|
||||
// captcha: [{ required: true, trigger: "change", message: "请输入验证码" }],
|
||||
isCheck: [{ required: true, validator: isCheck, trigger: "change" }],
|
||||
};
|
||||
|
||||
const codeUrl = ref("");
|
||||
const loading = ref(false);
|
||||
|
||||
function handleRegister() {
|
||||
registerRef.value.validate((valid) => {
|
||||
if (valid) {
|
||||
loading.value = true;
|
||||
let formData = Object.assign({}, registerForm.value);
|
||||
formData.password = md5(formData.password);
|
||||
formData.repeat_pass = md5(formData.repeat_pass);
|
||||
register(formData)
|
||||
.then((res) => {
|
||||
const username = formData.username;
|
||||
ElMessageBox.alert(
|
||||
"<font color='red'>恭喜你,您的账号 " +
|
||||
username +
|
||||
" 注册成功!</font>",
|
||||
"系统提示",
|
||||
{
|
||||
dangerouslyUseHTMLString: true,
|
||||
type: "success",
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
handleLogin();
|
||||
})
|
||||
.catch(() => {});
|
||||
})
|
||||
.catch(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.title {
|
||||
margin: 0px auto 40px auto;
|
||||
text-align: center;
|
||||
color: #333333;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.register-form {
|
||||
.el-input {
|
||||
height: 38px;
|
||||
input {
|
||||
height: 38px;
|
||||
}
|
||||
}
|
||||
.input-icon {
|
||||
height: 39px;
|
||||
width: 14px;
|
||||
margin-left: 2px;
|
||||
}
|
||||
}
|
||||
.register-tip {
|
||||
font-size: 13px;
|
||||
text-align: center;
|
||||
color: #bfbfbf;
|
||||
}
|
||||
.el-register-footer {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
font-family: Arial;
|
||||
font-size: 12px;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
</style>
|
266
src/views/website/retrieve/index.vue
Normal file
266
src/views/website/retrieve/index.vue
Normal file
@ -0,0 +1,266 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-form
|
||||
v-if="step == 1"
|
||||
ref="mobileRef"
|
||||
:model="retrieveForm"
|
||||
:rules="mobileRules"
|
||||
class="retrieve-form"
|
||||
>
|
||||
<h3 class="title">
|
||||
<el-icon
|
||||
class="pointer"
|
||||
:size="18"
|
||||
color="#333333"
|
||||
@click="handleLogin"
|
||||
>
|
||||
<Back />
|
||||
</el-icon>
|
||||
<span>找回密码</span>
|
||||
</h3>
|
||||
<el-form-item prop="mobile">
|
||||
<el-input
|
||||
v-model="retrieveForm.mobile"
|
||||
type="text"
|
||||
auto-complete="off"
|
||||
placeholder="手机号"
|
||||
>
|
||||
<template #prefix
|
||||
><svg-icon icon-class="user" class="el-input__icon input-icon"
|
||||
/></template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="captcha" style="margin-bottom: 0">
|
||||
<el-input
|
||||
v-model="retrieveForm.captcha"
|
||||
auto-complete="off"
|
||||
placeholder="验证码"
|
||||
style="width: 65%"
|
||||
>
|
||||
<template #prefix
|
||||
><svg-icon icon-class="validCode" class="el-input__icon input-icon"
|
||||
/></template>
|
||||
</el-input>
|
||||
<WebGetCode v-model:mobile="retrieveForm.mobile" />
|
||||
<!-- @isSuccess="isSuccess" -->
|
||||
</el-form-item>
|
||||
<el-form-item style="width: 100%; margin-top: 35px">
|
||||
<!-- <el-button
|
||||
class="x_btns"
|
||||
size="medium"
|
||||
type="primary"
|
||||
style="width: 100%"
|
||||
@click.prevent="handleNext"
|
||||
>
|
||||
<span>下一步</span>
|
||||
</el-button> -->
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-form
|
||||
v-else
|
||||
ref="passRef"
|
||||
:model="retrieveForm"
|
||||
:rules="passRules"
|
||||
class="retrieve-form"
|
||||
>
|
||||
<h3 class="title">
|
||||
<el-icon class="pointer" :size="18" color="#333333" @click="step--">
|
||||
<Back />
|
||||
</el-icon>
|
||||
<span>找回密码</span>
|
||||
</h3>
|
||||
<el-form-item prop="password">
|
||||
<el-input
|
||||
v-model="retrieveForm.password"
|
||||
type="password"
|
||||
auto-complete="off"
|
||||
placeholder="请输入新密码"
|
||||
>
|
||||
<template #prefix
|
||||
><svg-icon icon-class="password" class="el-input__icon input-icon"
|
||||
/></template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="repeat_pass">
|
||||
<el-input
|
||||
v-model="retrieveForm.repeat_pass"
|
||||
type="password"
|
||||
auto-complete="off"
|
||||
placeholder="确认密码"
|
||||
>
|
||||
<template #prefix
|
||||
><svg-icon icon-class="password" class="el-input__icon input-icon"
|
||||
/></template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item style="width: 100%; margin-top: 35px">
|
||||
<el-button
|
||||
class="x_btns"
|
||||
size="default"
|
||||
type="primary"
|
||||
style="width: 100%"
|
||||
@click.prevent="handleRetrieve"
|
||||
>
|
||||
<span>完 成</span>
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ElMessageBox } from "element-plus";
|
||||
import { getCodeImg, resetPassword } from "@/api/login";
|
||||
import WebGetCode from "@/components/webGetCode";
|
||||
|
||||
const props = defineProps({
|
||||
isLogin: Number,
|
||||
});
|
||||
|
||||
const emit = defineEmits();
|
||||
|
||||
function handleLogin() {
|
||||
emit("update:isLogin", 1);
|
||||
}
|
||||
|
||||
const router = useRouter();
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
const retrieveForm = ref({
|
||||
mobile: "",
|
||||
password: "",
|
||||
repeat_pass: "",
|
||||
captcha: "",
|
||||
token: "",
|
||||
});
|
||||
|
||||
const equalToPassword = (rule, value, callback) => {
|
||||
if (retrieveForm.value.password !== value) {
|
||||
callback(new Error("两次输入的密码不一致"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
|
||||
const mobileRules = {
|
||||
mobile: [
|
||||
{ required: true, message: "手机号不能为空", trigger: "blur" },
|
||||
{
|
||||
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
|
||||
message: "请输入正确的手机号码",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
captcha: [{ required: true, trigger: "change", message: "请输入验证码" }],
|
||||
};
|
||||
const passRules = {
|
||||
password: [
|
||||
{ required: true, trigger: "blur", message: "请输入您的密码" },
|
||||
{
|
||||
min: 5,
|
||||
max: 20,
|
||||
message: "用户密码长度必须介于 5 和 20 之间",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
repeat_pass: [
|
||||
{ required: true, trigger: "blur", message: "请再次输入您的新密码" },
|
||||
{ required: true, validator: equalToPassword, trigger: "blur" },
|
||||
],
|
||||
};
|
||||
|
||||
const step = ref(1);
|
||||
|
||||
// function handleNext() {
|
||||
// proxy.$refs.mobileRef.validate((valid) => {
|
||||
// if (valid) {
|
||||
// codeValid(retrieveForm.value).then((res) => {
|
||||
// if (res.code == 200) {
|
||||
// retrieveForm.value.token = res.data.token;
|
||||
// step.value = 2;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
function handleRetrieve() {
|
||||
proxy.$refs.passRef.validate((valid) => {
|
||||
if (valid) {
|
||||
let formData = Object.assign({}, retrieveForm.value);
|
||||
formData.password = proxy.md5(formData.password);
|
||||
formData.repeat_pass = proxy.md5(formData.repeat_pass);
|
||||
resetPassword(formData)
|
||||
.then((res) => {
|
||||
const mobile = formData.mobile;
|
||||
ElMessageBox.alert(
|
||||
"<font color='red'>恭喜你,您的账号 " +
|
||||
mobile +
|
||||
" 修改密码成功!</font>",
|
||||
"系统提示",
|
||||
{
|
||||
dangerouslyUseHTMLString: true,
|
||||
type: "success",
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
handleLogin();
|
||||
// router.push("/login");
|
||||
})
|
||||
.catch(() => {});
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
.title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 0px auto 40px auto;
|
||||
color: #333333;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
.el-icon {
|
||||
text-align: left;
|
||||
}
|
||||
span {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.retrieve-form {
|
||||
.el-input {
|
||||
height: 38px;
|
||||
input {
|
||||
height: 38px;
|
||||
}
|
||||
}
|
||||
.input-icon {
|
||||
height: 39px;
|
||||
width: 14px;
|
||||
margin-left: 2px;
|
||||
}
|
||||
}
|
||||
.register-tip {
|
||||
font-size: 13px;
|
||||
text-align: center;
|
||||
color: #bfbfbf;
|
||||
}
|
||||
.el-register-footer {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
font-family: Arial;
|
||||
font-size: 12px;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
</style>
|
26
src/views/website/website-layout.vue
Normal file
26
src/views/website/website-layout.vue
Normal file
@ -0,0 +1,26 @@
|
||||
<template>
|
||||
<div class="index">
|
||||
<WebsiteHeader></WebsiteHeader>
|
||||
<div class="content">
|
||||
<router-view />
|
||||
</div>
|
||||
<el-backtop />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="WebsiteLayout">
|
||||
import WebsiteHeader from "@/components/WebsiteHeader";
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.index {
|
||||
position: relative;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
.content {
|
||||
width: 100%;
|
||||
padding-top: 80px;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user