Commit e7f4a57c225a1835a8e59bc19309eef9afe91b60
Merge branch 'local_dev_ft' into 'main'
pref:优化部分问题 See merge request yunteng/thingskit-front!475
Showing
4 changed files
with
65 additions
and
10 deletions
@@ -182,12 +182,16 @@ export const formSchemas: FormSchema[] = [ | @@ -182,12 +182,16 @@ export const formSchemas: FormSchema[] = [ | ||
182 | componentProps: { | 182 | componentProps: { |
183 | placeholder: '如:关', | 183 | placeholder: '如:关', |
184 | }, | 184 | }, |
185 | + defaultValue: '关', | ||
185 | ifShow: ({ values }) => values[FormField.TYPE] === DataTypeEnum.IS_BOOL, | 186 | ifShow: ({ values }) => values[FormField.TYPE] === DataTypeEnum.IS_BOOL, |
186 | dynamicRules: ({ model }) => { | 187 | dynamicRules: ({ model }) => { |
187 | const close = model[FormField.BOOL_CLOSE]; | 188 | const close = model[FormField.BOOL_CLOSE]; |
188 | const open = model[FormField.BOOL_OPEN]; | 189 | const open = model[FormField.BOOL_OPEN]; |
189 | return [ | 190 | return [ |
190 | { | 191 | { |
192 | + required: true, | ||
193 | + }, | ||
194 | + { | ||
191 | validator() { | 195 | validator() { |
192 | if (open === close) return Promise.reject('布尔值不能相同'); | 196 | if (open === close) return Promise.reject('布尔值不能相同'); |
193 | return Promise.resolve(); | 197 | return Promise.resolve(); |
@@ -207,12 +211,16 @@ export const formSchemas: FormSchema[] = [ | @@ -207,12 +211,16 @@ export const formSchemas: FormSchema[] = [ | ||
207 | componentProps: { | 211 | componentProps: { |
208 | placeholder: '如:开', | 212 | placeholder: '如:开', |
209 | }, | 213 | }, |
214 | + defaultValue: '开', | ||
210 | ifShow: ({ values }) => values[FormField.TYPE] === DataTypeEnum.IS_BOOL, | 215 | ifShow: ({ values }) => values[FormField.TYPE] === DataTypeEnum.IS_BOOL, |
211 | dynamicRules: ({ model }) => { | 216 | dynamicRules: ({ model }) => { |
212 | const close = model[FormField.BOOL_CLOSE]; | 217 | const close = model[FormField.BOOL_CLOSE]; |
213 | const open = model[FormField.BOOL_OPEN]; | 218 | const open = model[FormField.BOOL_OPEN]; |
214 | return [ | 219 | return [ |
215 | { | 220 | { |
221 | + required: true, | ||
222 | + }, | ||
223 | + { | ||
216 | validator() { | 224 | validator() { |
217 | if (open === close) return Promise.reject('布尔值不能相同'); | 225 | if (open === close) return Promise.reject('布尔值不能相同'); |
218 | return Promise.resolve(); | 226 | return Promise.resolve(); |
@@ -80,7 +80,10 @@ | @@ -80,7 +80,10 @@ | ||
80 | // import { useUserStore } from '/@/store/modules/user'; | 80 | // import { useUserStore } from '/@/store/modules/user'; |
81 | import { getPlatForm } from '/@/api/oem/index'; | 81 | import { getPlatForm } from '/@/api/oem/index'; |
82 | import defaultShowLogoImg from '/@/assets/svg/login-bg.svg'; | 82 | import defaultShowLogoImg from '/@/assets/svg/login-bg.svg'; |
83 | + import defaultShowLogoDarkImg from '/@/assets/svg/login-bg-dark.svg'; | ||
83 | import { useTitle } from '@vueuse/core'; | 84 | import { useTitle } from '@vueuse/core'; |
85 | + import { createLocalStorage } from '/@/utils/cache'; | ||
86 | + // import {usePlatform} from '/@/views/system/customize/hook/usePlatformInfo' | ||
84 | 87 | ||
85 | defineProps({ | 88 | defineProps({ |
86 | sessionTimeout: { | 89 | sessionTimeout: { |
@@ -91,8 +94,14 @@ | @@ -91,8 +94,14 @@ | ||
91 | const defaultTitle = ref(''); | 94 | const defaultTitle = ref(''); |
92 | const defaultLogo = ref(''); | 95 | const defaultLogo = ref(''); |
93 | const logoUrl = ref(''); | 96 | const logoUrl = ref(''); |
97 | + // const userStore = useUserStore(); | ||
98 | + const storage = createLocalStorage(); | ||
99 | + | ||
94 | onMounted(async () => { | 100 | onMounted(async () => { |
95 | - const res = await getPlatForm(); | 101 | + let res = storage.get('platformInfo'); |
102 | + if (res === '' || res === null) { | ||
103 | + res = await getPlatForm(); | ||
104 | + } | ||
96 | logoUrl.value = res?.background; | 105 | logoUrl.value = res?.background; |
97 | defaultTitle.value = res?.name || title; | 106 | defaultTitle.value = res?.name || title; |
98 | defaultLogo.value = res?.logo; | 107 | defaultLogo.value = res?.logo; |
@@ -100,13 +109,38 @@ | @@ -100,13 +109,38 @@ | ||
100 | document.createElement('link')) as HTMLLinkElement; | 109 | document.createElement('link')) as HTMLLinkElement; |
101 | link.type = 'image/x-icon'; | 110 | link.type = 'image/x-icon'; |
102 | link.rel = 'shortcut icon'; | 111 | link.rel = 'shortcut icon'; |
103 | - link.href = res.icon ?? '/favicon.ico'; | 112 | + link.href = res?.icon ?? '/favicon.ico'; |
104 | document.getElementsByTagName('head')[0].appendChild(link); | 113 | document.getElementsByTagName('head')[0].appendChild(link); |
114 | + let defaultLogoBg = document.createElement('style'); | ||
115 | + let defaultLogoDarkBg = document.createElement('style'); | ||
105 | if (logoUrl.value !== undefined) { | 116 | if (logoUrl.value !== undefined) { |
117 | + //企业自定义 | ||
106 | ifCustom.value = false; | 118 | ifCustom.value = false; |
119 | + //默认图片 | ||
120 | + defaultLogoBg.innerHTML = `.vben-login::before{ | ||
121 | + background-image:url(""); | ||
122 | + position:absolute; | ||
123 | + }`; | ||
124 | + //切换黑暗模式图片 | ||
125 | + defaultLogoDarkBg.innerHTML = `html[data-theme='dark'] .vben-login::before{ | ||
126 | + background-image:url(""); | ||
127 | + position:absolute; | ||
128 | + }`; | ||
107 | } else { | 129 | } else { |
108 | logoUrl.value = 'url(' + defaultShowLogoImg + ')'; | 130 | logoUrl.value = 'url(' + defaultShowLogoImg + ')'; |
131 | + //默认图片 | ||
132 | + defaultLogoBg.innerHTML = `.vben-login::before{ | ||
133 | + background-image:url(${defaultShowLogoImg}); | ||
134 | + position:absolute; | ||
135 | + }`; | ||
136 | + //切换黑暗模式图片 | ||
137 | + defaultLogoDarkBg.innerHTML = `html[data-theme='dark'] .vben-login::before{ | ||
138 | + background-image:url(${defaultShowLogoDarkImg}); | ||
139 | + position:absolute; | ||
140 | + }`; | ||
109 | } | 141 | } |
142 | + document.head.appendChild(defaultLogoBg); | ||
143 | + document.head.appendChild(defaultLogoDarkBg); | ||
110 | }); | 144 | }); |
111 | 145 | ||
112 | // const userStore = useUserStore(); | 146 | // const userStore = useUserStore(); |
@@ -200,9 +234,8 @@ | @@ -200,9 +234,8 @@ | ||
200 | width: 100%; | 234 | width: 100%; |
201 | height: 100%; | 235 | height: 100%; |
202 | margin-left: -48%; | 236 | margin-left: -48%; |
203 | - background-image: v-bind(logourl); | ||
204 | - // background-image: url(/@/assets/svg/login-bg.svg); | ||
205 | background-position: 100%; | 237 | background-position: 100%; |
238 | + // background-image: url(/@/assets/svg/login-bg.svg); | ||
206 | background-repeat: no-repeat; | 239 | background-repeat: no-repeat; |
207 | background-size: auto 100%; | 240 | background-size: auto 100%; |
208 | content: ''; | 241 | content: ''; |
@@ -106,17 +106,20 @@ export const schemas: FormSchema[] = [ | @@ -106,17 +106,20 @@ export const schemas: FormSchema[] = [ | ||
106 | }, | 106 | }, |
107 | { | 107 | { |
108 | field: 'nameCountry', | 108 | field: 'nameCountry', |
109 | - component: 'ApiSelect', | 109 | + component: 'Select', |
110 | label: '国家/地区', | 110 | label: '国家/地区', |
111 | colProps: { | 111 | colProps: { |
112 | span: 24, | 112 | span: 24, |
113 | }, | 113 | }, |
114 | + // componentProps: { | ||
115 | + // api: getAreaList, | ||
116 | + // params: { parentId: 0 }, | ||
117 | + // labelField: 'name', | ||
118 | + // valueField: 'code', | ||
119 | + // placeholder: '国家/地区', | ||
120 | + // }, | ||
114 | componentProps: { | 121 | componentProps: { |
115 | - api: getAreaList, | ||
116 | - params: { parentId: 0 }, | ||
117 | - labelField: 'name', | ||
118 | - valueField: 'code', | ||
119 | - placeholder: '国家/地区', | 122 | + options: [{ label: '中国', value: 1 }], |
120 | }, | 123 | }, |
121 | }, | 124 | }, |
122 | { | 125 | { |
1 | import { getPlatForm } from '/@/api/oem'; | 1 | import { getPlatForm } from '/@/api/oem'; |
2 | +import { createLocalStorage } from '/@/utils/cache'; | ||
2 | 3 | ||
3 | enum DefaultPlatform { | 4 | enum DefaultPlatform { |
4 | LOGO = '/resource/img/logo.png', | 5 | LOGO = '/resource/img/logo.png', |
@@ -8,6 +9,16 @@ enum DefaultPlatform { | @@ -8,6 +9,16 @@ enum DefaultPlatform { | ||
8 | 9 | ||
9 | export const usePlatform = async () => { | 10 | export const usePlatform = async () => { |
10 | const platformInfo = await getPlatForm(); | 11 | const platformInfo = await getPlatForm(); |
12 | + const storage = createLocalStorage(); | ||
13 | + if ( | ||
14 | + platformInfo === '' || | ||
15 | + platformInfo === null || | ||
16 | + Object.getOwnPropertyNames(platformInfo).length === 0 | ||
17 | + ) { | ||
18 | + storage.set('platformInfo', 1234); | ||
19 | + } else { | ||
20 | + storage.set('platformInfo', platformInfo); | ||
21 | + } | ||
11 | 22 | ||
12 | const createLoadingEffect = () => { | 23 | const createLoadingEffect = () => { |
13 | const wrap = document.createElement('div'); | 24 | const wrap = document.createElement('div'); |