From 92e63d9fa77d0b93b68267a20ca807aa4ad8d8ae Mon Sep 17 00:00:00 2001 From: xuhuajiao <13476289682@163.com> Date: Tue, 12 May 2026 11:03:36 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E6=9D=83=E9=99=90=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/home/home.vue | 63 +++++++++++++------ pages/lendCar/lendCar.vue | 23 ++++++- pages/login/login.vue | 12 ++-- pages/user/user.vue | 52 +++++++-------- .../pages/activity-detail/activity-detail.vue | 11 ++-- subpkg/pages/activity-list/activity-list.vue | 4 +- subpkg/pages/book-detail/book-detail.vue | 3 +- subpkg/pages/reader-card/reader-card.vue | 3 +- 8 files changed, 106 insertions(+), 65 deletions(-) diff --git a/pages/home/home.vue b/pages/home/home.vue index 08f45d8..dfcab45 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -38,10 +38,10 @@ @@ -355,9 +355,7 @@ export default { }, // 去图书借阅车页 onToLendCar() { - uni.switchTab({ - url: "/pages/lendCar/lendCar" - }); + this.checkBindAndNavigate("/pages/lendCar/lendCar", "请您绑定读者证", true); }, // 点击未绑定借阅证区域 触发跳转 toCheckLogin() { @@ -371,15 +369,27 @@ export default { }) }, toActivityList(){ - uni.navigateTo({ - url: "/subpkg/pages/activity-list/activity-list" - }) + this.checkBindAndNavigate("/subpkg/pages/activity-list/activity-list", "请您绑定读者证"); }, toBorrowPage(index) { - uni.setStorageSync('switch_tab_index', index); - uni.navigateTo({ - url: '/subpkg/pages/myLending/myLending' - }); + if (this.isBindLibraryCard) { + uni.setStorageSync('switch_tab_index', index); + uni.navigateTo({ + url: '/subpkg/pages/myLending/myLending' + }); + } else { + uni.showModal({ + title: '提示', + content: '请您绑定读者证', + confirmText: '去绑定', + cancelText: '取消', + success: (res) => { + if (res.confirm) { + uni.navigateTo({ url: "/pages/login/login" }); + } + } + }); + } }, toBorrowCar() { uni.switchTab({ @@ -387,9 +397,7 @@ export default { }); }, toFeedback() { - uni.navigateTo({ - url: '/subpkg/pages/feedback-list/feedback-list' - }); + this.checkBindAndNavigate("/subpkg/pages/feedback-list/feedback-list", "请您绑定读者证"); }, // 去借阅证列表页 toLibraryCard() { @@ -404,9 +412,28 @@ export default { }, // 去个人中心页 onToUser() { - uni.switchTab({ - url: "/pages/user/user" - }); + this.checkBindAndNavigate("/pages/user/user", "请您绑定读者证", true); + }, + checkBindAndNavigate(url, message, isSwitchTab = false) { + if (this.isBindLibraryCard) { + if (isSwitchTab) { + uni.switchTab({ url }); + } else { + uni.navigateTo({ url }); + } + } else { + uni.showModal({ + title: '提示', + content: message, + confirmText: '去绑定', + cancelText: '取消', + success: (res) => { + if (res.confirm) { + uni.navigateTo({ url: "/pages/login/login" }); + } + } + }); + } }, showQrcode(bindValue) { this.qrcodeText = bindValue; diff --git a/pages/lendCar/lendCar.vue b/pages/lendCar/lendCar.vue index 8f59835..c4c8dc7 100644 --- a/pages/lendCar/lendCar.vue +++ b/pages/lendCar/lendCar.vue @@ -79,7 +79,28 @@ export default { sm4Key: res.data.sm4_key?.context || '', opuser: res.data.op_user?.context || 'JH001', }; - this.getLendingList(); + + const currentReaderCard = await getCurrentReaderCard(); + if (currentReaderCard) { + this.isBindLibraryCard = true; + this.getLendingList(); + } else { + this.isBindLibraryCard = false; + this.bookList = []; + uni.showModal({ + title: '提示', + content: '请您绑定读者证', + confirmText: '去绑定', + cancelText: '取消', + success: (res) => { + if (res.confirm) { + uni.navigateTo({ url: "/pages/login/login" }); + } else { + uni.switchTab({ url: "/pages/home/home" }); + } + } + }); + } } catch (err) {} }, diff --git a/pages/login/login.vue b/pages/login/login.vue index dca8406..8f1dc1f 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -81,9 +81,9 @@ export default { // 开始上传 uni.uploadFile({ - url: config.baseUrl +'/api/fileRelevant/uploadWxAvatarImg', // 你的后端上传地址 + url: config.baseUrl +'/api/fileRelevant/uploadWxAvatarImg', filePath: tempFilePath, - name: 'file', // 后端接收的文件字段名,保持一致! + name: 'file', header: { "Content-Type": "multipart/form-data" }, @@ -93,9 +93,9 @@ export default { try { const data = JSON.parse(res.data); console.log('解析成功:', data) - realAvatar = data.data || data.url || ''; // 按你后端字段改 + realAvatar = data.data || data.url || ''; } catch (e) { - realAvatar = res.data; // 如果直接返回字符串URL + realAvatar = res.data; } if (realAvatar) { console.log("永久头像URL:", realAvatar); @@ -161,7 +161,7 @@ export default { queryvalue: this.queryvalue, rdpasswd: this.rdpasswd, }; - + // 420703GD0000748 // {"code":200,"message":"操作成功","data":"{\"messagelist\":[{\"code\":\"R00138\",\"message\":\"未找到符合条件的读者!\"}],\"success\":false}","timestamp":1778154499544} // {"code":200,"message":"操作成功","data":"{\"success\":true,\"pagedata\":[{\"rdClusterCode\":null,\"rdlib\":\"GD\",\"rdid\":\"420105198509200438\",\"rdcfstate\":1}]}","timestamp":1778154647854} @@ -251,7 +251,7 @@ export default { } catch (err) { console.error('绑定流程异常:', err) uni.hideLoading(); - uni.showToast({ title: '网络异常或绑定失败', icon: 'none' }); + uni.showToast({ title: err || '绑定失败', icon: 'none' }); } } } diff --git a/pages/user/user.vue b/pages/user/user.vue index 6ada29b..53d56fb 100644 --- a/pages/user/user.vue +++ b/pages/user/user.vue @@ -27,29 +27,19 @@ - - 我的留言 - - - - 个人资料 - - - - 解绑读者证 - + + 我的留言 - - - - - - + + + 个人资料 + + + + 解绑读者证 +