diff --git a/src/components/ImageUploader.jsx b/src/components/ImageUploader.jsx index b4f719a..fc4ca2c 100644 --- a/src/components/ImageUploader.jsx +++ b/src/components/ImageUploader.jsx @@ -1,6 +1,6 @@ import { useEffect, useState } from "react"; -import { Upload, List, Button, Popconfirm , Col , Row } from "antd"; -import { UploadOutlined, FileTextOutlined,DeleteOutlined } from "@ant-design/icons"; +import { Upload, List, Button, Popconfirm, Col, Row } from "antd"; +import { UploadOutlined, FileTextOutlined, DeleteOutlined } from "@ant-design/icons"; import { Image } from "antd"; import { fetchJSON } from "@/utils/request"; import { HT3_HOST } from "@/config"; @@ -21,9 +21,15 @@ const simple_encrypt = text => { }; // 获取图片列表 -const getImageList = async (key,type='111') => { +const getImageList = async (key, overlist = false) => { try { - const { errcode, result } = await fetchJSON(`${HT3_HOST}/oss/list_unique_key?key=${key}&type=${type}`); + let url; + if (overlist) { + url = `${HT3_HOST}/oss/list_over_unique_key?key=${key}`; + } else { + url = `${HT3_HOST}/oss/list_unique_key?key=${key}`; + } + const { errcode, result } = await fetchJSON(url); if (errcode === 0) { return result .map(file => ({ @@ -221,13 +227,12 @@ export const ImageUploader = props => { export const ImageViewer = props => { const [fileList, setFileList] = useState([]); const key = props.osskey; - const type = props.type || '111'; - + const overlist = props.overlist || false; // 组件挂载时获取图片列表 useEffect(() => { const loadImages = async () => { - const images = await getImageList(key,type); + const images = await getImageList(key, overlist); setFileList(images); if (props.onChange) { @@ -245,23 +250,23 @@ export const ImageViewer = props => { <> - {fileList && - fileList.map(item => { - return ( - - {item.key.match(/\.(jpg|jpeg|png|gif|bmp|webp)$/i) ? ( + {fileList && + fileList.map(item => { + return ( + + {item.key.match(/\.(jpg|jpeg|png|gif|bmp|webp)$/i) ? ( - ) : ( - - - - )} - - ); - })} - + ) : ( + + + + )} + + ); + })} + ); diff --git a/src/views/CustomerImageViewer.jsx b/src/views/CustomerImageViewer.jsx index 57d42d0..eb2f2af 100644 --- a/src/views/CustomerImageViewer.jsx +++ b/src/views/CustomerImageViewer.jsx @@ -1,47 +1,31 @@ -import React, { useState, useEffect } from 'react'; -import { Input, Button, Card, Typography, Space, Alert } from 'antd'; -import { useParams } from 'react-router-dom'; -import {ImageViewer} from '@/components/ImageUploader'; - - -const { Title, Text } = Typography; +import { useState, useEffect } from "react"; +import { Alert } from "antd"; +import { useParams } from "react-router-dom"; +import { ImageViewer } from "@/components/ImageUploader"; const CustomerImageViewer = () => { - - const [ossKey, setOssKey] = useState(''); - const [showUploader, setShowUploader] = useState(false); - const { key } = useParams(); - - useEffect(() => { - console.log(key); - // const key = `temp/tour-guide/2025-6/31278`; - setOssKey(key); - setShowUploader(true); - }, []); - - return ( -
- -
- - {showUploader ? ( -
- -
- ) : ( -
- - 无法提取客户信息 - -
- )} -
- ); + const [ossKey, setOssKey] = useState(""); + const [showUploader, setShowUploader] = useState(false); + const { key } = useParams(); + + useEffect(() => { + setOssKey(key); + setShowUploader(true); + }, []); + + return ( + <> + {showUploader ? ( + <> + +
+ + + ) : ( + + )} + + ); }; export default CustomerImageViewer; diff --git a/src/views/feedback/Detail.jsx b/src/views/feedback/Detail.jsx index 91ab19d..dfe3845 100644 --- a/src/views/feedback/Detail.jsx +++ b/src/views/feedback/Detail.jsx @@ -23,7 +23,7 @@ function Detail() { const [feedbackInfo, setFeedbackInfo] = useState({}); const [ossKey, setOssKey] = useState(''); useEffect(() => { - const key = `temp/tour-guide/2025-6/31278`; + const key = `ghh/${GRI_SN}-${RefNo}/tourguide_image/travel-agency-${travelAgencyId}`; setOssKey(key); }, []);