杨磊
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
<template>
  <div class="bookInfo">
    <div class="recommend" v-if="bookInfo.caupress_recommendationReason">
      <div class="title">推荐理由</div>
      <div
        class="content"
        v-html="bookInfo.caupress_recommendationReason"
      ></div>
    </div>
    <div class="otherBox">
      <div class="itemBox" v-for="(item, index) in dataList" :key="index">
        <div v-if="item.content != undefined && item.content.length > 0">
          <div class="itemTitle">
            <div class="titleName">{{ item.title }}</div>
 
          </div>
          <div
            class="itemContent"
            v-html="item.content"
            v-if="item.content != undefined"
          ></div>
          <el-empty description="暂无内容" v-else></el-empty>
        </div>
      </div>
    </div>
  </div>
</template>
 
<script>
export default {
  data() {
    return {
      dataList: [
        {
          title: "作者简介",
          content: null,
        },
        {
          title: "简介",
          content: null,
        },
        {
          title: "前言",
          content: null,
        },
        {
          title: "目录",
          content: null,
        },
      ],
    };
  },
  props: {
    bookInfo: {
      type: Object,
      default: () => {},
    },
  },
  watch: {
    bookInfo() {
      this.dataList.forEach((item) => {
        if (item.title == "作者简介")
          item.content = this.bookInfo.caupress_authorAbout;
        if (item.title == "简介") item.content = this.bookInfo.caupress_content;
        if (item.title == "前言") item.content = this.bookInfo.caupress_preface;
        if (item.title == "目录") item.content = this.bookInfo.caupress_catalog;
      });
    },
  },
};
</script>
 
<style scoped>
.bookInfo {
  width: 813px;
  background-color: #fff;
  margin: 10px 0 0 10px;
  padding: 40px;
  box-sizing: border-box;
}
.recommend {
  max-height: 270px;
  background-color: #fbf5eb;
  overflow: auto;
  border-radius: 4px;
  border: 1px solid #ebd5b4;
}
.title {
  height: 20px;
  line-height: 20px;
  border-bottom: 1px dashed #d6d6d6;
  padding: 20px;
  color: #333333;
  font-size: 18px;
  font-weight: 700;
}
.content {
  max-height: 210px;
  line-height: 40px;
  margin-top: 20px;
  padding: 20px;
}
.itemTitle {
  height: 20px;
  position: relative;
  border-left: 3px solid #019E58;
  line-height: 20px;
  padding-left: 20px;
}
.titleName {
  font-size: 18px;
  font-weight: 700;
  position: absolute;
}
.otherBox {
  margin-top: 40px;
}
.itemContent {
  padding: 20px;
  line-height: 25px;
  max-height: 900px;
  overflow: auto;
}
.itemBox {
  margin-top: 50px;
}
</style>