Browse Source

0520提交

master
xuhuajiao 1 month ago
parent
commit
e5bef8e59d
  1. 2
      .env.development
  2. 123
      src/views/pageOne/index.vue

2
.env.development

@ -3,7 +3,7 @@ ENV = 'development'
# 接口地址
# 许镇-本地服地址
VUE_APP_BASE_API = 'http://192.168.99.72:8080'
VUE_APP_BASE_API = 'http://192.168.99.63:8080'
# VUE_APP_BASE_API = 'http://27.19.209.92:13244'
VUE_APP_LIB_API = 'http://118.253.150.248:8099'

123
src/views/pageOne/index.vue

@ -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 = {

Loading…
Cancel
Save