Commit 69ada9c1e39d38e1b70a3baa595399e75535b0a1

Authored by ww
1 parent eb697a87

fix: 修复打包时类型校验不通过

@@ -15,11 +15,11 @@ export interface IResources { @@ -15,11 +15,11 @@ export interface IResources {
15 const fileSuffix = ['earth', 'gradient', 'redCircle', 'label', 'aperture', 'glow', 'light_column', 'aircraft'] 15 const fileSuffix = ['earth', 'gradient', 'redCircle', 'label', 'aperture', 'glow', 'light_column', 'aircraft']
16 const textures: ITextures[] = [] 16 const textures: ITextures[] = []
17 17
18 -const modules = import.meta.globEager("../../images/earth/*"); 18 +const modules: Record<string, { default: string }> = import.meta.glob("../../images/earth/*", { eager: true });
19 19
20 -for(let item in modules) { 20 +for (const item in modules) {
21 const n = item.split('/').pop() 21 const n = item.split('/').pop()
22 - if(n) { 22 + if (n) {
23 textures.push({ 23 textures.push({
24 name: n.split('.')[0], 24 name: n.split('.')[0],
25 url: modules[item].default 25 url: modules[item].default
@@ -3,11 +3,11 @@ import { CreateComponentType } from '@/packages/index.d' @@ -3,11 +3,11 @@ import { CreateComponentType } from '@/packages/index.d'
3 import { CarouselConfig } from './index' 3 import { CarouselConfig } from './index'
4 import cloneDeep from 'lodash/cloneDeep' 4 import cloneDeep from 'lodash/cloneDeep'
5 import logo from '@/assets/logo.png' 5 import logo from '@/assets/logo.png'
6 - 6 +
7 // 示例图片资源 7 // 示例图片资源
8 -const modules = import.meta.globEager("./images/*"); 8 +const modules: Record<string, { default: string }> = import.meta.glob("./images/*", {eager: true});
9 const dataset = [logo] 9 const dataset = [logo]
10 -for (var item in modules) { 10 +for (const item in modules) {
11 dataset.push(modules[item].default) 11 dataset.push(modules[item].default)
12 } 12 }
13 13
@@ -3,12 +3,8 @@ @@ -3,12 +3,8 @@
3 <setting-item-box name="背景上传" :alone="true"> 3 <setting-item-box name="背景上传" :alone="true">
4 <setting-item> 4 <setting-item>
5 <n-card class="upload-box"> 5 <n-card class="upload-box">
6 - <n-upload  
7 - :show-file-list="false"  
8 - v-model:file-list="uploadFileListRef"  
9 - :customRequest="customRequest"  
10 - :onBeforeUpload="beforeUploadHandle"  
11 - > 6 + <n-upload :show-file-list="false" v-model:file-list="uploadFileListRef" :customRequest="customRequest"
  7 + :onBeforeUpload="beforeUploadHandle">
12 <n-upload-dragger> 8 <n-upload-dragger>
13 <img v-if="optionData.backgroundImage" class="upload-show" :src="optionData.backgroundImage" alt="背景" /> 9 <img v-if="optionData.backgroundImage" class="upload-show" :src="optionData.backgroundImage" alt="背景" />
14 <div class="upload-img" v-show="!optionData.backgroundImage"> 10 <div class="upload-img" v-show="!optionData.backgroundImage">
@@ -32,14 +28,8 @@ @@ -32,14 +28,8 @@
32 </setting-item-box> 28 </setting-item-box>
33 <setting-item-box name="背景选择" :alone="true"> 29 <setting-item-box name="背景选择" :alone="true">
34 <setting-item> 30 <setting-item>
35 - <n-select  
36 - size="small"  
37 - placeholder="请选择您要使用的背景"  
38 - style="width: 250px"  
39 - v-model:value="selectValue"  
40 - :options="selectBgOptions"  
41 - @update:value="selectBgValueHandle"  
42 - /> 31 + <n-select size="small" placeholder="请选择您要使用的背景" style="width: 250px" v-model:value="selectValue"
  32 + :options="selectBgOptions" @update:value="selectBgValueHandle" />
43 </setting-item> 33 </setting-item>
44 </setting-item-box> 34 </setting-item-box>
45 <setting-item-box name="文字" :alone="true"> 35 <setting-item-box name="文字" :alone="true">
@@ -83,11 +73,7 @@ @@ -83,11 +73,7 @@
83 </setting-item-box> 73 </setting-item-box>
84 <setting-item-box name="文字"> 74 <setting-item-box name="文字">
85 <setting-item name="字体大小"> 75 <setting-item name="字体大小">
86 - <n-input-number  
87 - v-model:value="optionData.textRightFontSize"  
88 - size="small"  
89 - placeholder="字体大小"  
90 - ></n-input-number> 76 + <n-input-number v-model:value="optionData.textRightFontSize" size="small" placeholder="字体大小"></n-input-number>
91 </setting-item> 77 </setting-item>
92 <setting-item name="字体位置x轴"> 78 <setting-item name="字体位置x轴">
93 <n-input-number v-model:value="optionData.xT" size="small" placeholder="字体位置"></n-input-number> 79 <n-input-number v-model:value="optionData.xT" size="small" placeholder="字体位置"></n-input-number>
@@ -133,7 +119,7 @@ const selectValue = ref('headerBg08') @@ -133,7 +119,7 @@ const selectValue = ref('headerBg08')
133 119
134 // TODO待封装 成传文件夹名字获取下面所有图片 120 // TODO待封装 成传文件夹名字获取下面所有图片
135 const getFetchImages = () => { 121 const getFetchImages = () => {
136 - const imagesModules = import.meta.globEager('@/assets/external/headbackground/*') 122 + const imagesModules: Record<string, { default: string }> = import.meta.glob('@/assets/external/headbackground/*', { eager: true })
137 selectBgOptions.value = Object.keys(imagesModules).map(item => ({ 123 selectBgOptions.value = Object.keys(imagesModules).map(item => ({
138 label: imagesModules[item]?.default.split('/').at(-1), 124 label: imagesModules[item]?.default.split('/').at(-1),
139 value: imagesModules[item]?.default 125 value: imagesModules[item]?.default
@@ -199,31 +185,38 @@ const clearImage = () => { @@ -199,31 +185,38 @@ const clearImage = () => {
199 <style lang="scss" scoped> 185 <style lang="scss" scoped>
200 // $uploadWidth: 215px; 186 // $uploadWidth: 215px;
201 $uploadHeight: 193px; 187 $uploadHeight: 193px;
  188 +
202 .upload-box { 189 .upload-box {
203 cursor: pointer; 190 cursor: pointer;
204 margin-bottom: 20px; 191 margin-bottom: 20px;
  192 +
205 @include deep() { 193 @include deep() {
206 .n-card__content { 194 .n-card__content {
207 padding: 0; 195 padding: 0;
208 overflow: hidden; 196 overflow: hidden;
209 } 197 }
  198 +
210 .n-upload-dragger { 199 .n-upload-dragger {
211 padding: 5px; 200 padding: 5px;
212 // width: $uploadWidth; 201 // width: $uploadWidth;
213 } 202 }
214 } 203 }
  204 +
215 .upload-show { 205 .upload-show {
216 width: -webkit-fill-available; 206 width: -webkit-fill-available;
217 height: $uploadHeight; 207 height: $uploadHeight;
218 border-radius: 5px; 208 border-radius: 5px;
219 } 209 }
  210 +
220 .upload-img { 211 .upload-img {
221 display: flex; 212 display: flex;
222 flex-direction: column; 213 flex-direction: column;
223 align-items: center; 214 align-items: center;
  215 +
224 img { 216 img {
225 height: 150px; 217 height: 150px;
226 } 218 }
  219 +
227 .upload-desc { 220 .upload-desc {
228 padding: 10px 0; 221 padding: 10px 0;
229 } 222 }