Browse Source

修改根据部署场景更改后端地址配置,全局通用

俞宝山 4 years ago
parent
commit
46463f4a68

+ 1 - 1
_web/.env

@ -1,3 +1,3 @@
NODE_ENV=production
VUE_APP_PREVIEW=false
VUE_APP_API_BASE_URL=/api
VUE_APP_API_BASE_URL=http://127.0.0.1:82

+ 2 - 2
_web/.env.development

@ -1,3 +1,3 @@
NODE_ENV=development
VUE_APP_PREVIEW=true
VUE_APP_API_BASE_URL=/api
VUE_APP_PREVIEW=false
VUE_APP_API_BASE_URL=http://127.0.0.1:82

+ 2 - 2
_web/.env.preview

@ -1,3 +1,3 @@
NODE_ENV=production
VUE_APP_PREVIEW=true
VUE_APP_API_BASE_URL=/api
VUE_APP_PREVIEW=false
VUE_APP_API_BASE_URL=https://sep.stylefeng.cn:82

+ 1 - 0
_web/src/config/defaultSettings.js

@ -12,6 +12,7 @@
 * storageOptions: {} - Vue-ls 插件配置项 (localStorage/sessionStorage)
 * production: 变量暂先设定为 false,目的是各种环境都正常显示设置抽屉,真实环境请放开注释
 *
 *
 */
export default {

+ 0 - 2
_web/src/main.js

@ -20,7 +20,6 @@ import './components/global.less'
import { Dialog } from '@/components'
import { hasBtnPermission } from './utils/permissions' // button permission
import { baseServer} from './utils/baseServerUrl'
import { sysApplication } from './utils/applocation'
Vue.config.productionTip = false
@ -30,7 +29,6 @@ Vue.use(VueAxios)
Vue.use(Dialog)
Vue.prototype.hasPerm = hasBtnPermission
Vue.prototype.applocation = sysApplication
Vue.prototype.baseServer = baseServer
new Vue({
  router,

+ 0 - 9
_web/src/utils/baseServerUrl.js

@ -1,9 +0,0 @@
/**
 * 后端全局地址
 *
 * @author yubaoshan
 * @date 2020年7月6日20:51:01
 */
export function baseServer () {
  return "http://127.0.0.1:82"
}

+ 1 - 1
_web/src/utils/request.js

@ -7,7 +7,7 @@ import { ACCESS_TOKEN } from '@/store/mutation-types'
// 创建 axios 实例
const service = axios.create({
  baseURL: process.env.VUE_APP_API_BASE_URL, // api base_url
  baseURL: '/api', // api base_url
  timeout: 6000 // 请求超时时间
})

+ 1 - 1
_web/src/views/system/email/index.vue

@ -101,7 +101,7 @@
        })
        sysFileInfoUpload(formData).then((res) => {
          if (res.success) {
            insert(this.baseServer()+'/sysFileInfo/preview?id='+res.data)
            insert(process.env.VUE_APP_API_BASE_URL+'/sysFileInfo/preview?id='+res.data)
          }else {
            this.$message.error('编辑器上传图片失败:' + res.message);
          }

+ 1 - 1
_web/src/views/system/notice/addForm.vue

@ -137,7 +137,7 @@
        })
        sysFileInfoUpload(formData).then((res) => {
          if (res.success) {
            insert(this.baseServer()+'/sysFileInfo/preview?id='+res.data)
            insert(process.env.VUE_APP_API_BASE_URL+'/sysFileInfo/preview?id='+res.data)
          }else {
            this.$message.error('编辑器上传图片失败:' + res.message);
          }

+ 1 - 1
_web/src/views/system/notice/editForm.vue

@ -158,7 +158,7 @@
        })
        sysFileInfoUpload(formData).then((res) => {
          if (res.success) {
            insert(this.baseServer()+'/sysFileInfo/preview?id='+res.data)
            insert(process.env.VUE_APP_API_BASE_URL+'/sysFileInfo/preview?id='+res.data)
          }else {
            this.$message.error('编辑器上传图片失败:' + res.message);
          }

+ 1 - 1
_web/vue.config.js

@ -88,7 +88,7 @@ const vueConfig = {
    port: 8080,
    proxy: {
      '/api': {
        target: 'http://127.0.0.1:82',
        target: process.env.VUE_APP_API_BASE_URL,
        ws: false,
        changeOrigin: true,
        pathRewrite: {