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/components/detail/bookList.vue | 190 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 190 insertions(+), 0 deletions(-) diff --git a/src/components/detail/bookList.vue b/src/components/detail/bookList.vue new file mode 100644 index 0000000..21ddd4d --- /dev/null +++ b/src/components/detail/bookList.vue @@ -0,0 +1,190 @@ +<template> + <div class="relatedBox"> + <div class="headBox"> + <div class="titleBox">{{ title }}</div> + </div> + <div class="bookBox" v-if="dataList.length > 0"> + <div class="itemBox" v-for="(item, index) in dataList" :key="index"> + <div class="checkBox"> + <el-checkbox + @change="selectBook(item)" + v-model="item.checked" + label + ></el-checkbox> + </div> + <div class="imgBox"> + <img class="autoImg" :src="item.icon" alt="" /> + </div> + <div class="rightBox"> + <div class="bookName"> + {{ item.name }} + </div> + <div class="authorBox">浣滆�咃細{{ item.caupress_author }}</div> + <div class="authorBox"> + 鍑虹増鏃堕棿锛歿{ + item.caupress_publicationDate + ? moment(item.caupress_publicationDate).format("YYYY-MM-DD") + : "-" + }} + </div> + <div class="authorBox">ISBN锛歿{ item.caupress_ISBN }}</div> + </div> + <div class="iconBox" @click="deleteItem(item, index)"> + <i class="iconfont icon-shanchu"></i> + </div> + </div> + </div> + <el-empty :image-size="100" description="鏆傛棤璧勬簮" v-else></el-empty> + </div> +</template> + +<script> +export default { + data() { + return { + dataList: [], + detailRoute: "bookStore-detail", + }; + }, + created() { + this.getData("caupress_teachingResource"); + }, + props: { + title: { + type: String, + }, + }, + methods: { + getData(channel) { + if (this.$route.name == "teachingServices-applyBook-paper") { + this.dataList = this.$store.state.paperCopiesList; + } else { + this.dataList = this.$store.state.electronicBookList; + } + this.dataList.forEach((item) => { + this.$set(item,"checked",false) + // item.checked = false; + }); + // this.dataList = res.datas; + // this.$emit("getList", this.dataList); + }, + selectBook(val) { + this.$emit("getList", this.dataList); + }, + toDetail(row) { + this.$emit("reloadPage", row); + }, + deleteItem(item, index) { + this.$confirm("鏄惁鍒犻櫎褰撳墠鏍蜂功?", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(() => { + if (this.$route.name == "teachingServices-applyBook-paper") { + this.$store.commit("deletePbookList", index); + } else { + this.$store.commit("deleteEbookList", index); + } + this.$message({ + type: "success", + message: "鍒犻櫎鎴愬姛!", + }); + if (this.dataList.length == 0) { + this.$router.push("/teachingServices"); + } + }) + .catch(() => {}); + }, + }, +}; +</script> + +<style scoped> +.relatedBox { + width: 100%; + background-color: #fff; + margin: 10px 0 0 0px; + border-top: 1px solid #00873c; + box-sizing: border-box; +} +.titleBox { + height: 60px; + background: #d8f7e6; + line-height: 60px; + padding: 0 40px; + font-weight: 700; + color: #00873c; + font-size: 18px; +} +.bookBox { + display: flex; + flex-wrap: wrap; + background-color: #fff; + padding: 10px; +} +.imgBox { + width: 100px; + height: 150px; + position: relative; + border: 1px solid #eee; +} +.rightBox { + flex: 1; + overflow: hidden; + margin-left: 10px; +} +.itemBox { + flex: 1; + overflow: hidden; + display: flex; + padding: 10px; + position: relative; + border: 1px solid #ccc; + margin: 0 5px; +} +.bookName { + font-size: 16px !important; + line-height: 20px; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; /* 杩欓噷鏄秴鍑哄嚑琛岀渷鐣� */ + overflow: hidden; +} +.authorBox { + margin-top: 20px; + color: #666666; + position: relative; +} +.iconBox { + cursor: pointer; + color: red; + margin-left: 10px; +} +.toDetail { + margin-top: 50px; + color: #00873c; +} +.authorName { + max-width: 86px; + position: absolute; + line-height: 20px; + top: -4px; + left: 44px; +} +.headBox { + display: flex; + background: #d8f7e6; + justify-content: space-between; +} +.viewMore { + cursor: pointer; + padding: 20px; + color: #999; +} +.checkBox { + margin-right: 10px; + line-height: 150px; +} +</style> -- Gitblit v1.9.1