Quellcode durchsuchen

登录页面为jeecg

yuhan vor 4 Monaten
Ursprung
Commit
82d4206e5a
3 geänderte Dateien mit 270 neuen und 318 gelöschten Zeilen
  1. 122 125
      src/components/layouts/UserLayout.vue
  2. 7 51
      src/views/user/Login.vue
  3. 141 142
      src/views/user/LoginAccount.vue

+ 122 - 125
src/components/layouts/UserLayout.vue

@@ -1,22 +1,39 @@
 <template>
-  <div class="iot-login">
-    <!-- 头部 -->
-    <div class="login-header">
-      <div class="top-line"></div>
-      <div class="iotmenu-header-content">
-        <span class="iotmenu-header-text">联锁管理平台</span>
+  <div id="userLayout" :class="['user-layout-wrapper', device]">
+    <div class="container">
+      <div class="top">
+        <div class="header">
+          <a href="/">
+            <!-- 修改框架 -->
+            <!-- <img src="~@/assets/logo.png" class="logo" alt="logo"> -->
+            <!-- <img src="~@/assets/logo.svg" class="logo" alt="logo"> -->
+            <!-- 修改框架 -->
+            <span class="title">联锁管理平台</span>
+            <!-- <span class="title">Jeecg Boot</span> -->
+          </a>
+        </div>
+        <div class="desc">
+          <!-- 修改框架 -->
+          <!-- Jeecg Boot 是中国最具影响力的 企业级 低代码平台 -->
+        </div>
       </div>
-    </div>
-    <!--  -->
-    <div class="login-content">
-      <div class="login-box">
-        <route-view></route-view>
+
+      <route-view></route-view>
+
+      <div class="footer">
+        <!-- 修改框架 -->
+        <!-- <div class="links">
+          <a href="http://doc.jeecg.com" target="_blank">帮助</a>
+          <a href="https://github.com/zhangdaiscott/jeecg-boot" target="_blank">隐私</a>
+          <a href="https://github.com/zhangdaiscott/jeecg-boot/blob/master/LICENSE" target="_blank">条款</a>
+        </div> -->
+        <div class="copyright">
+          <!-- 修改框架 -->
+          <!-- Copyright &copy; 2024 山东研讯智能科技有限公司 出品 -->
+          <!-- Copyright &copy; 2019 <a href="http://www.jeecg.com" target="_blank">JEECG开源社区</a> 出品 -->
+        </div>
       </div>
     </div>
-    <!-- 尾部 -->
-     <div class="login-footer">
-      <div class="login-footer-text">© 1983-2024 Advantech Co., Ltd.</div>
-     </div>
   </div>
 </template>
 
@@ -40,122 +57,102 @@
   }
 </script>
 
-<style lang="less">
-@iotTpmFontColor: #323233;
-@iotTpmContentBg: #FAFAFA;
+<style lang="less" scoped>
+  #userLayout.user-layout-wrapper {
+    height: 100%;
 
-@iotHContentHeight: 48px;
-@iotHLineHeight: 8px;
-@iotHHeight: 56px;
+    &.mobile {
+      .container {
+        .main {
+          max-width: 368px;
+          width: 98%;
+        }
+      }
+    }
 
-.iot-login{
-  .login-header{
-    height: @iotHHeight !important;
-    .top-line{
+    .container {
       width: 100%;
-      height: @iotHLineHeight;
-      background: linear-gradient(90deg,#019ff3,#004280);
-    }
-    .iotmenu-header-content{
-      height: @iotHContentHeight !important;
-      line-height: @iotHContentHeight !important;
-      background-color: #fff !important;
-      color: rgba(0,0,0,65) !important;
-      box-shadow: 0 2px 4px 0 rgba(50,50,51,.5) !important;
-      z-index: 999 !important;
-      padding: 0 !important;
+      min-height: 100%;
+      background: #f0f2f5 url(~@/assets/background.svg) no-repeat 50%;
+      background-size: 100%;
+      padding: 110px 0 144px;
       position: relative;
-      .user-wrapper{
-        .avatar{
-          margin: 0 10px 0 0 !important;
+
+      a {
+        text-decoration: none;
+      }
+
+      .top {
+        text-align: center;
+
+        .header {
+          height: 44px;
+          line-height: 44px;
+
+          .badge {
+            position: absolute;
+            display: inline-block;
+            line-height: 1;
+            vertical-align: middle;
+            margin-left: -12px;
+            margin-top: -10px;
+            opacity: 0.8;
+          }
+
+          .logo {
+            height: 44px;
+            vertical-align: top;
+            margin-right: 16px;
+            border-style: none;
+          }
+
+          .title {
+            font-size: 33px;
+            color: rgba(0, 0, 0, .85);
+            font-family: "Chinese Quote", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
+            font-weight: 600;
+            position: relative;
+            top: 2px;
+          }
+        }
+        .desc {
+          font-size: 14px;
+          color: rgba(0, 0, 0, 0.45);
+          margin-top: 12px;
+          margin-bottom: 40px;
+        }
+      }
+
+      .main {
+        min-width: 260px;
+        width: 368px;
+        margin: 0 auto;
+      }
+
+      .footer {
+        position: absolute;
+        width: 100%;
+        bottom: 0;
+        padding: 0 16px;
+        margin: 48px 0 24px;
+        text-align: center;
+
+        .links {
+          margin-bottom: 8px;
+          font-size: 14px;
+          a {
+            color: rgba(0, 0, 0, 0.45);
+            transition: all 0.3s;
+            &:not(:last-child) {
+              margin-right: 40px;
+            }
+          }
+        }
+        .copyright {
+          color: rgba(0, 0, 0, 0.45);
+          font-size: 14px;
         }
       }
-    }
-    .iotmenu-header-text{
-      font-size: 23px;
-      font-weight: 700;
-      color: #004280;
-      letter-spacing: 1px;
-      margin-left: 30px;
-    }
-  }
-  .login-content{
-    width: 100%;
-    height: calc(100vh - 38px - 56px);
-    // background: url('../../assets/login.png') no-repeat;
-    // background-size: cover;
-    // background-position: center 50%;
-    position: relative;
-    .login-box{
-      width: 400px;
-      min-height: 580px;
-      background-color: #fff;
-      padding: 40px;
-      box-shadow: 0 0 10px rgba(0,0,0,.25);
-      border-radius: 4px;
-      position: absolute;
-      top: 50%;
-      right: 30%;
-      transform: translate(50%, -50%);
-    }
-  }
-  .login-footer{
-    height: 38px;
-    padding-left: 37px;
-    .login-footer-text{
-      color: #a1a1a1;
-      font-size: 14px;
-    }
-  }
-}
-@media (min-width: 1281px){
-  .iot-login .login-content{
-    background: url('../../assets/login.png') no-repeat;
-    background-size: cover;
-    background-position: center 50%;
-    .login-box{
-      right: 30%;
-    }
-  }
-}
-@media (max-width: 1280px){
-  .iot-login .login-content{
-    background: url('../../assets/login1024.png') no-repeat;
-    background-size: cover;
-    background-position: center 50%;
-    .login-box{
-      right: 50%;
     }
   }
-}
-// @media (max-width: 1919px) and (min-width: 1441px){
-//   .iot-login .login-content .login-box{
-//     left: 55.56%;
-//     right: 16.67%;
-//     top: 22.22%;
-//     bottom: 24.07%;
-//   }
-// }
-// @media (max-width: 1440px) and (min-width: 1367px){
-//   .iot-login .login-content .login-box{
-//     left: 53.15%;
-//     right: 17.57%;
-//     top: 8.33%;
-//     bottom: 8.33%;
-//   }
-// }
-// @media (max-width: 1366px) and (min-width: 1281px){
-//   .iot-login .login-content .login-box{
-//     left: 50%;
-//     right: 18.75%;
-//     top: 8.33%;
-//     bottom: 8.33%;
-//   }
-// }
-// @media (max-width: 1280px){
-//   .iot-login .login-content .login-box{
-//     left: calc(50% - 200px);
-//     top: 108px;
-//   }
-// }
 </style>

+ 7 - 51
src/views/user/Login.vue

@@ -1,10 +1,8 @@
 <template>
-  <div class="main iot-login-content">
-    <div class="top-img"></div>
-    <div class="sign-text">登录到 联锁管理平台</div>
+  <div class="main">
     <a-form-model class="user-layout-login" @keyup.enter.native="handleSubmit">
-      <a-tabs :activeKey="customActiveKey" :tabBarStyle="{ textAlign: 'center', borderBottom: 'unset' }"  @change="handleTabClick" class="login-tabs">
-        <a-tab-pane key="tab1" tab="SSO">
+      <a-tabs :activeKey="customActiveKey" :tabBarStyle="{ textAlign: 'center', borderBottom: 'unset' }"  @change="handleTabClick">
+        <a-tab-pane key="tab1" tab="账号密码登录">
           <login-account ref="alogin" @validateFail="validateFail" @success="requestSuccess" @fail="requestFailed"></login-account>
         </a-tab-pane>
 
@@ -15,7 +13,7 @@
       </a-tabs>
 
       <a-form-model-item>
-        <a-checkbox @change="handleRememberMeChange" default-checked>记住我</a-checkbox>
+        <a-checkbox @change="handleRememberMeChange" default-checked>自动登录</a-checkbox>
         <!-- 修改框架 -->
         <!-- <router-link :to="{ name: 'alteration'}" class="forge-password" style="float: right;">
           忘记密码
@@ -26,7 +24,7 @@
       </a-form-model-item>
 
       <a-form-item style="margin-top:24px">
-        <a-button size="large"  type="primary"  htmlType="submit"  class="login-button"  :loading="loginBtn"  @click.stop.prevent="handleSubmit" :disabled="loginBtn">登录
+        <a-button size="large"  type="primary"  htmlType="submit"  class="login-button"  :loading="loginBtn"  @click.stop.prevent="handleSubmit" :disabled="loginBtn">确定
         </a-button>
       </a-form-item>
 
@@ -167,46 +165,7 @@ export default {
 
   }
 </script>
-<style lang="less">
-  .login-tabs{
-    .ant-tabs-nav-container{
-      font-size: 16px !important;
-    }
-    .ant-tabs-nav{
-      width: 50%;
-    }
-    .ant-tabs-nav .ant-tabs-tab-active{
-      color: #3395ff !important;
-    }
-    .ant-tabs-ink-bar{
-      width: 100% !important;
-      height: 3px;
-      background: #3395ff;
-    }
-  }
-  .iot-login-content{
-    .ant-checkbox-checked .ant-checkbox-inner{
-      background-color: #3395FF !important;
-      border-color: #3395FF;
-    }
-  }
-</style>
 <style lang="less" scoped>
-  .top-img{
-    width: 100%;
-    height: 64px;
-    background: url('../../assets/login_logo.svg') no-repeat;
-    background-size: 100%;
-  }
-  .sign-text{
-    width: 100%;
-    height: 32px;
-    font-size: 16px;
-    font-weight: 400;
-    color: #646464;
-    margin-top: 8px;
-  }
-
   .user-layout-login {
     label {
       font-size: 14px;
@@ -222,13 +181,10 @@ export default {
     }
 
     button.login-button {
-      width: 100%;
-      height: 40px;
       padding: 0 15px;
       font-size: 16px;
-      background: #004280;
-      font-weight: 700;
-      border-color: transparent;
+      height: 40px;
+      width: 100%;
     }
 
   .user-login-other {

+ 141 - 142
src/views/user/LoginAccount.vue

@@ -1,161 +1,160 @@
 <template>
-    <div>
-      <a-form-model ref="form" :model="model" :rules="validatorRules">
-        <!-- IoT Edge相关 修改框架 -->
-        <a-form-model-item required prop="username">
-          <a-input v-model="model.username" size="large" placeholder="请输入帐户名">
-            <a-icon slot="prefix" type="user" :style="{ color: 'rgba(0,0,0,.25)' }"/>
-          </a-input>
-        </a-form-model-item>
-        <a-form-model-item required prop="password">
-          <a-input-password v-model="model.password" size="large" type="password" autocomplete="false" placeholder="请输入密码">
-            <a-icon slot="prefix" type="lock" :style="{ color: 'rgba(0,0,0,.25)' }"/>
-          </a-input-password>
-        </a-form-model-item>
+  <div>
+    <a-form-model ref="form" :model="model" :rules="validatorRules">
+      <a-form-model-item required prop="username">
+        <a-input v-model="model.username" size="large" placeholder="请输入帐户名 / admin">
+          <a-icon slot="prefix" type="user" :style="{ color: 'rgba(0,0,0,.25)' }"/>
+        </a-input>
+      </a-form-model-item>
+      <a-form-model-item required prop="password">
+        <a-input v-model="model.password" size="large" type="password" autocomplete="false" placeholder="请输入密码 / 123456">
+          <a-icon slot="prefix" type="lock" :style="{ color: 'rgba(0,0,0,.25)' }"/>
+        </a-input>
+      </a-form-model-item>
 
-        <!-- IoT Edge相关 修改框架 -->
-        <!-- <a-row :gutter="0">
-          <a-col :span="16">
-            <a-form-model-item required prop="inputCode">
-              <a-input v-model="model.inputCode" size="large" type="text" placeholder="请输入验证码">
-                <a-icon slot="prefix" type="smile" :style="{ color: 'rgba(0,0,0,.25)' }"/>
-              </a-input>
-            </a-form-model-item>
-          </a-col>
-          <a-col :span="8" style="text-align: right">
-            <img v-if="requestCodeSuccess" style="margin-top: 2px;" :src="randCodeImage" @click="handleChangeCheckCode"/>
-            <img v-else style="margin-top: 2px;" src="../../assets/checkcode.png" @click="handleChangeCheckCode"/>
-          </a-col>
-        </a-row> -->
-      </a-form-model>
-    </div>
+      <!-- <a-row :gutter="0">
+        <a-col :span="16">
+          <a-form-model-item required prop="inputCode">
+            <a-input v-model="model.inputCode" size="large" type="text" placeholder="请输入验证码">
+              <a-icon slot="prefix" type="smile" :style="{ color: 'rgba(0,0,0,.25)' }"/>
+            </a-input>
+          </a-form-model-item>
+        </a-col>
+        <a-col :span="8" style="text-align: right">
+          <img v-if="requestCodeSuccess" style="margin-top: 2px;" :src="randCodeImage" @click="handleChangeCheckCode"/>
+          <img v-else style="margin-top: 2px;" src="../../assets/checkcode.png" @click="handleChangeCheckCode"/>
+        </a-col>
+      </a-row> -->
+    </a-form-model>
+  </div>
 </template>
 
 <script>
-  import { getAction } from '@/api/manage'
-  import Vue from 'vue'
-  import { mapActions } from 'vuex'
+import { getAction } from '@/api/manage'
+import Vue from 'vue'
+import { mapActions } from 'vuex'
 
-  export default {
-    name: 'LoginAccount',
-    data(){
-      return {
-        requestCodeSuccess: false,
-        randCodeImage: '',
-        currdatetime: '',
-        loginType: 0,
-        model:{
-          username: '',
-          password: '',
-          inputCode: ''
-        },
-        validatorRules:{
-          username: [
-            { required: true, message: '请输入用户名!' },
-            { validator: this.handleUsernameOrEmail }
-          ],
-          password: [{
-            required: true, message: '请输入密码!', validator: 'click'
-          }],
-          inputCode: [{
-            required: true, message: '请输入验证码!'
-          }]
-        }
+export default {
+  name: 'LoginAccount',
+  data(){
+    return {
+      requestCodeSuccess: false,
+      randCodeImage: '',
+      currdatetime: '',
+      loginType: 0,
+      model:{
+        username: '',
+        password: '',
+        inputCode: ''
+      },
+      validatorRules:{
+        username: [
+          { required: true, message: '请输入用户名!' },
+          { validator: this.handleUsernameOrEmail }
+        ],
+        password: [{
+          required: true, message: '请输入密码!', validator: 'click'
+        }],
+        inputCode: [{
+          required: true, message: '请输入验证码!'
+        }]
+      }
 
+    }
+  },
+  created() {
+    this.handleChangeCheckCode();
+  },
+  methods:{
+    ...mapActions(['Login']),
+    /**刷新验证码*/
+    handleChangeCheckCode(){
+      this.currdatetime = new Date().getTime();
+      this.model.inputCode = ''
+      getAction(`/sys/randomImage/${this.currdatetime}`).then(res=>{
+        if(res.success){
+          this.randCodeImage = res.result
+          this.requestCodeSuccess=true
+        }else{
+          this.$message.error(res.message)
+          this.requestCodeSuccess=false
+        }
+      }).catch(()=>{
+        this.requestCodeSuccess=false
+      })
+    },
+    // 判断登录类型
+    handleUsernameOrEmail (rule, value, callback) {
+      const regex = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/;
+      if (regex.test(value)) {
+        this.loginType = 0
+      } else {
+        this.loginType = 1
       }
+      callback()
     },
-    created() {
-      this.handleChangeCheckCode();
+    /**
+     * 验证字段
+     * @param arr
+     * @param callback
+     */
+    validateFields(arr, callback){
+      let promiseArray = []
+      for(let item of arr){
+        let p = new Promise((resolve, reject) => {
+          this.$refs['form'].validateField(item, (err)=>{
+            if(!err){
+              resolve();
+            }else{
+              reject(err);
+            }
+          })
+        });
+        promiseArray.push(p)
+      }
+      Promise.all(promiseArray).then(()=>{
+        callback()
+      }).catch(err=>{
+        callback(err)
+      })
+    },
+    acceptUsername(username){
+      this.model['username'] = username
     },
-    methods:{
-      ...mapActions(['Login']),
-      /**刷新验证码*/
-      handleChangeCheckCode(){
-        this.currdatetime = new Date().getTime();
-        this.model.inputCode = ''
-        getAction(`/sys/randomImage/${this.currdatetime}`).then(res=>{
-          if(res.success){
-            this.randCodeImage = res.result
-            this.requestCodeSuccess=true
-          }else{
-            this.$message.error(res.message)
-            this.requestCodeSuccess=false
+    //账号密码登录
+    handleLogin(rememberMe){
+      this.validateFields([ 'username', 'password' ], (err)=>{
+        if(!err){
+          let loginParams = {
+            username: this.model.username,
+            password: this.model.password,
+            // captcha: this.model.inputCode,
+            checkKey: this.currdatetime,
+            remember_me: rememberMe,
           }
-        }).catch(()=>{
-          this.requestCodeSuccess=false
-        })
-      },
-      // 判断登录类型
-      handleUsernameOrEmail (rule, value, callback) {
-        const regex = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/;
-        if (regex.test(value)) {
-          this.loginType = 0
-        } else {
-          this.loginType = 1
-        }
-        callback()
-      },
-      /**
-       * 验证字段
-       * @param arr
-       * @param callback
-       */
-      validateFields(arr, callback){
-        let promiseArray = []
-        for(let item of arr){
-          let p = new Promise((resolve, reject) => {
-            this.$refs['form'].validateField(item, (err)=>{
-              if(!err){
-                resolve();
-              }else{
-                reject(err);
-              }
-            })
+          console.log("登录参数", loginParams)
+          this.Login(loginParams).then((res) => {
+            this.$emit('success', res.result)
+          }).catch((err) => {
+            //update-begin-author: taoyan date:20220425 for: 登录页面,当输入验证码错误时,验证码图片要刷新一下,而不是保持旧的验证码图片不变 #41
+            if(err && err.code===412){
+              this.handleChangeCheckCode();
+            }
+            //update-end-author: taoyan date:20220425 for: 登录页面,当输入验证码错误时,验证码图片要刷新一下,而不是保持旧的验证码图片不变 #41
+            this.$emit('fail', err)
           });
-          promiseArray.push(p)
+        }else{
+          this.$emit('validateFail')
         }
-        Promise.all(promiseArray).then(()=>{
-          callback()
-        }).catch(err=>{
-          callback(err)
-        })
-      },
-      acceptUsername(username){
-        this.model['username'] = username
-      },
-      //账号密码登录
-      handleLogin(rememberMe){
-        this.validateFields([ 'username', 'password' ], (err)=>{
-          if(!err){
-            let loginParams = {
-              username: this.model.username,
-              password: this.model.password,
-              // captcha: this.model.inputCode,
-              checkKey: this.currdatetime,
-              remember_me: rememberMe,
-            }
-            console.log("登录参数", loginParams)
-            this.Login(loginParams).then((res) => {
-              this.$emit('success', res.result)
-            }).catch((err) => {
-              //update-begin-author: taoyan date:20220425 for: 登录页面,当输入验证码错误时,验证码图片要刷新一下,而不是保持旧的验证码图片不变 #41
-              if(err && err.code===412){
-                this.handleChangeCheckCode();
-              }
-              //update-end-author: taoyan date:20220425 for: 登录页面,当输入验证码错误时,验证码图片要刷新一下,而不是保持旧的验证码图片不变 #41
-              this.$emit('fail', err)
-            });
-          }else{
-            this.$emit('validateFail')
-          }
-        })
-      }
-
-
+      })
     }
 
+
   }
+
+}
 </script>
 
-<style>
+<style scoped>
+
 </style>