Browse Source

暂存

lihuilin/feature-20250718094329-25周年庆后台
lihuilin 4 weeks ago
parent
commit
0932d3a642
  1. 11
      activitylink/src/utils/request.js
  2. 4
      activitylink/src/views/zhongchou/gift/index.vue
  3. 2
      activitylink/src/views/zhongchou/level/index.vue
  4. 5
      activitylink/vite.config.js

11
activitylink/src/utils/request.js

@ -26,5 +26,14 @@ service.interceptors.response.use(
return Promise.reject(error)
}
)
export const uploadFile = (file) => {
const formData = new FormData();
formData.append('file', file);
return service.post(import.meta.env.VITE_UPLOAD_URL, formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
});
};
export default service

4
activitylink/src/views/zhongchou/gift/index.vue

@ -346,11 +346,11 @@ const beforeUpload = (file) => {
const isLt500K = file.size / 1024 < 500;
if (!isJPG && !isPNG) {
ElMessage.error('上传图片只能是 JPG 或 PNG 格式!');
ElMessage.error('上传图片只能是 JPG 或 PNG 格式');
return false;
}
if (!isLt500K) {
ElMessage.error('上传图片大小不能超过 500KB!');
ElMessage.error('上传图片大小不能超过 500KB');
return false;
}
return true;

2
activitylink/src/views/zhongchou/level/index.vue

@ -23,7 +23,7 @@
<template #default="scope">
<div style="display: flex; gap: 10px; justify-content: center;">
<el-button text type="warning" @click="editLevel(scope.row)">编辑</el-button>
<el-button text type="danger" @click="deleteGrade(scope.row)">删除</el-button>
<el-button text type="danger" @click="deleteLevel(scope.row)">删除</el-button>
</div>
</template>
</el-table-column>

5
activitylink/vite.config.js

@ -19,11 +19,6 @@ export default defineConfig({
rewrite: (path) => path.replace(/^\/api/, ''), // 移除 /api 前缀
// 或者更精确的重写(根据后端路径调整):
// rewrite: (path) => path.replace(/^\/api\/admin/, '/admin'),
},
'/hljw/api/aws/upload': {
target: 'http://39.101.133.168:8828', // 上传接口的基础地址
changeOrigin: true, // 开启跨域
rewrite: (path) => path.replace(/^\/hljw/, '/hljw'), // 保留原路径
}
},
},

Loading…
Cancel
Save