From dd5efc126b55283b3e9d8dd78aba03eb30cdc988 Mon Sep 17 00:00:00 2001 From: A1300399510 Date: Fri, 30 Aug 2024 10:50:05 +0800 Subject: [PATCH] no message --- index.html | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 37263ce..d8d17b2 100644 --- a/index.html +++ b/index.html @@ -40,7 +40,7 @@
- +
{{ offerinfo?.school?.name }}
@@ -216,7 +216,7 @@
- +
{{ item.schoolname }}
@@ -423,6 +423,23 @@ this.arrowsgray = arrowsgray }, methods: { + getBase64ImageFromURL(url, type, index) { + fetch(url) + .then(response => response.blob()) + .then(blob => { + const reader = new FileReader() + reader.onloadend = () => { + if (type == "offer") { + this.offerinfo.school["base64"] = reader.result + } else { + this.offercollege[index]["base64"] = reader.result + this.$forceUpdate() + } + } + reader.readAsDataURL(blob) + }) + }, + // 获取 offer 详情 getOfferDetails() { axios @@ -437,10 +454,11 @@ } const data = res.data - - this.offerinfo = data.offerinfo + const offerinfo = data.offerinfo || {} + this.offerinfo = offerinfo this.moodmessage = data.moodmessage this.getPersonalBackground(data.backgroundid) + this.getBase64ImageFromURL(offerinfo.school.image, "offer") }) }, @@ -458,7 +476,12 @@ } const data = res.data - this.offercollege = data.offercollege + const offercollege = data.offercollege || [] + offercollege.forEach((element, index) => { + this.getBase64ImageFromURL(element.schoolimage, "summary", index) + }) + + this.offercollege = offercollege this.info = data.info })