af-mobile-client-vue3 1.6.46 → 1.6.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.env CHANGED
@@ -5,7 +5,7 @@ VITE_APP_OUT_DIR=dist_af-library-mobile-web
5
5
  VITE_APP_VCONSOLE=false
6
6
  # 自定义参数
7
7
  VITE_APP_WEB_CONFIG_KEY=admin.webconfig
8
- VITE_APP_SYSTEM_NAME=af-safecheck
8
+ VITE_APP_SYSTEM_NAME=af-system
9
9
  # 最低兼容性 V4(最新产品)V3(V3产品) OA(公司OA)
10
10
  VITE_APP_COMPATIBLE=V4
11
11
  VITE_RSA_PRIVATE_KEY=MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAIRrmftLDHCQqREEJ132Onu+W3vmFbdF7QD751SrcDDGDTfzuz1zBuElvkHhuDBb7KZkXrCIe+MhvX2IvxcLObl3faX+evYlnfj2HRbF0hIpQLuIq22tL06ZcV5w7wqLxUZRpFElIFm8gZTkUvfKXVuHw89e4daDVhU5hK3GHNGTAgMBAAECgYABiINrFaE1E8pkBYx1JJA5yuhL73aUktfd2TeCU00vFg6kyrWCI85Sa2RKu/6CJNZWeOFgdubEUv7a22tRrNIZb3yUMaqtTwSso78mspIOJqjWXTkTH9WPElfTcdpdIse/lgZtPz6egxkuhadSvwrM9Y6NgusiW/5+x95Ct08iOQJBAN5aK+7uISURvGQj2EaRtgGEd8+d4oHl+BYvvTeG3qSgUikHQW3j0sp4gXPw2kxw6sjVgLFOc4FB6LGqwzOTzokCQQCYdYG8ty3Uo/ebUlNzeJFxHXjy/KvBSytAUzAXkRu3nZrkEaPQsi3dgOkZgk+F1fMDzfQ4EbDIU6xvqOoZXHg7AkATCW9XfoXR8anKfRMoP5Nwn9HOMbtR2cmaxK2TknV/bMZ8AsYETYwfj5+tuIJIJybC2RyykX/sIiN1CqS5xr7ZAkArj19rMRdaKyMi8MnBM1Cy9g3Jt2HHj5ejAGG8SgyWUOShh1y70z0BjcSMMkxQXAncK2s83ekZw7aADM4eQupjAkARRgTwwMOnn3IoKmQusKhZk0uxilZ4Zc2LH6Z4GiWnvteM0W8Zw4Z1lJUcjgQq3dGqL2RdmzeQZ+HgPIOXrZVK
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "af-mobile-client-vue3",
3
3
  "type": "module",
4
- "version": "1.6.46",
4
+ "version": "1.6.47",
5
5
  "packageManager": "pnpm@10.13.1",
6
6
  "description": "Vue + Vite component lib",
7
7
  "engines": {
@@ -40,6 +40,7 @@ const fileSource = shallowRef<string | ArrayBuffer>('')
40
40
  const textContent = ref('')
41
41
  const imageSrc = ref('')
42
42
  const videoSrc = ref('')
43
+ const audioSrc = ref('')
43
44
  const openUrl = ref('')
44
45
  const downloadName = ref('')
45
46
  const loading = ref(false)
@@ -66,24 +67,36 @@ async function init(options: FilePreviewInitOptions) {
66
67
  fileSource.value = ''
67
68
  imageSrc.value = ''
68
69
  videoSrc.value = ''
70
+ audioSrc.value = ''
69
71
 
70
72
  try {
71
73
  switch (previewKind.value) {
72
74
  case 'image':
73
75
  imageSrc.value = openUrl.value
74
76
  break
77
+
75
78
  case 'video':
76
79
  videoSrc.value = openUrl.value
77
80
  break
81
+
82
+ case 'audio':
83
+ audioSrc.value = openUrl.value
84
+ break
85
+
78
86
  case 'text':
79
87
  textContent.value = await fetchResourceText(openUrl.value)
80
88
  break
89
+
81
90
  case 'pdf':
82
91
  case 'docx':
92
+ case 'doc':
83
93
  case 'xlsx':
94
+ case 'xls':
84
95
  fileSource.value = await fetchResourceArrayBuffer(openUrl.value)
85
96
  break
86
- default:
97
+
98
+ case 'unsupported':
99
+ // 未知格式,直接用 iframe 尝试打开,无需预加载内容
87
100
  break
88
101
  }
89
102
  }
@@ -95,11 +108,6 @@ async function init(options: FilePreviewInitOptions) {
95
108
  }
96
109
  }
97
110
 
98
- function openExternal() {
99
- if (openUrl.value)
100
- window.open(openUrl.value, '_blank')
101
- }
102
-
103
111
  function handleDownload() {
104
112
  if (!openUrl.value)
105
113
  return
@@ -139,14 +147,16 @@ defineExpose({
139
147
  class="office-preview"
140
148
  @error="onRenderError"
141
149
  />
150
+ <!-- docx / doc 共用同一渲染器 -->
142
151
  <VueOfficeDocx
143
- v-else-if="previewKind === 'docx' && fileSource"
152
+ v-else-if="(previewKind === 'docx' || previewKind === 'doc') && fileSource"
144
153
  :src="fileSource"
145
154
  class="office-preview"
146
155
  @error="onRenderError"
147
156
  />
157
+ <!-- xlsx / xls 共用同一渲染器 -->
148
158
  <VueOfficeExcel
149
- v-else-if="previewKind === 'xlsx' && fileSource"
159
+ v-else-if="(previewKind === 'xlsx' || previewKind === 'xls') && fileSource"
150
160
  :src="fileSource"
151
161
  class="office-preview"
152
162
  @error="onRenderError"
@@ -157,8 +167,26 @@ defineExpose({
157
167
  <div v-else-if="previewKind === 'video'" class="preview-video-wrapper">
158
168
  <video class="preview-video" controls :src="videoSrc" />
159
169
  </div>
170
+ <div v-else-if="previewKind === 'audio'" class="preview-audio-wrapper">
171
+ <audio class="preview-audio" controls :src="audioSrc" />
172
+ </div>
160
173
  <pre v-else-if="previewKind === 'text'" class="preview-text">{{ textContent }}</pre>
161
- <VanEmpty v-else description="暂不支持在线预览该格式">
174
+ <!-- 未知格式:用 iframe 尝试直接打开,系统/浏览器自行决定如何处理 -->
175
+ <div v-else-if="previewKind === 'unsupported'" class="preview-iframe-wrapper">
176
+ <iframe
177
+ :src="openUrl"
178
+ class="preview-iframe"
179
+ sandbox="allow-scripts allow-same-origin allow-forms allow-popups"
180
+ @error="onRenderError"
181
+ />
182
+ <div class="preview-iframe-fallback">
183
+ <span>若文件无法显示,请</span>
184
+ <VanButton size="small" type="primary" plain @click="handleDownload">
185
+ 下载查看
186
+ </VanButton>
187
+ </div>
188
+ </div>
189
+ <VanEmpty v-else description="文件路径异常">
162
190
  <VanButton v-if="openUrl" size="small" type="primary" @click="handleDownload">
163
191
  下载
164
192
  </VanButton>
@@ -232,4 +260,43 @@ defineExpose({
232
260
  line-height: 1.5;
233
261
  color: #333;
234
262
  }
263
+
264
+ .preview-audio-wrapper {
265
+ display: flex;
266
+ align-items: center;
267
+ justify-content: center;
268
+ padding: 32px 16px;
269
+ min-height: 120px;
270
+ }
271
+
272
+ .preview-audio {
273
+ width: 100%;
274
+ max-width: 480px;
275
+ }
276
+
277
+ .preview-iframe-wrapper {
278
+ display: flex;
279
+ flex-direction: column;
280
+ width: 100%;
281
+ height: 100%;
282
+ flex: 1;
283
+ }
284
+
285
+ .preview-iframe {
286
+ width: 100%;
287
+ flex: 1;
288
+ min-height: 200px;
289
+ border: none;
290
+ }
291
+
292
+ .preview-iframe-fallback {
293
+ display: flex;
294
+ align-items: center;
295
+ gap: 8px;
296
+ padding: 8px 12px;
297
+ font-size: 12px;
298
+ color: #999;
299
+ flex-shrink: 0;
300
+ border-top: 1px solid #f0f0f0;
301
+ }
235
302
  </style>