vip-books.js 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const _sfc_main = {
  4. data() {
  5. const getBookImage = (seed) => {
  6. return `https://picsum.photos/seed/${seed}/200/300`;
  7. };
  8. return {
  9. hasMore: true,
  10. page: 1,
  11. bookList: [
  12. {
  13. id: 1,
  14. title: "互联网心理学",
  15. author: "雷雳",
  16. desc: "当连接万物的互联网遇见无处不在的心理学,我们需要用心理学的方式,重新思考互联网背后的人与社会。",
  17. cover: getBookImage("vip-internet-psychology"),
  18. isVip: true
  19. },
  20. {
  21. id: 2,
  22. title: "孝经 (中华经典诵读)",
  23. author: "孔子",
  24. desc: "以孔子与其弟子曾参之间问答的形式,将社会上各种阶层的人士,标示出其实践孝亲的法则与途径,阐述了「孝」的意义。",
  25. cover: getBookImage("vip-xiaojing"),
  26. isVip: true
  27. },
  28. {
  29. id: 3,
  30. title: "自省",
  31. author: "约翰·班扬",
  32. desc: "讲述了敬虔之人和不敬虔之人截然相反的结局。本书就是他的细细品味,文风一如从前,朴实无华却又字字珠玑。",
  33. cover: getBookImage("vip-self-reflection"),
  34. isVip: true
  35. },
  36. {
  37. id: 4,
  38. title: "思维的艺术",
  39. author: "延斯·森特根",
  40. desc: "一本关于思维方式和哲学思考的经典之作,帮助读者提升逻辑思维和批判性思考能力。",
  41. cover: getBookImage("vip-thinking-art"),
  42. isVip: true
  43. },
  44. {
  45. id: 5,
  46. title: "传习录:全译全注",
  47. author: "王阳明",
  48. desc: "王阳明心学的核心著作,记录了其与学生之间的对话,阐述了知行合一的哲学思想。",
  49. cover: getBookImage("vip-chuanxilu"),
  50. isVip: true
  51. },
  52. {
  53. id: 6,
  54. title: "社会契约论",
  55. author: "让·雅克·卢梭",
  56. desc: "探讨了政治权力的合法性和人民主权的基本原则,是现代民主理论的重要基石。",
  57. cover: getBookImage("vip-social-contract"),
  58. isVip: true
  59. },
  60. {
  61. id: 7,
  62. title: "没有烦恼的世界",
  63. author: "王觉仁",
  64. desc: "通过禅修和正念的实践,帮助读者摆脱内心的烦恼,获得内心的平静与智慧。",
  65. cover: getBookImage("vip-no-worries"),
  66. isVip: true
  67. },
  68. {
  69. id: 8,
  70. title: "透过电影看文化",
  71. author: "陈红",
  72. desc: "从电影的角度分析不同文化的特点,探讨电影如何反映和影响社会文化的发展。",
  73. cover: getBookImage("vip-film-culture"),
  74. isVip: true
  75. }
  76. ]
  77. };
  78. },
  79. onLoad() {
  80. this.loadBookList();
  81. },
  82. methods: {
  83. goBack() {
  84. common_vendor.index.navigateBack({
  85. delta: 1
  86. });
  87. },
  88. goToSearch() {
  89. common_vendor.index.navigateTo({
  90. url: "/pages/search/search"
  91. });
  92. },
  93. goToVip() {
  94. common_vendor.index.navigateTo({
  95. url: "/pages/vip/vip"
  96. });
  97. },
  98. goToBookDetail(book) {
  99. if (!book || !book.id) {
  100. common_vendor.index.showToast({
  101. title: "书籍信息不完整",
  102. icon: "none"
  103. });
  104. return;
  105. }
  106. common_vendor.index.navigateTo({
  107. url: `/pages/book-detail/book-detail?bookId=${book.id}`
  108. });
  109. },
  110. handleImageError(index) {
  111. if (this.bookList[index]) {
  112. this.bookList[index].cover = `https://picsum.photos/seed/fallback${index}/200/300`;
  113. }
  114. },
  115. loadBookList() {
  116. },
  117. loadMore() {
  118. if (this.hasMore) {
  119. setTimeout(() => {
  120. const moreBooks = [
  121. {
  122. id: 9,
  123. title: "车尔尼钢琴流畅练习曲",
  124. author: "高新颜",
  125. desc: "经典的钢琴练习曲集,适合中级钢琴学习者,帮助提升演奏技巧和流畅度。",
  126. cover: `https://picsum.photos/seed/vip-czerny${this.page}/200/300`,
  127. isVip: true
  128. },
  129. {
  130. id: 10,
  131. title: "古典哲学的趣味",
  132. author: "朱利安·巴吉尼",
  133. desc: "用通俗易懂的方式介绍古典哲学的核心思想,让哲学变得生动有趣。",
  134. cover: `https://picsum.photos/seed/vip-philosophy${this.page}/200/300`,
  135. isVip: true
  136. },
  137. {
  138. id: 11,
  139. title: "走向大洋",
  140. author: "未知",
  141. desc: "一部关于海洋探索和人类文明发展的历史著作,展现了人类对未知世界的探索精神。",
  142. cover: `https://picsum.photos/seed/vip-ocean${this.page}/200/300`,
  143. isVip: true
  144. },
  145. {
  146. id: 12,
  147. title: "思维的艺术",
  148. author: "延斯·森特根",
  149. desc: "一本关于思维方式和哲学思考的经典之作,帮助读者提升逻辑思维和批判性思考能力。",
  150. cover: `https://picsum.photos/seed/vip-thinking-art2${this.page}/200/300`,
  151. isVip: true
  152. }
  153. ];
  154. if (this.page < 3) {
  155. const newBooks = moreBooks.map((book, idx) => ({
  156. ...book,
  157. id: book.id + this.page * 10
  158. }));
  159. this.bookList = [...this.bookList, ...newBooks];
  160. this.page++;
  161. } else {
  162. this.hasMore = false;
  163. }
  164. }, 500);
  165. }
  166. }
  167. }
  168. };
  169. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  170. return common_vendor.e({
  171. a: common_vendor.o((...args) => $options.goBack && $options.goBack(...args)),
  172. b: common_vendor.o((...args) => $options.goToSearch && $options.goToSearch(...args)),
  173. c: common_vendor.o((...args) => $options.goToVip && $options.goToVip(...args)),
  174. d: common_vendor.f($data.bookList, (book, index, i0) => {
  175. return common_vendor.e({
  176. a: book.isVip
  177. }, book.isVip ? {} : {}, {
  178. b: book.cover,
  179. c: common_vendor.o(($event) => $options.handleImageError(index), book.id || index),
  180. d: common_vendor.t(book.title),
  181. e: common_vendor.t(book.desc),
  182. f: common_vendor.t(book.author),
  183. g: book.id || index,
  184. h: common_vendor.o(($event) => $options.goToBookDetail(book), book.id || index)
  185. });
  186. }),
  187. e: $data.hasMore
  188. }, $data.hasMore ? {} : $data.bookList.length > 0 ? {} : {}, {
  189. f: $data.bookList.length > 0,
  190. g: common_vendor.o((...args) => $options.loadMore && $options.loadMore(...args))
  191. });
  192. }
  193. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-a8b1dfa0"]]);
  194. wx.createPage(MiniProgramPage);
  195. //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/vip-books/vip-books.js.map