refactor: remove unused CustomEmpty and related code
clean up dead code by removing all CustomEmpty component imports, template usages and the associated detailEmptyText state variable
This commit is contained in:
@@ -5,7 +5,6 @@
|
|||||||
<view class="aigc-detail-content">
|
<view class="aigc-detail-content">
|
||||||
<template v-if="taskDetail">
|
<template v-if="taskDetail">
|
||||||
<ResultPreview v-if="result.cover" :result="result" />
|
<ResultPreview v-if="result.cover" :result="result" />
|
||||||
<CustomEmpty v-else :statusText="result.resultLabel" />
|
|
||||||
<ResultMeta :items="metaItems" />
|
<ResultMeta :items="metaItems" />
|
||||||
<ResultActions :saving="isSaving" @save="handleSave" />
|
<ResultActions :saving="isSaving" @save="handleSave" />
|
||||||
|
|
||||||
@@ -15,7 +14,6 @@
|
|||||||
<view class="aigc-detail-text-action" @tap="handleOpenRecords">历史记录</view>
|
<view class="aigc-detail-text-action" @tap="handleOpenRecords">历史记录</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<CustomEmpty v-else :statusText="detailEmptyText" />
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -23,7 +21,6 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref } from "vue";
|
import { computed, ref } from "vue";
|
||||||
import { onLoad, onShareAppMessage, onShow } from "@dcloudio/uni-app";
|
import { onLoad, onShareAppMessage, onShow } from "@dcloudio/uni-app";
|
||||||
import CustomEmpty from "@/components/CustomEmpty/index.vue";
|
|
||||||
import AigcTopBar from "@/pages-aigc/components/AigcTopBar/index.vue";
|
import AigcTopBar from "@/pages-aigc/components/AigcTopBar/index.vue";
|
||||||
import { useCurrentCredit } from "@/pages-aigc/hooks/useCurrentCredit.js";
|
import { useCurrentCredit } from "@/pages-aigc/hooks/useCurrentCredit.js";
|
||||||
import { getAigcGeneratorTaskDetail } from "@/request/api/AigcApi.js";
|
import { getAigcGeneratorTaskDetail } from "@/request/api/AigcApi.js";
|
||||||
@@ -34,7 +31,6 @@ import ResultPreview from "./components/ResultPreview/index.vue";
|
|||||||
const { pointBalance, fetchCurrentCredit } = useCurrentCredit();
|
const { pointBalance, fetchCurrentCredit } = useCurrentCredit();
|
||||||
const taskId = ref("");
|
const taskId = ref("");
|
||||||
const taskDetail = ref(null);
|
const taskDetail = ref(null);
|
||||||
const detailEmptyText = ref("加载中...");
|
|
||||||
const isSaving = ref(false);
|
const isSaving = ref(false);
|
||||||
|
|
||||||
const GENERATOR_TYPE_TEXT = {
|
const GENERATOR_TYPE_TEXT = {
|
||||||
@@ -114,7 +110,6 @@ const showPlaceholderToast = (title) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const fetchTaskDetail = async () => {
|
const fetchTaskDetail = async () => {
|
||||||
detailEmptyText.value = "加载中...";
|
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: "加载中",
|
title: "加载中",
|
||||||
mask: true,
|
mask: true,
|
||||||
@@ -128,12 +123,10 @@ const fetchTaskDetail = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
taskDetail.value = null;
|
taskDetail.value = null;
|
||||||
detailEmptyText.value = "未获取到生成结果";
|
|
||||||
showPlaceholderToast("获取任务详情失败");
|
showPlaceholderToast("获取任务详情失败");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("获取AIGC生成任务详情失败", error);
|
console.error("获取AIGC生成任务详情失败", error);
|
||||||
taskDetail.value = null;
|
taskDetail.value = null;
|
||||||
detailEmptyText.value = "未获取到生成结果";
|
|
||||||
showPlaceholderToast("获取任务详情失败");
|
showPlaceholderToast("获取任务详情失败");
|
||||||
} finally {
|
} finally {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
@@ -143,7 +136,6 @@ const fetchTaskDetail = async () => {
|
|||||||
onLoad((query = {}) => {
|
onLoad((query = {}) => {
|
||||||
taskId.value = String(query.taskId || "").trim();
|
taskId.value = String(query.taskId || "").trim();
|
||||||
if (!taskId.value) {
|
if (!taskId.value) {
|
||||||
detailEmptyText.value = "缺少任务信息";
|
|
||||||
showPlaceholderToast("缺少任务ID");
|
showPlaceholderToast("缺少任务ID");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user