文件下载
+
+
+
+
+ 取消
+
+
+
+
+ 如果浏览器没有自动下载,请直接点击
+ 下载文件
+ 按钮
+
@@ -56,6 +57,18 @@ async function copyFileId(fileId: string) {
}
}
+/** 复制下载直链 */
+async function copyDownloadLink(fileId: string) {
+ try {
+ const baseUrl = window.location.origin + window.location.pathname;
+ const downloadUrl = `${baseUrl}?id=${fileId}`;
+ await navigator.clipboard.writeText(downloadUrl);
+ await MessagePlugin.success("已复制下载直链到剪贴板");
+ } catch (error) {
+ await MessagePlugin.error("复制失败");
+ }
+}
+
/** 获取剩余时间 */
function getTimeRemaining(expiryTime: string): string {
const now = Time.now();
@@ -140,7 +153,7 @@ onMounted(fileHistoryStore.loadHistory);
}
.actions {
- gap: 1rem;
+ gap: .5rem;
display: flex;
.download {
@@ -151,4 +164,20 @@ onMounted(fileHistoryStore.loadHistory);
}
}
}
+
+@media (max-width: 960px) {
+ .file-history-list {
+ flex-direction: column;
+
+ .list .item .bottom {
+ align-items: flex-start;
+ flex-direction: column;
+
+ .actions {
+ margin-top: .5rem;
+ place-self: flex-end;
+ }
+ }
+ }
+}
diff --git a/src/components/FileUpload.vue b/src/components/FileUpload.vue
index d6900b5..c19d2c3 100644
--- a/src/components/FileUpload.vue
+++ b/src/components/FileUpload.vue
@@ -204,7 +204,7 @@ async function upload(files: File[]) {
.upload-area {
border: .125rem dashed #CBD5E0;
- padding: 1rem 2.5rem;
+ padding: 1rem;
text-align: center;
transition: all .3s ease;
background: #F7FAFC;
diff --git a/src/main.ts b/src/main.ts
index 1d27536..1d1b6a1 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -5,8 +5,10 @@ import { axios, Network, VDraggable, VPopup } from "timi-web";
import "timi-tdesign-pc/style.css";
import "timi-web/style.css";
+import "@/assets/style.less";
import Root from "@/Root.vue";
+import router from "@/router";
console.log(`
______ __ _ _
@@ -24,6 +26,7 @@ axios.interceptors.request.use(Network.userTokenInterceptors);
const pinia = createPinia();
const app = createApp(Root);
app.use(pinia);
+app.use(router);
app.directive("draggable", VDraggable as any);
app.directive("popup", VPopup as any);
app.mount("#root");
diff --git a/src/router/index.ts b/src/router/index.ts
new file mode 100644
index 0000000..4a831c8
--- /dev/null
+++ b/src/router/index.ts
@@ -0,0 +1,18 @@
+import { createRouter, createWebHistory } from "vue-router";
+import type { RouteRecordRaw } from "vue-router";
+import Home from "@/views/Home.vue";
+
+const routes: RouteRecordRaw[] = [
+ {
+ path: "/",
+ name: "Home",
+ component: Home,
+ },
+];
+
+const router = createRouter({
+ history: createWebHistory(),
+ routes,
+});
+
+export default router;
diff --git a/src/views/Home.vue b/src/views/Home.vue
index fe5ff3c..611969b 100644
--- a/src/views/Home.vue
+++ b/src/views/Home.vue
@@ -74,7 +74,7 @@ onMounted(() => setInterval(fileHistoryStore.cleanExpiredFiles, Time.S));
}
}
-@media (max-width: 45rem) {
+@media (max-width: 960px) {
.home .content {
flex-direction: column;