gaoluyang
2025-12-29 bbdd646b82cb8c84079598b7200b1102fd247b28
src/components/imageUpload/index.vue
@@ -99,6 +99,7 @@
<script setup>
import { ref, computed, watch, onMounted, onUnmounted, nextTick } from 'vue';
import { getToken } from "@/utils/auth";
import config from '@/config.js';
// Props 定义
const props = defineProps({
@@ -130,19 +131,10 @@
// 计算属性
const uploadFileUrl = computed(() => {
  // 获取基础API地址,适配uniapp环境
  let baseUrl = '';
  // 尝试多种方式获取baseUrl
  if (process.env.VUE_APP_BASE_API) {
    baseUrl = process.env.VUE_APP_BASE_API;
  } else if (process.env.NODE_ENV === 'development') {
    baseUrl = 'http://192.168.1.147:9036';
  } else {
    baseUrl = 'http://192.168.1.147:9036';
  }
  // 获取基础API地址,优先使用 config.js 中的 baseUrl
  const baseUrl = config.baseUrl || process.env.VUE_APP_BASE_API || 'http://192.168.1.147:7016';
  const fullUrl = baseUrl + props.action;
  console.log('上传URL:', fullUrl);
  return fullUrl;
});
const headers = computed(() => {