Procházet zdrojové kódy

fix: 形象生成视频尺寸适配

sheldon před 3 týdny
rodič
revize
fab24bed96

+ 6 - 7
src/pages/agent-avatars/index.tsx

@@ -78,7 +78,7 @@ export default function Index() {
 
   const renderMedia = (avatar: TAvatarItem) => {
     if (avatar.isVideo) {
-      return (
+      return <>
         <View className={style.videoContainer}>
           <Video
             controls={false}
@@ -89,13 +89,12 @@ export default function Index() {
             src={avatar.avatarUrl}
             className="w-full h-full"
           />
-            <View className={style.durationStatus}>
-              <View className={style.playBtn}></View>
-              <View>{formatSeconds(Math.round(avatar.videoSeconds))}</View>
-            </View>
-          )}
+          <View className={style.durationStatus}>
+            <View className={style.playBtn}></View>
+            <View>{formatSeconds(Math.round(avatar.videoSeconds))}</View>
+          </View>
         </View>
-      );
+      </>
     }
     return <Image src={avatar.avatarUrl} mode="widthFix" className="w-full" />;
   };

+ 4 - 2
src/pages/agent-gen/components/step/StepConfirm.tsx

@@ -2,6 +2,7 @@ import { View, Image } from "@tarojs/components";
 import React, { useState } from "react";
 import style from "./index.module.less";
 import WemetaRadio from '@/components/WemetaRadio'
+import { AvatarMedia } from "@/components/AvatarMedia";
 import Taro from "@tarojs/taro";
 import { TAvatarItem } from "@/service/storage";
 import { editAgentAvatar } from "@/service/agent";
@@ -39,11 +40,12 @@ export default React.memo(function Index({prev, pickedAvatar}:IProps) {
         </View>
         <View className={style.confirmChatAvatarBg}>
           <View className={style.confirmChatAvatarImage}>
-            <Image
+            <AvatarMedia source={pickedAvatar.avatarUrl} className={style.confirmChatAvatarImage} />
+            {/* <Image
               mode="widthFix"
               className="w-full"
               src={pickedAvatar.avatarUrl}
-            ></Image>
+            ></Image> */}
           </View>
           <View className={style.confirmChatAvatarBgCover}>
               <View className={style.block1}></View>

+ 6 - 4
src/pages/agent-gen/components/step/StepPick.tsx

@@ -1,5 +1,6 @@
 import { View, Swiper, SwiperItem, Image } from "@tarojs/components";
 import React, { useEffect, useState } from "react";
+import { AvatarMedia } from "@/components/AvatarMedia";
 import style from "./index.module.less";
 import IconStarColor from "@/components/icon/icon-star-color";
 import { getUploadedAvatarStatus, genAvatarVideo, type TAvatarItem } from '@/service/storage'
@@ -121,10 +122,11 @@ export default React.memo(function Index({ prev, next, taskId, setPickedAvatar }
           {avatars.map(avatar => {
             return <SwiperItem>
               <View className={style.swiperItem}>
-                <Image
+                <AvatarMedia source={avatar.avatarUrl} className="w-full h-full" />
+                {/* <Image
                   mode="widthFix"
                   src={avatar.avatarUrl}
-                ></Image>
+                ></Image> */}
                 {avatar.isOriginal && <View className={style.pickAvatarOriginal}>
                   <View>原图</View>
                 </View> }
@@ -175,11 +177,11 @@ export default React.memo(function Index({ prev, next, taskId, setPickedAvatar }
       </View>
 
       <View className="bottom-bar">
-        <View className="grid grid-cols-2 gap-8 px-20 py-12">
+        <View className="grid grid-cols-3 gap-8 px-20 py-12">
           <View className={`button-rounded`} onClick={prev}>
             上一步
           </View>
-          <View className={`button-rounded`} onClick={genVideo}>
+          <View className={`button-rounded ${avatars.length ? '' : 'opacity-20'}`} onClick={genVideo}>
             生成微视频
           </View>
           <View className={`button-rounded primary ${avatars.length ? '' : 'opacity-20'}`} onClick={()=> goNext()}>

+ 1 - 1
src/pages/agent-gen/components/step/StepStart.tsx

@@ -61,7 +61,7 @@ export default React.memo(function StepStart({ next, setTaskId }: IProps) {
           <View className={style.startIconChange} onClick={handleChange}>
             <IconChange />
           </View>
-          <Image className={style.startCard} src={currentAvatarUrl} mode="widthFix"></Image>
+          <Image className={style.startCardImage} src={currentAvatarUrl} mode="widthFix"></Image>
         </View>
       </View>
       {/* <View className="mb-24">

+ 11 - 3
src/pages/agent-gen/components/step/index.module.less

@@ -1,17 +1,24 @@
 .startContainer{
-  padding: 24px 72px 32px;
+  padding: 12px 0 0;
+  display: flex;
+  align-items: center;
+  justify-content: center;
 }
 .startCard{
   position: relative;
   display: flex;
   align-items: center;
   justify-content: center;
-  width: 200px;
-  height: 356px;
+  width: 300px;
+  height: 554px;
   border-radius: 16px;
   overflow: hidden;
   background-color: white;
 }
+.startCardImage{
+  width: 100%;
+  height: 100%;
+}
 
 .startIconChange{
   position: absolute;
@@ -33,6 +40,7 @@
   background: linear-gradient(276.8deg, #317CFA -11.65%, #FF2DF8 91.8%);
 }
 .pickContainer{
+  padding-top: 12px;
   display: flex;
   justify-content: center;
   align-items: center;

+ 2 - 0
src/pages/dislike-messages/index.tsx

@@ -20,6 +20,7 @@ import { TVisitorChat } from "@/types/visitor";
 import { useModalStore } from "@/store/modalStore";
 import { isSuccess } from "@/utils";
 import { useLoadMoreInfinite, createKey } from "@/utils/loadMoreInfinite";
+import EmptyData from "@/components/empty-data";
 
 export default function Index() {
   const router = useRouter();
@@ -125,6 +126,7 @@ export default function Index() {
           }}
         >
           <View className="pb-80">
+            {dislikeList.length <=0 ? <View className="pt-24"><EmptyData type="box" /> </View>: <></>}
             {dislikeList.map((item) => {
               return (
                 <View className="flex flex-col gap-16 px-16 mb-16">