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:
duanshuwen
2026-07-12 21:14:22 +08:00
parent 7db07273af
commit cadddb5c3f
29 changed files with 655 additions and 303 deletions

View File

@@ -1,6 +1,6 @@
<template>
<view :class="['custom-card', { 'is-selected': selected }]" @tap="emit('select')">
<text class="custom-title">自选金额</text>
<view class="custom-card is-selected">
<text class="custom-title">充值金额</text>
<label class="custom-input-wrap">
<text class="custom-currency">¥</text>
@@ -8,43 +8,29 @@
class="custom-input"
type="number"
:value="modelValue"
@focus="emit('select')"
@input="handleInput"
/>
</label>
<view class="custom-hint">
<text> 1 = 100 积分换算</text>
<text>当前可得 {{ currentPoints }} 积分</text>
<text>请输入整数金额</text>
</view>
</view>
</template>
<script setup>
import { computed } from "vue";
const props = defineProps({
defineProps({
modelValue: {
type: String,
default: "",
},
selected: {
type: Boolean,
default: false,
},
});
const emit = defineEmits(["update:modelValue", "select"]);
const currentPoints = computed(() => {
const amount = Number.parseInt(props.modelValue || "0", 10);
return Number.isNaN(amount) ? 0 : amount * 100;
});
const emit = defineEmits(["update:modelValue"]);
const handleInput = (event) => {
const rawValue = event?.detail?.value ?? event?.target?.value ?? "";
const value = String(rawValue).replace(/\D/g, "");
emit("select");
emit("update:modelValue", value);
};
</script>