From 375513370cc01fcd976987d07797249600b0bb3e Mon Sep 17 00:00:00 2001 From: 杨磊 <505174330@qq.com> Date: 星期四, 07 八月 2025 17:15:09 +0800 Subject: [PATCH] 'first' --- src/components/detail/history.vue | 136 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 136 insertions(+), 0 deletions(-) diff --git a/src/components/detail/history.vue b/src/components/detail/history.vue new file mode 100644 index 0000000..2d8e97e --- /dev/null +++ b/src/components/detail/history.vue @@ -0,0 +1,136 @@ +<template> + <div class="historyBox"> + <div class="titleBox">娴忚鍘嗗彶</div> + <div class="iconBox" @click="deleteAll"> + <i class="iconfont icon-shanchu"></i> + </div> + <div class="itemBox"> + <div + class="historyItem" + v-for="(item, index) in this.$store.state.historyBook" + :key="index" + @click="toDetail(item)" + > + <div class="nameBox"> {{ item.name }}</div> + <div class="deleteIcon" @click="deleteHistory(index)">脳</div> + </div> + </div> + </div> +</template> + +<script> +export default { + name: "history", + data() { + return { + dataList: [], + }; + }, + methods: { + //鍘昏鎯� + toDetail(row) { + this.$router.replace({ + name: "bookStore-detail", + query: { id: row.id, cmsPath: row.rootCmsItemId }, + }); + this.$emit("reloadPage", row); + }, + deleteHistory(index) { + this.$confirm("鏄惁鍒犻櫎褰撳墠娴忚璁板綍?", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(() => { + this.$store.commit("deleteHistoryBook", index); + this.$message({ + type: "success", + message: "鍒犻櫎鎴愬姛!", + }); + }) + .catch(() => {}); + }, + deleteAll() { + this.$confirm("鏄惁鍒犻櫎褰撳墠娴忚璁板綍?", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(() => { + this.$store.commit("deleteAllHistory"); + this.$message({ + type: "success", + message: "鍒犻櫎鎴愬姛!", + }); + }) + .catch(() => {}); + }, + }, + created() { + // this.dataList = this.$store.state.historyBook; + }, +}; +</script> + +<style scoped> +.historyBox { + position: relative; + width: 377px; + margin-top: 10px; + border-top: 1px solid #00873c; +} + +.titleBox { + height: 60px; + background: #d8f7e6; + line-height: 60px; + padding: 0 40px; + font-weight: 700; + color: #00873c; + font-size: 18px; +} +.itemBox { + padding: 0 40px; + background-color: #fff; + max-height: 1000px; + overflow-y: auto; +} +.historyItem { + height: 50px; + line-height: 50px; + width: 100%; + background-color: #fff; + border-bottom: 1px solid #eeeeee; + color: #333333; + position: relative; + + +} +.historyItem .nameBox { + width: 80%; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} +.deleteIcon { + position: absolute; + right: 10px; + top: 0px; + display: none; +} +.historyItem:hover div { + display: block; + color: #00873c; + cursor: pointer; +} +.historyItem:hover { + color: #00873c; +} +.iconBox { + position: absolute; + top: 20px; + right: 20px; + cursor: pointer; + color: red; +} +</style> -- Gitblit v1.9.1