Browse Source

增加图片基础地址不同环境的环境变量,解决组件目录下新增index.js文件引起的页面报错,优化

master
wen 2 years ago
parent
commit
b02f076d01
  1. 3
      .env.development
  2. 2
      .env.production
  3. 1
      src/App.vue
  4. 2
      src/router/index.js
  5. 2
      src/styles/sidebar.scss
  6. 5
      src/utils/request.js
  7. 9
      src/views/subfile/index.vue
  8. 0
      src/views/subfile/indexs.js
  9. 3
      src/views/systme/switchtheme.vue

3
.env.development

@ -3,3 +3,6 @@ ENV = 'development' @@ -3,3 +3,6 @@ ENV = 'development'
# base api
VUE_APP_BASE_API = '/api'
# base imgurl
VUE_APP_IMG_URL = 'http://192.168.0.100'

2
.env.production

@ -4,3 +4,5 @@ ENV = 'production' @@ -4,3 +4,5 @@ ENV = 'production'
# base api
VUE_APP_BASE_API = '/prod-api'
# base imgurl
VUE_APP_IMG_URL = 'https://dev.filesite.io'

1
src/App.vue

@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
</template>
<script>
export default {
name: 'App'
}

2
src/router/index.js

@ -69,7 +69,7 @@ export const constantRoutes = [ @@ -69,7 +69,7 @@ export const constantRoutes = [
{
path: 'subfile',
name: 'Subfile',
component: () => import('@/views/subfile/index'),
component: () => import('@/views/subfile/index.vue'),
meta: { title: '子文件', icon: 'dashboard' }
}
]

2
src/styles/sidebar.scss

@ -33,6 +33,8 @@ @@ -33,6 +33,8 @@
overflow-x: hidden !important;
}
.el-scrollbar__view{padding-bottom:92px;}
.el-scrollbar__bar.is-vertical {
right: 0px;
}

5
src/utils/request.js

@ -7,7 +7,10 @@ import axios from 'axios' @@ -7,7 +7,10 @@ import axios from 'axios'
const service = axios.create({
//baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
// withCredentials: true, // send cookies when cross-domain requests
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
//headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
headers: {
'Content-Type': 'multipart/form-data'
},
// headers: { 'Content-Type': 'multipart/form-data' },
// headers: {
// 'Content-Type': 'application/x-www-form-urlencoded'

9
src/views/subfile/index.vue

@ -101,7 +101,8 @@ @@ -101,7 +101,8 @@
label="图片"
width="auto">
<template slot-scope="scope">
<img :src="'http://192.168.0.100/'+scope.row.image" alt="图片"/>
<!-- <img :src="'http://192.168.0.100/'+scope.row.image" alt="图片"/> -->
<img :src="imgurl+scope.row.image" alt="图片"/>
</template>
</el-table-column>
@ -222,10 +223,13 @@ export default { @@ -222,10 +223,13 @@ export default {
//
created() {
this.getFileData();
console.log(this.imgurl);
},
//
// mounted () {
// console.log(this.imgurl);
// },
filters: {
@ -262,6 +266,7 @@ export default { @@ -262,6 +266,7 @@ export default {
// },
// value2: '',
imgurl:process.env.VUE_APP_IMG_URL,
//haveRealpath: 0,
//
tableData: [],

0
src/views/subfile/index.js → src/views/subfile/indexs.js

3
src/views/systme/switchtheme.vue

@ -21,9 +21,10 @@ @@ -21,9 +21,10 @@
</template>
<script>
//console.log(process.env.VUE_APP_BASE_API);
import { switchthemeApi} from '@/api/user'
export default {
data() {
return {
options: [{

Loading…
Cancel
Save