Browse Source

下载地址从环境变量中获取

孙志雷 5 years ago
parent
commit
b9f8e121c9
5 changed files with 7 additions and 5 deletions
  1. 1 1
      config/dev.env.js
  2. 1 1
      config/prod.env.js
  3. 1 1
      src/utils/request.js
  4. 2 1
      src/views/browse/index.vue
  5. 2 1
      src/views/fileDetail/index.vue

+ 1 - 1
config/dev.env.js

@@ -4,6 +4,6 @@ const prodEnv = require('./prod.env')
 
 module.exports = merge(prodEnv, {
   NODE_ENV: '"development"',
-  BASE_API: '"https://whiteboardtest.ai160.com/sharedWhiteBoard"',
+  BASE_API: '"https://whiteboardtest.ai160.com"',
   // BASE_API: '"https://easy-mock.com/mock/5950a2419adc231f356a6636/vue-admin"',
 })

+ 1 - 1
config/prod.env.js

@@ -1,6 +1,6 @@
 'use strict'
 module.exports = {
   NODE_ENV: '"production"',
-  BASE_API: '"https://whiteboard.ai160.com/sharedWhiteBoard"',
+  BASE_API: '"https://whiteboard.ai160.com"',
   // BASE_API: '"https://easy-mock.com/mock/5950a2419adc231f356a6636/vue-admin"',
 }

+ 1 - 1
src/utils/request.js

@@ -5,7 +5,7 @@ import { getToken } from '@/utils/auth'
 
 // 创建axios实例
 const service = axios.create({
-  baseURL: process.env.BASE_API // api 的 base_url
+  baseURL: process.env.BASE_API + '/sharedWhiteBoard' // api 的 base_url
   // timeout: 5000 // 请求超时时间
 })
 

+ 2 - 1
src/views/browse/index.vue

@@ -75,7 +75,8 @@ export default {
     detail(row) {
       const link = document.createElement('a')
       link.style.display = 'none'
-      link.href = `https://whiteboardtest.ai160.com/download?path=${row.taskFile.path}&fileName=${row.taskFile.fileName}`
+      // link.href = `https://whiteboardtest.ai160.com/download?path=${row.taskFile.path}&fileName=${row.taskFile.fileName}`
+      link.href = `${process.env.BASE_API}/download?path=${row.taskFile.path}&fileName=${row.taskFile.fileName}`
       link.setAttribute('download', 'excel.xlsx')
       document.body.appendChild(link)
       link.click()

+ 2 - 1
src/views/fileDetail/index.vue

@@ -74,7 +74,8 @@ export default {
     detail(row) {
       const link = document.createElement('a')
       link.style.display = 'none'
-      link.href = `https://whiteboardtest.ai160.com/download?path=${row.path}&fileName=${row.fileName}`
+      // link.href = `https://whiteboardtest.ai160.com/download?path=${row.path}&fileName=${row.fileName}`
+      link.href = `${process.env.BASE_API}/download?path=${row.path}&fileName=${row.fileName}`
       link.setAttribute('download', 'excel.xlsx')
       document.body.appendChild(link)
       link.click()