图书馆小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

286 lines
8.7 KiB

2 weeks ago
1 week ago
2 weeks ago
1 week ago
2 weeks ago
1 week ago
2 weeks ago
  1. <template>
  2. <view>
  3. <view class="ranking-header">
  4. <image
  5. class="ranking-heander-bg"
  6. src="@/static/images/ranking-bg.png"
  7. mode="aspectFill"
  8. />
  9. <view class="ranking-header-txt">
  10. <view class="ranking-title">
  11. <uni-icons custom-prefix="iconfont" type="icon-paihangbang2" size="20"></uni-icons>
  12. <text class="title-text">借阅排行</text>
  13. </view>
  14. <text class="ranking-header-tip">由本图书馆累计借阅而定期生成排行榜单</text>
  15. <!-- <text class="ranking-num">{{ bookList.length }}</text> -->
  16. </view>
  17. </view>
  18. <view class="ranking-list">
  19. <view
  20. class="ranking-item"
  21. :class="[
  22. index === 0 ? 'first-item' : '',
  23. index === 1 ? 'two-item' : '',
  24. index === 2 ? 'three-item' : ''
  25. ]"
  26. v-for="(item, index) in bookList"
  27. :key="index"
  28. >
  29. <!-- 第一名 -->
  30. <view
  31. class="ranking-icon t-icon"
  32. :class="index === 0 ? 't-icon-TOP2' : ''"
  33. v-if="index === 0"
  34. ></view>
  35. <!-- 第二名 -->
  36. <view
  37. class="ranking-icon t-icon"
  38. :class="index === 1 ? 't-icon-TOP' : ''"
  39. v-if="index === 1"
  40. ></view>
  41. <!-- 第三名 -->
  42. <view
  43. class="ranking-icon t-icon"
  44. :class="index === 2 ? 't-icon-TOP1' : ''"
  45. v-if="index === 2"
  46. ></view>
  47. <!-- 4~15 显示数字 -->
  48. <view
  49. class="ranking-common-icon t-icon t-icon-tag"
  50. v-if="index >= 3"
  51. >{{ index + 1 }}</view>
  52. <!-- 书籍封面 -->
  53. <view class="ranking-item-img">
  54. <image
  55. class="book-cover"
  56. :src="item.cover"
  57. mode="scaleToFill"
  58. />
  59. </view>
  60. <!-- 书籍信息 -->
  61. <view class="ranking-book-info">
  62. <text class="book-info-title">{{ item.title }}</text>
  63. <text class="book-info-name">{{ item.author }}</text>
  64. <text class="book-info-desc line-clamp-3 ">{{ item.desc }}</text>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </template>
  70. <script>
  71. export default {
  72. data() {
  73. return {
  74. bookList: [
  75. {
  76. cover: "https://qiniu.aiyxlib.com/1606124577077",
  77. title: "名侦探柯南",
  78. author: "青山刚昌",
  79. desc: "《名侦探柯南》是日本漫画家青山刚昌创作的著名侦探漫画作品,讲述了高中生侦探工藤新一被灌下毒药后身体缩小,化名为江户川柯南,秘密调查黑暗组织,并解决无数离奇案件的故事。作品兼具推理、冒险、情感与幽默元素,是全球极具影响力的经典漫画。"
  80. },
  81. {
  82. cover: "https://qiniu.aiyxlib.com/1606124577077",
  83. title: "海贼王",
  84. author: "尾田荣一郎",
  85. desc: "《海贼王》讲述了主角蒙奇·D·路飞为了成为海贼王,与伙伴们在伟大航路上冒险,寻找传说中的One Piece的故事。"
  86. },
  87. {
  88. cover: "https://qiniu.aiyxlib.com/1606124577077",
  89. title: "火影忍者",
  90. author: "岸本齐史",
  91. desc: "《火影忍者》讲述了鸣人从小被孤立,通过努力成为忍者,最终成为英雄守护村子的故事。"
  92. },
  93. {
  94. cover: "https://qiniu.aiyxlib.com/1606124577077",
  95. title: "三体",
  96. author: "刘慈欣",
  97. desc: "《三体》是刘慈欣创作的长篇科幻小说,讲述了人类与三体文明之间的生死博弈。"
  98. },
  99. {
  100. cover: "https://qiniu.aiyxlib.com/1606124577077",
  101. title: "盗墓笔记",
  102. author: "南派三叔",
  103. desc: "《盗墓笔记》讲述了吴邪等人在古墓中探险,揭开一系列神秘谜团的故事。"
  104. },
  105. {
  106. cover: "https://qiniu.aiyxlib.com/1606124577077",
  107. title: "斗罗大陆",
  108. author: "唐家三少",
  109. desc: "《斗罗大陆》讲述了唐三穿越到斗罗大陆,一步步成为魂师巅峰的故事。"
  110. },
  111. {
  112. cover: "https://qiniu.aiyxlib.com/1606124577077",
  113. title: "斗破苍穹",
  114. author: "天蚕土豆",
  115. desc: "《斗破苍穹》讲述了萧炎从废柴少年逆袭成为斗气大陆最强者的故事。"
  116. },
  117. {
  118. cover: "https://qiniu.aiyxlib.com/1606124577077",
  119. title: "西游记",
  120. author: "吴承恩",
  121. desc: "《西游记》是中国古典四大名著之一,讲述了唐僧师徒西天取经的故事。"
  122. },
  123. {
  124. cover: "https://qiniu.aiyxlib.com/1606124577077",
  125. title: "红楼梦",
  126. author: "曹雪芹",
  127. desc: "《红楼梦》以贾史王薛四大家族为背景,讲述了贾宝玉与林黛玉的爱情悲剧。"
  128. },
  129. {
  130. cover: "https://qiniu.aiyxlib.com/1606124577077",
  131. title: "水浒传",
  132. author: "施耐庵",
  133. desc: "《水浒传》讲述了108位好汉在梁山起义,最终接受招安的故事。"
  134. },
  135. {
  136. cover: "https://qiniu.aiyxlib.com/1606124577077",
  137. title: "三国演义",
  138. author: "罗贯中",
  139. desc: "《三国演义》描写了从东汉末年到西晋初年的群雄割据与英雄争霸。"
  140. },
  141. {
  142. cover: "https://qiniu.aiyxlib.com/1606124577077",
  143. title: "沉默的大多数",
  144. author: "王小波",
  145. desc: "《沉默的大多数》是王小波的杂文精选,探讨了社会、文化与人性。"
  146. },
  147. {
  148. cover: "https://qiniu.aiyxlib.com/1606124577077",
  149. title: "活着",
  150. author: "余华",
  151. desc: "《活着》讲述了福贵在苦难中坚守生命的故事。"
  152. },
  153. {
  154. cover: "https://qiniu.aiyxlib.com/1606124577077",
  155. title: "人间失格",
  156. author: "太宰治",
  157. desc: "《人间失格》讲述了主人公叶藏从青年到颓废堕落的人生历程。"
  158. },
  159. {
  160. cover: "https://qiniu.aiyxlib.com/1606124577077",
  161. title: "解忧杂货店",
  162. author: "东野圭吾",
  163. desc: "《解忧杂货店》讲述了一家神奇杂货店帮助人们解决烦恼的温暖故事。"
  164. }
  165. ]
  166. };
  167. }
  168. }
  169. </script>
  170. <style lang="scss" scoped>
  171. .ranking-header{
  172. position: relative;
  173. width: 100%;
  174. height: 150px;
  175. .ranking-heander-bg{
  176. width: 100%;
  177. height: 100%;
  178. }
  179. .ranking-header-txt{
  180. position: absolute;
  181. top: 0;
  182. left: 0;
  183. height: 150px;
  184. padding: 20px;
  185. display: flex;
  186. flex-direction: column;
  187. justify-content: flex-start;
  188. .ranking-title{
  189. display: flex;
  190. justify-content: flex-start;
  191. align-items: center;
  192. font-size: 26px;
  193. font-weight: bold;
  194. color: #1a1a1a;
  195. ::v-deep .uni-icons{
  196. color: #01a4fe !important;
  197. }
  198. .title-text{
  199. // 多层阴影 = 立体 + 好看
  200. text-shadow: 0 2px 4px rgba(0, 0, 0, 0.15),
  201. 0 1px 2px rgba(0, 0, 0, 0.1);
  202. letter-spacing: 1px; /* 文字间距更舒服 */
  203. margin-left: 8px;
  204. }
  205. }
  206. .ranking-header-tip,
  207. .ranking-num{
  208. color: #333;
  209. font-size: 14px;
  210. padding-top: 15px;
  211. }
  212. }
  213. }
  214. .ranking-list{
  215. position: relative;
  216. background-color: #fff;
  217. border-radius: 26px 26px 0 0;
  218. margin-top: -30px;
  219. z-index: 999;
  220. padding: 20px 0;
  221. }
  222. .ranking-item{
  223. position: relative;
  224. display: flex;
  225. justify-content: space-between;
  226. margin: 30px 20px 0 20px;
  227. padding: 10px;
  228. background-color: #f7f8fc;
  229. border-radius: 6px;
  230. .ranking-item-img{
  231. margin-right: 10px;
  232. .book-cover{
  233. width: 100px;
  234. height: 150px;
  235. border-radius: 10px;
  236. padding: 0 10px;
  237. background-color: #fff;
  238. }
  239. }
  240. .ranking-book-info{
  241. flex: 1;
  242. display: flex;
  243. flex-direction: column;
  244. font-size: 14px;
  245. color: #666;
  246. .book-info-title{
  247. font-size: 16px;
  248. font-weight: bold;
  249. color: #000;
  250. padding-top: 10px;
  251. }
  252. .book-info-name,
  253. .book-info-desc{
  254. padding-top: 10px;
  255. line-height: 24px;
  256. }
  257. }
  258. &.first-item{
  259. background-color: #fBF0BB;
  260. }
  261. &.two-item{
  262. background-color: #e9eff6;
  263. }
  264. &.three-item{
  265. background-color: #fBF0BB;
  266. }
  267. .ranking-icon{
  268. position: absolute;
  269. right: 10px;
  270. top: -10px;
  271. width: 64px;
  272. height: 28px;
  273. }
  274. .ranking-common-icon{
  275. position: absolute;
  276. right: 10px;
  277. top: -10px;
  278. width: 28px;
  279. height: 28px;
  280. text-align: center;
  281. color: #fff;
  282. }
  283. }
  284. </style>