Explorar el Código

feat: 添加意见反馈

王晓东 hace 1 semana
padre
commit
c9addd97b2

+ 1 - 9
src/pages/knowledge/components/CorrectionTab/components/CorrectionList.tsx

@@ -13,9 +13,8 @@ import { isSuccess } from "@/utils";
 export interface Iprops {
   entId?: number|string
   setTotalCount: (count: number) => void;
-  setData: (value: any[])=> void
 }
-const Index = ({entId, setData, setTotalCount}:Iprops) => {
+const Index = ({entId, setTotalCount}:Iprops) => {
   
   const { showModal } = useModalStore();
 
@@ -33,13 +32,6 @@ const Index = ({entId, setData, setTotalCount}:Iprops) => {
     console.log('toUpper')
     loadMore()
   }
-  
-  useEffect(() => {
-    if(pageIndex === 1){
-      console.log('setData', entId)
-      setData(list);
-    }
-  }, [entId]);
 
   useDidShow(()=> {
     mutate(undefined, { revalidate: true });

+ 5 - 11
src/pages/knowledge/components/CorrectionTab/components/CorrectionListChat.tsx

@@ -1,7 +1,7 @@
 import { ScrollView, View, Image, Text } from "@tarojs/components";
 
 import Taro, { useDidShow } from "@tarojs/taro";
-import { useEffect, useState } from "react";
+import { useEffect, useRef, useState } from "react";
 
 import { TCorrectionItem } from "@/types/correction";
 import { getCorrectionList } from "@/service/correction";
@@ -18,9 +18,8 @@ import { isSuccess } from "@/utils";
 export interface Iprops {
   entId?: number|string
   setTotalCount: (count: number) => void;
-  setData: (value: any[])=> void
 }
-const Index = ({entId, setData, setTotalCount}:Iprops) => {
+const Index = ({entId, setTotalCount}:Iprops) => {
   
   const { showModal } = useModalStore();
 
@@ -31,20 +30,15 @@ const Index = ({entId, setData, setTotalCount}:Iprops) => {
 
   
   const {data, list, loadMore, pageIndex, mutate } = useLoadMoreInfinite<TCorrectionItem[]>(
-    createKey(`api/v1/my/correction/list${entId}`, 10, [entId]),
+    createKey(`api/v1/my/correction/list${entId}`, 20, [entId]),
     fetcher);  
 
   const onScrollToUpper = async () => {
     console.log('toUpper')
     loadMore()
   }
-  console.log('pageIndex', pageIndex, list)
-  useEffect(() => {
-    if(pageIndex === 1){
-      console.log('setData', entId)
-      setData(list);
-    }
-  }, [entId]);
+  
+
 
   useDidShow(()=> {
     mutate(undefined, { revalidate: true });

+ 3 - 7
src/pages/knowledge/components/CorrectionTab/index.tsx

@@ -2,7 +2,7 @@ import { View } from "@tarojs/components";
 import EmptyData from "@/components/empty-data";
 
 import StyleFilter, { TListStyle } from "../StyleFilter";
-import { useState } from "react";
+import { useRef, useState } from "react";
 
 import CorrectionListChat from "./components/CorrectionListChat";
 import CorrectionList from "./components/CorrectionList";
@@ -10,14 +10,12 @@ import CorrectionList from "./components/CorrectionList";
 import { TEntItem } from "@/types/user";
 
 import CompanyList from "../CompanyList";
-import { TCorrectionItem } from "@/types/correction";
 
 const Index = () => {
   // const [checked, setChecked] = useState(false);
   // const [showPopup, setShowPopup] = useState(false);
   const [listStyle, setListStyle] = useState<TListStyle>("chat");
   const [ent, setEnt] = useState<TEntItem | null>(null);
-  const [list, setList] = useState<TCorrectionItem[]>();
   const [totalCount, setTotalCount] = useState<number>(0);
 
   const extraEnt: TEntItem[] = [
@@ -36,7 +34,6 @@ const Index = () => {
       return (
         <CorrectionListChat
           setTotalCount={setTotalCount}
-          setData={setList}
           entId={ent?.entId}
         />
       );
@@ -44,16 +41,15 @@ const Index = () => {
     return (
       <CorrectionList
         setTotalCount={setTotalCount}
-        setData={setList}
         entId={ent?.entId}
       />
     );
   };
-  console.log("渲染纠错模块");
+  console.log("渲染纠错模块", totalCount);
   // 渲染主体
   const renderEmpty = () => {
     // 空数据
-    if (!list?.length) {
+    if (!totalCount) {
       return (
         <View className="flex-center pt-40">
           <EmptyData type={"whiteboard"}>

+ 8 - 2
src/pages/personal/index.tsx

@@ -1,7 +1,7 @@
 import PageCustom from "@/components/page-custom/index";
 import NavBarNormal from "@/components/NavBarNormal";
 
-import { View, Input, Image } from "@tarojs/components";
+import { View, Button, Image } from "@tarojs/components";
 import Logo from "@/components/logo";
 import AvatarDefault from "@/components/AvatarDefault";
 import { useEffect, useState } from "react";
@@ -136,7 +136,13 @@ export default function Index() {
               // Taro.navigateTo({ url: "/pages/voice/index" });
             }}
           >
-            <View className="py-18 label-text">意见反馈</View>
+            <View className="py-18 label-text relative">
+              意见反馈
+              <Button
+                openType="contact"
+                className="absolute left-0 top-0 right-0 bottom-0 opacity-0"
+              ></Button>
+            </View>
           </CardListItem>
           <CardListItem
             className="pl-16"