|
@@ -7,228 +7,242 @@
|
|
|
<span class="info">用户注册</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="bgImg">
|
|
|
- <div class="container pt3rem pb3rem">
|
|
|
- <el-row :gutter="20">
|
|
|
- <el-col :span="8" :offset="16">
|
|
|
- <div class="loginDiv">
|
|
|
- <div class="name"><span class="line"></span>用户注册</div>
|
|
|
- <div class="inputDiv">
|
|
|
- <img src="@assets/user.png" alt="" />
|
|
|
- <el-input
|
|
|
- class="fr"
|
|
|
- placeholder="登录账号"
|
|
|
- v-model="form.loginAccount"
|
|
|
- >
|
|
|
- </el-input>
|
|
|
- </div>
|
|
|
- <div class="inputDiv">
|
|
|
- <img src="@assets/lock.png" alt="" />
|
|
|
- <el-input
|
|
|
- class="fr"
|
|
|
- type="password"
|
|
|
- placeholder="登录密码"
|
|
|
- v-model="form.loginPassword"
|
|
|
- >
|
|
|
- </el-input>
|
|
|
- </div>
|
|
|
- <div class="inputDiv">
|
|
|
- <img src="@assets/phone.png" alt="" />
|
|
|
- <el-input
|
|
|
- class="fr"
|
|
|
- placeholder="手机号码"
|
|
|
- v-model="form.phone"
|
|
|
- >
|
|
|
- </el-input>
|
|
|
- </div>
|
|
|
- <div class="yzmDiv">
|
|
|
- <div class="inputDiv per70">
|
|
|
- <img src="@assets/yz.png" alt="" />
|
|
|
- <el-input class="fr" placeholder="验证码" style="width:88%;">
|
|
|
- </el-input>
|
|
|
- </div>
|
|
|
- <div class="yzm">获取验证码</div>
|
|
|
- </div>
|
|
|
- <div class="checkboxDiv">
|
|
|
- <el-checkbox v-model="flag">我已阅读并同意</el-checkbox
|
|
|
- ><a class="xieyi" href="javascript:;"
|
|
|
- >《用户服务协议和平台免责条款》</a
|
|
|
- >
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- <el-button class="loginBtn" @click="submit">注册</el-button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
+ <div class="bg">
|
|
|
+ <div class="container ">
|
|
|
+ <img src="@assets/loginbg.png" />
|
|
|
+ <div class="loginDiv">
|
|
|
+ <div class="x-title">用户注册</div>
|
|
|
+ <el-form :model="form" :rules="rules" class="form" ref="form">
|
|
|
+ <el-form-item class="formItem" prop="loginAccount">
|
|
|
+ <img class="icon" src="@assets/user.png" alt="" />
|
|
|
+ <el-input
|
|
|
+ v-model="form.loginAccount"
|
|
|
+ prefix-icon="x-el-icon-user"
|
|
|
+ placeholder="登录账号"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item class="formItem" prop="loginPassword">
|
|
|
+ <img class="icon" src="@assets/lock.png" alt="" />
|
|
|
+ <el-input
|
|
|
+ v-model="form.loginPassword"
|
|
|
+ prefix-icon="x-el-icon-lock"
|
|
|
+ placeholder="登录密码"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item class="formItem" prop="phone">
|
|
|
+ <img class="icon" src="@assets/phone.png" alt="" />
|
|
|
+ <el-input
|
|
|
+ v-model="form.phone"
|
|
|
+ prefix-icon="x-el-icon-lock"
|
|
|
+ placeholder="手机号码"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item class="formItem yzm" prop="validateCode">
|
|
|
+ <img class="icon" src="@assets/yz.png" alt="" />
|
|
|
+ <el-input
|
|
|
+ v-model="form.validateCode"
|
|
|
+ prefix-icon="icon-yzm"
|
|
|
+ placeholder="验证码"
|
|
|
+ />
|
|
|
+ <div class="getyzm">获取验证码</div>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item class="formItem check " prop="check">
|
|
|
+ <el-checkbox v-model="form.check">我已阅读并同意</el-checkbox
|
|
|
+ ><a class="xieyi" href="javascript:;"
|
|
|
+ >《用户服务协议和平台免责条款》</a
|
|
|
+ >
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-button class="loginBtn" @click="validate">注册</el-button>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script lang="ts">
|
|
|
import { Component, Vue, Watch } from "vue-property-decorator";
|
|
|
+import user from "@/store/modules/user";
|
|
|
import { RegAccount } from "@/utils";
|
|
|
+import { ElForm } from "element-ui/types/form";
|
|
|
@Component
|
|
|
export default class extends Vue {
|
|
|
- private flag = false;
|
|
|
- private form = {
|
|
|
+ private verifyImg = "";
|
|
|
+ private form: ILogin = {
|
|
|
loginAccount: "",
|
|
|
loginPassword: "",
|
|
|
- phone: ""
|
|
|
+ validateCode: "",
|
|
|
+ autoLogin: false
|
|
|
+ };
|
|
|
+ private rules = {
|
|
|
+ loginAccount: [
|
|
|
+ { required: true, message: "请输入用户名", trigger: "blur" },
|
|
|
+ {
|
|
|
+ validator: (rule: any, value: string, callback: any) =>
|
|
|
+ callback(
|
|
|
+ RegAccount.test(value)
|
|
|
+ ? undefined
|
|
|
+ : new Error("用户名必须为9到16位由数字字母组合")
|
|
|
+ ),
|
|
|
+ trigger: "blur"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ loginPassword: [
|
|
|
+ { required: true, message: "请输入密码", trigger: "blur" },
|
|
|
+ {
|
|
|
+ validator: (rule: any, value: string, callback: any) =>
|
|
|
+ callback(
|
|
|
+ RegAccount.test(value)
|
|
|
+ ? undefined
|
|
|
+ : new Error("密码必须为9到16位由数字字母组合")
|
|
|
+ ),
|
|
|
+ trigger: "blur"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ phone: [
|
|
|
+ { required: true, message: "请输入手机号码", trigger: "blur" },
|
|
|
+ {
|
|
|
+ validator: (rule: any, value: string, callback: any) =>
|
|
|
+ callback(
|
|
|
+ /^1[3|4|5|7|8][0-9]\d{8}$/.test(value)
|
|
|
+ ? undefined
|
|
|
+ : new Error("请输入正确的手机号")
|
|
|
+ ),
|
|
|
+ trigger: "blur"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ validateCode: [
|
|
|
+ { required: true, message: "请输入验证码", trigger: "blur" }
|
|
|
+ ],
|
|
|
+ check: [
|
|
|
+ {
|
|
|
+ validator: (rule: any, value: boolean, callback: any) =>
|
|
|
+ callback(value ? undefined : new Error("请同意免责条款")),
|
|
|
+ trigger: "blur"
|
|
|
+ }
|
|
|
+ ]
|
|
|
};
|
|
|
|
|
|
+ validate() {
|
|
|
+ (this.$refs.form as ElForm).validate(x => x && this.submit());
|
|
|
+ }
|
|
|
+
|
|
|
async submit() {
|
|
|
- if (!RegAccount.test(this.form.loginAccount))
|
|
|
- return this.$message.error("请输入9到16位由数字字母组合的账号");
|
|
|
- if (!RegAccount.test(this.form.loginPassword))
|
|
|
- return this.$message.error("请输入9到16位由数字字母组合的密码");
|
|
|
- if (!/^1[3456789]\d{9}$/.test(this.form.phone))
|
|
|
- return this.$message.error("请正确输入手机号");
|
|
|
- if (!this.flag) return this.$message.error("请同意服务条款");
|
|
|
const [err] = await this.$post("/member/info/userRegister", this.form);
|
|
|
if (err) return;
|
|
|
this.$message.success("注册成功 请登陆");
|
|
|
+ (this.$refs.form as ElForm).resetFields();
|
|
|
this.$router.push("/login");
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
-.topDiv {
|
|
|
- height: 9rem;
|
|
|
- line-height: 9rem;
|
|
|
- background: #fff;
|
|
|
- .title {
|
|
|
- font-size: 2.2rem;
|
|
|
- font-weight: bold;
|
|
|
- color: #fd5522;
|
|
|
- }
|
|
|
- .line {
|
|
|
- display: inline-block;
|
|
|
- height: 3rem;
|
|
|
- width: 0.1rem;
|
|
|
- background: #e5e5e5;
|
|
|
- margin: 0 2rem;
|
|
|
- vertical-align: middle;
|
|
|
- }
|
|
|
- .info {
|
|
|
- font-size: 1.8rem;
|
|
|
- font-weight: bold;
|
|
|
- color: #666;
|
|
|
- }
|
|
|
-}
|
|
|
-.loginDiv {
|
|
|
- background: #fff;
|
|
|
- padding: 1.6rem;
|
|
|
- box-sizing: border-box;
|
|
|
- border-radius: 0.4rem;
|
|
|
- box-shadow: 2px 2px 12px #ddd;
|
|
|
- .name {
|
|
|
- height: 3rem;
|
|
|
- line-height: 3rem;
|
|
|
- font-size: 1.6rem;
|
|
|
- color: #333;
|
|
|
- position: relative;
|
|
|
- .line {
|
|
|
- display: inline-block;
|
|
|
- height: 1.8rem;
|
|
|
- width: 0.4rem;
|
|
|
- background: #fd5522;
|
|
|
- position: absolute;
|
|
|
- left: -1.6rem;
|
|
|
- top: 0.6rem;
|
|
|
- }
|
|
|
- }
|
|
|
- .inputDiv {
|
|
|
- height: 4rem;
|
|
|
- line-height: 4rem;
|
|
|
- border: 0.1rem solid #acacac;
|
|
|
- border-radius: 0.4rem;
|
|
|
- margin-top: 2rem;
|
|
|
- img {
|
|
|
- height: 1.6rem;
|
|
|
- vertical-align: middle;
|
|
|
- margin-left: 0.6rem;
|
|
|
- }
|
|
|
- }
|
|
|
- .yzmDiv {
|
|
|
- overflow: hidden;
|
|
|
- .yzm {
|
|
|
- height: 4rem;
|
|
|
- line-height: 4rem;
|
|
|
- width: 28%;
|
|
|
- font-size: 1.4rem;
|
|
|
+.bg-F5 {
|
|
|
+ .topDiv {
|
|
|
+ height: 9rem;
|
|
|
+ line-height: 9rem;
|
|
|
+ background: #fff;
|
|
|
+ .title {
|
|
|
+ font-size: 2.2rem;
|
|
|
+ font-weight: bold;
|
|
|
color: #fd5522;
|
|
|
- text-align: center;
|
|
|
- float: right;
|
|
|
- background: #ffded5;
|
|
|
- border-radius: 0.4rem;
|
|
|
- margin-top: 2rem;
|
|
|
}
|
|
|
- }
|
|
|
- .checkboxDiv {
|
|
|
- margin-top: 2rem;
|
|
|
- }
|
|
|
-
|
|
|
- .loginBtn {
|
|
|
- width: 100%;
|
|
|
- background: #fd5522;
|
|
|
- color: #fff;
|
|
|
- border-color: #fd5522;
|
|
|
- margin-top: 2rem;
|
|
|
- }
|
|
|
- .xieyi {
|
|
|
- color: #fd5522;
|
|
|
- }
|
|
|
-
|
|
|
- .newDiv {
|
|
|
- height: 4rem;
|
|
|
- line-height: 4rem;
|
|
|
- text-align: right;
|
|
|
- font-size: 1.4rem;
|
|
|
.line {
|
|
|
- height: 1rem;
|
|
|
+ display: inline-block;
|
|
|
+ height: 3rem;
|
|
|
width: 0.1rem;
|
|
|
background: #e5e5e5;
|
|
|
- margin: 0 1rem;
|
|
|
+ margin: 0 2rem;
|
|
|
vertical-align: middle;
|
|
|
- display: inline-block;
|
|
|
}
|
|
|
- .forgetPass {
|
|
|
+ .info {
|
|
|
+ font-size: 1.8rem;
|
|
|
+ font-weight: bold;
|
|
|
color: #666;
|
|
|
}
|
|
|
- .register {
|
|
|
- color: #fd5522;
|
|
|
+ }
|
|
|
+
|
|
|
+ .bg {
|
|
|
+ background: #84ccc9;
|
|
|
+ padding: 75px 0;
|
|
|
+ .container {
|
|
|
+ overflow: hidden;
|
|
|
+ > img {
|
|
|
+ margin-left: 180px;
|
|
|
+ margin-top: 50px;
|
|
|
+ float: left;
|
|
|
+ }
|
|
|
+ .loginDiv {
|
|
|
+ // width: 320px;
|
|
|
+ // height: 338px;
|
|
|
+ margin-left: 218px;
|
|
|
+ float: left;
|
|
|
+ background: #fff;
|
|
|
+
|
|
|
+ box-sizing: border-box;
|
|
|
+ border-radius: 0.4rem;
|
|
|
+ box-shadow: 2px 2px 12px #ddd;
|
|
|
+ .x-title {
|
|
|
+ margin-top: 20px;
|
|
|
+ }
|
|
|
+ .form {
|
|
|
+ padding: 15px 20px;
|
|
|
+ .formItem {
|
|
|
+ height: 40px;
|
|
|
+ line-height: 40px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ border-radius: 4px;
|
|
|
+ margin-bottom: 20px;
|
|
|
+ position: relative;
|
|
|
+ .icon {
|
|
|
+ position: absolute;
|
|
|
+ left: 10px;
|
|
|
+ top: 50%;
|
|
|
+ transform: translateY(-50%);
|
|
|
+ z-index: 1;
|
|
|
+ width: 12px;
|
|
|
+ }
|
|
|
+ &.check {
|
|
|
+ height: auto;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .loginBtn {
|
|
|
+ width: 100%;
|
|
|
+ background: #fd5522;
|
|
|
+ color: #fff;
|
|
|
+ border-color: #fd5522;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .getyzm {
|
|
|
+ height: 40px;
|
|
|
+ line-height: 40px;
|
|
|
+ width: 100px;
|
|
|
+ font-size: 14px;
|
|
|
+ color: #fd5522;
|
|
|
+ text-align: center;
|
|
|
+ float: right;
|
|
|
+ background: #ffded5;
|
|
|
+ border-radius: 0.4rem;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ .xieyi {
|
|
|
+ color: #fd5522;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-.bgImg {
|
|
|
- background: url("~@assets/loginbg.png") no-repeat;
|
|
|
- background-size: 100% 100%;
|
|
|
-}
|
|
|
-.bg-F5 {
|
|
|
- background: #f5f5f5;
|
|
|
-}
|
|
|
-.pt3rem {
|
|
|
- padding-top: 3rem;
|
|
|
-}
|
|
|
-.pb3rem {
|
|
|
- padding-bottom: 3rem;
|
|
|
-}
|
|
|
-.fr {
|
|
|
- float: right;
|
|
|
-}
|
|
|
-.per70 {
|
|
|
- width: 70%;
|
|
|
- float: left;
|
|
|
-}
|
|
|
</style>
|
|
|
<style lang="scss">
|
|
|
-.inputDiv .el-input {
|
|
|
- width: 92%;
|
|
|
- float: right;
|
|
|
- .el-input__inner {
|
|
|
- border: 0;
|
|
|
- padding-left: 0.6rem;
|
|
|
+.formItem.yzm {
|
|
|
+ .el-input {
|
|
|
+ width: 200px;
|
|
|
+ }
|
|
|
+ .verifyImg {
|
|
|
+ height: 40px;
|
|
|
+ width: 108px;
|
|
|
+ margin-left: 10px;
|
|
|
+ vertical-align: middle;
|
|
|
}
|
|
|
}
|
|
|
</style>
|