Browse Source

历史回顾 对接接口

任一存 2 năm trước cách đây
mục cha
commit
7fadeda12f
2 tập tin đã thay đổi với 15 bổ sung1 xóa
  1. 2 1
      src/components/HistoryPersonCard.vue
  2. 13 0
      src/views/HistoryNew.vue

+ 2 - 1
src/components/HistoryPersonCard.vue

@@ -23,7 +23,7 @@
           tall: tallOrFat === 'tall',
           fat: tallOrFat === 'fat',
         }"
-        src=""
+        :src="img"
         alt=""
         draggable="false"
       >
@@ -97,6 +97,7 @@ export default {
     }
     >img.portrait{
       flex: 0 0 auto;
+      object-fit: cover;
       &.tall{
         margin-top: 20px;
         width: 210px;

+ 13 - 0
src/views/HistoryNew.vue

@@ -79,6 +79,7 @@
       :key="item.id"
       class="history-person-card"
       :name="item.name"
+      :img="item.img"
       :text="item.description || item.story"
       :tall-or-fat="item.tallOrFat"
       :style="{
@@ -187,6 +188,18 @@ export default {
         stageItem.personList = res
         const personWidth = spaceEachPerson
         stageItem.width = personWidth * res.length
+      }).then(() => {
+        // 获取各人物的照片
+        for (const personItem of stageItem.personList) {
+          api.getHistoryDetail(personItem.id).then((res) => {
+            try {
+              personItem.img = process.env.VUE_APP_API_ORIGIN + res.file[0].filePath
+              console.log(personItem.img)
+            } catch (e) {
+              console.log(e)
+            }
+          })
+        }
       })
     })).then((res) => {
       console.log(stageList)