diff --git a/env/.env.dev b/env/.env.dev index cae1be7..6a4c522 100644 --- a/env/.env.dev +++ b/env/.env.dev @@ -13,7 +13,6 @@ VITE_proxyTarget = 'http://10.40.92.74:8080' #盛旭 # VITE_proxyTarget = 'http://10.40.92.253:8080' # 牛 (个人中心 基础信息企业申请认证) -VITE_UPLOAD_URL='apiUpload - + diff --git a/env/.env.serve1 b/env/.env.serve1 index bafb909..75c8e19 100644 --- a/env/.env.serve1 +++ b/env/.env.serve1 @@ -16,3 +16,5 @@ VITE_LocalFlag = 0 + + diff --git a/env/.env.sit b/env/.env.sit index 71559b1..827c0dc 100644 --- a/env/.env.sit +++ b/env/.env.sit @@ -3,4 +3,4 @@ VITE_ENV = 'production' VITE_BUILD_MODE = 'sit' # 线上环境接口地址 -VITE_API_URL = 'http://192.168.1.3:10086' \ No newline at end of file +VITE_API_URL = 'http://112.29.103.165:1619/zlpt/' \ No newline at end of file diff --git a/src/components/uploadComponent/index.vue b/src/components/uploadComponent/index.vue index bf30694..fd26d14 100644 --- a/src/components/uploadComponent/index.vue +++ b/src/components/uploadComponent/index.vue @@ -2,7 +2,7 @@
- +
+ + +
@@ -31,13 +34,15 @@ import { ref, nextTick } from 'vue' import { ElMessage } from 'element-plus' import { Base64 } from 'js-base64' - import {apiUpload} from "http/api/myInfo" + const tmpUploadUrl = import.meta.env.VITE_API_URL +"/zlpt-file/file/cos/upload" + console.log("tmpUploadUrl",tmpUploadUrl) + const actionUrl = ref(tmpUploadUrl) const props = defineProps({ - actionUrl: { - //上传的地址 - type: String, - default: "" - }, + // actionUrl: { + // //上传的地址 + // type: String, + // default: "" + // }, width: { //上传的地址 type: String, @@ -165,6 +170,7 @@ }) } const beforeUpload = (file:any) => { + console.log("file",file) const { name = '', size } = file if (size > props.maxSize * 1024 * 1000) { ElMessage({ @@ -173,11 +179,14 @@ }) return false } - - if (!props.acceptTypeList.includes(name.split('.').pop()) + '.') { + let names = name.split(".") + let currentName = names[names.length-1] + console.log("acceptTypeListacceptTypeList",props.acceptTypeList,currentName) + console.log("name.split().pop()",) + if (!props.acceptTypeList.includes( '.'+currentName) ) { ElMessage({ type: 'warning', - message: `文件格式仅支持${props.acceptTypeList.join(',')}M` + message: `文件格式仅支持${props.acceptTypeList.join(',')}` }) return false }