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:
@@ -2,12 +2,11 @@
|
||||
<view
|
||||
class="template-version-hero"
|
||||
:class="`is-${variant}`"
|
||||
:style="{ '--template-accent': template.accent || '#0a4d46' }"
|
||||
>
|
||||
<video
|
||||
v-if="isVideoTemplate"
|
||||
v-if="templateMediaUrl && isVideoTemplate"
|
||||
class="template-version-video"
|
||||
:src="template.cover"
|
||||
:src="templateMediaUrl"
|
||||
autoplay
|
||||
muted
|
||||
loop
|
||||
@@ -16,13 +15,13 @@
|
||||
:show-center-play-btn="false"
|
||||
object-fit="cover"
|
||||
/>
|
||||
<image v-else class="template-version-image" :src="template.cover" mode="aspectFill" />
|
||||
<image v-else-if="templateMediaUrl" class="template-version-image" :src="templateMediaUrl" mode="aspectFill" />
|
||||
<view class="template-version-shade" />
|
||||
|
||||
<view class="template-version-copy">
|
||||
<text class="template-version-badge">{{ template.badge || "同源双版本" }}</text>
|
||||
<text class="template-version-title">{{ template.title }}</text>
|
||||
<text class="template-version-desc">{{ template.desc }}</text>
|
||||
<text class="template-version-badge">{{ template.templateTag }}</text>
|
||||
<text class="template-version-title">{{ template.templateTitle || template.templateName }}</text>
|
||||
<text class="template-version-desc">{{ template.templateSubTitle || template.templateDescription }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -43,11 +42,12 @@ const props = defineProps({
|
||||
|
||||
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