|
|
|
@ -8,19 +8,13 @@ |
|
|
|
<view class="article-detail-author">作者:{{ bookInfo.author || '暂无' }}</view> |
|
|
|
<view class="article-detail-time">出版社:{{ bookInfo.publisher || '暂无' }}</view> |
|
|
|
<view class="article-detail-time">ISBN:{{ bookInfo.isbn || '暂无' }}</view> |
|
|
|
<!-- <view class="article-detail-time">出版时间:{{ bookInfo.publishdate || '暂无' }}</view> --> |
|
|
|
<view class="article-detail-time">出版时间:{{ bookInfo.pubdate || '暂无' }}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="article-detail-right"> |
|
|
|
<!-- <image |
|
|
|
:src="bookInfo.imgPath |
|
|
|
? baseUrl + '/api/fileRelevant/getImg?imgType=2&imgId=' + bookInfo.imgPath |
|
|
|
: bookInfo.cover || '/static/images/default-book.png'" |
|
|
|
mode="widthFix" |
|
|
|
/> --> |
|
|
|
<image |
|
|
|
class="img-item" |
|
|
|
:src="bookInfo.cover || (bookInfo.imgPath ? baseUrl + '/api/fileRelevant/getImg?imgType=2&imgId=' + bookInfo.imgPath : '/static/images/default-book.png')" |
|
|
|
:src="bookInfo.cover || '/static/images/default-book.png'" |
|
|
|
mode="widthFix" |
|
|
|
@error="onImgError" |
|
|
|
></image> |
|
|
|
@ -30,23 +24,22 @@ |
|
|
|
<!-- 馆藏信息 --> |
|
|
|
<view class="book-store-info"> |
|
|
|
<view class="book-store-info-item"> |
|
|
|
<text class="store-txt1">{{ bookInfo.orglib || '暂无' }}</text> |
|
|
|
<text class="store-txt2">所属馆</text> |
|
|
|
<text class="store-txt1">{{ holdingsData.length || 0 }}</text> |
|
|
|
<text class="store-txt2">馆藏总数</text> |
|
|
|
</view> |
|
|
|
<view class="book-store-info-item"> |
|
|
|
<text class="store-txt1">{{ bookInfo.loancount || 0 }}</text> |
|
|
|
<text class="store-txt1">{{ inLibraryCount }}</text> |
|
|
|
<text class="store-txt2">在馆(本)</text> |
|
|
|
</view> |
|
|
|
<!-- 编目=1,在馆=2,借出=3,丢失=4,剔除=5,交换=6,赠送=7,装订=8,锁定=9,预借=10, 清点=12 --> |
|
|
|
<view class="book-store-info-item"> |
|
|
|
<text class="store-txt1">{{ stateText }}</text> |
|
|
|
<text class="store-txt2">馆藏状态</text> |
|
|
|
<text class="store-txt1">{{ lendCount }}</text> |
|
|
|
<text class="store-txt2">借出(本)</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 索书号/条码号 --> |
|
|
|
<view v-if="bookInfo.collection" class="store-info-list"> |
|
|
|
<view class="store-info-item" v-for="(item, index) in bookInfo.collection" :key="index"> |
|
|
|
<view class="store-info-list"> |
|
|
|
<view class="store-info-item" v-for="(item, index) in holdingsData" :key="index"> |
|
|
|
<view> |
|
|
|
<text>索书号</text> |
|
|
|
<text>{{ item.callno || '暂无' }}</text> |
|
|
|
@ -55,6 +48,10 @@ |
|
|
|
<text>条码号</text> |
|
|
|
<text>{{ item.barcode || '暂无' }}</text> |
|
|
|
</view> |
|
|
|
<view> |
|
|
|
<text>馆藏状态</text> |
|
|
|
<text>{{ getStateText(item.state) }}</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
@ -102,41 +99,39 @@ export default { |
|
|
|
isCollected: false, |
|
|
|
bookrecno: '', |
|
|
|
opacUrl: '', |
|
|
|
bookInfo: {} // 图书详情 |
|
|
|
bookInfo: {}, // 图书基础信息(biblios) |
|
|
|
holdingsData: [], // 馆藏列表(holdings) |
|
|
|
}; |
|
|
|
}, |
|
|
|
onLoad(options) { |
|
|
|
// 接收从首页带过来的完整图书数据 |
|
|
|
// 1. 首页/列表页 直接带完整 bookData 过来,优先走这个 |
|
|
|
if (options.bookData) { |
|
|
|
const bookData = JSON.parse(decodeURIComponent(options.bookData)); |
|
|
|
this.bookInfo = bookData; // 直接赋值渲染 |
|
|
|
this.bookInfo = bookData; |
|
|
|
this.bookrecno = bookData.bookrecno || ""; |
|
|
|
// 没有馆藏数据就置空 |
|
|
|
this.holdingsData = []; |
|
|
|
this.checkCollectStatus(); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// 如果是从检索页过来(走bookrecno请求) |
|
|
|
// 2. 检索页只传 bookrecno,请求接口拿详情 |
|
|
|
this.bookrecno = options.bookrecno || ""; |
|
|
|
this.getOpacUrl(); |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
// 馆藏状态转换:数字 → 文字 |
|
|
|
stateText() { |
|
|
|
const state = this.bookInfo.state || 0 |
|
|
|
const map = { |
|
|
|
1: '编目', |
|
|
|
2: '在馆', |
|
|
|
3: '借出', |
|
|
|
4: '丢失', |
|
|
|
5: '剔除', |
|
|
|
6: '交换', |
|
|
|
7: '赠送', |
|
|
|
8: '装订', |
|
|
|
9: '锁定', |
|
|
|
10: '预借', |
|
|
|
12: '清点' |
|
|
|
} |
|
|
|
return map[state] || '未知' |
|
|
|
// 在馆数量 |
|
|
|
inLibraryCount() { |
|
|
|
return this.holdingsData.filter(item => item.state === 2).length; |
|
|
|
}, |
|
|
|
// 借出数量(新增) |
|
|
|
lendCount() { |
|
|
|
return this.holdingsData.filter(item => item.state === 3).length; |
|
|
|
}, |
|
|
|
// 第一个馆藏状态 |
|
|
|
firstStateText() { |
|
|
|
if (this.holdingsData.length === 0) return '无馆藏'; |
|
|
|
return this.getStateText(this.holdingsData[0].state); |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
@ -152,7 +147,7 @@ export default { |
|
|
|
} catch (err) {} |
|
|
|
}, |
|
|
|
|
|
|
|
// 获取图书详情 |
|
|
|
// 获取图书详情(适配新接口结构) |
|
|
|
async getBookDetail() { |
|
|
|
if (!this.bookrecno || !this.opacUrl) return; |
|
|
|
|
|
|
|
@ -164,23 +159,37 @@ export default { |
|
|
|
}; |
|
|
|
const res = await FetchFindbookByQuery(params); |
|
|
|
|
|
|
|
// 解析数据 |
|
|
|
let detail = {}; |
|
|
|
if (typeof res.data === 'string') { |
|
|
|
detail = JSON.parse(res.data); |
|
|
|
} else { |
|
|
|
detail = res.data || {}; |
|
|
|
} |
|
|
|
const apiData = res.data || {}; |
|
|
|
this.bookInfo = apiData.biblios || {}; |
|
|
|
this.holdingsData = apiData.holdings || []; |
|
|
|
|
|
|
|
this.bookInfo = detail; |
|
|
|
this.checkCollectStatus(); |
|
|
|
} catch (err) { |
|
|
|
console.log(err); |
|
|
|
} finally { |
|
|
|
uni.hideLoading(); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 收藏逻辑 |
|
|
|
// 馆藏状态文字 |
|
|
|
getStateText(state) { |
|
|
|
const map = { |
|
|
|
1: '编目', |
|
|
|
2: '在馆', |
|
|
|
3: '借出', |
|
|
|
4: '丢失', |
|
|
|
5: '剔除', |
|
|
|
6: '交换', |
|
|
|
7: '赠送', |
|
|
|
8: '装订', |
|
|
|
9: '锁定', |
|
|
|
10: '预借', |
|
|
|
12: '清点' |
|
|
|
} |
|
|
|
return map[state] || '未知'; |
|
|
|
}, |
|
|
|
|
|
|
|
// 收藏 |
|
|
|
checkCollectStatus() { |
|
|
|
const list = uni.getStorageSync('collectList') || []; |
|
|
|
this.isCollected = list.includes(this.bookrecno); |
|
|
|
@ -217,7 +226,6 @@ export default { |
|
|
|
padding-bottom: 60px; |
|
|
|
} |
|
|
|
|
|
|
|
/* 书籍信息 */ |
|
|
|
.article-detail-container { |
|
|
|
display: flex; |
|
|
|
background-color: #fff; |
|
|
|
@ -251,7 +259,6 @@ export default { |
|
|
|
box-shadow: 0 2px 8px rgba(0,0,0,0.1); |
|
|
|
} |
|
|
|
|
|
|
|
/* 馆藏统计 */ |
|
|
|
.book-store-info { |
|
|
|
background-color: #fff; |
|
|
|
border-radius: 10px; |
|
|
|
@ -276,7 +283,6 @@ export default { |
|
|
|
margin-top: 4px; |
|
|
|
} |
|
|
|
|
|
|
|
/* 索书号 */ |
|
|
|
.store-info-list { |
|
|
|
background-color: #fff; |
|
|
|
border-radius: 10px; |
|
|
|
@ -288,6 +294,7 @@ export default { |
|
|
|
justify-content: space-between; |
|
|
|
font-size: 14px; |
|
|
|
color: #666; |
|
|
|
margin-bottom: 10px; |
|
|
|
} |
|
|
|
.store-info-item view { |
|
|
|
display: flex; |
|
|
|
@ -295,7 +302,6 @@ export default { |
|
|
|
align-items: center; |
|
|
|
} |
|
|
|
|
|
|
|
/* TAB */ |
|
|
|
.content-tab { |
|
|
|
display: flex; |
|
|
|
background-color: #fff; |
|
|
|
@ -327,7 +333,6 @@ export default { |
|
|
|
border-radius: 2px; |
|
|
|
} |
|
|
|
|
|
|
|
/* 内容区域 */ |
|
|
|
.content-item { |
|
|
|
background-color: #fff; |
|
|
|
border-radius: 10px; |
|
|
|
|