杨磊
2025-08-07 375513370cc01fcd976987d07797249600b0bb3e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<template>
  <div class="relatedBox">
    <div class="headBox">
      <div class="titleBox">电子样书</div>
      <div class="inventory" @click="createList">
        <i class="iconfont icon-tongxunlu"></i> 生成清单
      </div>
    </div>
    <div class="bookBox" v-if="$store.state.electronicBookList.length > 0">
      <div
        class="itemBox"
        v-for="(item, index) in $store.state.electronicBookList"
        :key="index"
      >
        <div class="imgBox">
          <img class="autoImg" :src="item.icon" alt="" />
        </div>
        <div class="rightBox">
          <div class="bookName">
            {{ item.name }}
          </div>
          <div class="authorBox1">
            作者:
            <div class="authorName">{{ item.caupress_author }}</div>
          </div>
          <div class="iconBox" @click="deleteItem(item, index)">
            <i class="iconfont icon-shanchu"></i>
          </div>
        </div>
      </div>
    </div>
    <div class="emptyBox" v-else>
      <el-empty :image-size="100" description="暂无书籍"></el-empty>
    </div>
  </div>
 
  
</template>
 
<script>
export default {
  data() {
    return {};
  },
  methods: {
    deleteItem(item, index) {
      this.$confirm("是否删除当前样书?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.$store.commit("deleteEbookList", index);
          this.$message({
            type: "success",
            message: "删除成功!",
          });
        })
        .catch(() => {});
    },
    createList() {
      if (this.$store.state.userInfo.role !== "Teacher") {
        this.$message({
          showClose: true,
          message: "请先进行教师认证",
          type: "warning",
        });
        return;
      }
      if (this.$store.state.electronicBookList.length == 0) {
        this.$message.error("请添加电子样书后生成清单!");
        return;
      } else {
        this.$router.push("applyBook-electronic");
      }
    },
  },
};
</script>
 
<style scoped>
.relatedBox {
  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;
}
.bookBox {
  background-color: #fff;
  padding: 10px;
}
.imgBox {
  width: 100px;
  height: 150px;
  position: relative;
  padding: 10px;
  border: 1px solid #ccc;
}
.rightBox {
  flex: 1;
  overflow: hidden;
  position: relative;
  margin-left: 10px;
}
.itemBox {
  display: flex;
  border-bottom: 1px solid #eeeeee;
  padding: 10px;
}
.bookName {
  font-size: 16px !important;
  line-height: 20px;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2; /* 这里是超出几行省略 */
  overflow: hidden;
}
.authorBox1 {
  margin-top: 10px;
  color: #666666;
  position: relative;
}
.toDetail {
  margin-top: 50px;
  color: #00873c;
}
.authorName {
  position: absolute;
  line-height: 20px;
  top: -4px;
  left: 44px;
}
.headBox {
  display: flex;
  justify-content: space-between;
  background: #d8f7e6;
}
.inventory {
  cursor: pointer;
  padding: 20px;
  color: #999;
}
.iconBox {
  position: absolute;
  bottom: 20px;
  right: 20px;
  display: none;
  cursor: pointer;
  color: red;
}
.itemBox:hover .iconBox {
  display: block;
}
.emptyBox {
  background-color: #fff;
}
</style>