feat(home): add Canvas import and update image upload logic for template selection

This commit is contained in:
iHeyTang 2025-09-25 20:46:13 +08:00
parent 884d7410c8
commit 33b08433b5
2 changed files with 4 additions and 2 deletions

View File

@ -1,4 +1,4 @@
import { View, ScrollView } from '@tarojs/components';
import { View, ScrollView, Canvas } from '@tarojs/components';
import { useEffect, useState } from 'react';
import Taro, { navigateTo } from '@tarojs/taro';
import { useAppDispatch, useAppSelector } from '../../hooks/redux';
@ -92,8 +92,9 @@ export default function Home() {
const handleTemplateClick = async (template: Template) => {
try {
// 第一步:选择并上传图片
const imageCount = template.templateType === '2image-to-video' ? 2 : 1;
const imageUrl = await sdk.chooseAndUploadImage({
count: imageCount,
onImageSelected: () => {
Taro.showLoading({
title: getLoadingText('uploading'),

View File

@ -18,6 +18,7 @@ export interface Template {
inputExample: string; // 原始图片
outputExample: string; // 输出图片
tags: string[]; // 标签数组
templateType: string; // 模板类型
}
/**