Quellcode durchsuchen

api前缀:上传时不用加,显示是再加

Alex vor 4 Jahren
Ursprung
Commit
d41aa7dc87

+ 5 - 3
src/views/system/appUser/detail/appUserAvatar.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <img v-bind:src="options.img" @click="editCropper()" title="点击上传头像" class="img-lg" />
+    <img v-bind:src="baseUrl+options.img" slot="reference" @click="editCropper()" title="点击上传头像" class="img-lg" />
     <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body @opened="modalOpened">
       <el-row>
         <el-col :xs="24" :md="12" :style="{height: '350px'}">
@@ -67,6 +67,7 @@ export default {
   },
   data() {
     return {
+      baseUrl: null,
       // 是否显示弹出层
       open: false,
       // 是否显示cropper
@@ -84,7 +85,8 @@ export default {
     };
   },
   mounted() {  
-    //  console.log(this.personal)
+    this.baseUrl = process.env.VUE_APP_BASE_API;
+    //  console.log(this.baseUrl)
   },
   methods: {
     // 编辑头像
@@ -131,7 +133,7 @@ export default {
         uploadFile(formData).then(response => {
           if (response.code === 200) {
             this.open = false;
-            this.options.img = process.env.VUE_APP_BASE_API + response.fileName;
+            this.options.img = response.fileName;
             this.personal.avatar = this.options.img;
             this.msgSuccess("上传成功");
           }

+ 3 - 1
src/views/system/appUser/index.vue

@@ -67,7 +67,7 @@
       <el-table-column label="昵称" align="center" prop="nickName" />
       <el-table-column label="头像" align="center" >
         <template scope="scope">
-            <img width="40" height="40" :src="scope.row.avatar" />
+            <img width="40" height="40" slot="reference" :src="baseUrl + scope.row.avatar" />
         </template>
       </el-table-column>
       <el-table-column
@@ -250,6 +250,7 @@ export default {
   },
   data() {
     return {
+      baseUrl: null,
       // 遮罩层
       loading: true,
       friendLoading: true,
@@ -318,6 +319,7 @@ export default {
     }
   },
   created() {
+    this.baseUrl = process.env.VUE_APP_BASE_API;
     this.getList();
     this.getDicts("sys_yes_no").then(response => {
       this.joinsOptions = response.data;

+ 4 - 2
src/views/system/family/detail/familyAvatar.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <img v-bind:src="options.img" @click="editCropper()" title="点击上传头像" class="img-lg" />
+    <img v-bind:src="baseUrl+options.img" slot="reference" @click="editCropper()" title="点击上传头像" class="img-lg" />
     <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body @opened="modalOpened">
       <el-row>
         <el-col :xs="24" :md="12" :style="{height: '350px'}">
@@ -67,6 +67,7 @@ export default {
   },
   data() {
     return {
+      baseUrl: null,
       // 是否显示弹出层
       open: false,
       // 是否显示cropper
@@ -84,6 +85,7 @@ export default {
     };
   },
   mounted() {  
+    this.baseUrl = process.env.VUE_APP_BASE_API;
     //  console.log(this.family)
   },
   methods: {
@@ -131,7 +133,7 @@ export default {
         uploadFile(formData).then(response => {
           if (response.code === 200) {
             this.open = false;
-            this.options.img = process.env.VUE_APP_BASE_API + response.fileName;
+            this.options.img = response.fileName;
             this.family.avatar = this.options.img;
             this.msgSuccess("上传成功");
           }

+ 11 - 1
src/views/system/family/detail/member.vue

@@ -1,5 +1,7 @@
 <template>
   <div class="app-container">
+    <span><i class="el-icon-house"></i> 家族 - {{ nickName }}</span>
+    <el-divider></el-divider>
     <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
       <el-form-item label="姓名" prop="name">
         <el-input
@@ -150,6 +152,7 @@
 </template>
 
 <script>
+import { getFamily } from "@/api/system/family";
 import { listMember, getMember, delMember, addMember, updateMember, exportMember } from "@/api/system/member";
 
 export default {
@@ -193,18 +196,25 @@ export default {
       form: {},
       // 表单校验
       rules: {
-      }
+      },
+      familyName: null,
     };
   },
   created() {
     const fid = this.$route.query.fid;
     this.queryParams.familyId = fid;
+    this.getFamily(fid);
     this.getList();
     this.getDicts("sys_user_sex").then((response) => {
       this.genderOptions = response.data;
     });
   },
   methods: {
+    getFamily(id){
+      getFamily(id).then(response => {
+        this.familyName = response.data.fullName;
+      });
+    },
     /** 查询家族成员列表 */
     getList() {
       this.loading = true;

+ 4 - 2
src/views/system/personalPage/detail/personalAvatar.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <img v-bind:src="options.img" @click="editCropper()" title="点击上传头像" class="img-lg" />
+    <img v-bind:src="baseUrl+options.img" slot="reference" @click="editCropper()" title="点击上传头像" class="img-lg" />
     <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body @opened="modalOpened">
       <el-row>
         <el-col :xs="24" :md="12" :style="{height: '350px'}">
@@ -67,6 +67,7 @@ export default {
   },
   data() {
     return {
+      baseUrl: null,
       // 是否显示弹出层
       open: false,
       // 是否显示cropper
@@ -84,6 +85,7 @@ export default {
     };
   },
   mounted() {  
+    this.baseUrl = process.env.VUE_APP_BASE_API;
     //  console.log(this.personal)
   },
   methods: {
@@ -131,7 +133,7 @@ export default {
         uploadFile(formData).then(response => {
           if (response.code === 200) {
             this.open = false;
-            this.options.img = process.env.VUE_APP_BASE_API + response.fileName;
+            this.options.img = response.fileName;
             this.personal.avatar = this.options.img;
             this.msgSuccess("上传成功");
           }