feat(home): add Canvas import and update image upload logic for template selection
This commit is contained in:
parent
884d7410c8
commit
33b08433b5
|
|
@ -1,4 +1,4 @@
|
||||||
import { View, ScrollView } from '@tarojs/components';
|
import { View, ScrollView, Canvas } from '@tarojs/components';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import Taro, { navigateTo } from '@tarojs/taro';
|
import Taro, { navigateTo } from '@tarojs/taro';
|
||||||
import { useAppDispatch, useAppSelector } from '../../hooks/redux';
|
import { useAppDispatch, useAppSelector } from '../../hooks/redux';
|
||||||
|
|
@ -92,8 +92,9 @@ export default function Home() {
|
||||||
const handleTemplateClick = async (template: Template) => {
|
const handleTemplateClick = async (template: Template) => {
|
||||||
try {
|
try {
|
||||||
// 第一步:选择并上传图片
|
// 第一步:选择并上传图片
|
||||||
|
const imageCount = template.templateType === '2image-to-video' ? 2 : 1;
|
||||||
const imageUrl = await sdk.chooseAndUploadImage({
|
const imageUrl = await sdk.chooseAndUploadImage({
|
||||||
|
count: imageCount,
|
||||||
onImageSelected: () => {
|
onImageSelected: () => {
|
||||||
Taro.showLoading({
|
Taro.showLoading({
|
||||||
title: getLoadingText('uploading'),
|
title: getLoadingText('uploading'),
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ export interface Template {
|
||||||
inputExample: string; // 原始图片
|
inputExample: string; // 原始图片
|
||||||
outputExample: string; // 输出图片
|
outputExample: string; // 输出图片
|
||||||
tags: string[]; // 标签数组
|
tags: string[]; // 标签数组
|
||||||
|
templateType: string; // 模板类型
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue