From aa424a2abe96dc466f7a9389326116b5da09cb8a Mon Sep 17 00:00:00 2001 From: xuhuajiao <13476289682@163.com> Date: Sat, 9 May 2026 10:21:26 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BB=E8=80=85=E8=AF=81=E6=9D=BF=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/article.js | 21 -- api/book.js | 9 + api/hot.js | 19 -- api/video.js | 21 -- pages/home/home.vue | 103 ++----- pages/user/user.vue | 156 +++++------ subpkg/pages/reader-card/reader-card copy.vue | 151 +++++++++++ subpkg/pages/reader-card/reader-card.vue | 195 +++++++++++--- subpkg/pages/unbind-card/unbind-card.vue | 164 ++++-------- subpkg/pages/user-info/user-info.vue | 253 ++++++++++++------ 10 files changed, 631 insertions(+), 461 deletions(-) delete mode 100644 api/article.js delete mode 100644 api/hot.js delete mode 100644 api/video.js create mode 100644 subpkg/pages/reader-card/reader-card copy.vue diff --git a/api/article.js b/api/article.js deleted file mode 100644 index 49f8cd6..0000000 --- a/api/article.js +++ /dev/null @@ -1,21 +0,0 @@ -import request from '../utils/request'; - -/** - * 获取文章详情 - */ -export function getArticleDetail(data) { - return request({ - url: '/article/details', - data - }); -} - -/** - * 获取文章评论列表 - */ -export function getArticleCommentList(data) { - return request({ - url: '/article/comment/list', - data - }); -} diff --git a/api/book.js b/api/book.js index aa6d90a..a6e5b65 100644 --- a/api/book.js +++ b/api/book.js @@ -1,5 +1,14 @@ import request from '../utils/request'; +// 查询读者当前借阅(群) +export function FetchRdloanlist(data) { + return request({ + url: '/api/screenSetting/rdloanlist', + data + }) +} + + // 图书推荐 export function FetchInitScreenBookRecommend(data) { return request({ diff --git a/api/hot.js b/api/hot.js deleted file mode 100644 index 9e1cb27..0000000 --- a/api/hot.js +++ /dev/null @@ -1,19 +0,0 @@ -import request from '../utils/request'; - -export function getHotTabs() { - return request({ - url: '/hot/tabs' - }); -} - -/** - * 热搜文章列表 - */ -export function getHotListFromTabType(type) { - return request({ - url: '/hot/list', - data: { - type - } - }); -} diff --git a/api/video.js b/api/video.js deleted file mode 100644 index 674041a..0000000 --- a/api/video.js +++ /dev/null @@ -1,21 +0,0 @@ -import request from '../utils/request'; - -/** - * 热播视频列表 - */ -export function getHotVideoList(data) { - return request({ - url: '/video/list', - data - }); -} - -/** - * 获取视频弹幕列表 - */ -export function getVideoDanmuList(data) { - return request({ - url: '/video/danmu', - data - }); -} diff --git a/pages/home/home.vue b/pages/home/home.vue index def9839..de824db 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -90,7 +90,7 @@ 电子证 - + @@ -110,7 +110,7 @@ indicator-active-color="#01a4fe" --> @@ -119,7 +119,7 @@ 读者证号 {{ item.bindValue }} - 默认证件 + 默认证 @@ -173,7 +173,7 @@ export default { token: "", userInfo: {}, isBindLibraryCard: false, - readerCardList: [], // 改成数组,存多个借阅证 + readerCardList: [], // 多个借阅证 baseUrl: config.baseUrl, }; }, @@ -226,8 +226,13 @@ export default { if (res.code === 200 && res.data.length > 0) { this.isBindLibraryCard = true; - this.readerCardList = res.data; - uni.setStorageSync(READLIST, res.data); + // 👉 默认证排第一位 + const defaultCard = res.data.find(item => item.bindDefault === true); + const otherCards = res.data.filter(item => !item.bindDefault); + // 合并:默认在前,其他在后 + this.readerCardList = defaultCard ? [defaultCard, ...otherCards] : res.data; + + uni.setStorageSync(READLIST, this.readerCardList); } else { this.isBindLibraryCard = false; this.readerCardList = []; @@ -236,22 +241,15 @@ export default { } catch (err) { console.error('初始化失败:', err); - // 兜底读缓存 const list = uni.getStorageSync(READLIST) || []; - this.readerCardList = list; + // 同样默认排第一 + const defaultCard = list.find(item => item.bindDefault === true); + const otherCards = list.filter(item => !item.bindDefault); + this.readerCardList = defaultCard ? [defaultCard, ...otherCards] : list; + this.isBindLibraryCard = list.length > 0; } - }, - // 时间戳格式化 - formatTime(timestamp) { - if (!timestamp) return '' - const date = new Date(timestamp) - const year = date.getFullYear() - const month = (date.getMonth() + 1).toString().padStart(2, '0') - const day = date.getDate().toString().padStart(2, '0') - return `${year}-${month}-${day}` - }, - + }, async getRecommendBooks() { try { const res = await FetchInitScreenBookRecommend({ libcode: '1201' }); @@ -263,7 +261,6 @@ export default { this.isLoading = false } }, - goToBookDetail(item) { uni.navigateTo({ url: "/subpkg/pages/book-detail/book-detail?isbn=" + item.isbn @@ -276,7 +273,7 @@ export default { url: "/subpkg/pages/book-list/book-list" }) }, - + // 去图书检索页 onToSearch() { uni.switchTab({ url: "/pages/search/search" @@ -288,63 +285,6 @@ export default { url: "/pages/login/login" }); }, - // toCheckLogin(pageName) { - // // 未登录:获取微信登录 code,再跳转到登录页 - // uni.login({ - // success: (res) => { - // if (res.code) { - // console.log('res',res) - // console.log("微信登录凭证 code:", res.code); - // const params = { - // libcode: '1201', - // code: res.code - // } - // FetchOpenId(params).then(res => { - // console.log('获取微信openId',res) - // if(res.code === 200 && res.data){ - // uni.setStorageSync("wx_login_code", res.data); - - // const data = { - // libcode: '1201', - // openId: res.data - // } - // FetchFindAllReaderBindByOpenId(data).then(res => { - // console.log('获取读者证列表',res) - // if (res.code === 200 && res.data.length > 0) { - // this.isBindLibraryCard = true; - // this.readerCardList = res.data; - // uni.setStorageSync(READLIST, res.data); - // } else { - // this.isBindLibraryCard = false; - // uni.navigateTo({ - // url: "/pages/login/login" - // }); - // } - // }) - // .catch(err => { - // console.error('获取读者证列表失败:', err); - // }) - // } - // }) - // .catch(err => { - // console.error('获取微信openId失败:', err); - // }) - // } else { - // uni.showToast({ - // title: "获取登录信息失败", - // icon: "error" - // }); - // } - // }, - // fail: () => { - // uni.showToast({ - // title: "授权失败", - // icon: "error" - // }); - // } - // }); - // }, - toRanking(){ uni.navigateTo({ url: "/subpkg/pages/ranking/ranking" @@ -371,6 +311,7 @@ export default { url: '/subpkg/pages/feedback-list/feedback-list' }); }, + // 去借阅证列表页 toLibraryCard() { // 已绑定 → 进列表 if (this.isBindLibraryCard) { @@ -381,6 +322,12 @@ export default { uni.navigateTo({ url: "/pages/login/login" }); } }, + // 去个人中心页 + onToUser() { + uni.switchTab({ + url: "/pages/user/user" + }); + }, onToScan() { uni.scanCode({ onlyFromCamera: true, diff --git a/pages/user/user.vue b/pages/user/user.vue index 2f32669..38ccde9 100644 --- a/pages/user/user.vue +++ b/pages/user/user.vue @@ -1,52 +1,52 @@