Browse Source

#3267 C750 首页--近期课堂记录与课堂记录管理中课例封面不一致

XW 1 year ago
parent
commit
7c8c85a428
1 changed files with 42 additions and 7 deletions
  1. 42 7
      TEAMModelOS/ClientApp/src/view/homepage/HomePage.vue

+ 42 - 7
TEAMModelOS/ClientApp/src/view/homepage/HomePage.vue

@@ -793,8 +793,8 @@ export default {
         DESC: "startTime"
       };
       this.$api.lessonRecord.getLessonListAll(params).then(
-        (res) => {
-          this.recentRcdList = res.lessonRecords;
+          async (res) => {
+          this.recentRcdList = await this.getCoverImg(res.lessonRecords)
 
           let schoolSasInfo = {};
           let sBlobInfo = this.$store.state.user.schoolProfile;
@@ -809,12 +809,11 @@ export default {
           // privateSasInfo.name = listType === 'school' ? this.$store.state.userInfo.schoolCode : this.$store.state.userInfo.TEAMModelId
           // privateSasInfo.url = pBlobInfo.blob_uri.slice(0, pBlobInfo.blob_uri.lastIndexOf(privateSasInfo.name) - 1)
           privateSasInfo.url = pBlobInfo.blob_uri;
-          this.recentRcdList.forEach((item) => {
-            let sasInfo =
-              item.scope == "school" ? schoolSasInfo : privateSasInfo;
+          /* this.recentRcdList = .forEach((item) => {
+            let sasInfo = item.scope == "school" ? schoolSasInfo : privateSasInfo;
             // item.poster = `${sasInfo.url}/${sasInfo.name}/records/${item.id}/Record/CoverImage.jpg${sasInfo.sas}`
-            item.poster = `${sasInfo.url}/records/${item.id}/Record/CoverImage.jpg${sasInfo.sas}`;
-          });
+            item.poster = `${sasInfo.url}/records/${item.id}/Memo/${item}.jpg${sasInfo.sas}`;
+          }); */
           this.recentRcdList.sort((a, b) => {
             return b.startTime - a.startTime;
           });
@@ -825,6 +824,42 @@ export default {
         }
       );
     },
+    getCoverImg(lists) {
+        return new Promise(async (resolve, reject) => {
+            let promiseArr = []
+
+            let schoolSasInfo = {}
+            let sBlobInfo = this.$store.state.user.schoolProfile
+            schoolSasInfo.sas = "?" + sBlobInfo.blob_sas
+            schoolSasInfo.url = sBlobInfo.blob_uri
+
+            let privateSasInfo = {}
+            let pBlobInfo = this.$store.state.user.userProfile
+            privateSasInfo.sas = "?" + pBlobInfo.blob_sas
+            privateSasInfo.url = pBlobInfo.blob_uri
+
+            lists.forEach((item, index) => {
+                promiseArr.push(new Promise(async (r, j) => {
+                    let imageCover = ''
+                    let sasInfo = item.scope == "school" ? schoolSasInfo : privateSasInfo
+                    try {
+                        let url = `${sasInfo.url}/records/${item.id}/IES/TimeLine.json${sasInfo.sas}`
+                        let res = JSON.parse(await this.$tools.getFile(url))
+                        let pgids = res.PgIdList || []
+                        imageCover = `${sasInfo.url}/records/${item.id}/Memo/${pgids[0]}.jpg${sasInfo.sas}`
+                    } catch (e) {
+                    }
+                    item.poster = imageCover
+                    r(item)
+                }))
+            })
+            Promise.all(promiseArr).then(res => {
+                resolve(res)
+            }).catch(err => {
+                reject(err)
+            })
+        })
+    },
     openPlatform(index) {
       let url = this.platformList[index].url;
       window.open(/^(http:|https:)/i.test(url) ? url : "http://" + url);