<template>
<div>
<div class="register-container">
<div class="register-swiper3">
<div class="swiper-container mySwiper3">
<div class="swiper-wrapper">
<div
class="swiper-slide"
v-for="(item, index) in swiperList"
:key="item.id"
>
<div>
<el-image :src="item.url" fit="cover"></el-image>
</div>
</div>
</div>
<!-- Add Pagination -->
<div class="swiper-pagination"></div>
<!-- Add Arrows -->
<div class="swiper-button-next">
<span class="icon iconfont icon-jiantou18"></span>
</div>
<div class="swiper-button-prev">
<span class="icon iconfont icon-jiantou39"></span>
</div>
</div>
</div>
<el-form
v-if="pageFlag == 'register'"
ref="ruleForm"
class="rgs-form animate__animated animate__fadeIn"
:model="ruleForm"
:rules="rules"
>
<div class="rgs-form2">
<div class="title">陶瓷爱好者交流平台</div>
<el-form-item class="list-item" v-if="tableName == 'yonghu'">
<div
class="lable"
:class="changeRules('yonghuming') ? 'required' : ''"
>
用户名:
</div>
<el-input
v-model="ruleForm.yonghuming"
autocomplete="off"
placeholder="用户名"
type="text"
/>
</el-form-item>
<el-form-item class="list-item" v-if="tableName == 'yonghu'">
<div class="lable" :class="changeRules('mima') ? 'required' : ''">
密码:
</div>
<el-input
v-model="ruleForm.mima"
autocomplete="off"
placeholder="密码"
type="password"
/>
</el-form-item>
<el-form-item class="list-item" v-if="tableName == 'yonghu'">
<div class="lable" :class="changeRules('mima') ? 'required' : ''">
确认密码:
</div>
<el-input
v-model="ruleForm.mima2"
autocomplete="off"
placeholder="确认密码"
type="password"
/>
</el-form-item>
<el-form-item class="list-item" v-if="tableName == 'yonghu'">
<div
class="lable"
:class="changeRules('nicheng') ? 'required' : ''"
>
昵称:
</div>
<el-input
v-model="ruleForm.nicheng"
autocomplete="off"
placeholder="昵称"
type="text"
/>
</el-form-item>
<el-form-item class="list-item" v-if="tableName == 'yonghu'">
<div
class="lable"
:class="changeRules('xingbie') ? 'required' : ''"
>
性别:
</div>
<el-select v-model="ruleForm.xingbie" placeholder="请选择性别">
<el-option
v-for="(item, index) in yonghuxingbieOptions"
v-bind:key="index"
:label="item"
:value="item"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item class="list-item" v-if="tableName == 'yonghu'">
<div
class="lable"
:class="changeRules('nianling') ? 'required' : ''"
>
年龄:
</div>
<el-input
v-model.number="ruleForm.nianling"
autocomplete="off"
placeholder="年龄"
type="text"
/>
</el-form-item>
<el-form-item class="list-item" v-if="tableName == 'yonghu'">
<div class="lable" :class="changeRules('shouji') ? 'required' : ''">
手机:
</div>
<el-input
v-model="ruleForm.shouji"
autocomplete="off"
placeholder="手机"
type="text"
/>
</el-form-item>
<el-form-item class="list-item" v-if="tableName == 'yonghu'">
<div
class="lable"
:class="changeRules('touxiang') ? 'required' : ''"
>
头像:
</div>
<file-upload
tip="点击上传头像"
action="file/upload"
:limit="3"
:multiple="true"
:fileUrls="ruleForm.touxiang ? ruleForm.touxiang : ''"
@change="yonghutouxiangUploadChange"
></file-upload>
</el-form-item>
<div class="register-btn">
<div class="register-btn1">
<button type="button" class="r-btn" @click="login()">注册</button>
</div>
<div class="register-btn2">
<div class="r-login" @click="close()">已有账号,直接登录</div>
</div>
</div>
</div>
</el-form>
</div>
</div>
</template>
<script>
import "animate.css";
import Swiper from "swiper";
export default {
data() {
return {
ruleForm: {},
forgetForm: {},
pageFlag: "",
tableName: "",
rules: {},
yonghuxingbieOptions: [],
swiperList: [
{
name: "003.jpg",
uid: 1728616881522,
url: "http://codegen.caihongy.cn/20241011/f26bb7ee188744ec8dccf4684bd7d560.jpg",
status: "success",
},
{
name: "001.jpg",
uid: 1728616885258,
url: "http://codegen.caihongy.cn/20241011/909e2931cae842f0b1bfc33ea25ad3c4.jpg",
status: "success",
},
{
name: "002.jpg",
uid: 1728616888937,
url: "http://codegen.caihongy.cn/20241011/3bddfac695c84447af0a76774373690b.jpg",
status: "success",
},
],
};
},
mounted() {
setTimeout(() => {
new Swiper(".mySwiper3", {
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
pagination: { el: ".swiper-pagination", clickable: true },
autoplay: { delay: 3000, disableOnInteraction: false },
effect: "fade",
});
}, 500);
this.pageFlag = this.$route.query.pageFlag;
if (this.$route.query.pageFlag == "register") {
let table = this.$storage.get("loginTable");
this.tableName = table;
if (this.tableName == "yonghu") {
this.ruleForm = {
yonghuming: "",
mima: "",
nicheng: "",
xingbie: "",
nianling: "",
shouji: "",
gerenjianjie: "",
touxiang: "",
};
}
if ("yonghu" == this.tableName) {
this.rules.yonghuming = [
{ required: true, message: "请输入用户名", trigger: "blur" },
];
}
if ("yonghu" == this.tableName) {
this.rules.mima = [
{ required: true, message: "请输入密码", trigger: "blur" },
];
}
if ("yonghu" == this.tableName) {
this.rules.nicheng = [
{ required: true, message: "请输入昵称", trigger: "blur" },
];
}
if ("yonghu" == this.tableName) {
this.rules.xingbie = [
{ required: true, message: "请输入性别", trigger: "blur" },
];
}
if ("yonghu" == this.tableName) {
this.rules.nianling = [
{ required: true, message: "请输入年龄", trigger: "blur" },
];
}
if ("yonghu" == this.tableName) {
this.rules.shouji = [
{ required: true, message: "请输入手机", trigger: "blur" },
];
}
this.yonghuxingbieOptions = "男,女".split(",");
}
},
created() {},
destroyed() {},
methods: {
changeRules(name) {
if (this.rules[name]) {
return true;
}
return false;
},
// 获取uuid
getUUID() {
return new Date().getTime();
},
close() {
this.$router.push({ path: "/login" });
},
yonghutouxiangUploadChange(fileUrls) {
this.ruleForm.touxiang = fileUrls;
},
// 多级联动参数
// 注册
login() {
var url = this.tableName + "/register";
if (!this.ruleForm.yonghuming && `yonghu` == this.tableName) {
this.$message.error(`用户名不能为空`);
return;
}
if (!this.ruleForm.mima && `yonghu` == this.tableName) {
this.$message.error(`密码不能为空`);
return;
}
if (
this.ruleForm.mima != this.ruleForm.mima2 &&
`yonghu` == this.tableName
) {
this.$message.error(`两次密码输入不一致`);
return;
}
if (!this.ruleForm.nicheng && `yonghu` == this.tableName) {
this.$message.error(`昵称不能为空`);
return;
}
if (!this.ruleForm.xingbie && `yonghu` == this.tableName) {
this.$message.error(`性别不能为空`);
return;
}
if (!this.ruleForm.nianling && `yonghu` == this.tableName) {
this.$message.error(`年龄不能为空`);
return;
}
if (
`yonghu` == this.tableName &&
this.ruleForm.nianling &&
!this.$validate.isIntNumer(this.ruleForm.nianling)
) {
this.$message.error(`年龄应输入整数`);
return;
}
if (!this.ruleForm.shouji && `yonghu` == this.tableName) {
this.$message.error(`手机不能为空`);
return;
}
if (
`yonghu` == this.tableName &&
this.ruleForm.shouji &&
!this.$validate.isMobile(this.ruleForm.shouji)
) {
this.$message.error(`手机应输入手机格式`);
return;
}
if (this.ruleForm.touxiang != null) {
this.ruleForm.touxiang = this.ruleForm.touxiang.replace(
new RegExp(this.$base.url, "g"),
""
);
}
this.$http({
url: url,
method: "post",
data: this.ruleForm,
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: "注册成功",
type: "success",
duration: 1500,
onClose: () => {
this.$router.replace({ path: "/login" });
},
});
} else {
this.$message.error(data.msg);
}
});
},
},
};
</script>
<style lang="scss" scoped>
.register-container {
position: relative;
background-repeat: no-repeat;
background-size: cover;
background: url(http://codegen.caihongy.cn/20240929/ec5c51f1ce0845289dd993d890db8d68.png)
right top/50% 100% no-repeat;
display: block;
width: 100%;
min-height: 100vh;
justify-content: flex-start;
align-items: center;
background-position: center center;
.register-swiper3 {
margin: 0 auto;
z-index: auto;
top: 0;
left: 0;
width: 100vw;
position: fixed;
height: 100vh;
.swiper-container {
.swiper-slide {
div {
width: 100%;
height: 100vh;
.el-image {
object-fit: cover;
width: 100%;
height: 100vh;
}
}
}
.swiper-pagination {
left: 0;
bottom: 10px;
width: 100%;
::v-deep span.swiper-pagination-bullet {
border-radius: 100%;
margin: 0 4px;
background: #000;
display: inline-block;
width: 8px;
opacity: 0.2;
height: 8px;
}
::v-deep span.swiper-pagination-bullet:hover {
background: #fff;
opacity: 1;
}
::v-deep span.swiper-pagination-bullet.swiper-pagination-bullet-active {
background: #fff;
opacity: 1;
}
}
.swiper-button-next {
margin: -12px 0 0;
top: 50%;
width: 24px;
height: 24px;
.iconfont {
color: #fff;
width: 24px;
font-size: 24px;
height: 24px;
}
}
.swiper-button-prev {
margin: -12px 0 0;
top: 50%;
width: 24px;
height: 24px;
.iconfont {
color: #fff;
width: 24px;
font-size: 24px;
height: 24px;
}
}
.swiper-button-prev:after {
display: none;
}
.swiper-button-next:after {
display: none;
}
}
}
.rgs-form {
.rgs-form2 {
width: 100%;
}
padding: 40px 140px 40px;
margin: 0;
z-index: 1000;
display: flex;
min-height: 100vh;
border-radius: 0;
box-shadow: inset 0px 0px 0px 0px #000;
flex-direction: column;
background: #eff4ff;
width: 50%;
justify-content: center;
align-items: center;
position: relative;
height: auto;
.title {
padding: 0 40px;
margin: 0 0 60px 0;
color: #000;
background: none;
font-weight: 600;
width: 100%;
font-size: 28px;
line-height: 40px;
text-align: center;
}
.list-item {
padding: 0 0 0 0px;
margin: 0 0 10px;
width: 100%;
position: relative;
height: auto;
::v-deep .el-form-item__content {
display: flex;
align-items: flex-start;
}
.lable {
padding: 0;
color: #000000;
width: 120px;
font-size: 16px;
line-height: 34px;
text-align: left;
}
.el-input {
width: calc(100% - 120px);
}
.el-input ::v-deep .el-input__inner {
border: 0px solid #efeff7;
border-radius: 0px;
padding: 0 10px;
color: #666;
width: 100%;
font-size: 14px;
height: 44px;
}
.el-input ::v-deep .el-input__inner:focus {
border: 0px solid #efeff7;
border-radius: 0px;
padding: 0 10px;
color: #000;
width: 100%;
font-size: 14px;
height: 44px;
}
.el-select {
width: calc(100% - 120px);
}
.el-select ::v-deep .el-input__inner {
border: 0px solid #efeff7;
border-radius: 0px;
padding: 0 10px;
color: #666;
width: 100%;
font-size: 14px;
height: 44px;
}
.el-select ::v-deep .el-input__inner:focus {
border: 0px solid #efeff7;
border-radius: 0;
padding: 0 10px;
color: #000;
width: 100%;
font-size: 14px;
height: 44px;
}
.el-date-editor {
width: calc(100% - 120px);
}
.el-date-editor ::v-deep .el-input__inner {
border: 0px solid #efeff7;
border-radius: 0;
padding: 0 10px 0 30px;
color: #666;
width: 100%;
font-size: 14px;
height: 44px;
}
.el-date-editor ::v-deep .el-input__inner:focus {
border: 0px solid #efeff7;
border-radius: 0;
padding: 0 10px 0 30px;
color: #000;
width: 100%;
font-size: 14px;
height: 44px;
}
.el-date-editor.el-input {
width: 100%;
}
::v-deep .el-upload--picture-card {
background: transparent;
border: 0;
border-radius: 0;
width: auto;
height: auto;
line-height: initial;
vertical-align: middle;
}
::v-deep .upload .upload-img {
border: 1px solid #efeff7;
cursor: pointer;
border-radius: 0px;
color: #999;
background: #fff;
width: 110px;
font-size: 24px;
line-height: 60px;
text-align: center;
height: 60px;
}
::v-deep .el-upload-list .el-upload-list__item {
border: 1px solid #efeff7;
cursor: pointer;
border-radius: 0px;
color: #999;
background: #fff;
width: 110px;
font-size: 24px;
line-height: 60px;
text-align: center;
height: 60px;
}
::v-deep .el-upload .el-icon-plus {
border: 1px solid #efeff7;
cursor: pointer;
border-radius: 0px;
color: #999;
background: #fff;
width: 110px;
font-size: 24px;
line-height: 60px;
text-align: center;
height: 60px;
}
::v-deep .el-upload__tip {
margin: 10px 0 0;
color: #999;
font-size: 12px;
line-height: 1.5;
}
::v-deep .el-input__inner::placeholder {
color: #999;
font-size: 14px;
}
.required {
position: relative;
}
.required::after {
color: red;
left: 0;
position: inherit;
content: "*";
order: -1;
}
.editor {
background: #fff;
width: 100%;
height: auto;
}
.editor > .avatar-uploader {
line-height: 0;
height: 0;
}
}
.list-item.email {
input {
border: 0px solid #efeff7;
border-radius: 0;
padding: 0 10px;
margin: 0;
color: #666;
background: #fff;
flex: 1;
width: 100%;
font-size: 14px;
height: 44px;
}
input:focus {
border: 1px solid #efeff7;
border-radius: 4px 0 0 4px;
padding: 0 10px;
color: #666;
width: 100%;
font-size: 14px;
height: 38px;
}
input::placeholder {
color: #999;
font-size: 14px;
}
button {
border: 0px solid #efeff7;
cursor: pointer;
border-radius: 0;
padding: 0;
margin: 0;
color: #fff;
background: #7ea0f6;
width: 110px;
font-size: 14px;
height: 44px;
}
button:hover {
opacity: 0.8;
}
}
.register-btn {
width: 100%;
}
.register-btn1 {
display: flex;
width: 100%;
justify-content: center;
}
.register-btn2 {
width: 100%;
}
.r-btn {
border: 0px solid rgba(0, 0, 0, 1);
cursor: pointer;
border-radius: 30px;
padding: 0 10px;
margin: 0 auto 50px;
color: #fff;
background: #7ea0f6;
font-weight: 600;
width: 80%;
font-size: 24px;
min-width: 68px;
height: 60px;
}
.r-btn:hover {
border: 0px solid rgba(0, 0, 0, 1);
opacity: 0.8;
}
.r-login {
border: 0;
cursor: pointer;
border-radius: 0;
padding: 0;
margin: 0 10px 10px 0;
color: #505050;
background: none;
width: 100%;
font-size: 14px;
text-align: center;
height: 34px;
}
.r-login:hover {
opacity: 1;
}
}
}
::-webkit-scrollbar {
display: none;
}
</style>
不显示输入框
最新发布