|
103 | 103 | </a-select> |
104 | 104 | </a-form-item> |
105 | 105 | <a-form-item field="data"> |
| 106 | + <!-- 使用 label 插槽自定义标题 --> |
| 107 | + <template #label> |
| 108 | + {{ $t('common.operation.uploadFile') }} |
| 109 | + <a-tooltip :content="$t('common.operation.uploadFileOrUrl')"> |
| 110 | + <icon-info-circle |
| 111 | + style="margin-left: 4px; color: var(--color-text-3); cursor: help" |
| 112 | + /> |
| 113 | + </a-tooltip> |
| 114 | + </template> |
| 115 | + |
106 | 116 | <a-upload |
107 | 117 | v-model:file-list="uploadData.data" |
108 | 118 | draggable |
|
111 | 121 | :limit="1" |
112 | 122 | > |
113 | 123 | <template #upload-button> |
114 | | - <a-button class="w-full" |
115 | | - >{{ $t('common.operation.uploadFile') }} |
116 | | - <template #icon><icon-upload /> </template> |
| 124 | + <a-button class="w-full"> |
| 125 | + <template #icon><icon-upload /></template> |
| 126 | + {{ $t('common.operation.uploadFile') }} |
117 | 127 | </a-button> |
118 | 128 | </template> |
119 | 129 | </a-upload> |
120 | 130 | </a-form-item> |
| 131 | + <a-form-item field="url" :label="$t('common.operation.uploadUrl')"> |
| 132 | + <a-input |
| 133 | + v-model="uploadData.url" |
| 134 | + placeholder="https://example.com/test.pdf" |
| 135 | + /> |
| 136 | + </a-form-item> |
121 | 137 | </a-form> |
122 | 138 | </a-modal> |
123 | 139 | <a-modal |
@@ -153,7 +169,7 @@ import { debounce } from 'lodash'; |
153 | 169 | import { Group, Step, recruitSteps } from '@/constants/team'; |
154 | 170 | import useRecruitmentStore from '@/store/modules/recruitment'; |
155 | 171 | import TeamGroupRadio from '@/views/components/team-group-radio.vue'; |
156 | | -import { FileItem, Message } from '@arco-design/web-vue'; |
| 172 | +import { FileItem, Message, Tooltip } from '@arco-design/web-vue'; |
157 | 173 | import { useI18n } from 'vue-i18n'; |
158 | 174 | import useWindowResize from '@/hooks/resize'; |
159 | 175 | import candidateInfoCard from './candidate-info-card.vue'; |
@@ -322,22 +338,27 @@ const handleClearSelected = () => { |
322 | 338 |
|
323 | 339 | watch([curStep, currentGroup, recStore], handleClearSelected); |
324 | 340 |
|
325 | | -const uploadData = ref<{ group: Ref<Group>; data: FileItem[] }>({ |
| 341 | +const uploadData = ref<{ group: Ref<Group>; data: FileItem[]; url: string }>({ |
326 | 342 | group: currentGroup, |
327 | 343 | data: [], |
| 344 | + url: '', |
328 | 345 | }); |
329 | 346 |
|
330 | 347 | const showUploadModal = ref(false); |
331 | 348 |
|
332 | 349 | const handleUpload = async (): Promise<boolean> => { |
333 | | - if (!uploadData.value.data[0]?.file) { |
334 | | - Message.warning(t('common.operation.uploadFileFirst')); |
| 350 | + if (!uploadData.value.data[0]?.file && !uploadData.value.url) { |
| 351 | + Message.warning(t('common.operation.uploadFileOrUrlFirst')); |
| 352 | + return false; |
| 353 | + } |
| 354 | + if (uploadData.value.data[0]?.file && uploadData.value.url) { |
| 355 | + Message.warning(t('common.operation.uploadFileOrUrlOnly')); |
335 | 356 | return false; |
336 | 357 | } |
337 | 358 | const res = await recStore.uploadTest( |
338 | 359 | recStore.currentRid, |
339 | 360 | uploadData.value.group, |
340 | | - uploadData.value.data[0].file, |
| 361 | + uploadData.value.data[0]?.file || uploadData.value.url, |
341 | 362 | ); |
342 | 363 | if (!res) return false; |
343 | 364 | Message.success(t('common.result.uploadFileSuccess')); |
@@ -371,6 +392,10 @@ const handleSetStressTime = async (): Promise<boolean> => { |
371 | 392 | Message.success(t('common.result.setStressTestTimeSuccess')); |
372 | 393 | return true; |
373 | 394 | }; |
| 395 | +
|
| 396 | +// 预览链接 |
| 397 | +const preUrl = |
| 398 | + 'blob:http://localhost:5111/33cb0d31-e85c-4d11-90df-70328f58f268'; |
374 | 399 | </script> |
375 | 400 |
|
376 | 401 | <style scoped lang="less"> |
|
0 commit comments