소스 검색

登录增加注册入口

natasha 20 시간 전
부모
커밋
96ae92b8f7
2개의 변경된 파일30개의 추가작업 그리고 3개의 파일을 삭제
  1. 9 2
      src/views/login.vue
  2. 21 1
      src/views/register.vue

+ 9 - 2
src/views/login.vue

@@ -73,7 +73,8 @@
               ></el-checkbox
             >
           </el-checkbox-group>
-          <a class="forgotPwd" @click="forgotPwd">忘记密码?</a>
+          <a class="forgotPwd" @click="forgotPwd">忘记密码?</a>|&nbsp;
+          <a class="forgotPwd" @click="handleLink('register')">注册</a>
         </el-form-item>
         <el-form-item class="btn-box">
           <el-button
@@ -142,7 +143,8 @@
               ></el-checkbox
             >
           </el-checkbox-group>
-          <a class="forgotPwd" @click="forgotPwd">忘记密码?</a>
+          <a class="forgotPwd" @click="forgotPwd">忘记密码?</a> |&nbsp;
+          <a class="forgotPwd" @click="handleLink('register')">注册</a>
         </el-form-item>
         <el-form-item class="btn-box">
           <el-button
@@ -398,6 +400,11 @@ export default {
     cancelFot() {
       this.forgotPwdFlag = false;
     },
+    handleLink(link) {
+      this.$router.push({
+        path: "/" + link,
+      });
+    },
   },
   mounted() {},
 };

+ 21 - 1
src/views/register.vue

@@ -12,7 +12,7 @@
         >
       </div>
     </div>
-    <div class="contents">
+    <div class="contents" :class="[isPhone ? 'contents-phone' : '']">
       <h2>注册</h2>
       <el-form
         :model="registerForm"
@@ -20,6 +20,7 @@
         ref="registerFormUser"
         label-width="100px"
         class="registerForm"
+        :label-position="isPhone ? 'top' : ''"
       >
         <el-divider content-position="left">基本信息</el-divider>
         <el-form-item label="头像" prop="cover_image_url">
@@ -421,6 +422,7 @@ export default {
           children: [],
         },
       ],
+      isPhone: false,
     };
   },
   //计算属性 类似于data概念
@@ -600,6 +602,8 @@ export default {
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   async created() {
+    const regExp = /Android|webOS|iPhone|BlackBerry|IEMobile|Opera Mini/i;
+    this.isPhone = regExp.test(navigator.userAgent) && window.innerWidth < 860;
     if (this.config) {
       let arr = this.config.split("&&&");
       this.userBg = arr[1] ? arr[1] : "rgba(0, 0, 0, 0.24)";
@@ -640,6 +644,14 @@ export default {
   margin: 72px auto;
   background: #ffffff;
   padding: 64px 200px;
+  &-phone {
+    padding: 20px;
+    width: 100%;
+    .registerForm .el-input,
+    .registerForm .el-textarea {
+      width: 100%;
+    }
+  }
   h2 {
     font-weight: 500;
     font-size: 20px;
@@ -780,6 +792,14 @@ export default {
     border-color: #165dff;
   }
 }
+.contents-phone {
+  .registerForm {
+    .el-input,
+    .el-textarea {
+      width: 100%;
+    }
+  }
+}
 .login-userAgree {
   .el-dialog {
     height: 70%;