yubo
2026-04-07 a6b622246509d2043a1da3bd8d034f53c6f75c4b
fix(utils): 修复请求头Content-Type设置及更新图片接口路径

- 在请求中添加了'Content-Type': 'application/x-www-form-urlencoded'头部
- 设置responseType为'blob'以支持二进制数据处理
- 将图片相关接口路径更新为相对路径,避免Mixed Content安全问题
- 统一注释说明了图片接口使用相对路径通过API代理加载
2个文件已修改
7 ■■■■ 已修改文件
src/settings_server.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/request.js 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/settings_server.js
@@ -30,9 +30,9 @@
    downloadEmpExcel: 'http://120.24.23.155:8000/员工信息.xls',
    // 导入员工
    uploadEmpExcel: '/api/hr/empBaseInfo/importEmp',
    // 获取图片
    // 获取图片(使用相对路径通过API代理,避免Mixed Content问题)
    getFilesUploadImage: '/api/hr/filesUpload/image/',
    // 获取图片
    // 获取图片(使用相对路径通过API代理,避免Mixed Content问题)
    getAccessoryImage: '/api/hr/empAccessory/image/'
  }
}
src/utils/request.js
@@ -194,6 +194,9 @@
      transformRequest: [(params) => {
        return tansParams(params)
      }],
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
      },
      responseType: 'blob'
    }).then((r) => {
      const content = r.data