From 1ddbfa615a4bf09521ec30b692abdf6bbf2bc878 Mon Sep 17 00:00:00 2001
From: xuhuajiao <13476289682@163.com>
Date: Tue, 12 May 2026 15:09:20 +0800
Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AElibcode,=E7=BB=9F=E4=B8=80?=
=?UTF-8?q?=E8=B0=83=E5=8F=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
App.vue | 32 +++++++-------
api/user.js | 55 +-----------------------
pages/home/home.vue | 7 ++-
pages/lendCar/lendCar.vue | 7 +--
pages/login/login.vue | 20 ++++-----
pages/search/search.vue | 5 ++-
pages/user/user.vue | 6 +--
subpkg/pages/book-detail/book-detail.vue | 10 ++---
subpkg/pages/book-list/book-list.vue | 2 +-
subpkg/pages/feedback/feedback.vue | 2 +-
subpkg/pages/myLending/myLending.vue | 3 +-
subpkg/pages/ranking/ranking.vue | 15 ++++---
subpkg/pages/reader-card/reader-card.vue | 16 +++----
subpkg/pages/user-info/user-info.vue | 2 +-
utils/config.js | 9 +++-
utils/index.js | 12 ------
utils/storage.js | 21 ++++-----
17 files changed, 84 insertions(+), 140 deletions(-)
delete mode 100644 utils/index.js
diff --git a/App.vue b/App.vue
index 5098cf2..ee288b1 100644
--- a/App.vue
+++ b/App.vue
@@ -1,19 +1,19 @@
-
-
-
diff --git a/api/user.js b/api/user.js
index 327ab2d..47fa112 100644
--- a/api/user.js
+++ b/api/user.js
@@ -101,57 +101,4 @@ export function FetchUnbindReadCard(data) {
method: 'POST',
data
});
-}
-
-
-/**
- * 用户登录
- */
-export function login(data) {
- return request({
- url: '/sys/login',
- method: 'POST',
- data
- });
-}
-
-/**
- * 关注用户
- */
-// export function userFollow(data) {
-// return request({
-// url: '/user/follow',
-// data
-// });
-// }
-
-/**
- * 发表评论
- */
-// export function userArticleComment(data) {
-// return request({
-// url: '/user/article/comment',
-// method: 'POST',
-// data
-// });
-// }
-
-/**
- * 用户点赞
- */
-// export function userPraise(data) {
-// return request({
-// url: '/user/praise',
-// data
-// });
-// }
-
-/**
- * 用户收藏
- */
-// export function userCollect(data) {
-// return request({
-// url: '/user/collect',
-// data
-// });
-// }
+}
\ No newline at end of file
diff --git a/pages/home/home.vue b/pages/home/home.vue
index e45aa51..32a09b9 100644
--- a/pages/home/home.vue
+++ b/pages/home/home.vue
@@ -256,7 +256,7 @@ export default {
// 3. 获取 openId
const openRes = await FetchOpenId({
- libcode: '1201',
+ libcode: config.LIB_CODE,
code: loginRes.code
});
@@ -270,7 +270,7 @@ export default {
// 4. 有了 openId → 查绑定状态
const res = await FetchFindAllReaderBindByOpenId({
- libcode: '1201',
+ libcode: config.LIB_CODE,
openId: openId
});
@@ -305,7 +305,7 @@ export default {
// 获取图书推荐 + 封面转 base64
async getRecommendBooks() {
try {
- const res = await FetchInitScreenBookRecommend({ libcode: '1201' });
+ const res = await FetchInitScreenBookRecommend({ libcode: config.LIB_CODE });
let books = res.data || [];
// 只处理并展示前3条,避免setData数据过大
@@ -441,7 +441,6 @@ export default {
this.$refs.popup.open();
},
closePopup() {
- console.log('关闭弹窗');
this.qrcodeText = '';
this.$refs.popup.close();
},
diff --git a/pages/lendCar/lendCar.vue b/pages/lendCar/lendCar.vue
index 1998b21..1804397 100644
--- a/pages/lendCar/lendCar.vue
+++ b/pages/lendCar/lendCar.vue
@@ -63,6 +63,7 @@
import { FetchInitScreenSetting } from '@/api/user';
import { FetchRdloanlist, FetchRenewbook } from '@/api/book';
import { getCurrentReaderCard } from '@/utils/storage';
+import config from '@/utils/config';
export default {
data() {
@@ -111,7 +112,7 @@ export default {
try {
// 1. 获取配置
- await this.fetchScreenConfig();
+ await this.getScreenSetting();
// 2. 获取读者证
const currentReaderCard = await getCurrentReaderCard();
@@ -136,8 +137,8 @@ export default {
/**
* 获取屏幕配置
*/
- async fetchScreenConfig() {
- const res = await FetchInitScreenSetting({ libcode: '1201' });
+ async getScreenSetting() {
+ const res = await FetchInitScreenSetting({ libcode: config.LIB_CODE });
this.screenConfig = {
thirdUrl: res.data.open_lib_http?.context || '',
thirdAppid: res.data.open_lib_appId?.context || '',
diff --git a/pages/login/login.vue b/pages/login/login.vue
index 8f1dc1f..702aebe 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -75,7 +75,7 @@ export default {
methods: {
// 获取微信头像 + 上传到服务器
onChooseAvatar(e) {
- console.log('获取微信头像', e)
+ // console.log('获取微信头像', e)
// 临时文件路径
const tempFilePath = e.detail.avatarUrl;
@@ -88,24 +88,24 @@ export default {
"Content-Type": "multipart/form-data"
},
success: (res) => {
- console.log("上传成功原始返回:", res);
+ // console.log("上传成功原始返回:", res);
let realAvatar = '';
try {
const data = JSON.parse(res.data);
- console.log('解析成功:', data)
+ // console.log('解析成功:', data)
realAvatar = data.data || data.url || '';
} catch (e) {
realAvatar = res.data;
}
if (realAvatar) {
- console.log("永久头像URL:", realAvatar);
+ // console.log("永久头像URL:", realAvatar);
this.avatarUrl = config.baseUrl + '/api/fileRelevant/getImg?imgType=5&imgId=' + realAvatar
} else {
uni.showToast({ title: '头像上传失败', icon: 'none' });
}
},
fail: (err) => {
- console.log("上传失败", err);
+ // console.log("上传失败", err);
uni.showToast({ title: '头像上传失败', icon: 'none' });
}
});
@@ -129,7 +129,7 @@ export default {
async getScreenSetting() {
try {
- const res = await FetchInitScreenSetting({ libcode: '1201' });
+ const res = await FetchInitScreenSetting({ libcode: config.LIB_CODE });
const data = res.data;
this.screenConfig = {
thirdUrl: data.open_lib_http?.context || '',
@@ -200,11 +200,11 @@ export default {
openid: openId,
bindValue: this.queryvalue,
bindType: 'rdid',
- libcode: '1201',
+ libcode: config.LIB_CODE,
}
// 调用绑定接口
const bindRes = await FetchBindReadCard(bindParams);
- console.log('绑定结果', bindRes);
+ // console.log('绑定结果', bindRes);
if(bindRes.code === 200 ){
@@ -214,11 +214,11 @@ export default {
icon: 'success'
});
const data = {
- libcode: '1201',
+ libcode: config.LIB_CODE,
openId: openId
}
FetchFindAllReaderBindByOpenId(data).then(res => {
- console.log('获取读者证列表',res)
+ // console.log('获取读者证列表',res)
if (res.code === 200 && res.data.length > 0) {
uni.setStorageSync(STORAGE_KEYS.READER_CARD_LIST, res.data);
} else {
diff --git a/pages/search/search.vue b/pages/search/search.vue
index f0f98ea..58fc093 100644
--- a/pages/search/search.vue
+++ b/pages/search/search.vue
@@ -78,6 +78,7 @@
import { FetchInitScreenSetting } from '@/api/user';
import { FetchBookSearch } from '@/api/book';
import BookListItem from "@/components/book-list-item/book-list-item.vue";
+import config from '@/utils/config';
export default {
components: { BookListItem },
@@ -135,7 +136,7 @@ export default {
// 获取opacUrl
async getOpacUrl() {
try {
- const res = await FetchInitScreenSetting({ libcode: '1201' });
+ const res = await FetchInitScreenSetting({ libcode: config.LIB_CODE });
this.opacUrl = res.data.opac_url?.context || '';
} catch (err) {
console.error('获取配置失败', err);
@@ -174,7 +175,7 @@ export default {
};
const res = await FetchBookSearch(params);
- console.log('res',res)
+ // console.log('res',res)
// 精准适配你当前返回格式
const apiData = res.data || {};
diff --git a/pages/user/user.vue b/pages/user/user.vue
index 60942c8..4d227e9 100644
--- a/pages/user/user.vue
+++ b/pages/user/user.vue
@@ -82,9 +82,9 @@ export default {
if (openId) {
const res = await FetchFindAllReaderByOpenId({
- libcode: '1201',
- openId: openId
- });
+ libcode: config.LIB_CODE,
+ openId: openId
+ });
if (res.code === 200 && res.data) {
this.userInfo = {
diff --git a/subpkg/pages/book-detail/book-detail.vue b/subpkg/pages/book-detail/book-detail.vue
index cfdf59a..3c1bd7d 100644
--- a/subpkg/pages/book-detail/book-detail.vue
+++ b/subpkg/pages/book-detail/book-detail.vue
@@ -153,7 +153,7 @@ export default {
// 获取配置
async getOpacUrl() {
try {
- const res = await FetchInitScreenSetting({ libcode: '1201' });
+ const res = await FetchInitScreenSetting({ libcode: config.LIB_CODE });
this.opacUrl = res.data.opac_url?.context || '';
this.getBookDetail();
} catch (err) {}
@@ -170,17 +170,17 @@ export default {
bookrecno: this.bookrecno
};
const res = await FetchFindbookByQuery(params);
- console.log('bookrecno详情',res);
+ // console.log('bookrecno详情',res);
const apiData = res.data || {};
this.bookInfo = apiData.biblios || {};
- console.log('bookrecno-bookInfo详情',this.bookInfo);
+ // console.log('bookrecno-bookInfo详情',this.bookInfo);
this.holdingsData = apiData.holdings || [];
- console.log('bookrecno-holdingsData详情',this.holdingsData);
+ // console.log('bookrecno-holdingsData详情',this.holdingsData);
this.checkCollectStatus();
} catch (err) {
- console.log(err);
+ console.error(err);
} finally {
uni.hideLoading();
}
diff --git a/subpkg/pages/book-list/book-list.vue b/subpkg/pages/book-list/book-list.vue
index a6e7529..005a0bd 100644
--- a/subpkg/pages/book-list/book-list.vue
+++ b/subpkg/pages/book-list/book-list.vue
@@ -76,7 +76,7 @@ export default {
async getBookRecommendList() {
this.loading = true;
try {
- const res = await FetchInitScreenBookRecommend({ libcode: '1201' });
+ const res = await FetchInitScreenBookRecommend({ libcode: config.LIB_CODE });
let books = res.data || [];
// 1. 先显示列表(图片为空,显示默认图)
diff --git a/subpkg/pages/feedback/feedback.vue b/subpkg/pages/feedback/feedback.vue
index 3fbb4c5..eb05963 100644
--- a/subpkg/pages/feedback/feedback.vue
+++ b/subpkg/pages/feedback/feedback.vue
@@ -82,7 +82,7 @@ export default {
this.formData.readerCard = readerCard.bindValue || '';
}
} catch (err) {
- console.error('Failed to load reader card info:', err);
+ console.error('获取读者证信息失败:', err);
}
},
diff --git a/subpkg/pages/myLending/myLending.vue b/subpkg/pages/myLending/myLending.vue
index 9b260da..c5fc06f 100644
--- a/subpkg/pages/myLending/myLending.vue
+++ b/subpkg/pages/myLending/myLending.vue
@@ -71,6 +71,7 @@ import { FetchHistoryloan, FetchRdloanlist, FetchCoverByISBN } from '@/api/book'
import myTabs from "@/components/my-tabs/my-tabs.vue";
import lendingListItem from "@/components/lending-list-item/lending-list-item.vue";
import { getCurrentReaderCard } from '@/utils/storage';
+import config from '@/utils/config';
export default {
components: { myTabs, lendingListItem },
@@ -149,7 +150,7 @@ export default {
async getScreenSetting() {
try {
- const res = await FetchInitScreenSetting({ libcode: '1201' });
+ const res = await FetchInitScreenSetting({ libcode: config.LIB_CODE });
const data = res.data;
this.screenConfig = {
thirdUrl: data.open_lib_http?.context || '',
diff --git a/subpkg/pages/ranking/ranking.vue b/subpkg/pages/ranking/ranking.vue
index 39db3e0..fb26f8e 100644
--- a/subpkg/pages/ranking/ranking.vue
+++ b/subpkg/pages/ranking/ranking.vue
@@ -71,6 +71,7 @@