123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207 |
- <template>
- <div class="page">
- <div class="page-content">
- <el-form :model="formData" :rules="rules" label-position="top">
- <el-form-item label="手机号" prop="mobile">
- <el-input
- placeholder="请输入手机号"
- maxlength="11"
- v-model="formData.mobile"
- ></el-input>
- </el-form-item>
- <el-form-item label="验证码" prop="verifyCode">
- <div class="verify-code">
- <el-input
- placeholder="请输入验证码"
- maxlength="6"
- v-model="formData.verifyCode"
- ></el-input>
- <div class="send">获取验证码</div>
- </div>
- </el-form-item>
- <el-form-item label="新密码" prop="password">
- <el-input
- type="password"
- placeholder="请输入新密码"
- v-model="formData.password"
- ></el-input>
- </el-form-item>
- <el-form-item label="确认密码" prop="confirmPwd">
- <el-input
- type="password"
- placeholder="请输入确认密码"
- v-model="formData.confirmPwd"
- ></el-input>
- </el-form-item>
- </el-form>
- <div class="submit-button">
- <div class="back btn">返回</div>
- <div class="submit btn">提交</div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import { validPassword } from '~/utils/validator'
- export default {
- layout: 'app-ross',
- data() {
- const passwordValidate = (rule, value, callback) => {
- console.log(value)
- if (validPassword(value)) {
- callback()
- } else {
- callback(new Error('密码只能包含英文大小写和数字'))
- }
- }
- const confirmPwdValide = (rule, value, callback) => {
- if (this.formData.password !== value) {
- callback(new Error('两次输入的密码不一致'))
- } else {
- callback()
- }
- }
- return {
- formData: {
- mobile: '',
- verifyCode: '',
- password: '',
- confirmPwd: '',
- },
- rules: {
- mobile: [
- { required: true, message: '请输入手机号', trigger: ['blur'] },
- ],
- verifyCode: [
- { required: true, message: '请输入验证码', trigger: ['blur'] },
- ],
- password: [
- { required: true, message: '请输入新密码', trigger: ['blur'] },
- { min: 6, message: '密码长度不能小于6位', trigger: ['blur'] },
- { validator: passwordValidate, trigger: ['blur'] },
- ],
- confirmPwd: [
- { required: true, message: '请输入确认密码', trigger: ['blur'] },
- { validator: confirmPwdValide, trigger: ['blur'] },
- ],
- },
- }
- },
- }
- </script>
- <style lang="scss" scoped>
- @media screen and (min-width: 768px) {
- .page {
- position: relative;
- min-height: calc(100vh - 80px - 80px);
- background-color: #fff;
- overflow: hidden;
- }
- .page-content {
- width: 518px;
- margin: 0 auto;
- margin-top: 100px;
- .verify-code {
- width: 100%;
- display: flex;
- align-items: center;
- .send {
- flex-shrink: 0;
- margin-left: 16px;
- height: 40px;
- text-align: center;
- line-height: 40px;
- width: 118px;
- background: #f3920d;
- border-radius: 4px;
- font-size: 16px;
- color: #fff;
- cursor: pointer;
- }
- }
- .submit-button {
- display: flex;
- align-items: center;
- justify-content: center;
- margin-top: 32px;
- .btn {
- text-align: center;
- width: 118px;
- height: 40px;
- border-radius: 4px;
- font-size: 16px;
- cursor: pointer;
- box-sizing: border-box;
- margin: 0 16px;
- &.back {
- border: 1px solid #f3920d;
- color: #f3920d;
- line-height: 38px;
- }
- &.submit {
- background: #f3920d;
- color: #fff;
- line-height: 40px;
- }
- }
- }
- }
- }
- @media screen and (max-width: 768px) {
- .page-content {
- padding: 10vw 4vw 0;
- .verify-code {
- width: 100%;
- display: flex;
- align-items: center;
- .send {
- flex-shrink: 0;
- margin-left: 2.4vw;
- height: 40px;
- text-align: center;
- line-height: 40px;
- width: 24.2vw;
- background: #f3920d;
- border-radius: 0.4vw;
- font-size: 3.4vw;
- color: #fff;
- cursor: pointer;
- }
- }
- .submit-button {
- margin-top: 20vw;
- .btn {
- text-align: center;
- height: 40px;
- border-radius: 0.4vw;
- font-size: 3.4vw;
- cursor: pointer;
- box-sizing: border-box;
- margin-bottom: 3.2vw;
- &.back {
- border: 1px solid #f3920d;
- color: #f3920d;
- line-height: 38px;
- }
- &.submit {
- background: #f3920d;
- color: #fff;
- line-height: 40px;
- }
- }
- }
- }
- }
- </style>
|