| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- const _sfc_main = {
- data() {
- const getBookImage = (seed) => {
- return `https://picsum.photos/seed/${seed}/200/300`;
- };
- return {
- hasMore: true,
- page: 1,
- bookList: [
- {
- id: 1,
- title: "互联网心理学",
- author: "雷雳",
- desc: "当连接万物的互联网遇见无处不在的心理学,我们需要用心理学的方式,重新思考互联网背后的人与社会。",
- cover: getBookImage("vip-internet-psychology"),
- isVip: true
- },
- {
- id: 2,
- title: "孝经 (中华经典诵读)",
- author: "孔子",
- desc: "以孔子与其弟子曾参之间问答的形式,将社会上各种阶层的人士,标示出其实践孝亲的法则与途径,阐述了「孝」的意义。",
- cover: getBookImage("vip-xiaojing"),
- isVip: true
- },
- {
- id: 3,
- title: "自省",
- author: "约翰·班扬",
- desc: "讲述了敬虔之人和不敬虔之人截然相反的结局。本书就是他的细细品味,文风一如从前,朴实无华却又字字珠玑。",
- cover: getBookImage("vip-self-reflection"),
- isVip: true
- },
- {
- id: 4,
- title: "思维的艺术",
- author: "延斯·森特根",
- desc: "一本关于思维方式和哲学思考的经典之作,帮助读者提升逻辑思维和批判性思考能力。",
- cover: getBookImage("vip-thinking-art"),
- isVip: true
- },
- {
- id: 5,
- title: "传习录:全译全注",
- author: "王阳明",
- desc: "王阳明心学的核心著作,记录了其与学生之间的对话,阐述了知行合一的哲学思想。",
- cover: getBookImage("vip-chuanxilu"),
- isVip: true
- },
- {
- id: 6,
- title: "社会契约论",
- author: "让·雅克·卢梭",
- desc: "探讨了政治权力的合法性和人民主权的基本原则,是现代民主理论的重要基石。",
- cover: getBookImage("vip-social-contract"),
- isVip: true
- },
- {
- id: 7,
- title: "没有烦恼的世界",
- author: "王觉仁",
- desc: "通过禅修和正念的实践,帮助读者摆脱内心的烦恼,获得内心的平静与智慧。",
- cover: getBookImage("vip-no-worries"),
- isVip: true
- },
- {
- id: 8,
- title: "透过电影看文化",
- author: "陈红",
- desc: "从电影的角度分析不同文化的特点,探讨电影如何反映和影响社会文化的发展。",
- cover: getBookImage("vip-film-culture"),
- isVip: true
- }
- ]
- };
- },
- onLoad() {
- this.loadBookList();
- },
- methods: {
- goBack() {
- common_vendor.index.navigateBack({
- delta: 1
- });
- },
- goToSearch() {
- common_vendor.index.navigateTo({
- url: "/pages/search/search"
- });
- },
- goToVip() {
- common_vendor.index.navigateTo({
- url: "/pages/vip/vip"
- });
- },
- goToBookDetail(book) {
- if (!book || !book.id) {
- common_vendor.index.showToast({
- title: "书籍信息不完整",
- icon: "none"
- });
- return;
- }
- common_vendor.index.navigateTo({
- url: `/pages/book-detail/book-detail?bookId=${book.id}`
- });
- },
- handleImageError(index) {
- if (this.bookList[index]) {
- this.bookList[index].cover = `https://picsum.photos/seed/fallback${index}/200/300`;
- }
- },
- loadBookList() {
- },
- loadMore() {
- if (this.hasMore) {
- setTimeout(() => {
- const moreBooks = [
- {
- id: 9,
- title: "车尔尼钢琴流畅练习曲",
- author: "高新颜",
- desc: "经典的钢琴练习曲集,适合中级钢琴学习者,帮助提升演奏技巧和流畅度。",
- cover: `https://picsum.photos/seed/vip-czerny${this.page}/200/300`,
- isVip: true
- },
- {
- id: 10,
- title: "古典哲学的趣味",
- author: "朱利安·巴吉尼",
- desc: "用通俗易懂的方式介绍古典哲学的核心思想,让哲学变得生动有趣。",
- cover: `https://picsum.photos/seed/vip-philosophy${this.page}/200/300`,
- isVip: true
- },
- {
- id: 11,
- title: "走向大洋",
- author: "未知",
- desc: "一部关于海洋探索和人类文明发展的历史著作,展现了人类对未知世界的探索精神。",
- cover: `https://picsum.photos/seed/vip-ocean${this.page}/200/300`,
- isVip: true
- },
- {
- id: 12,
- title: "思维的艺术",
- author: "延斯·森特根",
- desc: "一本关于思维方式和哲学思考的经典之作,帮助读者提升逻辑思维和批判性思考能力。",
- cover: `https://picsum.photos/seed/vip-thinking-art2${this.page}/200/300`,
- isVip: true
- }
- ];
- if (this.page < 3) {
- const newBooks = moreBooks.map((book, idx) => ({
- ...book,
- id: book.id + this.page * 10
- }));
- this.bookList = [...this.bookList, ...newBooks];
- this.page++;
- } else {
- this.hasMore = false;
- }
- }, 500);
- }
- }
- }
- };
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- return common_vendor.e({
- a: common_vendor.o((...args) => $options.goBack && $options.goBack(...args)),
- b: common_vendor.o((...args) => $options.goToSearch && $options.goToSearch(...args)),
- c: common_vendor.o((...args) => $options.goToVip && $options.goToVip(...args)),
- d: common_vendor.f($data.bookList, (book, index, i0) => {
- return common_vendor.e({
- a: book.isVip
- }, book.isVip ? {} : {}, {
- b: book.cover,
- c: common_vendor.o(($event) => $options.handleImageError(index), book.id || index),
- d: common_vendor.t(book.title),
- e: common_vendor.t(book.desc),
- f: common_vendor.t(book.author),
- g: book.id || index,
- h: common_vendor.o(($event) => $options.goToBookDetail(book), book.id || index)
- });
- }),
- e: $data.hasMore
- }, $data.hasMore ? {} : $data.bookList.length > 0 ? {} : {}, {
- f: $data.bookList.length > 0,
- g: common_vendor.o((...args) => $options.loadMore && $options.loadMore(...args))
- });
- }
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-a8b1dfa0"]]);
- wx.createPage(MiniProgramPage);
- //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/vip-books/vip-books.js.map
|