osskey设置

main
Ycc 1 month ago
parent a6cde1f8fb
commit 2a6c5ecf9f

@ -21,9 +21,15 @@ const simple_encrypt = text => {
}; };
// //
const getImageList = async (key,type='111') => { const getImageList = async (key, overlist = false) => {
try { 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) { if (errcode === 0) {
return result return result
.map(file => ({ .map(file => ({
@ -221,13 +227,12 @@ export const ImageUploader = props => {
export const ImageViewer = props => { export const ImageViewer = props => {
const [fileList, setFileList] = useState([]); const [fileList, setFileList] = useState([]);
const key = props.osskey; const key = props.osskey;
const type = props.type || '111'; const overlist = props.overlist || false;
// //
useEffect(() => { useEffect(() => {
const loadImages = async () => { const loadImages = async () => {
const images = await getImageList(key,type); const images = await getImageList(key, overlist);
setFileList(images); setFileList(images);
if (props.onChange) { if (props.onChange) {
@ -253,7 +258,7 @@ export const ImageViewer = props => {
<Image width={200} src={item.url} /> <Image width={200} src={item.url} />
) : ( ) : (
<a href={item.url} download> <a href={item.url} download>
<Button type="primary" icon={<FileTextOutlined />} size="large" title={item.key.replace(/^.*[\\\/]/, '')}> <Button type="primary" icon={<FileTextOutlined />} size="large" title={item.key.replace(/^.*[\\\/]/, "")}>
...{item.key.slice(-10)} ...{item.key.slice(-10)}
</Button> </Button>
</a> </a>

@ -1,46 +1,30 @@
import React, { useState, useEffect } from 'react'; import { useState, useEffect } from "react";
import { Input, Button, Card, Typography, Space, Alert } from 'antd'; import { Alert } from "antd";
import { useParams } from 'react-router-dom'; import { useParams } from "react-router-dom";
import {ImageViewer} from '@/components/ImageUploader'; import { ImageViewer } from "@/components/ImageUploader";
const { Title, Text } = Typography;
const CustomerImageViewer = () => { const CustomerImageViewer = () => {
const [ossKey, setOssKey] = useState("");
const [ossKey, setOssKey] = useState('');
const [showUploader, setShowUploader] = useState(false); const [showUploader, setShowUploader] = useState(false);
const { key } = useParams(); const { key } = useParams();
useEffect(() => { useEffect(() => {
console.log(key);
// const key = `temp/tour-guide/2025-6/31278`;
setOssKey(key); setOssKey(key);
setShowUploader(true); setShowUploader(true);
}, []); }, []);
return ( return (
<div> <>
<Alert
message="信息提示"
description="您可以在此页面查看与旅行相关的所有图片,支持点击放大等操作。"
type="info"
showIcon
/>
<br/>
{showUploader ? ( {showUploader ? (
<div> <>
<ImageViewer osskey={ossKey} type='222' /> <Alert message="Information" description="You can view all travel-related Photos on this page, provided by your tour guides." type="info" showIcon />
</div> <br />
<ImageViewer osskey={ossKey} overlist={true} />
</>
) : ( ) : (
<div> <Alert message="Error" description="Photos not found" type="error" showIcon />
<Text style={{ display: 'block', color: '#874d00', fontSize: '16px' }}>
无法提取客户信息
</Text>
</div>
)} )}
</div> </>
); );
}; };

@ -23,7 +23,7 @@ function Detail() {
const [feedbackInfo, setFeedbackInfo] = useState({}); const [feedbackInfo, setFeedbackInfo] = useState({});
const [ossKey, setOssKey] = useState(''); const [ossKey, setOssKey] = useState('');
useEffect(() => { useEffect(() => {
const key = `temp/tour-guide/2025-6/31278`; const key = `ghh/${GRI_SN}-${RefNo}/tourguide_image/travel-agency-${travelAgencyId}`;
setOssKey(key); setOssKey(key);
}, []); }, []);

Loading…
Cancel
Save