Procházet zdrojové kódy

删除教材资源的PDF的收藏按钮

gcj před 3 roky
rodič
revize
4591a18a38
1 změnil soubory, kde provedl 14 přidání a 73 odebrání
  1. 14 73
      src/views/textbook-detail/TextbookDetailPdf.vue

+ 14 - 73
src/views/textbook-detail/TextbookDetailPdf.vue

@@ -9,29 +9,19 @@
         <div class="text">
           <p class="p1">{{ data.name }}</p>
           <p class="p2">
-            <span >
-                {{data.author}}
+            <span>
+              {{ data.author }}
             </span>
           </p>
         </div>
         <div class="pay_collect">
           <div class="download">
-            <img @click="download" src="../../assets/common/download.png" alt="" />
-            <!-- <span>DOWNLOAD</span> -->
-          </div>
-          <div class="collect">
-            <img
-              @click="changeCollect"
-              v-show="!data.isFavorite"
-              src="../../assets/textBookDetail/collect4.png"
-              alt=""
-            />
             <img
-              @click="changeCollect"
-              v-show="data.isFavorite"
-              src="../../assets/textBookDetail/enshrine1.png"
+              @click="download"
+              src="../../assets/common/download.png"
               alt=""
             />
+            <!-- <span>DOWNLOAD</span> -->
           </div>
         </div>
       </div>
@@ -56,12 +46,9 @@ import HeaderOne from "@/components/inputModules/common/HeaderOne";
 import pdf from "vue-pdf";
 import { updateWordPack } from "@/utils/i18n";
 import { getToken } from "@/utils/auth";
-import { Base64 } from 'js-base64';
+import { Base64 } from "js-base64";
 
-import {
-  TextbookAPI,
-  LearnWebSI,
-} from "@/api/ajax";
+import { TextbookAPI, LearnWebSI } from "@/api/ajax";
 export default {
   name: "TextbookDetailPdf",
   components: {
@@ -99,7 +86,7 @@ export default {
         UserType = userInfor.user_type;
         SessionID = userInfor.session_id;
       }
-      let FileID = Base64.decode(this.$route.query.fileId)
+      let FileID = Base64.decode(this.$route.query.fileId);
       let data = {
         SessionID,
         UserCode,
@@ -129,53 +116,6 @@ export default {
           console.error("Pdf Loading failed", err);
         });
     },
-    // 修改收藏状态
-    changeCollect() {
-      this.loading = true;
-      if (this.data.isFavorite) {
-        let Mname = "order-collection_manager-CancelMyGoodsCollection";
-        LearnWebSI(Mname, {
-          goods_id_list: [this.materialId],
-          goods_type: 401,
-        })
-          .then((res) => {
-            this.$message({
-              type: "success",
-              message: this.$t("Key396"), //"取消收藏成功",
-            });
-            this.data.isFavorite = false;
-
-            this.loading = false;
-            // this.getdetail();
-          })
-          .catch((res) => {
-            this.loading = false;
-          });
-      } else {
-        let Mname = "order-collection_manager-AddMyCollection";
-        LearnWebSI(Mname, {
-          goods_id: this.materialId,
-          goods_type: 401,
-          goods_name: this.data.name,
-          goods_person_name_desc: this.data.teacher,
-          goods_picture_id: this.data.coverFileId,
-          goods_price: this.data.price,
-        })
-          .then((res) => {
-            this.$message({
-              type: "success",
-              message: this.$t("Key575"), //"收藏成功",
-            });
-            this.data.isFavorite = true;
-
-            this.loading = false;
-            // this.getdetail();
-          })
-          .catch((res) => {
-            this.loading = false;
-          });
-      }
-    },
     // 获取学习资料详情
     getdetail() {
       this.loading = true;
@@ -188,9 +128,10 @@ export default {
           this.data = res;
           this.loading = false;
           this.attachment =
-                    process.env.VUE_APP_PDF_API + Base64.decode(this.$route.query.relativePath)
+            process.env.VUE_APP_PDF_API +
+            Base64.decode(this.$route.query.relativePath);
           this.getNumPages();
-          console.log(this.attachment)
+          console.log(this.attachment);
         })
         .catch((res) => {
           this.loading = false;
@@ -231,9 +172,9 @@ export default {
   },
   mounted() {
     this.materialId = this.$route.query.id;
-      if (this.materialId) {
-        this.getdetail();
-      }
+    if (this.materialId) {
+      this.getdetail();
+    }
   },
 };
 </script>