Browse Source

”实现动态修改登录页面的背景图\

Sanmu8 1 year ago
parent
commit
3f9ea44f7f
2 changed files with 19 additions and 4 deletions
  1. 8 0
      src/api/login.js
  2. 11 4
      src/views/login.vue

+ 8 - 0
src/api/login.js

@@ -56,4 +56,12 @@ export function getCodeImg() {
     method: 'get',
     timeout: 20000
   })
+}
+
+// 查询系统管理详细
+export function getSYSTEM(id) {
+  return request({
+    url: '/portal_api/SYSTEM/getInfo/' + id,
+    method: 'get'
+  })
 }

+ 11 - 4
src/views/login.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="login">
+  <div class="login" :style="{backgroundImage:'url('+url+')'}">
     <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
       <div class="logo"><img src="../assets/logo/logo.png" class="img" /></div>
       <h3 class="title">欢迎登录广西综合保税区智慧管理平台</h3>
@@ -40,7 +40,7 @@
 </template>
 
 <script>
-import { getCodeImg } from '@/api/login';
+import { getCodeImg , getSYSTEM } from '@/api/login';
 import Cookies from 'js-cookie';
 import { encrypt, decrypt } from '@/utils/jsencrypt';
 
@@ -66,7 +66,8 @@ export default {
       captchaEnabled: true,
       // 注册开关
       register: false,
-      redirect: undefined
+      redirect: undefined,
+      url:''
     };
   },
   watch: {
@@ -80,8 +81,14 @@ export default {
   created() {
     this.getCode();
     this.getCookie();
+    this.getBgImg()
   },
   methods: {
+    getBgImg(){
+      getSYSTEM(1).then(res=>{
+        this.url = res.data.systemPicture
+      })
+    },
     getCode() {
       getCodeImg().then(res => {
         this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled;
@@ -138,7 +145,7 @@ export default {
   justify-content: center;
   align-items: center;
   height: 100%;
-  background-image: url('../assets/images/bg.png');
+  // background-image: url('../assets/images/bg.png');
   background-size: cover;
 }
 .title {