feat: update
This commit is contained in:
@@ -5,5 +5,6 @@ serverPort = 1422
|
|||||||
name = "test-http"
|
name = "test-http"
|
||||||
type = "tcp"
|
type = "tcp"
|
||||||
localIP = "127.0.0.1"
|
localIP = "127.0.0.1"
|
||||||
localPort = 8088
|
#localPort = 8088
|
||||||
|
localPort = 3000
|
||||||
remotePort = 1423
|
remotePort = 1423
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { mediaService } from '@/api/mediaService';
|
import { mediaService } from '@/api/mediaService';
|
||||||
import { postService } from '@/api/postService';
|
import { postService } from '@/api/postService';
|
||||||
import { formatDate } from "@/utils/date";
|
import { formatDate, formatDuration } from "@/utils/date";
|
||||||
import { formatFileSize } from "@/utils/filesize";
|
import { formatFileSize } from "@/utils/filesize";
|
||||||
import { getFileIcon, getFileTypeByMimeCN } from "@/utils/filetype";
|
import { getFileIcon, getFileTypeByMimeCN } from "@/utils/filetype";
|
||||||
import { useToast } from 'primevue/usetoast';
|
import { useToast } from 'primevue/usetoast';
|
||||||
@@ -373,10 +373,16 @@ const loadHeadImagePreviews = async () => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex-1 overflow-hidden">
|
<div class="flex-1 overflow-hidden">
|
||||||
<div class="text-sm font-medium text-gray-900 truncate">{{ media.name }}
|
<div class="text-sm font-medium text-gray-900 truncate">
|
||||||
|
{{ media.name }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Badge :value="getFileTypeByMimeCN(media.mime_type)" />
|
<div class="flex gap-2">
|
||||||
|
<Badge :value="getFileTypeByMimeCN(media.mime_type)" />
|
||||||
|
<Badge v-if="media.metas?.short" severity="warn" value="试听" />
|
||||||
|
<Badge v-if="media.metas?.duration" severity="secondary"
|
||||||
|
:value="'时长:' + formatDuration(media.metas?.duration)" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Button icon="pi pi-times" class="p-button-rounded p-button-text p-button-sm"
|
<Button icon="pi pi-times" class="p-button-rounded p-button-text p-button-sm"
|
||||||
@click="removeMedia(media)" aria-label="移除" />
|
@click="removeMedia(media)" aria-label="移除" />
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { mediaService } from '@/api/mediaService';
|
import { mediaService } from '@/api/mediaService';
|
||||||
import { postService } from '@/api/postService';
|
import { postService } from '@/api/postService';
|
||||||
import { formatDate } from "@/utils/date";
|
import { formatDate, formatDuration } from "@/utils/date";
|
||||||
import { formatFileSize } from "@/utils/filesize";
|
import { formatFileSize } from "@/utils/filesize";
|
||||||
import { getFileIcon, getFileTypeByMimeCN } from "@/utils/filetype";
|
import { getFileIcon, getFileTypeByMimeCN } from "@/utils/filetype";
|
||||||
import { useToast } from 'primevue/usetoast';
|
import { useToast } from 'primevue/usetoast';
|
||||||
@@ -425,7 +425,14 @@ onMounted(() => {
|
|||||||
<div class="text-sm font-medium text-gray-900 truncate">{{ media.name }}
|
<div class="text-sm font-medium text-gray-900 truncate">{{ media.name }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Badge :value="getFileTypeByMimeCN(media.mime_type)" />
|
<!-- <Badge :value="getFileTypeByMimeCN(media.mime_type)" /> -->
|
||||||
|
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<Badge :value="getFileTypeByMimeCN(media.mime_type)" />
|
||||||
|
<Badge v-if="media.metas?.short" severity="warn" value="试听" />
|
||||||
|
<Badge v-if="media.metas?.duration" severity="secondary"
|
||||||
|
:value="'时长:' + formatDuration(media.metas?.duration)" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Button icon="pi pi-times" class="p-button-rounded p-button-text p-button-sm"
|
<Button icon="pi pi-times" class="p-button-rounded p-button-text p-button-sm"
|
||||||
@click="removeMedia(media)" aria-label="移除" />
|
@click="removeMedia(media)" aria-label="移除" />
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { createRouter, createWebHashHistory } from 'vue-router';
|
import { createRouter, createWebHistory } from 'vue-router';
|
||||||
import { useAuthStore } from './stores/auth';
|
import { useAuthStore } from './stores/auth';
|
||||||
|
|
||||||
// Define your routes here
|
// Define your routes here
|
||||||
@@ -62,8 +62,8 @@ const routes = [
|
|||||||
|
|
||||||
// Create the router instance
|
// Create the router instance
|
||||||
export const router = createRouter({
|
export const router = createRouter({
|
||||||
// history: createWebHistory(),
|
history: createWebHistory("/admin/"), // Use createWebHashHistory() if you want hash-based routing
|
||||||
history: createWebHashHistory(),
|
// history: createWebHashHistory(),
|
||||||
routes
|
routes
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -14,3 +14,24 @@ dayjs.extend(timezone);
|
|||||||
export function formatDate(date) {
|
export function formatDate(date) {
|
||||||
return dayjs.tz(date, 'Asia/Shanghai').format('YYYY-MM-DD HH:mm:ss');
|
return dayjs.tz(date, 'Asia/Shanghai').format('YYYY-MM-DD HH:mm:ss');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format seconds to readable duration string
|
||||||
|
* @param {number} seconds - Number of seconds
|
||||||
|
* @returns {string} Formatted duration string (e.g., "2h 30m 15s")
|
||||||
|
*/
|
||||||
|
export function formatDuration(seconds) {
|
||||||
|
if (!seconds || seconds < 0) return '0 秒';
|
||||||
|
|
||||||
|
const hours = Math.floor(seconds / 3600);
|
||||||
|
const minutes = Math.floor((seconds % 3600) / 60);
|
||||||
|
const remainingSeconds = Math.floor(seconds % 60);
|
||||||
|
|
||||||
|
const parts = [];
|
||||||
|
if (hours > 0) parts.push(`${hours} 时`);
|
||||||
|
if (minutes > 0) parts.push(`${minutes} 分`);
|
||||||
|
if (remainingSeconds > 0 || parts.length === 0) parts.push(`${remainingSeconds} 秒`);
|
||||||
|
|
||||||
|
return parts.join(' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export default defineConfig({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
base: "./",
|
base: "/admin",
|
||||||
minify: true,
|
minify: true,
|
||||||
sourceMap: true,
|
sourceMap: true,
|
||||||
plugins: [
|
plugins: [
|
||||||
@@ -26,6 +26,8 @@ export default defineConfig({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
|
host: '0.0.0.0',
|
||||||
|
allowedHosts: ['mp.jdwan.com'],
|
||||||
port: 3000,
|
port: 3000,
|
||||||
open: true,
|
open: true,
|
||||||
proxy: {
|
proxy: {
|
||||||
|
|||||||
Reference in New Issue
Block a user