完善桌面端交互体验与发布检查

This commit is contained in:
Cheng Zhou
2026-06-30 22:26:34 +08:00
parent 628ff8828b
commit c923f887a0
30 changed files with 2507 additions and 141 deletions
@@ -121,7 +121,7 @@
{{ TEXT.common.labels.preview }}
</el-button>
<el-button link type="primary" size="small" @click="downloadVersion(row)" v-if="canReadDocument">
{{ TEXT.modules.fileVersionManagement.actions.download }}
另存为
</el-button>
<el-button link type="primary" size="small" @click="openVersion(row)" v-if="canReadDocument">
打开
@@ -264,7 +264,13 @@
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/></svg>
上传文件
</div>
<div class="upload-zone" :class="{ 'has-file': uploadFile }" @click="triggerFileInput">
<div
class="upload-zone"
:class="{ 'has-file': uploadFile }"
@click="triggerFileInput"
@dragover.prevent
@drop.prevent="handleUploadDrop"
>
<template v-if="!uploadFile">
<div class="upload-zone-icon">
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/></svg>
@@ -344,7 +350,7 @@
</template>
<script setup lang="ts">
import { computed, onMounted, reactive, ref, watch } from "vue";
import { computed, onBeforeUnmount, onMounted, reactive, ref, watch } from "vue";
import { useRoute } from "vue-router";
import { ElMessage, ElMessageBox, FormInstance, FormRules } from "element-plus";
import { Edit, Upload, Share } from "@element-plus/icons-vue";
@@ -373,6 +379,7 @@ import { usePermission } from "../../utils/permission";
import StateError from "../../components/StateError.vue";
import StateLoading from "../../components/StateLoading.vue";
import { openFile, pickFiles, saveFile } from "../../runtime";
import { onDesktopRefreshCurrentView } from "../../composables/useDesktopRefresh";
const route = useRoute();
const auth = useAuthStore();
@@ -380,6 +387,7 @@ const study = useStudyStore();
const { roleLabel, loadRoleTemplates } = useRoleTemplateMeta();
const { can } = usePermission();
const documentId = computed(() => route.params.id as string);
let desktopRefreshCleanup: (() => void) | undefined;
const loading = ref(false);
const errorMessage = ref("");
@@ -523,6 +531,10 @@ const triggerFileInput = async () => {
});
if (file) uploadFile.value = file;
};
const handleUploadDrop = (event: DragEvent) => {
const [file] = Array.from(event.dataTransfer?.files || []);
if (file) uploadFile.value = file;
};
const removeFile = () => { uploadFile.value = null; };
const distributeVisible = ref(false);
@@ -887,9 +899,14 @@ watch(previewVisible, (visible) => {
});
onMounted(async () => {
desktopRefreshCleanup = onDesktopRefreshCurrentView(loadDetail);
await loadRoleTemplates();
await loadDetail();
});
onBeforeUnmount(() => {
desktopRefreshCleanup?.();
});
</script>
<style scoped>