Commit 374833cc authored by xinzhedeai's avatar xinzhedeai

fix: 导入上传问题处理

parent 10aec2f3
...@@ -74,10 +74,10 @@ VITE_STORAGE_PREFIX=SOY_ ...@@ -74,10 +74,10 @@ VITE_STORAGE_PREFIX=SOY_
# ============================================ old # ============================================ old
# 开发环境 - 视频流地址 # 开发环境 - 视频流地址
VITE_VIDEO_URL=ws://192.168.2.14:9999 VITE_VIDEO_URL=ws://192.168.2.16:9999
# 开发环境 - 所有服务接口地址 # 开发环境 - 所有服务接口地址
VITE_SERVICE_URL=http://192.168.2.14:9998 VITE_SERVICE_URL=http://192.168.2.16:9998
# 开发环境 - WebSocket 全局地址 # 开发环境 - WebSocket 全局地址
VITE_WEBSOCKET_URL=ws://192.168.2.14:9998 VITE_WEBSOCKET_URL=ws://192.168.2.16:9998
...@@ -85,6 +85,7 @@ const tableColumn = [ ...@@ -85,6 +85,7 @@ const tableColumn = [
minWidth: 160, minWidth: 160,
align: 'center', align: 'center',
render: (row: any) => { render: (row: any) => {
console.log('preview', row.preview)
return h(NImage, { return h(NImage, {
width: '70', width: '70',
lazy: true, lazy: true,
...@@ -560,7 +561,7 @@ const modifyAreaNode = async () => { ...@@ -560,7 +561,7 @@ const modifyAreaNode = async () => {
// 图片上传 - 结束回调 // 图片上传 - 结束回调
const handleFinish = ({ file, event }: { file: UploadFileInfo; event?: ProgressEvent }) => { const handleFinish = ({ file, event }: { file: UploadFileInfo; event?: ProgressEvent }) => {
const res = event?.target && event?.target?.response && JSON.parse(event?.target?.response); const res = event?.target && event?.target?.response && JSON.parse(event?.target?.response);
console.log(res, 'handleFinish----》')
if (res.code === 200) { if (res.code === 200) {
formWebCam.value.preview = res.data; formWebCam.value.preview = res.data;
message.success('图片上传成功!'); message.success('图片上传成功!');
...@@ -572,7 +573,7 @@ const handleFinish = ({ file, event }: { file: UploadFileInfo; event?: ProgressE ...@@ -572,7 +573,7 @@ const handleFinish = ({ file, event }: { file: UploadFileInfo; event?: ProgressE
// 文件上传 - 结束回调 // 文件上传 - 结束回调
const handleFinishFile = ({ file, event }: { file: UploadFileInfo; event?: ProgressEvent }) => { const handleFinishFile = ({ file, event }: { file: UploadFileInfo; event?: ProgressEvent }) => {
console.log(JSON.parse(event?.target.response)); console.log(JSON.parse(event?.target.response));
console.log('evnet 上传结束事件', event, file);
const res = JSON.parse(event?.target.response); const res = JSON.parse(event?.target.response);
if (res.code === 200) { if (res.code === 200) {
...@@ -580,13 +581,16 @@ const handleFinishFile = ({ file, event }: { file: UploadFileInfo; event?: Progr ...@@ -580,13 +581,16 @@ const handleFinishFile = ({ file, event }: { file: UploadFileInfo; event?: Progr
formWebCam.value.preview = res.data; formWebCam.value.preview = res.data;
message.success('文件上传成功!'); message.success('文件上传成功!');
getCameraList(); getCameraList();
return file;
}else{
message.error(res.msg);
} }
// message.success((event?.target as XMLHttpRequest).response); // message.success((event?.target as XMLHttpRequest).response);
// const ext = file.name.split('.')[1]; // const ext = file.name.split('.')[1];
// file.name = `更名.${ext}`; // file.name = `更名.${ext}`;
// file.url = '__HTTPS__://www.mocky.io/v2/5e4bafc63100007100d8b70f'; // file.url = '__HTTPS__://www.mocky.io/v2/5e4bafc63100007100d8b70f';
return file;
}; };
const selectWebCaM = ref([]); const selectWebCaM = ref([]);
...@@ -655,20 +659,18 @@ const realTimeMonitoring = (url: string | undefined) => { ...@@ -655,20 +659,18 @@ const realTimeMonitoring = (url: string | undefined) => {
// 图片上传前-钩子 // 图片上传前-钩子
function beforeUpload(data: { file: UploadFileInfo; fileList: UploadFileInfo[] }) { function beforeUpload(data: { file: UploadFileInfo; fileList: UploadFileInfo[] }) {
// if (data.file.file?.type !== 'image/png') { console.log('校验大虾', data)
// message.error('仅支持JPEG/JPG/PNG三种图片格式上传'); const maxSizeInBytes = 1024 * 1024 * 2.5; // 限制为 2MB(你可以根据需要调整这个值)
// return false; if (data?.file?.file?.size > maxSizeInBytes) {
// } message.error('文件大小不能超过 2.5MB');
return false; // 返回 false 阻止上传或执行其他逻辑处理大文件情况
}
// if (data.file.file?.type !== 'image/jpg') { if (data.file.file?.type !== 'image/png' && data.file.file?.type !== 'image/jpg' && data.file.file?.type !== 'image/jpeg') {
// message.error('仅支持JPEG/JPG/PNG三种图片格式上传'); message.error('仅支持JPEG/JPG/PNG三种图片格式上传');
// return false; return false;
// } }
// if (data.file.file?.type !== 'image/jpeg') {
// message.error('仅支持JPEG/JPG/PNG三种图片格式上传');
// return false;
// }
return true; return true;
} }
...@@ -791,7 +793,7 @@ const showRealTimeVideoPlayer = () => { ...@@ -791,7 +793,7 @@ const showRealTimeVideoPlayer = () => {
font-size: 13px; font-size: 13px;
line-height: 19px; line-height: 19px;
display: inline-block; display: inline-block;
"> `` ">
* 按模板文件的格式进行填写 * 按模板文件的格式进行填写
</div> </div>
</NFormItem> </NFormItem>
...@@ -803,7 +805,7 @@ const showRealTimeVideoPlayer = () => { ...@@ -803,7 +805,7 @@ const showRealTimeVideoPlayer = () => {
<!-- <NImage lazy width="100" src="https://07akioni.oss-cn-beijing.aliyuncs.com/07akioni.jpeg" /> --> <!-- <NImage lazy width="100" src="https://07akioni.oss-cn-beijing.aliyuncs.com/07akioni.jpeg" /> -->
<NSpace> <NSpace>
<!-- <NButton strong secondary>上传图片</NButton> --> <!-- <NButton strong secondary>上传图片</NButton> -->
<NUpload :max="1" action="/v1/export/upload" :headers="{ <NUpload :max="1" action="/v1/export/upload" accept=".xlsx,.xls" :headers="{
'naive-info': 'hello!' 'naive-info': 'hello!'
}" :data="{ }" :data="{
'naive-data': 'cool! naive!' 'naive-data': 'cool! naive!'
...@@ -822,7 +824,7 @@ const showRealTimeVideoPlayer = () => { ...@@ -822,7 +824,7 @@ const showRealTimeVideoPlayer = () => {
<!-- <div style="border: 1px solid red; width: 100%; height: 200px"></div> --> <!-- <div style="border: 1px solid red; width: 100%; height: 200px"></div> -->
<!-- <template #footer> --> <!-- <template #footer> -->
<NSpace justify="end"> <NSpace justify="end">
<NButton @click="impWebCamModal = false" type="primary">确定</NButton> <NButton @click="impWebCamModal = false" type="primary">关闭</NButton>
</NSpace> </NSpace>
<!-- </template> --> <!-- </template> -->
</NModal> </NModal>
...@@ -896,7 +898,7 @@ const showRealTimeVideoPlayer = () => { ...@@ -896,7 +898,7 @@ const showRealTimeVideoPlayer = () => {
<NFormItem label="图片初始化" path="selectValue"> <NFormItem label="图片初始化" path="selectValue">
<NSpace justify="space-between" style="width: 100%;"> <NSpace justify="space-between" style="width: 100%;">
<NSpace justify="start"> <NSpace justify="start">
<NUpload :max="1" action="/v1/common/upload" :headers="{ <NUpload :max="1" action="/v1/common/upload" accept="image/png,image/jpeg,image/jpg" :headers="{
'naive-info': 'hello!' 'naive-info': 'hello!'
}" :data="{ }" :data="{
'naive-data': 'cool! naive!' 'naive-data': 'cool! naive!'
...@@ -1112,6 +1114,16 @@ const showRealTimeVideoPlayer = () => { ...@@ -1112,6 +1114,16 @@ const showRealTimeVideoPlayer = () => {
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
:deep .n-upload-file-info__action.n-upload-file-info__action--text-type{
right:-24px !important;
}
:deep .n-upload-file-list.n-upload-file.n-upload-file-info.n-upload-file-info__action{
right:-64px !important;
}
#algorithmconfiguration { #algorithmconfiguration {
#canvas-4 { #canvas-4 {
position: absolute; position: absolute;
......
...@@ -4,22 +4,22 @@ import { defineConfig, loadEnv } from 'vite'; ...@@ -4,22 +4,22 @@ import { defineConfig, loadEnv } from 'vite';
import { setupVitePlugins } from './build/plugins'; import { setupVitePlugins } from './build/plugins';
import { createViteProxy, getBuildTime } from './build/config'; import { createViteProxy, getBuildTime } from './build/config';
// export const proxyTarget = 'http://192.168.3.248:9996'; // export const proxyTarget = 'http://192.168.2.16:9996';
// export const proxyTarget = 'http://192.168.2.14:9998'; // export const proxyTarget = 'http://192.168.2.16:9998';
export const proxyTarget = 'http://192.168.2.14:9998'; export const proxyTarget = 'http://192.168.2.16:9998';
// export const proxyTarget = 'http://192.168.1.119:9996'; // export const proxyTarget = 'http://192.168.1.119:9996';
// export const proxyTarget = 'http://192.168.1.119:9996'; // export const proxyTarget = 'http://192.168.1.119:9996';
// 视频地址 // 视频地址
export const videdUrl = 'ws://192.168.2.14:9999'; export const videdUrl = 'ws://192.168.2.16:9999';
// 固定接口地址 // 固定接口地址
export const apiUrl = 'http://192.168.2.14:9998'; export const apiUrl = 'http://192.168.2.16:9998';
// WS 地址 // WS 地址
export const wsUrl = 'ws://192.168.2.14:9999'; export const wsUrl = 'ws://192.168.2.16:9999';
export default defineConfig(configEnv => { export default defineConfig(configEnv => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment