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

@@ -8,30 +8,44 @@
:is-mask-click="false"
>
<view class="photo-pick-drawer">
<view class="photo-pick-close" @tap="emit('close')">
<uni-icons type="closeempty" size="30" color="#8fa2ba" />
</view>
<text class="photo-pick-title">选择照片</text>
<view class="photo-pick-card">
<view class="photo-pick-plus">+</view>
<text class="photo-pick-card-title">上传照片或视频素材</text>
<text class="photo-pick-card-desc">
选择后会自动进行清晰度人脸数量和遮挡检测
</text>
</view>
<view class="photo-pick-actions">
<view class="photo-pick-action" hover-class="is-pressed" @tap="emit('camera')">
拍照
<view
class="photo-pick-close"
:class="{ 'is-disabled': loading }"
@tap="handleClose"
>
<uni-icons type="closeempty" size="30" color="#8fa2ba" />
</view>
<view class="photo-pick-action" hover-class="is-pressed" @tap="emit('album')">
相册
</view>
</view>
<text class="photo-pick-hint">建议使用半身照避免墨镜口罩强逆光</text>
<text class="photo-pick-title">选择照片</text>
<view class="photo-pick-card">
<view class="photo-pick-plus">+</view>
<text class="photo-pick-card-title">上传照片素材</text>
<text class="photo-pick-card-desc">
选择后会自动进行清晰度人脸数量和遮挡检测
</text>
</view>
<view class="photo-pick-actions">
<view
class="photo-pick-action"
:class="{ 'is-disabled': loading }"
:hover-class="loading ? 'none' : 'is-pressed'"
@tap="handleCamera"
>
拍照
</view>
<view
class="photo-pick-action"
:class="{ 'is-disabled': loading }"
:hover-class="loading ? 'none' : 'is-pressed'"
@tap="handleAlbum"
>
相册
</view>
</view>
<text class="photo-pick-hint">建议使用半身照避免墨镜口罩强逆光</text>
</view>
</uni-popup>
</template>
@@ -39,9 +53,34 @@
<script setup>
import { nextTick, onMounted, ref } from "vue";
const props = defineProps({
loading: {
type: Boolean,
default: false,
},
});
const emit = defineEmits(["close", "camera", "album"]);
const popupRef = ref(null);
const handleClose = () => {
if (props.loading) return;
emit("close");
};
const handleCamera = () => {
if (props.loading) return;
emit("camera");
};
const handleAlbum = () => {
if (props.loading) return;
emit("album");
};
onMounted(async () => {
await nextTick();
popupRef.value?.open();