Parcourir la source

登录页背景由接口获取

Xiao_123 il y a 5 mois
Parent
commit
27e7423977

+ 7 - 4
src/plugins/fullScreen/components/entUpdatePassword.vue

@@ -5,7 +5,7 @@
       v-model="dialog"
       max-width="100vw"
     >
-      <div class="white-bgc ma-n6 d-flex flex-column align-center justify-center" style="min-height: 100vh;">
+      <div class="white-bgc ma-n6 d-flex flex-column align-center justify-center" style="min-height: 100vh;" :style="{'background-image': 'url(' + webContent.loginBgUrl + ')'}">
         <staffChangePassword :hideGoBack="true" :hideWidth="true" :entChangePassword="true" elevation="0"></staffChangePassword>
       </div>
     </v-dialog>
@@ -13,19 +13,22 @@
 </template>
 
 <script setup>
+defineOptions({name: 'fullScreen-entUpdatePassword'})
 import { onMounted, ref } from 'vue'
+import { webContentStore } from '@/store/webContent'
 import staffChangePassword from '@/views/recruit/enterprise/staffChangePassword'
-defineOptions({name: 'fullScreen-entUpdatePassword'})
+
+const webContent = webContentStore()
 
 const dialog = ref(true)
-onMounted(() => {
+onMounted(async () => {
+  await webContent.getSystemWebContent()
   dialog.value = true
 })
 
 </script>
 <style lang="scss" scoped>
 .white-bgc {
-  background-image: url('https://minio.menduner.com/dev/menduner/login-bgc.jpg');
   background-size: cover;
 }
 ::-webkit-scrollbar {

+ 25 - 0
src/store/webContent.js

@@ -0,0 +1,25 @@
+import { defineStore } from 'pinia'
+import { getWebContent } from '@/api/common'
+
+export const webContentStore = defineStore('webContent',
+  {
+    state: () => ({
+      loginBgUrl: '' // 登录页背景图
+    }),
+    actions: {
+      async getSystemWebContent () {
+        try {
+          const data = await getWebContent()
+          this.loginBgUrl = data.pcLoginBackground && data.pcLoginBackground.length ? data.pcLoginBackground[0].img : 'https://minio.menduner.com/dev/menduner/login-bgc.jpg'
+        } catch (error) {
+          console.log(error)
+        }
+      }
+    }
+  },
+  {
+    persist: true,
+    devtools: true
+  }
+)
+

+ 5 - 3
src/views/login/forgotPassword.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="box">
+  <div class="box" :style="{'background-image': 'url(' + webContent.loginBgUrl + ')'}">
     <navBar v-if="!isMobile" :showLoginBtn="false" class="navBar"></navBar>
     <div class="content pa-10">
       <div class="resume-header">
@@ -24,12 +24,15 @@ import { useRouter, useRoute } from 'vue-router'
 import navBar from '@/layout/personal/navBar.vue'
 import editPasswordPage from '@/views/login/components/editPassword.vue'
 import { ref, onMounted } from 'vue'
+import { webContentStore } from '@/store/webContent'
 
 const router = useRouter()
 const route = useRoute()
+const webContent = webContentStore()
 
 const isMobile = ref(false)
-onMounted(() => {
+onMounted(async () => {
+  await webContent.getSystemWebContent()
   const userAgent = navigator.userAgent
   isMobile.value = /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(userAgent)
 })
@@ -45,7 +48,6 @@ onMounted(() => {
   position: relative;
   width: 100%;
   height: 100%;
-  background-image: url('https://minio.menduner.com/dev/menduner/login-bgc.jpg');
   background-size: cover;
   display: flex;
   justify-content: center;

+ 6 - 4
src/views/login/forgotPasswordEnt.vue

@@ -1,11 +1,11 @@
 <template>
-  <div class="box">
+  <div class="box" :style="{'background-image': 'url(' + webContent.loginBgUrl + ')'}">
     <navBar v-if="!isMobile" :showLoginBtn="false" class="navBar"></navBar>
     <div class="content pa-10">
       <div class="resume-header">
         <div class="resume-title">企业修改密码</div>
       </div>
-      <editPasswordPage :showCancelBtn="false" openVerify @cancel="router.push('/login')">
+      <editPasswordPage :showCancelBtn="false" openVerify>
         <template #custom>
           <div class="font-size-14 text-end">
             <span class="color-primary cursor-pointer" @click="router.push('/login')">回到登录页</span>
@@ -20,13 +20,16 @@
 defineOptions({ name: 'forgotPasswordEnt'})
 import { useRouter } from 'vue-router'
 import navBar from '@/layout/personal/navBar.vue'
+import { webContentStore } from '@/store/webContent'
 import editPasswordPage from '@/views/login/components/editPasswordEnt.vue'
 import { ref, onMounted } from 'vue'
 
 const router = useRouter()
+const webContent = webContentStore()
 
 const isMobile = ref(false)
-onMounted(() => {
+onMounted(async () => {
+  await webContent.getSystemWebContent()
   const userAgent = navigator.userAgent
   isMobile.value = /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(userAgent)
 })
@@ -43,7 +46,6 @@ onMounted(() => {
   position: relative;
   width: 100%;
   height: 100%;
-  background-image: url('https://minio.menduner.com/dev/menduner/login-bgc.jpg');
   background-size: cover;
   display: flex;
   justify-content: center;

+ 0 - 1
src/views/login/index.vue

@@ -259,7 +259,6 @@ const windowOpen = (url) => {
   position: relative;
   width: 100%;
   height: 100vh;
-  // background-image: url('https://minio.menduner.com/dev/menduner/login-bgc.jpg');
   background-size: cover;
   overflow: hidden;
   .navBar {

+ 5 - 3
src/views/recruit/entRegister/register.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="login-box py-5">
+  <div class="login-box py-5"  :style="{'background-image': 'url(' + webContent.loginBgUrl + ')'}">
     <v-card class="pa-5" :class="isMobile? 'mobileBox' : 'default-width'" :elevation="isMobile? '0' : '3'">
       <!-- 标题 -->
       <div class="mt-3" v-if="!isMobile">
@@ -113,10 +113,12 @@ import { enterpriseRegisterApply } from '@/api/personal/user'
 import { onMounted, ref, computed } from 'vue';
 import { checkCompanyEmail } from '@/utils/validate'
 import { getBusinessLicenseOCR } from '@/api/common'
+import { webContentStore } from '@/store/webContent'
 import Confirm from '@/plugins/confirm'
 import TextUI from '@/components/FormUI/TextInput'
 import { findFirstDuplicateWithIndices } from '@/utils/dealData'
 
+const webContent = webContentStore()
 const { t } = useI18n()
 const CtFormRef = ref()
 const loginLoading = ref(false)
@@ -130,7 +132,8 @@ let licenseUrl = ref('')
 
 // 组件挂载后添加事件监听器
 const isMobile = ref(false)
-onMounted(() => {
+onMounted(async () => {
+  await webContent.getSystemWebContent()
   const userAgent = navigator.userAgent
   isMobile.value = /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(userAgent)
 })
@@ -494,7 +497,6 @@ const passwordConfirmObj = {
   position: relative;
   width: 100%;
   height: 100%;
-  background-image: url('https://minio.menduner.com/dev/menduner/login-bgc.jpg');
   background-size: cover;
 }
 .file-box {

+ 5 - 3
src/views/recruit/enterprise/talentRecommendation/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <div v-if="showLogin" class="login-content">
+    <div v-if="showLogin" class="login-content" :style="{'background-image': 'url(' + webContent.loginBgUrl + ')'}">
       <div class="login-content-box pa-10">
         <div class="login-content-box-title text-center mt-4">请先登录您的企业账号</div>
         <passwordFrom class="mt-10" ref="passRef" placeholder="请输入企业邮箱" :validEmail="true"></passwordFrom>
@@ -73,7 +73,9 @@ import { dealDictArrayData } from '@/utils/position'
 import { getUserAvatar } from '@/utils/avatar'
 import { useRouter } from 'vue-router'
 import FilterPage from './components/filter.vue'
+import { webContentStore } from '@/store/webContent'
 
+const webContent = webContentStore()
 const router = useRouter()
 const loading = ref(false)
 const passRef = ref(null)
@@ -134,7 +136,8 @@ const handleClearJob = () => {
 
 // 组件挂载后添加事件监听器
 const isMobile = ref(false)
-onMounted(() => {
+onMounted(async () => {
+  await webContent.getSystemWebContent()
   if (!token.value) {
     Snackbar.warning('请先登录')
     showLogin.value = true
@@ -253,7 +256,6 @@ const handleSearch = (val) => {
   position: relative;
   width: 100%;
   height: 100vh;
-  background-image: url('https://minio.menduner.com/dev/menduner/login-bgc.jpg');
   background-size: cover;
   &-box {
     position: absolute;

+ 5 - 3
src/views/register/company.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="box" style="overflow-x: hidden;">
+  <div class="box" style="overflow-x: hidden;" :style="{'background-image': 'url(' + webContent.loginBgUrl + ')'}">
     <navBar v-if="!isMobile" :showLoginBtn="false" class="navBar"></navBar>
     <PhonePage v-if="!valid" :isCompany="true" @success="handleValidate" :isLogin="query.login ? true : false"></PhonePage>
   </div>
@@ -12,9 +12,12 @@ import navBar from '@/layout/personal/navBar.vue'
 import { ref, onMounted } from 'vue'
 import PhonePage from './person.vue'
 import { useRouter } from 'vue-router'
+import { webContentStore } from '@/store/webContent'
 
+const webContent = webContentStore()
 const isMobile = ref(false)
-onMounted(() => {
+onMounted(async () => {
+  await webContent.getSystemWebContent()
   const userAgent = navigator.userAgent
   isMobile.value = /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(userAgent)
 })
@@ -50,7 +53,6 @@ const handleValidate = async () => {
   position: relative;
   width: 100%;
   height: 100%;
-  background-image: url('https://minio.menduner.com/dev/menduner/login-bgc.jpg');
   background-size: cover;
   background-repeat: no-repeat;
   background-position: center center;

+ 5 - 3
src/views/register/person.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="box">
+  <div class="box" :style="{'background-image': 'url(' + webContent.loginBgUrl + ')'}">
     <navBar v-if="!isMobile" :showLoginBtn="false" class="navBar"></navBar>
     <div class="content pa-10">
       <div class="content-title text-center mt-4">{{ isLogin ? '请输入您申请企业账号时填入的手机号进行效验' : '请输入手机号码进行注册认证'}}</div>
@@ -28,9 +28,12 @@ import { useUserStore } from '@/store/user'
 import Snackbar from '@/plugins/snackbar'
 import { checkCompanyEmail } from '@/utils/validate'
 import navBar from '@/layout/personal/navBar.vue'
+import { webContentStore } from '@/store/webContent'
 
+const webContent = webContentStore()
 const isMobile = ref(false)
-onMounted(() => {
+onMounted(async () => {
+  await webContent.getSystemWebContent()
   const userAgent = navigator.userAgent
   isMobile.value = /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(userAgent)
 })
@@ -96,7 +99,6 @@ const windowOpen = (url) => {
   position: relative;
   width: 100%;
   height: 100%;
-  background-image: url('https://minio.menduner.com/dev/menduner/login-bgc.jpg');
   background-size: cover;
   display: flex;
   justify-content: center;

+ 5 - 3
src/views/register/select.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="register-box">
+  <div class="register-box" :style="{'background-image': 'url(' + webContent.loginBgUrl + ')'}">
     <navBar v-if="!isMobile" :showLoginBtn="false" class="navBar"></navBar>
     <div class="register-content">
       <h2 style="color: #666; font-weight: 400;">请选择您当前注册的身份</h2>
@@ -22,9 +22,12 @@ import navBar from '@/layout/personal/navBar.vue'
 defineOptions({ name: 'register-select'})
 import { useRouter } from 'vue-router'
 import { ref, onMounted } from 'vue'
+import { webContentStore } from '@/store/webContent'
 
+const webContent = webContentStore()
 const isMobile = ref(false)
-onMounted(() => {
+onMounted(async () => {
+  await webContent.getSystemWebContent()
   const userAgent = navigator.userAgent
   isMobile.value = /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(userAgent)
 })
@@ -41,7 +44,6 @@ const handleToRegister = (path) => {
   position: relative;
   width: 100%;
   height: 100%;
-  background-image: url('https://minio.menduner.com/dev/menduner/login-bgc.jpg');
   background-size: cover;
 }
 .register-content {