Browse Source

订阅显示最新封面图

natasha 5 days ago
parent
commit
d67d4dea35
1 changed files with 61 additions and 9 deletions
  1. 61 9
      src/views/bookStore/Subscribe.vue

+ 61 - 9
src/views/bookStore/Subscribe.vue

@@ -678,6 +678,7 @@ export default {
       tips: "",
       coverObj: [], // 存放选中期数的封面图
       coverSrc: "", // 显示的封面图
+      coverNew: "", // 新的封面图
     };
   },
   //计算属性 类似于data概念
@@ -985,6 +986,7 @@ export default {
       this.studyTypeName = item.study_phase_name;
       this.customOrderNumberList = [];
       this.coverObj = [];
+      this.coverNew = "";
       this.handleCoverSrc();
       this.handleOrderYearStartNO();
       await this.handleIssueLength();
@@ -1121,15 +1123,64 @@ export default {
         .catch(() => {});
     },
     // 计算封面图
-    handleCoverSrc() {
+    async handleCoverSrc() {
       this.coverSrc = "";
       if (this.coverObj.length === 0) {
-        this.coverSrc =
-          this.bookType === "jingdu"
-            ? require("../../assets/cover-order-jingdu.png")
-            : this.bookType === "huakan"
-            ? require("../../assets/cover-order-huakan.png")
-            : require("../../assets/cover-order-" + this.studyType + ".png");
+        if (!this.coverNew) {
+          if (this.bookType === "baozhi") {
+            let MethodName =
+              "/ShopServer/Client/ReservationQuery/GetReservationInfo_Issue";
+            let data = {
+              goods_type: 2,
+              study_phase: this.studyType,
+              period_count: 0,
+              is_custom_select_issue_no: "true",
+            };
+            await getLogin(MethodName, data).then((res) => {
+              if (res.status === 1) {
+                res.issue_no_school_year_list.reverse().forEach((item) => {
+                  item.issue_no_list.reverse().forEach((items, indexs) => {
+                    if (
+                      !this.coverNew &&
+                      items.is_shelve === "true" &&
+                      items.cover_image_url
+                    ) {
+                      this.coverNew = items.cover_image_url;
+                    }
+                  });
+                });
+              }
+            });
+          } else if (this.bookType === "huakan") {
+            let MethodName =
+              "/ShopServer/Client/ReservationQuery/GetReservationInfo_Issue";
+            let data = {
+              goods_type: 4,
+              study_phase: 1,
+              period_count: 0,
+              is_custom_select_issue_no: "true",
+            };
+            await getLogin(MethodName, data).then((res) => {
+              this.loading = false;
+              if (res.status === 1) {
+                res.issue_no_school_year_list.reverse().forEach((item) => {
+                  item.issue_no_list.reverse().forEach((items, indexs) => {
+                    if (
+                      !this.coverNew &&
+                      items.is_shelve === "true" &&
+                      items.cover_image_url
+                    ) {
+                      this.coverNew = items.cover_image_url;
+                    }
+                  });
+                });
+              }
+            });
+          } else {
+            this.coverNew = require("../../assets/cover-order-jingdu.png");
+          }
+        }
+        this.coverSrc = this.coverNew;
       } else {
         let lastValue = this.coverObj[this.coverObj.length - 1];
         if (lastValue) {
@@ -1166,7 +1217,6 @@ export default {
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   async created() {
-    this.handleCoverSrc();
     if (this.config) {
       let arr = this.config.split("&&&");
       this.LoginNavIndex = arr[0] * 1;
@@ -1218,7 +1268,9 @@ export default {
     this.getTotalSales();
   },
   //生命周期 - 挂载完成(可以访问DOM元素)
-  mounted() {},
+  mounted() {
+    this.handleCoverSrc();
+  },
   //生命周期-创建之前
   beforeCreated() {},
   //生命周期-挂载之前