feat(aigc): fully integrate backend API and replace mock data
- Replace all static mock data with real backend API calls for templates, generation tasks, credit balance and recharge - Remove deprecated mock data files including templates.js, versionOptions.js, records.js and packages.js - Add useCurrentCredit composable for fetching and managing user credit balance - Update all components to align with new backend data shapes (e.g. templateItemId instead of id) - Add loading and disabled states for interactive UI elements - Implement full WeChat mini-program payment flow for credit recharge - Fix template and record card UI styling and media handling - Set developVersion flag to true for testing environment
This commit is contained in:
@@ -1,17 +1,13 @@
|
||||
<template>
|
||||
<view
|
||||
class="template-card"
|
||||
:class="[
|
||||
active ? 'is-active' : '',
|
||||
template.tone ? `is-${template.tone}` : '',
|
||||
]"
|
||||
:style="{ '--memory-accent': template.accent || '#0f7069' }"
|
||||
:class="{ 'is-active': active }"
|
||||
>
|
||||
<view class="template-media">
|
||||
<video
|
||||
v-if="isVideoTemplate"
|
||||
v-if="templateMediaUrl && isVideoTemplate"
|
||||
class="template-video"
|
||||
:src="template.cover"
|
||||
:src="templateMediaUrl"
|
||||
autoplay
|
||||
muted
|
||||
loop
|
||||
@@ -20,17 +16,17 @@
|
||||
:show-center-play-btn="false"
|
||||
object-fit="cover"
|
||||
/>
|
||||
<image v-else class="template-image" :src="template.cover" mode="aspectFill" />
|
||||
<image v-else-if="templateMediaUrl" class="template-image" :src="templateMediaUrl" mode="aspectFill" />
|
||||
<view class="template-media-shade" />
|
||||
</view>
|
||||
|
||||
<view class="template-copy">
|
||||
<text class="template-badge">{{ template.badge }}</text>
|
||||
<text class="template-title ellipsis-1">{{ template.title }}</text>
|
||||
<text class="template-desc ellipsis-1">{{ template.desc }}</text>
|
||||
<text class="template-note ellipsis-1">{{ template.note }}</text>
|
||||
<text class="template-badge">{{ template.templateTag }}</text>
|
||||
<text class="template-title ellipsis-1">{{ template.templateTitle || template.templateName }}</text>
|
||||
<text class="template-desc ellipsis-1">{{ template.templateSubTitle }}</text>
|
||||
<text class="template-note ellipsis-1">{{ template.templateDescription }}</text>
|
||||
<button class="template-select" type="default" @tap.stop="emit('select')">
|
||||
{{ template.buttonText }}
|
||||
选这个模板
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
@@ -54,11 +50,12 @@ const emit = defineEmits(["select"]);
|
||||
|
||||
const VIDEO_EXT_REGEXP = /\.(mp4|mov|webm|m4v)(\?.*)?$/i;
|
||||
|
||||
const isVideoTemplate = computed(() => {
|
||||
const mediaType = props.template.type || props.template.mediaType;
|
||||
if (mediaType === "video") return true;
|
||||
const templateMediaUrl = computed(() => {
|
||||
return props.template.templateContentUrl || props.template.coverPhotoUrl || "";
|
||||
});
|
||||
|
||||
return VIDEO_EXT_REGEXP.test(props.template.cover || "");
|
||||
const isVideoTemplate = computed(() => {
|
||||
return VIDEO_EXT_REGEXP.test(templateMediaUrl.value);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user