From ef37c59e055a990ce247b265b27d3fcef430a243 Mon Sep 17 00:00:00 2001
From: 杨磊 <505174330@qq.com>
Date: 星期五, 15 八月 2025 10:19:18 +0800
Subject: [PATCH] first submit

---
 src/views/personalCenter/components/electronicSampleBook.vue |  392 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 392 insertions(+), 0 deletions(-)

diff --git a/src/views/personalCenter/components/electronicSampleBook.vue b/src/views/personalCenter/components/electronicSampleBook.vue
new file mode 100644
index 0000000..d927e9b
--- /dev/null
+++ b/src/views/personalCenter/components/electronicSampleBook.vue
@@ -0,0 +1,392 @@
+<template>
+  <div class="wrap">
+    <div v-loading="loading">
+      <el-empty
+        description="鏆傛棤鏁版嵁"
+        class="empty"
+        :image-size="200"
+        v-if="orderList.length == 0 && !loading"
+      ></el-empty>
+      <div class="bookItem" v-for="(item, index) in orderList" :key="index">
+        <div class="orderInformation">
+          <span class="primaryTxt" v-if="item.state == 'Normal'"
+            >瀹℃牳鐘舵�侊細
+            <template>閫氳繃</template>
+          </span>
+          <span class="toBeReviewed" v-else-if="item.state == 'WaitAudit'"
+            >瀹℃牳鐘舵�侊細
+            <template>瀹℃牳涓�</template>
+          </span>
+          <span class="auditFailed" v-else-if="item.state == 'Reject'"
+            >瀹℃牳鐘舵�侊細
+            <template>瀹℃牳澶辫触</template>
+          </span>
+          <span>
+            <span class="c999">鐢宠鏃ユ湡锛�</span>
+            {{ item.createDate }}</span
+          >
+          <div class="reason" v-if="item.state == 'Reject'">
+            <p class="reasonIntroduction">
+              <span class="c999">鐞嗙敱锛�</span>
+              <span class="reasonContent">
+                {{ item.feedBack.reason ? item.feedBack.reason : "-" }}
+              </span>
+            </p>
+          </div>
+          <span v-if="item.state == 'Normal' && item.isActive">
+            <span class="c999">鏈夋晥鏈燂細</span>
+            {{ item.feedBack.endDate || "-" }}
+          </span>
+          <span
+            v-if="item.state == 'Normal' && !item.isActive"
+            style="color: red"
+          >
+            <span class="c999">鏈夋晥鏈燂細</span>
+            宸茶繃鏈�
+          </span>
+        </div>
+        <div class="orderBookList">
+          <div
+            v-for="(itemBook, index) in item.content"
+            style="cursor: pointer"
+            class="orderBook"
+            :key="index"
+            @click.stop="jumpBookDetail(itemBook)"
+          >
+            <div class="wrapImg">
+              <img class="autoImg" :src="itemBook.icon" alt="" />
+            </div>
+            <p style="width: 150px" class="ellipsis" :title="itemBook.title">
+              {{ itemBook.title }}
+            </p>
+            <p style="width: 150px" class="c999 ellipsis">{{ itemBook.author }}</p>
+            <p
+              style="text-align: center"
+              v-if="item.state == 'Normal' && item.isActive"
+            >
+              <el-button @click.stop="readDate(itemBook)" type="primary"
+                >绔嬪嵆闃呰</el-button
+              >
+            </p>
+          </div>
+        </div>
+        <div v-if="item.state == 'Reject'" @click="deleteItem(item)">
+          <i class="el-icon-delete-solid red"></i>
+        </div>
+      </div>
+      <!-- 鍒嗛〉 -->
+      <div class="pageinateBox" v-if="orderList.length > 0">
+        <el-pagination
+          @size-change="
+            (val) => {
+              paginationData.limit = val;
+              getData();
+            }
+          "
+          @current-change="
+            (val) => {
+              paginationData.page = val;
+              getData();
+            }
+          "
+          background=""
+          :current-page="paginationData.page - 0"
+          :page-size="paginationData.limit"
+          prev-text="涓婁竴椤�"
+          next-text="涓嬩竴椤�"
+          layout="total, prev, pager, next, slot, jumper"
+          :total="paginationData.totalCount"
+        >
+        </el-pagination>
+      </div>
+    </div>
+  </div>
+</template>
+<script>
+import { mapState } from "vuex";
+export default {
+  data() {
+    return {
+      orderList: [],
+      loading: true,
+      paginationData: {
+        page: 1,
+        totalCount: 0,
+        limit: 5,
+        totalPage: 0,
+      },
+    };
+  },
+  computed: {
+    ...mapState(["userInfo"]),
+  },
+  created() {
+    this.getData();
+  },
+  methods: {
+    getData() {
+      this.loading = true;
+      let { limit, page } = this.paginationData;
+      const data = {
+        start: limit * page - limit,
+        size: limit,
+        sort: {
+          field: "createDate",
+          type: "Desc",
+        },
+        appRefCode: this.config.appRefCode,
+        topicIdOrRefCode: this.config.refCodes.applyBook,
+      };
+      this.MG.ugc.getTopicMessageList(data).then((res) => {
+        this.loading = false;
+        try {
+          this.paginationData.totalCount = res.totalSize;
+          if (res && res.datas.length > 0) {
+            let list = [];
+            for (let i = 0; i < res.datas.length; i++) {
+              const ele = res.datas[i];
+              ele.createDate = ele.createDate.split("T")[0];
+              if (ele.content) {
+                ele.content = JSON.parse(ele.content);
+              }
+              if (ele.feedBack) {
+                ele.isActive = false;
+                ele.feedBack = JSON.parse(ele.feedBack);
+                const readDate = new Date(
+                  ele.feedBack.endDate + " 23:59:59"
+                ).getTime();
+                const currentDate = Number(sessionStorage.currentDate);
+                if (readDate > currentDate) {
+                  ele.isActive = true;
+                }
+              }
+              list.push(ele);
+            }
+            this.orderList = list;
+          }
+        } catch (error) {
+          this.orderList = [];
+        }
+      });
+    },
+    deleteItem(item) {
+      this.$confirm("纭畾绉婚櫎鍚楋紵", "鎻愮ず", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning",
+      })
+        .then(() => {
+          let data = {
+            messageIds: [item.id],
+          };
+          this.MG.ugc.delTopicMessage(data).then((res) => {
+            if (res) {
+              this.$message({
+                type: "success",
+                message: "宸茬Щ闄よ鐢靛瓙鏍蜂功!",
+              });
+              this.getData();
+            }
+          });
+        })
+        .catch(() => {
+          this.$message({
+            type: "fail",
+            message: "鍙栨秷鎿嶄綔!",
+          });
+        });
+    },
+    readDate(item) {
+      this.getBookData(item);
+    },
+    // 鑾峰彇鏁版嵁
+    getBookData(item) {
+      this.loading = true;
+      this.MG.store
+        .getProductDetail({
+          path: "caupress_teachingResource\\" + item.id,
+          productId: item.id,
+          paging: {
+            start: 0,
+            size: 1,
+          },
+          fields: {
+            caupress_pdfFreeFile: [],
+            caupress_pdfFile: [],
+          },
+          coverSize: {
+            width: 180,
+          },
+        })
+        .then((res) => {
+          try {
+            let obj = {};
+            if (res.datas.alreadyBuy) {
+              obj = {
+                pdfFile: res.datas.caupress_pdfFile,
+                name: res.datas.name,
+                productLinkPath: res.datas.productLinkInfo[0].LinkPath,
+              };
+            } else {
+              obj = {
+                pdfFile: res.datas.caupress_pdfFreeFile,
+                name: res.datas.name,
+                productLinkPath: res.datas.productLinkInfo[0].LinkPath,
+              };
+            }
+            // 璺宠浆鑷砅DF椤甸潰
+            this.openBook(obj);
+            this.loading = false;
+          } catch (error) {
+            this.$message({
+              type: "fail",
+              message: "鏆傛棤闃呰璧勬枡!",
+            });
+            this.loading = false;
+          }
+        });
+    },
+    openBook(item) {
+      console.log(item,"item");
+      let routeUrl = this.$router.resolve({
+        name: "preview-pdf",
+        query: {
+          md5: item.pdfFile,
+          titleName: item.name,
+          productLinkPath: item.productLinkPath,
+        },
+      });
+      window.open(routeUrl.href, "_blank");
+      // this.$router.push({
+      //   name: "preview-pdf",
+      //   query: {
+      //     md5: item.pdfFile,
+      //     titleName: item.name,
+      //     productLinkPath: item.productLinkPath
+      //   }
+      // });
+    },
+    // 璺宠浆鍥句功璇︽儏
+    jumpBookDetail(row) {
+      let url = this.$router.resolve({
+        name: "teachingServices-detail",
+        query: {
+          id: row.id,
+          cmsPath: row.cmsPath,
+        },
+      });
+      window.open(url.href, "_blank");
+    },
+    // 澶勭悊褰� 褰撳墠椤甸潰鐨勬暟鎹凡鍏ㄩ儴绉婚櫎鍚庯紝璺宠浆鑷冲墠涓�椤�
+    JumpToPreviousPage(datas) {
+      if (this.paginationData.page > 1 && datas.length == 0) {
+        this.paginationData.page -= 1;
+        this.getData();
+      }
+    },
+  },
+};
+</script>
+<style lang="less" scoped>
+.wrap {
+  padding: 40px;
+  .tips {
+    padding: 20px;
+    background: #f2f7f4;
+    border-radius: 4px;
+    font-size: 14px;
+    color: #666666;
+  }
+  .bookItem {
+    border-bottom: 1px solid #eeeeee;
+    padding-bottom: 40px;
+    // margin-bottom: 40px;
+    .spaceBetween {
+      width: 100%;
+      display: flex;
+      justify-content: space-between;
+      align-items: flex-end;
+      font-size: 18px;
+      font-weight: 700;
+      line-height: 24px;
+    }
+    .orderInformation {
+      background: #f2f7f4;
+      border-radius: 4px;
+      padding: 20px;
+      font-size: 16px;
+      color: #333333;
+      margin: 30px 0;
+      .auditFailed {
+        color: #e50021;
+      }
+      .toBeReviewed {
+        color: #d18252;
+      }
+      span {
+        display: inline-block;
+        width: 330px;
+        line-height: 40px;
+      }
+      .c999 {
+        display: inline;
+        color: #999;
+      }
+      .reason {
+        display: flex;
+        line-height: 28px;
+        padding: 20px 0;
+        .reasonIntroduction {
+          width: 590px;
+          display: inline-block;
+          line-height: 22px;
+          .reasonContent {
+            display: inline;
+            width: 100%;
+            line-height: 30px;
+          }
+        }
+      }
+    }
+    .orderBookList {
+      display: flex;
+      justify-content: flex-start;
+      flex-wrap: wrap;
+      font-size: 16px;
+      color: #333;
+      .orderBook {
+        margin: 0 15px;
+      }
+      .wrapImg {
+        position: relative;
+        width: 150px;
+        height: 200px;
+        background-color: #f2f2f2;
+        border: 1px solid #e6e6e6;
+      }
+      > div > p {
+        margin: 10px 0;
+      }
+      .c999 {
+        color: #999;
+      }
+    }
+    .red {
+      font-size: 16px;
+      color: #e50021;
+      float: right;
+      cursor: pointer;
+    }
+  }
+  .pageinateBox {
+    text-align: center;
+    padding: 40px 0;
+    :deep(.el-pagination.is-background .btn-next) {
+      padding: 0 10px;
+    }
+    :deep(.el-pagination.is-background .btn-prev) {
+      padding: 0 10px;
+    }
+  }
+}
+</style>

--
Gitblit v1.9.1