傅行帆 5 年前
父节点
当前提交
ffc5ee9ffb
共有 2 个文件被更改,包括 11 次插入4 次删除
  1. 9
    2
      src/views/consultant/edit.vue
  2. 2
    2
      vue.config.js

+ 9
- 2
src/views/consultant/edit.vue 查看文件

29
           </el-select>
29
           </el-select>
30
         </el-form-item>
30
         </el-form-item>
31
         <el-form-item label="图片:">
31
         <el-form-item label="图片:">
32
-          <el-upload class="avatar-uploader" :action="upFileUrl" name="file" :show-file-list="false" :before-upload="beforeImgUpload" :on-success="handleAvatarSuccess">
32
+          <el-upload class="avatar-uploader" :headers="uploadHeaders" :action="upFileUrl" name="file" :show-file-list="false" :before-upload="beforeImgUpload" :on-success="handleAvatarSuccess">
33
             <img v-if="detail.photo" :src="detail.photo" class="avatar">
33
             <img v-if="detail.photo" :src="detail.photo" class="avatar">
34
             <i v-else class="el-icon-plus avatar-uploader-icon"></i>
34
             <i v-else class="el-icon-plus avatar-uploader-icon"></i>
35
           </el-upload>
35
           </el-upload>
88
   computed: {
88
   computed: {
89
     ...mapBuildingState({
89
     ...mapBuildingState({
90
       buildings: x => x.buildings
90
       buildings: x => x.buildings
91
-    })
91
+    }),
92
+    uploadHeaders() {
93
+      const token = localStorage.getItem("x-token") || "";
94
+
95
+      return {
96
+        Authorization: `Bearer ${token}`
97
+      };
98
+    }
92
   },
99
   },
93
   methods: {
100
   methods: {
94
     ...mapBuildingActions(["getBuildings"]),
101
     ...mapBuildingActions(["getBuildings"]),

+ 2
- 2
vue.config.js 查看文件

4
     port: 8080,
4
     port: 8080,
5
     proxy: {
5
     proxy: {
6
       '/api': {
6
       '/api': {
7
-        target: 'http://192.168.0.131:8080',
8
-        // target: 'http://localhost:8080',
7
+        // target: 'http://192.168.0.131:8080',
8
+        target: 'http://localhost:8080',
9
         changeOrigin: true,
9
         changeOrigin: true,
10
         // pathRewrite: {
10
         // pathRewrite: {
11
         //   '^/api': '/'
11
         //   '^/api': '/'