|
|
@ -101,7 +101,7 @@ |
|
|
|
<div class="database-right"> |
|
|
|
<h3 class="database-title">热门搜索</h3> |
|
|
|
<div class="tagcloud-main"> |
|
|
|
<div id="tagscloud" ref="tagcloudall" class="tagscloud"> |
|
|
|
<div v-if="tagList.length !== 0" id="tagscloud" ref="tagcloudall" class="tagscloud"> |
|
|
|
<!-- <a v-for="(item,index) in hotTagData" :key="index" :class="'tagc' + ((index % 4) + 1)"> |
|
|
|
{{ item }} |
|
|
|
</a> --> |
|
|
@ -160,7 +160,7 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { FetchInitSetting, FetchUsertotal, FetchLibBookTotal, FetchHotSearch, FetchFansCount, FetchLendingTotal, FetchNewBook } from '@/api/library' |
|
|
|
import { FetchInitSetting, FetchUsertotal, FetchLibBookTotal, FetchHotSearch, FetchFansCount, FetchLendingTotal, FetchNewBook, FetchMarcByISBN } from '@/api/library' |
|
|
|
export default { |
|
|
|
name: 'PageOne', |
|
|
|
data() { |
|
|
@ -250,8 +250,18 @@ export default { |
|
|
|
beforeDestroy() { |
|
|
|
clearInterval(this.intervalLeft) |
|
|
|
this.intervalLeft = null |
|
|
|
}, |
|
|
|
activated() { |
|
|
|
this.pageOneVisitBase = 0 |
|
|
|
this.getInitData() |
|
|
|
}, |
|
|
|
deactivated() { |
|
|
|
|
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
if (localStorage.getItem('wecharQrCodeSrc')) { |
|
|
|
this.wecharQrCodeSrc = localStorage.getItem('wecharQrCodeSrc') |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
getInitData() { |
|
|
@ -272,18 +282,6 @@ export default { |
|
|
|
initLeftPreview(result) { |
|
|
|
this.progressData = [] |
|
|
|
this.leftData = [] |
|
|
|
// 本年到馆/12个月=月基数 |
|
|
|
// 月基数/当月天数(28、29、30、31)= 日基数 |
|
|
|
// 昨日到馆=日基数+日随机数(-20到50之间) |
|
|
|
// 上月到馆=月基数+月随机数(-100到200之间) |
|
|
|
// 图书馆营业时间(8:00-18:00共10小时) |
|
|
|
// 8:00-9:00 算第1个小时、9:00-10:00算第2个小时、以此类推 |
|
|
|
// 日基数/10小时=小时基数 |
|
|
|
// 今日到馆=小时基数 * 第N小时+小时随机数(-5到10之间) |
|
|
|
// 本月到馆=月基数 * (当前月的日期dd/当前月的天数)+ 月随机数(-100到200之间) |
|
|
|
// 本年累计=月基数*月份+月随机数(-100到200之间) |
|
|
|
|
|
|
|
// 昨日到馆、上月到馆存一个缓存!当前第一次计算好之后就不变了! |
|
|
|
|
|
|
|
// visitBase 本年累计人次 |
|
|
|
// visitBaseCheck 是否直接显示 0false 1true |
|
|
@ -304,19 +302,29 @@ export default { |
|
|
|
|
|
|
|
const baseTotal = this.pageOneVisitBase // 本年到馆人数 |
|
|
|
console.log('假设本年到馆人数', baseTotal) |
|
|
|
|
|
|
|
// 本年到馆/12个月 = 月基数 |
|
|
|
const monthBase = Math.floor(baseTotal / 12) // 月基数 |
|
|
|
console.log('月基数', monthBase) |
|
|
|
// 月随机数(-100到200之间) |
|
|
|
const randomMonth = Math.floor(Math.random() * (200 - (-100) + 1)) + (-100) |
|
|
|
|
|
|
|
const now = new Date() |
|
|
|
const year = now.getFullYear() // 当前年份 |
|
|
|
const month = now.getMonth() + 1 // 当前月份 |
|
|
|
const daysInMonth = new Date(year, month, 0).getDate() // 当月天数 |
|
|
|
console.log('当月天数', daysInMonth) |
|
|
|
|
|
|
|
const dayBase = Math.floor(baseTotal / daysInMonth) // 日基数 |
|
|
|
// 月基数/当月天数(28、29、30、31)= 日基数 |
|
|
|
const dayBase = Math.floor(monthBase / daysInMonth) // 日基数 |
|
|
|
console.log('日基数', dayBase) |
|
|
|
|
|
|
|
// 本年累计=月基数*月份+月随机数(-100到200之间) |
|
|
|
let nowYearCount |
|
|
|
if (result.visitBaseCheck === '1') { |
|
|
|
nowYearCount = result.visitBase |
|
|
|
} else { |
|
|
|
nowYearCount = Math.floor(monthBase * month + randomMonth) // 本年累计 |
|
|
|
} |
|
|
|
console.log('本年累计', nowYearCount) |
|
|
|
// 昨日到馆=日基数+日随机数(-20到50之间) |
|
|
|
let yesterdayCount = 0 |
|
|
|
if (result.yesterdayVisitBaseCheck === '1') { |
|
|
|
yesterdayCount = result.yesterdayVisitBase |
|
|
@ -325,8 +333,7 @@ export default { |
|
|
|
yesterdayCount = localStorage.getItem('yesterdayCountCache') ? localStorage.getItem('yesterdayCountCache') : dayBase + randomDay // 昨日到馆 |
|
|
|
} |
|
|
|
console.log('昨日到馆', yesterdayCount) |
|
|
|
|
|
|
|
const randomMonth = Math.floor(Math.random() * (200 - (-100) + 1)) + (-100) // 月随机数(-100到200之间) |
|
|
|
// 上月到馆=月基数+月随机数(-100到200之间) |
|
|
|
let lastMonthCount = 0 |
|
|
|
if (result.lastMonthVisitBaseCheck === '1') { |
|
|
|
lastMonthCount = result.lastMonthVisitBase |
|
|
@ -335,18 +342,23 @@ export default { |
|
|
|
} |
|
|
|
console.log('上月到馆', lastMonthCount) |
|
|
|
|
|
|
|
// 日基数/10小时=小时基数 |
|
|
|
const hourBase = Math.floor(dayBase / 10) // 小时基数 |
|
|
|
console.log('小时基数', hourBase) |
|
|
|
|
|
|
|
// 图书馆营业时间(8:00-18:00共10小时) |
|
|
|
// 8:00-9:00 算第1个小时、9:00-10:00算第2个小时、以此类推 |
|
|
|
const openTime = 8 // 开门时间 |
|
|
|
const closeTime = 18 // 结束时间 |
|
|
|
const currentHour = now.getHours() // 当前时间点 |
|
|
|
|
|
|
|
// 今日到馆=小时基数 * 第N小时+小时随机数(-5到10之间) |
|
|
|
let todayCount = 0 |
|
|
|
if (result.todayVisitBaseCheck === '1') { |
|
|
|
todayCount = result.todayVisitBase |
|
|
|
} else { |
|
|
|
if (currentHour < openTime || currentHour >= closeTime) { |
|
|
|
console.log('当前时间不在图书馆营业时间内') |
|
|
|
todayCount = 0 |
|
|
|
} else { |
|
|
|
const N = currentHour - openTime |
|
|
|
console.log('第N个小时', N) |
|
|
@ -355,7 +367,7 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
console.log('今日到馆', todayCount) |
|
|
|
|
|
|
|
// 本月到馆=月基数 * (当前月的日期dd/当前月的天数)+ 月随机数(-100到200之间) |
|
|
|
let nowMonthCount = 0 |
|
|
|
if (result.thisMonthVisitBaseCheck === '1') { |
|
|
|
nowMonthCount = result.thisMonthVisitBase |
|
|
@ -364,9 +376,6 @@ export default { |
|
|
|
} |
|
|
|
console.log('本月到馆', nowMonthCount) |
|
|
|
|
|
|
|
const nowYearCount = Math.floor(monthBase * month + randomMonth) // 本年累计 |
|
|
|
console.log('本年累计', nowYearCount) |
|
|
|
|
|
|
|
this.progressData.push( |
|
|
|
{ |
|
|
|
name: '今日到馆', |
|
|
@ -405,6 +414,7 @@ export default { |
|
|
|
|
|
|
|
this.$parent.timedRefresh(this.leftData, 'left') |
|
|
|
|
|
|
|
// 昨日到馆、上月到馆存一个缓存!当前第一次计算好之后就不变了! |
|
|
|
localStorage.setItem('yesterdayCountCache', yesterdayCount) |
|
|
|
localStorage.setItem('lastMonthCountCache', lastMonthCount) |
|
|
|
}, |
|
|
@ -543,41 +553,38 @@ export default { |
|
|
|
FetchNewBook(params).then(res => { |
|
|
|
// 图片地址格式 http://192.168.99.67:8080/downloadFile/qytsg/ae281b90-b100-4541-9379-3e104854652c.png |
|
|
|
const linkSrc = process.env.VUE_APP_BASE_API |
|
|
|
|
|
|
|
// res.data.push({ |
|
|
|
// 'nbName': '222', |
|
|
|
// 'nbRecno': '', |
|
|
|
// 'isbn': '9787545559804', |
|
|
|
// 'nbImgPath': '', |
|
|
|
// 'nbExplain': '', |
|
|
|
// 'nbAuthor': '', |
|
|
|
// 'updateTime': '2024-07-05T05:22:33.307+0000', |
|
|
|
// 'updater': 'f8ccafbb791cb89e017968aae4470000', |
|
|
|
// 'rownum': 1, |
|
|
|
// 'nbBooktype': '', |
|
|
|
// 'nbPublisher': '', |
|
|
|
// 'libcode': 'FTZN', |
|
|
|
// 'sortmark': '', |
|
|
|
// 'createTime': '2024-07-05T05:22:33.307+0000', |
|
|
|
// 'creater': 'f8ccafbb791cb89e017968aae4470000', |
|
|
|
// 'nbId': '4028e3c39080e175019081581b1c008f', |
|
|
|
// 'nbPublisherdate': '' |
|
|
|
// }) |
|
|
|
|
|
|
|
this.newList = res.data.filter((item) => { |
|
|
|
this.newList = res.data.map(item => { |
|
|
|
if (item.nbImgPath) { |
|
|
|
item.nbImgPath = linkSrc + '/downloadFile' + item.nbImgPath |
|
|
|
return true |
|
|
|
return Promise.resolve(item) |
|
|
|
} else { |
|
|
|
const params = { |
|
|
|
'sIsbn': item.isbn |
|
|
|
} |
|
|
|
return FetchMarcByISBN(params).then(response => { |
|
|
|
const result = JSON.parse(response.data)[0] |
|
|
|
if (result.srcurl) { |
|
|
|
item.nbImgPath = result.srcurl |
|
|
|
return item |
|
|
|
} else if (result.img) { |
|
|
|
item.nbImgPath = 'data:image/png;base64,' + result.img |
|
|
|
return item |
|
|
|
} else { |
|
|
|
// '没有nbImgPath/srcurl/base64,去掉这项数据 |
|
|
|
return false |
|
|
|
return null // 或者根据需求返回其他值或处理 |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
Promise.all(this.newList).then(results => { |
|
|
|
// 过滤掉返回的空项(根据实际需求) |
|
|
|
this.newList = results.filter(item => item !== null) |
|
|
|
// 一分为二得两行 |
|
|
|
const halfLength = Math.ceil(this.newList.length / 2) |
|
|
|
this.listData1 = this.newList.slice(0, halfLength) |
|
|
|
this.listData2 = this.newList.slice(halfLength) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
getType1Value() { |
|
|
|
const type1Item = this.progressData.find(item => item.type === 1) |
|
|
@ -784,29 +791,31 @@ export default { |
|
|
|
text-wrap: nowrap; |
|
|
|
} |
|
|
|
#tagscloud a.tagc1{ |
|
|
|
border: 1px solid #30ADA6; |
|
|
|
background-color: #106B66; |
|
|
|
color: #51EAE2; |
|
|
|
// border: 1px solid #30ADA6; |
|
|
|
// background-color: #106B66; |
|
|
|
// color: #51EAE2; |
|
|
|
color: #F4C263; |
|
|
|
} |
|
|
|
|
|
|
|
#tagscloud a.tagc2{ |
|
|
|
font-size: 16px; |
|
|
|
border: 1px solid #3A64BE; |
|
|
|
background: rgba(16,45,107,0.7); |
|
|
|
font-size: 22px; |
|
|
|
// border: 1px solid #3A64BE; |
|
|
|
// background: rgba(16,45,107,0.7); |
|
|
|
color: #7EA7FF; |
|
|
|
} |
|
|
|
|
|
|
|
#tagscloud a.tagc3{ |
|
|
|
font-size: 22px; |
|
|
|
border: 1px solid #9439B6; |
|
|
|
background: rgba(74,18,95,0.8); |
|
|
|
color: #CD63F4; |
|
|
|
font-size: 18px; |
|
|
|
// border: 1px solid #9439B6; |
|
|
|
// background: rgba(74,18,95,0.8); |
|
|
|
// color: #CD63F4; |
|
|
|
color: #7EA7FF; |
|
|
|
} |
|
|
|
|
|
|
|
#tagscloud a.tagc4{ |
|
|
|
font-size: 26px; |
|
|
|
border: 1px solid #C2943C; |
|
|
|
background: rgba(107,76,16,0.7); |
|
|
|
// border: 1px solid #C2943C; |
|
|
|
// background: rgba(107,76,16,0.7); |
|
|
|
color: #F4C263; |
|
|
|
} |
|
|
|
|
|
|
|