|
593 | 593 | <div class="text-sm font-medium text-gray-900">当前导出任务</div> |
594 | 594 | <div class="mt-1 text-xs text-gray-500 break-all">ID:{{ exportJob.exportId || '-' }}</div> |
595 | 595 | </div> |
596 | | - <div class="flex flex-wrap items-center gap-2"> |
597 | | - <span class="px-2.5 py-1 rounded-full text-xs border border-gray-200 bg-white text-gray-600"> |
598 | | - 状态:{{ exportStatusText }} |
599 | | - </span> |
600 | | - <span class="px-2.5 py-1 rounded-full text-xs border border-gray-200 bg-white text-gray-600"> |
601 | | - {{ exportOverallPercent }}% |
602 | | - </span> |
603 | | - <button |
604 | | - v-if="canCancelSnsExport" |
605 | | - type="button" |
606 | | - class="px-3 py-1.5 rounded-md text-xs border border-amber-200 bg-amber-50 text-amber-700 hover:bg-amber-100 transition-colors disabled:opacity-50 disabled:cursor-not-allowed" |
607 | | - :disabled="isExportCancelling" |
608 | | - @click="cancelSnsExportJob" |
609 | | - > |
610 | | - {{ isExportCancelling ? '\u53d6\u6d88\u4e2d\u2026' : '\u53d6\u6d88\u5bfc\u51fa' }} |
611 | | - </button> |
612 | | - <button |
613 | | - v-if="exportJob.status === 'done' && exportJob.exportId && hasWebExportFolder" |
614 | | - type="button" |
615 | | - class="px-3 py-1.5 rounded-md text-xs border border-[#03C160]/20 bg-[#03C160]/10 text-[#027a44] hover:bg-[#03C160]/15 transition-colors disabled:opacity-50 disabled:cursor-not-allowed" |
616 | | - :disabled="exportSaveBusy" |
617 | | - @click="saveSnsExportToSelectedFolder()" |
618 | | - > |
619 | | - {{ exportSaveBusy ? '\u4fdd\u5b58\u4e2d\u2026' : exportSaveState === 'success' ? '\u91cd\u65b0\u4fdd\u5b58\u5230\u6587\u4ef6\u5939' : '\u4fdd\u5b58\u5230\u5df2\u9009\u6587\u4ef6\u5939' }} |
620 | | - </button> |
621 | | - </div> |
| 596 | + <button |
| 597 | + v-if="exportJob.status === 'done' && exportJob.exportId && hasWebExportFolder" |
| 598 | + type="button" |
| 599 | + class="w-fit px-3 py-1.5 rounded-md text-xs border border-[#03C160]/20 bg-[#03C160]/10 text-[#027a44] hover:bg-[#03C160]/15 transition-colors disabled:opacity-50 disabled:cursor-not-allowed" |
| 600 | + :disabled="exportSaveBusy" |
| 601 | + @click="saveSnsExportToSelectedFolder()" |
| 602 | + > |
| 603 | + {{ exportSaveBusy ? '保存中…' : exportSaveState === 'success' ? '重新保存到文件夹' : '保存到已选文件夹' }} |
| 604 | + </button> |
622 | 605 | </div> |
623 | 606 |
|
624 | 607 | <div class="space-y-2"> |
|
815 | 798 | <div class="px-5 py-4 border-t border-gray-200 flex items-center justify-between gap-3"> |
816 | 799 | <div class="text-xs text-gray-500">已选 {{ exportSelectedCount }} 人</div> |
817 | 800 | <div class="flex gap-2"> |
818 | | - <button |
819 | | - v-if="canCancelSnsExport" |
820 | | - type="button" |
821 | | - class="px-4 py-2 rounded-md text-sm border border-amber-200 bg-amber-50 text-amber-700 hover:bg-amber-100 transition-colors disabled:opacity-50 disabled:cursor-not-allowed" |
822 | | - :disabled="isExportCancelling" |
823 | | - @click="cancelSnsExportJob" |
824 | | - > |
825 | | - {{ isExportCancelling ? '\u53d6\u6d88\u4e2d\u2026' : '\u53d6\u6d88\u5bfc\u51fa' }} |
826 | | - </button> |
827 | 801 | <button |
828 | 802 | type="button" |
829 | 803 | class="px-4 py-2 rounded-md text-sm border border-gray-200 bg-white hover:bg-gray-50 transition-colors" |
|
833 | 807 | </button> |
834 | 808 | <button |
835 | 809 | type="button" |
836 | | - class="px-4 py-2 rounded-md text-sm bg-[#03C160] text-white hover:bg-[#02ad56] transition-colors disabled:opacity-50 disabled:cursor-not-allowed" |
837 | | - :disabled="!selectedAccount || !exportSelectedCount || isSnsExportBusy" |
838 | | - @click="startSnsExportFromModal" |
| 810 | + class="px-4 py-2 rounded-md text-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed" |
| 811 | + :class="canCancelSnsExport ? 'border border-amber-200 bg-amber-50 text-amber-700 hover:bg-amber-100' : 'bg-[#03C160] text-white hover:bg-[#02ad56]'" |
| 812 | + :disabled="exportPrimaryActionDisabled" |
| 813 | + @click="handleExportPrimaryAction" |
839 | 814 | > |
840 | | - {{ isSnsExportBusy ? '导出中…' : '开始导出' }} |
| 815 | + {{ exportPrimaryActionLabel }} |
841 | 816 | </button> |
842 | 817 | </div> |
843 | 818 | </div> |
@@ -1139,17 +1114,6 @@ const exportActiveFormatLabel = computed(() => { |
1139 | 1114 | return exportFormatOptions.find((item) => item.value === exportActiveFormat.value)?.label || 'HTML' |
1140 | 1115 | }) |
1141 | 1116 |
|
1142 | | -const exportStatusText = computed(() => { |
1143 | | - const status = String(exportJob.value?.status || '').trim() |
1144 | | - return { |
1145 | | - queued: '排队中', |
1146 | | - running: '导出中', |
1147 | | - done: '已完成', |
1148 | | - error: '失败', |
1149 | | - cancelled: '已取消' |
1150 | | - }[status] || status || '-' |
1151 | | -}) |
1152 | | - |
1153 | 1117 | const exportOverallPercent = computed(() => { |
1154 | 1118 | const status = String(exportJob.value?.status || '').trim() |
1155 | 1119 | if (status === 'done') return 100 |
@@ -1187,6 +1151,24 @@ const canCancelSnsExport = computed(() => { |
1187 | 1151 | return status === 'queued' || status === 'running' |
1188 | 1152 | }) |
1189 | 1153 |
|
| 1154 | +const exportPrimaryActionLabel = computed(() => { |
| 1155 | + if (canCancelSnsExport.value) return isExportCancelling.value ? '取消中…' : '取消导出' |
| 1156 | + return isSnsExportBusy.value ? '导出中…' : '开始导出' |
| 1157 | +}) |
| 1158 | + |
| 1159 | +const exportPrimaryActionDisabled = computed(() => { |
| 1160 | + if (canCancelSnsExport.value) return isExportCancelling.value |
| 1161 | + return !selectedAccount.value || !exportSelectedCount.value || isSnsExportBusy.value |
| 1162 | +}) |
| 1163 | + |
| 1164 | +const handleExportPrimaryAction = async () => { |
| 1165 | + if (canCancelSnsExport.value) { |
| 1166 | + await cancelSnsExportJob() |
| 1167 | + return |
| 1168 | + } |
| 1169 | + await startSnsExportFromModal() |
| 1170 | +} |
| 1171 | + |
1190 | 1172 | const normalizeExportSelectedUsernames = (list) => { |
1191 | 1173 | const validUsernames = new Set( |
1192 | 1174 | visibleSnsUsers.value |
|
0 commit comments