Browse Source

fix: 联系人展示更多信息; 上传封面增加清空;

王晓东 5 ngày trước cách đây
mục cha
commit
e704709a9c

+ 9 - 2
project.private.config.json

@@ -8,12 +8,19 @@
   "condition": {
     "miniprogram": {
       "list": [
+        {
+          "name": "contactus",
+          "pathName": "pages/contact-us/index",
+          "query": "",
+          "scene": null,
+          "launchMode": "default"
+        },
         {
           "name": "pages/agent/index",
           "pathName": "pages/agent/index",
           "query": "agentId=p_2e73c9d7efaYfDo2-agent_991",
-          "scene": null,
-          "launchMode": "default"
+          "launchMode": "default",
+          "scene": null
         },
         {
           "name": "pages/contact/index",

+ 2 - 2
src/components/EmptyData/index.tsx

@@ -7,8 +7,8 @@ interface IProps {
 }
 export default ({type, className='', text = '暂无数据', children}: IProps)=> {
   return (
-    <View className={`flex flex-col items-center ${className}`}>
-      <View className={`data-empty data-empty${type}`}></View>
+    <View className={`flex flex-col items-center mt-44 ${className}`}>
+      <View className={`data-empty data-empty-${type}`}></View>
       {children ? children : <View className='text-16 text-black font-medium text-center leading-24 mt-20'>{text}</View>}
     </View>
   )

+ 2 - 2
src/components/KnowledgeIcon/index.tsx

@@ -4,10 +4,10 @@ import IconFileTxt from "@/components/icon/IconFileDOC";
 import IconFilePDF from "@/components/icon/IconFilePDF";
 import IconFileXLSX from "@/components/icon/IconFileXLSX";
 import { TKnowledgeItem } from "@/types/knowledge";
-export interface Iprops {
+export interface IProps {
   data?: TKnowledgeItem | null
 }
-const KnowledgeIcon = ({data}:Iprops) => {
+const KnowledgeIcon = ({data}:IProps) => {
   if(!data){
     return <></>
   }

+ 3 - 2
src/components/chat-message/MessageRobot.tsx

@@ -20,8 +20,9 @@ interface Props {
   text: string;
   textReasoning: string;
   message: TMessage;
+  showUser?: boolean
 }
-export default ({ agent, text, message, textReasoning = "" }: Props) => {
+export default ({ agent, text, message, showUser=false, textReasoning = "" }: Props) => {
   const [isDislike, setIsDislike] = useState(message.isDislike);
   const [isLike, setIsLike] = useState(message.isLike);
   // console.log('helloworld: ', message)
@@ -138,7 +139,7 @@ export default ({ agent, text, message, textReasoning = "" }: Props) => {
 
   return (
     <View>
-      {agent && (
+      {showUser && (
         <View className="flex gap-8 mb-10">
           <View className={style.avatarContainer}>
             <AvatarMedia source={agent?.avatarLogo || ''} className={style.avatar} mode="aspectFill"></AvatarMedia>

+ 33 - 0
src/components/form/FormItemSingleImage/index.module.less

@@ -0,0 +1,33 @@
+.coverContainer{
+  display: flex;
+  flex-direction: column;
+  gap: 12px;
+  border-radius: 10px;
+  background-color: #fff;
+  align-items: center;
+  justify-content: center;
+  width: 100%;
+  overflow: hidden;
+  min-height: 180px;
+}
+.iconAdd{
+  width: 20px;
+  height: 20px;
+}
+.cover{
+  width: 100%;
+  display: block;
+  vertical-align: bottom;
+}
+.deleteButton{
+  position: absolute;
+  top: 0;
+  right: 0;
+  z-index: 1;
+  width: 32px;
+  height: 32px;
+  border-top-right-radius: 8px;
+  border-bottom-left-radius: 8px;
+  padding: 8px;
+  background-color: rgba(white, .85);
+}

+ 83 - 0
src/components/form/FormItemSingleImage/index.tsx

@@ -0,0 +1,83 @@
+import { View, Image } from "@tarojs/components";
+import Taro from "@tarojs/taro";
+
+import IconDeleteGray16 from "@/components/icon/IconDeleteGray16";
+
+import style from "./index.module.less";
+import { uploadImage } from "@/utils/http";
+
+interface IProps {
+  url?: string
+  setUrl: (url: string)=> void
+}
+export default function Index({url, setUrl}:IProps) {
+
+  const handleAddPoster = () => {
+    Taro.chooseImage({
+      count: 1,
+      sizeType: ["original", "compressed"],
+      sourceType: ["album", "camera"],
+      async success(chooseImageRes) {
+        const tempFilePaths = chooseImageRes.tempFilePaths;
+        const res = await uploadImage(tempFilePaths[0]);
+        if (res?.publicUrl) {
+          setUrl(res.publicUrl);
+        }
+      },
+    });
+  };
+
+
+  const onDelete = () => {
+    setUrl('')
+  }
+  
+
+  // 渲染封面
+  const renderPoster = (src?: string) => {
+    if (src) {
+      return (
+        <View className="w-full overflow-hidden relative">
+          <View className={style.deleteButton} onClick={(e:any)=> {
+                e.stopPropagation();
+                onDelete()
+              }}>
+                <IconDeleteGray16 />
+              </View>
+          <Image className={style.cover} mode="widthFix" src={src}></Image>
+        </View>
+      );
+    }
+    return (
+      <>
+        <View>
+          <Image
+            src="https://cdn.wehome.cn/cmn/png/100/META-H8UKVHWU-KIGP3BIL7M5AYC6XHNUA2-VDZCWI2M-O91.png"
+            className={style.iconAdd}
+          ></Image>
+        </View>
+        <View className="text-gray-45 text-12 leading-20 text-center">
+          上传展示图
+        </View>
+      </>
+    );
+  };
+
+
+  
+
+  return ( <View className="flex flex-col gap-6 w-full">
+    <View className="flex w-full items-center">
+      <View className="flex-1">
+        封面图
+      </View>
+    </View>
+    <View
+      className={`${style.coverContainer}`}
+      onClick={handleAddPoster}
+    >
+      {renderPoster(url)}
+    </View>
+  </View>
+  );
+}

+ 7 - 0
src/components/icon/IconArrowLeftWhite24/index.tsx

@@ -0,0 +1,7 @@
+import { Image } from '@tarojs/components'
+import Icon from '@/images/svgs/IconArrowLeftWhite24.svg'
+export default () => {
+  return (
+    <Image src={Icon} mode="widthFix" style={{width: '24px', height: '24px'}}></Image>
+  )
+}

+ 1 - 1
src/components/wemeta-input/index.tsx

@@ -41,7 +41,7 @@ const index = ({
     setFocus(true);
   };
   const handleBlur = () => {
-    console.log("textarea blur");
+    // console.log("textarea blur");
     if (!isInbox) {
       setFocus(false);
       if (onBlur && inputRef.current) {

+ 1 - 1
src/components/wemeta-textarea/index.tsx

@@ -47,7 +47,7 @@ const index = ({
     setFocus(true);
   };
   const handleBlur = () => {
-    console.log("textarea blur");
+    // console.log("textarea blur");
     if (!isInbox) {
       setFocus(false);
       if (onBlur && inputRef.current) {

+ 3 - 0
src/images/svgs/IconArrowLeftWhite24.svg

@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="design-iconfont">
+  <path d="M8.38611597,11.9920211 L16.1648223,4.73560142 C16.5466071,4.38527549 16.5943218,3.73470705 16.2602741,3.33434461 C15.9262263,2.93400563 15.3058232,2.88394566 14.9240608,3.23427159 L6.33407011,11.2413562 C6.0954518,11.4415256 6,11.6917551 6,11.9920211 C6,12.292287 6.0954518,12.5425165 6.33407011,12.742686 L14.9240608,20.7497705 C15.114942,20.8999035 15.3535603,21 15.5444415,21 C15.8307745,21 16.0693928,20.8999035 16.2602741,20.6496975 C16.5943218,20.2493351 16.5943218,19.5987667 16.1648223,19.2484407 L8.38611597,11.9920211 Z" fill="#FFF" fill-rule="nonzero"/>
+</svg>

+ 3 - 3
src/pages/chat/index.tsx

@@ -9,7 +9,7 @@ import { useTextChat } from "@/store/textChat";
 import { TRobotMessage, TMessage, EContentType } from "@/types/bot";
 
 import ChatGreeting from "./components/ChatGreeting";
-import IconArrowLeft from "@/components/icon/icon-arrow-left";
+import IconArrowLeftWhite24 from "@/components/icon/IconArrowLeftWhite24";
 import PersonalCard from "./components/personal-card";
 import { useAgentStore } from "@/store/agentStore";
 
@@ -157,7 +157,7 @@ const agent = useAgentStore((state) => {
         className="flex items-center gap-8"
         onClick={() => Taro.navigateBack()}
       >
-        <IconArrowLeft />
+        <IconArrowLeftWhite24 />
         <PersonalCard agent={agent} size="mini" />
       </View>
     );
@@ -198,7 +198,7 @@ const agent = useAgentStore((state) => {
           onScrollToUpper={onScrollToUpper}
           onScrollToLower={()=> setAutoScroll(true)}
         >
-          <View id="messageList" className="flex flex-col gap-8 px-18" onTouchMove={handleTouchMove}>
+          <View id="messageList" className="flex flex-col gap-16 px-18" onTouchMove={handleTouchMove}>
             {showWelcome && <ChatGreeting agent={agent} />}
             {/* 复制 histories 再 reverse 否则会影响 state */}
             {allMessages.map((message) => {

+ 6 - 8
src/pages/contact-us/index.tsx

@@ -1,11 +1,11 @@
-import { useState } from "react";
+import { useMemo, useState } from "react";
 import { View } from "@tarojs/components";
 
 import PageCustom from "@/components/page-custom/index";
 import NavBarNormal from "@/components/NavBarNormal/index";
 import WemetaInput from "@/components/wemeta-input/index";
 import WemetaTextarea from "@/components/wemeta-textarea";
-import FormItem from '@/components/form/FormItem'
+import FormItem from '@/components/Form/FormItem'
 
 import  PickerSingleColumn from "@/components/Picker/PickerSingleColumn";
 import IconArrowDownRounded from '@/components/icon/IconArrowDownRounded';
@@ -14,6 +14,7 @@ import { saveMyContact } from '@/service/user'
 import BottomBar from "@/components/BottomBar";
 import { isSuccess } from "@/utils";
 import Taro from "@tarojs/taro";
+import ButtonMain from "@/components/buttons/ButtonMain";
 
 export default function Index() {
 
@@ -57,6 +58,7 @@ export default function Index() {
     }
   };
 
+  const isDisable = useMemo(()=> !value.name || !value.mobileOrWechat || !value.entName || !selected, [value, selected])
   
 
   return (
@@ -107,12 +109,8 @@ export default function Index() {
 
       </View>
       <BottomBar>
-        <View
-          className="button-rounded button-primary w-full"
-          onClick={handleSubmit}
-        >
-          提 交
-        </View>
+        <ButtonMain className="flex-1" disabled={isDisable} onClick={handleSubmit}>提 交</ButtonMain>
+        
       </BottomBar>
     </PageCustom>
   );

+ 29 - 12
src/pages/contact/components/contact-card/index.module.less

@@ -1,14 +1,19 @@
 .contactCard{
   display: flex;
   padding: 16px;
-  align-items: center;
+  align-items: flex-start;
   gap: 8px;
   // border-radius: 12px;
   color: #262626;
   font-family: "PingFang SC";
 }
-
+.avatarContainer{
+  position: relative;
+  width: 48px;
+  height: 48px;
+}
 .avatar{
+  position: relative;
   width: 48px;
   height: 48px;
   border-radius: 100%;
@@ -34,23 +39,35 @@
   line-height: 20px;
 }
 .tipCnt{
+  position: absolute;
+  z-index: 1;
+  top: 6px;
+  right: 0px;
+  font-size: 0px;
+  height: 8px;
+  width: 8px;
+  border-radius: 8px;
+  background: #FF4747;
+  border: 1px solid white;
+}
+.certificationContainer{
   display: flex;
-  justify-content: center;
   align-items: center;
-  font-size: 10px;
-  font-style: normal;
-  height: 14px;
-  padding: 2px 4px;
-  flex-shrink: 0;
-  color: white;
-  border-radius: 14px;
-  background: red;
+  justify-content: center;
+  background-color: rgba(#31BE59, .1);
+  width: 20px;
+  height: 16px;
+  border-radius: 4px;
 }
 
 .subInfo{
-  color: #777E95;
+  color: #414A64;
   font-size: 12px;
   font-style: normal;
   font-weight: 400;
   line-height: 16px;
+}
+.lastMsg {
+  .subInfo();
+  color: #A1A7BA;
 }

+ 11 - 6
src/pages/contact/components/contact-card/index.tsx

@@ -20,20 +20,25 @@ const Index = ({data, deleteable, className, refresh, fromContact}: Props)=> {
     });
   }
   
-
+  
   return (
     <View className={`${style.contactCard} ${className}`} onClick={()=>{handleClick(data)}}>
-      <View className={style.avatar}>
+      <View className={style.avatarContainer}>
         <AvatarMedia source={data.avatarUrl || ''} mode="aspectFill" className={style.avatar}></AvatarMedia>
+        {(!!data?.tipCnt) && <View className={style.tipCnt}>{data.tipCnt}</View>}
       </View>
       <View className={`${style.infoColumn} truncate`}>
         <View className={`${style.nameRow} truncate`}>
           <View className={`${style.nickName} truncate`}>{data.name}</View>
-          {data.isEnt && <IconCertificateColor></IconCertificateColor>}
+          {data.isEnt && <View className={style.certificationContainer}><IconCertificateColor></IconCertificateColor></View>}
         </View>
-        <View className='flex items-center w-full truncate'>
-          <View className={`flex-1 ${style.subInfo} truncate`}>{data.lastChatMsg}</View>
-          {(!!data?.tipCnt) && <View className={style.tipCnt}>{data.tipCnt} </View>}
+        <View className='flex flex-col w-full gap-8 truncate'>
+          <View className={`flex items-center flex-1 ${style.subInfo} truncate`}>
+            <View className='max-w-156 truncate'>{!!data.entName?.length ? data.entName : '暂无企业名称'}</View>
+            <View className='px-4'>|</View>
+            <View className='truncate'>{!!data.position?.length ? data.position : '暂无职位名称'}</View>
+          </View>
+          <View className={`flex-1 ${style.lastMsg} truncate`}>{data.lastChatMsg}</View>
         </View>
         
       </View>

+ 11 - 6
src/pages/contact/index.tsx

@@ -131,6 +131,9 @@ export default function Index() {
     ];
   };
 
+  // 有联系人列表,或者搜索栏有值,说明是搜索结果,搜索结果有可能是 0 条记录
+  const showSearchBar = totalCount > 0 || !!searchValue.length
+
   const renderContent = () => {
     if (list?.length) {
       return list.map((item) => (
@@ -148,7 +151,7 @@ export default function Index() {
         </View>
       ));
     }
-    return <EmptyData type={"search"} />;
+    return <EmptyData text="暂无联系人" type={"search"} />;
   };
 
   return (
@@ -159,11 +162,13 @@ export default function Index() {
       ></NavBarNormal>
       <View className="flex flex-col w-full">
         <View className="px-16 pb-14">
-          <SearchBar
-            value={searchValue}
-            onChange={(e) => handleSearchBarChanged(e)}
-            onClear={() => handleClear()}
-          ></SearchBar>
+          {showSearchBar && (
+            <SearchBar
+              value={searchValue}
+              onChange={(e) => handleSearchBarChanged(e)}
+              onClear={() => handleClear()}
+            ></SearchBar>
+          )}
         </View>
         <BlurContainer>
           <View className="px-16 text-gray-45 text-12 leading-20 mb-20 pt-16">

+ 5 - 63
src/pages/editor-pages/editor-channels/index.tsx

@@ -4,14 +4,13 @@ import Taro, { useRouter } from "@tarojs/taro";
 import PageCustom from "@/components/page-custom/index";
 import NavBarNormal from "@/components/NavBarNormal/index";
 import Popup from "@/components/popup/popup";
-import style from './index.module.less'
 
 import { useComponentStore } from "@/store/componentStore";
 import WemetaInput from "@/components/wemeta-input/index";
-import { uploadImage } from "@/utils/http";
 import { EComponentType } from "@/consts/enum";
 import BottomBar from "@/components/BottomBar";
 import ButtonMain from "@/components/buttons/ButtonMain";
+import FormitemSingleImage from '@/components/Form/FormItemSingleImage';
 
 export default function Index() {
   
@@ -68,57 +67,8 @@ export default function Index() {
     setTipsType(type);
     setShow(true);
   };
-
-  const handleAddPoster = () => {
-    Taro.chooseImage({
-      count: 1,
-      sizeType: ['original', 'compressed'],
-      sourceType: ['album', 'camera'],
-      async success (chooseImageRes) {
-        const tempFilePaths = chooseImageRes.tempFilePaths
-        Taro.cropImage({
-          src: tempFilePaths[0],
-          cropScale: "16:9",
-          success: async (cropRes) => {
-            const path = cropRes.tempFilePath;
-            const res = await uploadImage(path);
-            if (res?.publicUrl) {
-              setValueByKey('poster', res.publicUrl)
-            }
-          },
-        });
-        // tempFilePath可以作为img标签的src属性显示图片
-        // const tempFilePaths = response.tempFilePaths
-        // Taro.showLoading();
-        // const res = await uploadImage(tempFilePaths[0]);
-        // Taro.hideLoading();
-        // if (res?.code === 0 && res.data) {
-        //   setValueByKey('poster', res.data)
-        // }
-      }
-    })
-  };
-
-  const renderPoster = (src?: string)=> {
-    if(src){
-      return (
-        <View className="w-full overflow-hidden">
-          <Image
-            className="w-full"
-            mode="widthFix"
-            src={src}
-          ></Image>
-        </View>
-      )
-    }
-    return (
-      <>
-        <View>
-          <Image src='https://cdn.wehome.cn/cmn/png/100/META-H8UKVHWU-KIGP3BIL7M5AYC6XHNUA2-VDZCWI2M-O91.png' className={style.iconAdd}></Image>
-        </View>
-        <View className="text-gray-45 text-12 leading-20 text-center">建议上传16:9标准尺寸图</View>
-      </>
-    )
+  const setLinkPoster = (value: string)=> {
+    setValueByKey('poster', value)
   }
 
   const renderTips = (type: number) => {
@@ -201,15 +151,7 @@ export default function Index() {
                 placeholder="请输入展示名称..."
               />
             </View>
-
-            <View className="flex flex-col gap-6 w-full">
-              <View className="flex items-center">
-                <View className="flex-1 text-14 leading-28 font-medium">封面图</View>
-              </View>
-              <View className={`${style.coverContainer}`} onClick={handleAddPoster}>
-                {renderPoster(shipingValue.poster)}
-              </View>
-            </View>
+            <FormitemSingleImage url={shipingValue.poster} setUrl={setLinkPoster} ></FormitemSingleImage>
             
           </View>
         </View>
@@ -224,7 +166,7 @@ export default function Index() {
         show={show}
         setShow={setShow}
       >
-        <View className="flex flex-col gap-16 mb-88" onClick={handleAddPoster}>
+        <View className="flex flex-col gap-16 mb-88">
           <View
             className={`flex flex-col p-12 gap-10 text-14 rounded-20 leading-22 text-gray-65 bg-gray-f8 overflow-hidden`}
           >

+ 22 - 11
src/pages/editor-pages/editor-link-social/index.tsx

@@ -67,16 +67,19 @@ export default function Index() {
     <PageCustom bgColor="global-light-green-bg">
       <NavBarNormal>{defaultLabel}</NavBarNormal>
       <View className="flex flex-col items-center gap-16 w-full px-16 pb-120">
-          <View className="flex flex-col gap-6 w-full">
-          <View className="flex w-full items-center ">
-              <View className="flex text-14 leading-28 font-medium flex-1">{isShiping ? '视频号ID': '链接'}<Text className="text-red">*</Text></View>
-              {isShiping && (
-              <View className="text-primary" onClick={() => setShow(true)}>
-                  如何获取?
-                </View>
-              )}
+        <View className="flex flex-col gap-6 w-full">
+          <View className="flex w-full items-center">
+            <View className="flex text-14 leading-28 font-medium flex-1">
+              {isShiping ? "视频号ID" : "链接"}
+              <Text className="text-red">*</Text>
             </View>
-          
+            {isShiping && (
+              <View className="text-primary" onClick={() => setShow(true)}>
+                如何获取?
+              </View>
+            )}
+          </View>
+
           <WemetaTextarea
             value={linkValue}
             onInput={(value: string) => setLinkValue(value)}
@@ -86,7 +89,9 @@ export default function Index() {
         </View>
         <View className={`flex flex-col gap-6 w-full`}>
           <View className="flex w-full items-center">
-            <View className="flex flex-1 text-14 leading-28 font-medium">链接描述</View>
+            <View className="flex flex-1 text-14 leading-28 font-medium">
+              链接描述
+            </View>
           </View>
           <WemetaInput
             value={linkText}
@@ -97,7 +102,13 @@ export default function Index() {
         </View>
       </View>
       <BottomBar>
-        <ButtonMain className="flex-1" disabled={!linkValue.length} onClick={handleSubmit}>保存</ButtonMain>
+        <ButtonMain
+          className="flex-1"
+          disabled={!linkValue.length}
+          onClick={handleSubmit}
+        >
+          保存
+        </ButtonMain>
       </BottomBar>
       <Popup title={"获取视频号ID"} show={show} setShow={setShow}>
         <View className="flex flex-col gap-10 rounded-20 p-12 bg-white">

+ 12 - 0
src/pages/editor-pages/editor-link/index.module.less

@@ -18,4 +18,16 @@
   width: 100%;
   display: block;
   vertical-align: bottom;
+}
+.deleteButton{
+  position: absolute;
+  top: 0;
+  right: 0;
+  z-index: 1;
+  width: 32px;
+  height: 32px;
+  border-top-left-radius: 8px;
+  border-bottom-right-radius: 8px;
+  padding: 8px;
+  background-color: rgba(white, .85);
 }

+ 26 - 83
src/pages/editor-pages/editor-link/index.tsx

@@ -6,8 +6,9 @@ import NavBarNormal from "@/components/NavBarNormal/index";
 import WemetaTextarea from "@/components/wemeta-textarea/index";
 import WemetaInput from "@/components/wemeta-input/index";
 import ButtonMain from "@/components/buttons/ButtonMain";
+import FormitemSingleImage from '@/components/Form/FormItemSingleImage'
+import IconDeleteGray16 from "@/components/icon/IconDeleteGray16";
 
-import editorStyle from "../editor.module.less";
 import style from "./index.module.less";
 
 import BottomBar from "@/components/BottomBar";
@@ -30,27 +31,9 @@ export default function Index() {
 
   const [linkValue, setLinkValue] = useState(link ?? "");
   const [linkText, setLinkText] = useState(text ?? "");
-  const [linkPoster, setLinkPoster] = useState(poster ?? "");
+  const [linkPoster, setLinkPoster] = useState<string>(poster ?? "");
 
   const [showPopup, setShowPopup] = useState(false);
-  
-
-  
-
-  const handleAddPoster = () => {
-    Taro.chooseImage({
-      count: 1,
-      sizeType: ["original", "compressed"],
-      sourceType: ["album", "camera"],
-      async success(chooseImageRes) {
-        const tempFilePaths = chooseImageRes.tempFilePaths;
-        const res = await uploadImage(tempFilePaths[0]);
-        if (res?.publicUrl) {
-          setLinkPoster(res.publicUrl);
-        }
-      },
-    });
-  };
 
   // 选择知识库导入
   const onPicked = (pickedArr?: TKnowledgeItem[]) => {
@@ -69,6 +52,7 @@ export default function Index() {
     setShowPopup(true)
   }
 
+
   const handleSubmit = async () => {
     if(!data?.id){
       return;
@@ -93,31 +77,7 @@ export default function Index() {
     await saveComponent(c);
     Taro.navigateBack();
   };
-  
 
-  // 渲染封面
-  const renderPoster = (src?: string) => {
-    if (src) {
-      return (
-        <View className="w-full overflow-hidden">
-          <Image className={style.cover} mode="widthFix" src={src}></Image>
-        </View>
-      );
-    }
-    return (
-      <>
-        <View>
-          <Image
-            src="https://cdn.wehome.cn/cmn/png/100/META-H8UKVHWU-KIGP3BIL7M5AYC6XHNUA2-VDZCWI2M-O91.png"
-            className={style.iconAdd}
-          ></Image>
-        </View>
-        <View className="text-gray-45 text-12 leading-20 text-center">
-          上传展示图
-        </View>
-      </>
-    );
-  };
 
 
   
@@ -126,49 +86,32 @@ export default function Index() {
     <PageCustom>
       <NavBarNormal>链接</NavBarNormal>
       <View className="flex flex-col items-center w-full">
-        <View className="px-16 w-full pb-120">
-          
-
-          <View className={editorStyle.formContainer}>
-            <View className={editorStyle.formItem}>
-              <View className={editorStyle.formItemLabel}>
-                <View className="flex flex-1 items-center">
-                  <View className={editorStyle.formLabel}>链接地址</View>
-                  <View className={editorStyle.formLabelRequired}>*</View>
-                </View>
-                <View className="text-primary" onClick={showKnowlegePopup}>知识库导入</View>
+        <View className="flex flex-col items-center gap-16 w-full px-16 pb-120">
+          <View className="flex flex-col gap-6 w-full">
+            <View className="flex w-full items-center">
+              <View className="flex flex-1 items-center">
+                <View className="flex text-14 leading-28 font-medium flex-1">链接地址<Text className="text-red">*</Text></View>
               </View>
-              <WemetaTextarea
-                value={linkValue}
-                onInput={(value: string) => setLinkValue(value)}
-                placeholder="请输入URL..."
-              ></WemetaTextarea>
+              <View className="text-primary" onClick={showKnowlegePopup}>知识库导入</View>
             </View>
-            <View className={editorStyle.formItem}>
-              <View className={editorStyle.formItemLabel}>
-                <View>链接描述<Text className="text-gray-45">(选填)</Text></View>
-              </View>
-              <WemetaInput
-                value={linkText}
-                onInput={(value: string) => setLinkText(value)}
-                placeholder="请输入..."
-                maxlength={50}
-              />
-            </View>
-            <View className={editorStyle.formItem}>
-              <View className={editorStyle.formItemLabel}>
-                <View className="flex-1">
-                  封面图 <Text className="text-gray-45">(选填)</Text>
-                </View>
-              </View>
-              <View
-                className={`${style.coverContainer}`}
-                onClick={handleAddPoster}
-              >
-                {renderPoster(linkPoster)}
-              </View>
+            <WemetaTextarea
+              value={linkValue}
+              onInput={(value: string) => setLinkValue(value)}
+              placeholder="请输入URL..."
+            ></WemetaTextarea>
+          </View>
+          <View className="flex flex-col gap-6 w-full">
+            <View className="flex w-full items-center">
+              <View>链接描述</View>
             </View>
+            <WemetaInput
+              value={linkText}
+              onInput={(value: string) => setLinkText(value)}
+              placeholder="请输入..."
+              maxlength={50}
+            />
           </View>
+          <FormitemSingleImage url={linkPoster} setUrl={setLinkPoster} ></FormitemSingleImage>
         </View>
         <BottomBar>
           <ButtonMain disabled={!linkValue.length} className="flex-1" onClick={handleSubmit}>保存</ButtonMain>

+ 6 - 64
src/pages/editor-pages/editor-mini-program/index.tsx

@@ -9,7 +9,7 @@ import style from './index.module.less'
 import BottomBar from "@/components/BottomBar";
 
 import { useComponentStore } from "@/store/componentStore";
-import { uploadImage } from "@/utils/http";
+import FormitemSingleImage from '@/components/Form/FormItemSingleImage';
 import { EComponentType } from "@/consts/enum";
 import ButtonMain from "@/components/buttons/ButtonMain";
 export default function Index() {
@@ -62,62 +62,12 @@ export default function Index() {
   };
 
 
-  
-
+  const setLinkPoster = (value: string)=> {
+    setValueByKey('poster', value)
+  }
   
   
 
-  const RenderPoster =  memo(({src}:{src: string})=> {
-    if(src){
-      console.log('render image')
-      return (
-        <View className="overflow-hidden">
-          <Image
-            className="w-160 h-160"
-            mode="widthFix"
-            style="height:auto"
-            src={src}
-          ></Image>
-        </View>
-      )
-    }
-    return (
-      <>
-        <View>
-          <Image src='https://cdn.wehome.cn/cmn/png/100/META-H8UKVHWU-KIGP3BIL7M5AYC6XHNUA2-VDZCWI2M-O91.png' className={style.iconAdd}></Image>
-        </View>
-        <View className="text-gray-45 text-12 leading-20 text-center">建议上传1:1标准尺寸图</View>
-      </>
-    )
-  })
-
-  // useMemo 麻烦...
-  const RenderPosterCached = useMemo(()=> {
-    return <RenderPoster src={linkValue.poster}></RenderPoster>
-  }, [linkValue.poster])
-  
-  const handleAddPoster = () => {
-    Taro.chooseImage({
-      count: 1,
-      sizeType: ['original', 'compressed'],
-      sourceType: ['album', 'camera'],
-      async success (chooseImageRes) {
-        const tempFilePaths = chooseImageRes.tempFilePaths
-        Taro.cropImage({
-          src: tempFilePaths[0],
-          cropScale: "1:1",
-          success: async (cropRes) => {
-            const path = cropRes.tempFilePath;
-            const res = await uploadImage(path);
-            if (res?.publicUrl) {
-              setValueByKey('poster', res.publicUrl)
-            }
-          },
-        });
-      }
-    })
-  };
-
   const renderTips = () => {
     return (
       <>
@@ -164,15 +114,7 @@ export default function Index() {
                 placeholder="长按粘贴小程序链接..."
               />
             </View>
-
-            <View className="flex flex-col gap-6">
-              <View className="flex text-14 leading-28 font-medium">
-                <View className="flex-1">封面图</View>
-              </View>
-              <View className={`${style.coverContainer}`} onClick={handleAddPoster}>
-                {RenderPosterCached}
-              </View>
-            </View>
+            <FormitemSingleImage url={linkValue.poster} setUrl={setLinkPoster} ></FormitemSingleImage>
             
           </View>
         </View>
@@ -187,7 +129,7 @@ export default function Index() {
         show={show}
         setShow={setShow}
       >
-        <View className="flex flex-col gap-16 mb-88" onClick={handleAddPoster}>
+        <View className="flex flex-col gap-16 mb-88">
           <View
             className={`flex flex-col p-12 gap-10 text-14 rounded-20 leading-22 text-gray-65 bg-gray-f8 overflow-hidden`}
           >

+ 2 - 0
src/types/contact.ts

@@ -4,6 +4,8 @@ export type TContactItem = {
   avatarUrl? : string|null // 联系人头像地址 ,
   contactId : number // 联系人ID --用于置顶、删除、拉黑 ,
   isEnt : boolean // 是否企业认证联系人 ,
+  entName: string|null
+  position: string|null
   isTop : boolean // 是否置顶 ,
   lastChatMsg : string // 最新的对话内容 ,
   lastChatTime : string // 最新的对话时间 ,