123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269 |
- <template>
- <div class="bg-F5">
- <div class="topDiv">
- <div class="container">
- <span class="title">{{ $t("title") }}</span>
- <span class="line"></span>
- <span class="info">{{
- $t("page.views.account.findPassword.title")
- }}</span>
- </div>
- </div>
- <div class="bg">
- <div class="container ">
- <img :src="require(`@assets/loginbg_${$i18n.locale}.png`)" />
- <div class="loginDiv">
- <div class="x-title">
- {{ $t("page.views.account.findPassword.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="
- `${$t(`inputPlaceholder`)}${$t(`form.loginAccount`)}`
- "
- />
- </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="`${$t(`inputPlaceholder`)}${$t(`form.phone`)}`"
- />
- </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="
- `${$t(`inputPlaceholder`)}${$t(`form.validateCode`)}`
- "
- />
- <div class="getyzm">{{ $t("form.getValidateCode") }}</div>
- </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="
- `${$t(`inputPlaceholder`)}${$t(
- `page.views.account.findPassword.loginPassword`
- )}`
- "
- show-password
- />
- </el-form-item>
- <el-button class="loginBtn" @click="validate">{{
- $t("page.views.account.findPassword.submit")
- }}</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";
- import i18n from "@/lang";
- @Component
- export default class extends Vue {
- private verifyImg = "";
- private form = {
- loginAccount: "",
- loginPassword: "",
- validateCode: "",
- phone: ""
- };
- private rules = {
- loginAccount: [
- {
- required: true,
- message: `${i18n.t(`inputPlaceholder`)}${i18n.t(`form.loginAccount`)}`,
- trigger: "blur"
- },
- {
- validator: (rule: any, value: string, callback: any) =>
- callback(
- RegAccount.test(value)
- ? undefined
- : new Error(`${i18n.t("form.RegAccount")}`)
- ),
- trigger: "blur"
- }
- ],
- loginPassword: [
- {
- required: true,
- message: `${i18n.t(`inputPlaceholder`)}${i18n.t(
- `page.views.account.findPassword.loginPassword`
- )}`,
- trigger: "blur"
- },
- {
- validator: (rule: any, value: string, callback: any) =>
- callback(
- RegAccount.test(value)
- ? undefined
- : new Error(`${i18n.t("form.RegAccount")}`)
- ),
- trigger: "blur"
- }
- ],
- phone: [
- {
- required: true,
- message: `${i18n.t(`inputPlaceholder`)}${i18n.t(`form.phone`)}`,
- 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(`${i18n.t("form.validatePhone")}`)
- ),
- trigger: "blur"
- }
- ],
- validateCode: [
- {
- required: true,
- message: `${i18n.t(`inputPlaceholder`)}${i18n.t(`form.validateCode`)}`,
- trigger: "blur"
- }
- ]
- };
- validate() {
- (this.$refs.form as ElForm).validate(x => x && this.submit());
- }
- async submit() {
- const [err] = await this.$post("/member/info/resetPassword", this.form);
- if (err) return;
- this.$message.success(`${this.$i18n.t("message.success.findPassword")}`);
- (this.$refs.form as ElForm).resetFields();
- this.$router.push("/login");
- }
- }
- </script>
- <style lang="scss" scoped>
- .bg-F5 {
- .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;
- }
- }
- .bg {
- background: #84ccc9;
- padding: 75px 0;
- .container {
- overflow: hidden;
- > img {
- margin-left: 180px;
- margin-top: 50px;
- float: left;
- }
- .loginDiv {
- // width: 320px;
- // height: 338px;
- overflow: hidden;
- 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;
- }
- }
- .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;
- }
- }
- }
- }
- </style>
- <style lang="scss">
- .formItem.yzm {
- .el-input {
- width: 200px;
- }
- .verifyImg {
- height: 40px;
- width: 108px;
- margin-left: 10px;
- vertical-align: middle;
- }
- }
- </style>
|