This commit is contained in:
yixu
2025-09-17 22:09:32 +08:00
parent 1b89cc367b
commit 097050e5df
8 changed files with 628 additions and 622 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 262 KiB

After

Width:  |  Height:  |  Size: 210 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -233,9 +233,6 @@ const generateImage = async (options) => {
mergeFetch(index) mergeFetch(index)
} }
}, 1000) }, 1000)
router.push({
name: 'synthesizedResults'
})
const mergeFetch = async (index)=> { const mergeFetch = async (index)=> {
const statusRes = await Request(`face/merge/${mergeData.merge_id}/status`, {}, 'GET', true) const statusRes = await Request(`face/merge/${mergeData.merge_id}/status`, {}, 'GET', true)
@@ -535,6 +532,7 @@ import generateImg from '../assets/images/generate-img-bg.webp'
height: 100%; height: 100%;
border-radius: 50%; border-radius: 50%;
object-fit: cover; object-fit: cover;
object-position: top;
} }
.main { .main {
height: 100%; height: 100%;

View File

@@ -365,7 +365,7 @@ watch(() => mergeId, async (newVal) => {
:class="{ 'disabled': globalStore.game_chances <= 0 }"> :class="{ 'disabled': globalStore.game_chances <= 0 }">
<img src="../assets/images/join.webp" alt="立即参与"> <img src="../assets/images/join.webp" alt="立即参与">
<div class="join-main"> <div class="join-main">
<p class="join-value"><span>X</span>{{ globalStore.game_chances }}</p> <p class="join-value">{{ globalStore.game_chances }}</p>
</div> </div>
</div> </div>
<div class="scene-item item-3" @click="navigateTodoList"> <div class="scene-item item-3" @click="navigateTodoList">
@@ -510,8 +510,8 @@ watch(() => mergeId, async (newVal) => {
.join-main { .join-main {
position: absolute; position: absolute;
top: 3.4vw; top: 2.6vw;
right: -0.4vw; right: -3.5vw;
width: 13vw; width: 13vw;
} }
@@ -524,10 +524,6 @@ watch(() => mergeId, async (newVal) => {
font-weight: 900; font-weight: 900;
} }
.join-main .join-value span {
padding-right: 0.2vw;
}
.item-3 { .item-3 {
width: 21vw; width: 21vw;
bottom: 5vw; bottom: 5vw;

View File

@@ -221,6 +221,26 @@ markers.value = [
{ x: 0, y: 32, width: 50, height: 14 } { x: 0, y: 32, width: 50, height: 14 }
]; ];
// 从URL中提取文件名
const getFileNameFromUrl = (url) => {
if (!url) return null;
return url.substring(url.lastIndexOf('/') + 1);
};
const downloadGenerateImg = (item)=> {
try {
const link = document.createElement('a');
link.href = item.result_url;
link.download = getFileNameFromUrl(item.result_url) || 'downloaded-image.jpg';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
ElMessage.success('下载成功!');
} catch (error) {
ElMessage.success('下载失败!');
}
}
</script> </script>
<template> <template>
@@ -277,6 +297,7 @@ markers.value = [
> >
</div> </div>
<img v-if="item.status === 'progressing'" @click="getGenerateImgStatus(item)" src="../assets/images/refresh-btn.webp" class="refresh-btn" alt="刷新"> <img v-if="item.status === 'progressing'" @click="getGenerateImgStatus(item)" src="../assets/images/refresh-btn.webp" class="refresh-btn" alt="刷新">
<img v-if="item.result_url !== failedImg" @click="downloadGenerateImg(item)" src="../assets/images/download.webp" class="download-btn" alt="下载图片">
<img <img
:src="(activeBorders[index] || (globalStore.chartsBattle && item.is_public)) :src="(activeBorders[index] || (globalStore.chartsBattle && item.is_public))
? activeBorderImage : defaultBorderImage" ? activeBorderImage : defaultBorderImage"
@@ -361,11 +382,19 @@ markers.value = [
color: #855211; color: #855211;
font-size: 3.6vw; font-size: 3.6vw;
} }
.download-btn {
width: 12.6vw;
position: absolute;
bottom: 7vw;
right: 3vw;
cursor: pointer;
z-index: 9;
}
.refresh-btn { .refresh-btn {
width: 12vw; width: 12vw;
position: absolute; position: absolute;
top: 12%; top: 7vw;
right: 8%; right: 3vw;
cursor: pointer; cursor: pointer;
z-index: 9; z-index: 9;
} }

View File

@@ -33,21 +33,6 @@ export async function loadFaceApiModels() {
return true return true
} catch (error) { } catch (error) {
console.error('Face API 模型加载失败:', error) console.error('Face API 模型加载失败:', error)
// 如果本地模型加载失败,尝试从 CDN 加载
try {
console.log('尝试从 CDN 加载模型...')
await Promise.all([
faceapi.nets.tinyFaceDetector.loadFromUri('https://cdn.jsdelivr.net/npm/@vladmandic/face-api@1.7.13/model'),
faceapi.nets.faceLandmark68Net.loadFromUri('https://cdn.jsdelivr.net/npm/@vladmandic/face-api@1.7.13/model'),
faceapi.nets.faceRecognitionNet.loadFromUri('https://cdn.jsdelivr.net/npm/@vladmandic/face-api@1.7.13/model')
])
console.log('CDN 模型加载成功')
modelsLoaded = true
return true
} catch (cdnError) {
console.error('CDN 模型加载也失败:', cdnError)
return false
}
} }
} }

File diff suppressed because it is too large Load Diff