|
|
|
@ -227,7 +227,7 @@ export default { |
|
|
|
localStorage.removeItem('lastMonthCountCache') |
|
|
|
} |
|
|
|
// this.getInitData() |
|
|
|
this.getMiddleAllData() |
|
|
|
// this.getMiddleAllData() |
|
|
|
this.getHotSearch() |
|
|
|
this.getNewBook() |
|
|
|
}, |
|
|
|
@ -238,17 +238,54 @@ export default { |
|
|
|
activated() { |
|
|
|
this.pageOneVisitBase = 0 |
|
|
|
this.getInitData() |
|
|
|
this.getMiddleAllData() |
|
|
|
}, |
|
|
|
deactivated() { |
|
|
|
clearInterval(this.intervalLeft) |
|
|
|
this.intervalLeft = null |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
// this.getTest() |
|
|
|
if (localStorage.getItem('wecharQrCodeSrc')) { |
|
|
|
this.wecharQrCodeSrc = localStorage.getItem('wecharQrCodeSrc') |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// getTest() { |
|
|
|
// const resData = { |
|
|
|
// 'errCode': 0, |
|
|
|
// 'errMsg': 'ok', |
|
|
|
// 'data': '{"success":true,"resultlist":[{"JCC_YEAR":0,"HRC_MONTH":0,"HCC_MONTH":0,"HCC":11,"JCC":0,"JRC_DAY":0,"JRC_YEAR":0,"HRC_YEAR":1,"BZL_MONTH":0,"JRC_MONTH":0,"HCC_DAY":0,"BZL":2,"HRC":1,"JCC_DAY":0,"JRC":0,"BZL_YEAR":1,"HCC_YEAR":11,"BZL_DAY":0,"HRC_DAY":0,"JCC_MONTH":0,"LIBCODE":"999"},{"JCC_YEAR":21822,"HRC_MONTH":296,"HCC_MONTH":770,"HCC":98972,"JCC":123736,"JRC_DAY":2,"JRC_YEAR":2837,"HRC_YEAR":2167,"BZL_MONTH":158,"JRC_MONTH":409,"HCC_DAY":0,"BZL":9814,"HRC":30813,"JCC_DAY":3,"JRC":39642,"BZL_YEAR":929,"HCC_YEAR":20298,"BZL_DAY":0,"HRC_DAY":0,"JCC_MONTH":1085,"LIBCODE":"GD"},{"JCC_YEAR":195,"HRC_MONTH":25,"HCC_MONTH":46,"HCC":106,"JCC":195,"JRC_DAY":1,"JRC_YEAR":102,"HRC_YEAR":62,"BZL_MONTH":0,"JRC_MONTH":38,"HCC_DAY":77,"BZL":2,"HRC":62,"JCC_DAY":9,"JRC":102,"BZL_YEAR":2,"HCC_YEAR":106,"BZL_DAY":0,"HRC_DAY":1,"JCC_MONTH":81,"LIBCODE":"DWSF"},{"JCC_YEAR":92,"HRC_MONTH":12,"HCC_MONTH":18,"HCC":65,"JCC":92,"JRC_DAY":0,"JRC_YEAR":46,"HRC_YEAR":36,"BZL_MONTH":0,"JRC_MONTH":19,"HCC_DAY":0,"BZL":0,"HRC":36,"JCC_DAY":0,"JRC":46,"BZL_YEAR":0,"HCC_YEAR":65,"BZL_DAY":0,"HRC_DAY":0,"JCC_MONTH":37,"LIBCODE":"ZJWSF"}]}' |
|
|
|
// } |
|
|
|
// const result = JSON.parse(resData.data) |
|
|
|
// console.log('【解析后的完整结果】', result) |
|
|
|
|
|
|
|
// if (result.success & result.resultlist.length !== 0) { |
|
|
|
// const filterData = result.resultlist.filter(item => item.LIBCODE === 'DWSF') |
|
|
|
// console.log('【过滤出 DWSF 的数据】', filterData) |
|
|
|
|
|
|
|
// // 4. 累加 JCC_DAY 并打印累加过程 借 |
|
|
|
// const total = filterData.reduce((acc, obj) => { |
|
|
|
// console.log(`【累加过程】当前累计值:${acc} + 当前项 JCC_DAY:${obj.JCC_DAY} = ${acc + obj.JCC_DAY}`) |
|
|
|
// return acc + obj.JCC_DAY |
|
|
|
// }, 0) |
|
|
|
|
|
|
|
// // 还 |
|
|
|
// const totalH = filterData.reduce((acc, obj) => { |
|
|
|
// console.log(`【累加过程】当前累计值:${acc} + 当前项 JCC_DAY:${obj.HCC_DAY} = ${acc + obj.HCC_DAY}`) |
|
|
|
// return acc + obj.HCC_DAY |
|
|
|
// }, 0) |
|
|
|
|
|
|
|
// // 5. 打印最终结果 |
|
|
|
// console.log('借', total) |
|
|
|
// console.log('还', totalH) |
|
|
|
|
|
|
|
// return total |
|
|
|
// } else { |
|
|
|
// console.log('【执行结果】数据获取失败或无结果,返回 0') |
|
|
|
// return 0 |
|
|
|
// } |
|
|
|
// }, |
|
|
|
getInitData() { |
|
|
|
// visitBase 本年到馆基础数 |
|
|
|
// wecharQrCode 二维码 用/downloadFile/+wecharQrCode |
|
|
|
@ -496,12 +533,13 @@ export default { |
|
|
|
}) |
|
|
|
}, |
|
|
|
getMiddleAllData() { |
|
|
|
this.middleData = [] |
|
|
|
Promise.all([ |
|
|
|
this.getLibBookTotal(), |
|
|
|
this.getUserTotal(), |
|
|
|
this.getFansNum(), |
|
|
|
this.getLendingTotal() |
|
|
|
]).then(([libBookTotal, userCardNum, fansNum, lendingTotal]) => { |
|
|
|
this.getLendingData() |
|
|
|
]).then(([libBookTotal, userCardNum, lendingData]) => { |
|
|
|
const { fansNum, lendingTotal } = lendingData |
|
|
|
this.middleData.push( |
|
|
|
{ |
|
|
|
id: 'totalBook', |
|
|
|
@ -529,11 +567,8 @@ export default { |
|
|
|
} |
|
|
|
) |
|
|
|
this.$parent.timedRefresh(this.middleData, 'middle') |
|
|
|
// setTimeout(() => { |
|
|
|
// this.$parent.timedRefresh(this.middleData, 'middle') |
|
|
|
// }, 8000) |
|
|
|
}).catch(error => { |
|
|
|
console.error('Error:', error) |
|
|
|
console.error('获取中间数据失败:', error) |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 馆藏量 |
|
|
|
@ -588,6 +623,22 @@ export default { |
|
|
|
return 0 |
|
|
|
}) |
|
|
|
}, |
|
|
|
getLendingData() { |
|
|
|
return FetchLendingTotal().then(res => { |
|
|
|
const result = JSON.parse(res.data) |
|
|
|
const dwsfData = result.success && result.resultlist.length |
|
|
|
? result.resultlist.filter(item => item.LIBCODE === 'DWSF') |
|
|
|
: [] |
|
|
|
// 归还 |
|
|
|
const fansNum = dwsfData.reduce((acc, obj) => acc + obj.HCC_DAY, 0) |
|
|
|
// 借出 |
|
|
|
const lendingTotal = dwsfData.reduce((acc, obj) => acc + obj.JCC_DAY, 0) |
|
|
|
return { fansNum, lendingTotal } |
|
|
|
}).catch(error => { |
|
|
|
console.error('获取借阅数据失败:', error) |
|
|
|
return { fansNum: 0, lendingTotal: 0 } |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 粉丝数量 |
|
|
|
// getFansNum() { |
|
|
|
// return FetchFansCount().then(res => { |
|
|
|
@ -597,34 +648,34 @@ export default { |
|
|
|
// return 0 |
|
|
|
// }) |
|
|
|
// }, |
|
|
|
// 累计借出 |
|
|
|
getFansNum() { |
|
|
|
return FetchLendingTotal().then(res => { |
|
|
|
const result = JSON.parse(res.data) |
|
|
|
if (result.success & result.resultlist.length !== 0) { |
|
|
|
return result.resultlist.filter(item => item.LIBCODE === 'DWSF').reduce((acc, obj) => acc + obj.HCC_DAY, 0) |
|
|
|
} else { |
|
|
|
return 0 |
|
|
|
} |
|
|
|
}).catch(error => { |
|
|
|
console.error('Error', error) |
|
|
|
return 0 |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 累计借出 |
|
|
|
getLendingTotal() { |
|
|
|
return FetchLendingTotal().then(res => { |
|
|
|
const result = JSON.parse(res.data) |
|
|
|
if (result.success & result.resultlist.length !== 0) { |
|
|
|
return result.resultlist.filter(item => item.LIBCODE === 'DWSF').reduce((acc, obj) => acc + obj.JCC_DAY, 0) |
|
|
|
} else { |
|
|
|
return 0 |
|
|
|
} |
|
|
|
}).catch(error => { |
|
|
|
console.error('Error', error) |
|
|
|
return 0 |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 今日归还 |
|
|
|
// getFansNum() { |
|
|
|
// return FetchLendingTotal().then(res => { |
|
|
|
// const result = JSON.parse(res.data) |
|
|
|
// if (result.success && result.resultlist.length !== 0) { |
|
|
|
// return result.resultlist.filter(item => item.LIBCODE === 'DWSF').reduce((acc, obj) => acc + obj.HCC_DAY, 0) |
|
|
|
// } else { |
|
|
|
// return 0 |
|
|
|
// } |
|
|
|
// }).catch(error => { |
|
|
|
// console.error('Error', error) |
|
|
|
// return 0 |
|
|
|
// }) |
|
|
|
// }, |
|
|
|
// 今日借出 |
|
|
|
// getLendingTotal() { |
|
|
|
// return FetchLendingTotal().then(res => { |
|
|
|
// const result = JSON.parse(res.data) |
|
|
|
// if (result.success && result.resultlist.length !== 0) { |
|
|
|
// return result.resultlist.filter(item => item.LIBCODE === 'DWSF').reduce((acc, obj) => acc + obj.JCC_DAY, 0) |
|
|
|
// } else { |
|
|
|
// return 0 |
|
|
|
// } |
|
|
|
// }).catch(error => { |
|
|
|
// console.error('Error', error) |
|
|
|
// return 0 |
|
|
|
// }) |
|
|
|
// }, |
|
|
|
// bottom - 图书推荐 |
|
|
|
getNewBook() { |
|
|
|
const params = { |
|
|
|
|