Browse Source

完整联调数据修改样式

master
xuhuajiao 2 years ago
parent
commit
3908c8cf32
  1. 32
      src/api/library.js
  2. 127
      src/assets/json/lib.json
  3. 23
      src/assets/json/lib2.json
  4. 6
      src/assets/styles/index.scss
  5. 19
      src/components/echart/barEcharts.vue
  6. 262
      src/components/echart/lineChart.vue
  7. 259
      src/components/echart/lineChartService.vue
  8. 2
      src/components/echart/todayCircle.vue
  9. 0
      src/components/echart/yearCircle.vue
  10. 1
      src/views/header/index.vue
  11. 46
      src/views/index.vue
  12. 117
      src/views/map/index.vue
  13. 637
      src/views/map/index2.vue
  14. 109
      src/views/pageFour/index.vue
  15. 289
      src/views/pageFour/module/video.vue
  16. 266
      src/views/pageOne/index.vue
  17. 121
      src/views/pageThree/index.vue

32
src/api/library.js

@ -1,15 +1,6 @@
import request from '@/utils/request'
import qs from 'qs'
// 获取token
export function FetchInitToken(params) {
return request({
url: '/openlib/service/barcode/token' + '?' + qs.stringify(params, { indices: false }),
method: 'get',
urlType: 'interlib'
})
}
// 馆藏量
export function FetchLibBookTotal(params) {
return request({
@ -118,8 +109,25 @@ export function FetchTotalResource(params) {
})
}
// 获取当日每小时借还信息
export function FetchTodayJH(params) {
return request({
url: '/qyzt/getTodayJH' + '?' + qs.stringify(params, { indices: false }),
method: 'get',
urlType: 'local'
})
}
// 获取一周内借还信息
export function FetchWeekJH(params) {
return request({
url: '/qyzt/getWeekJH' + '?' + qs.stringify(params, { indices: false }),
method: 'get',
urlType: 'local'
})
}
export default {
FetchInitToken,
FetchLibBookTotal,
FetchUsertotal,
FetchFansCount,
@ -131,5 +139,7 @@ export default {
FetchLibcodeDetails,
FetchNoticeList,
FetchSync36,
FetchTotalResource
FetchTotalResource,
FetchTodayJH,
FetchWeekJH
}

127
src/assets/json/lib.json

@ -1,108 +1,23 @@
[
{
"name": "陶铸图书馆",
"value": [111.848657, 26.588519],
"place": "祁阳县茅竹镇"
},
{
"name": "龙山街道分馆",
"value": [111.86478,26.599231],
"place": "祁阳县茅竹镇"
},
{
"name": "黎家坪分馆",
"value": [111.823424,26.693962],
"place": "祁阳县茅竹镇"
},
{
"name": "大村甸分馆",
"value": [111.77655,26.663866],
"place": "祁阳县茅竹镇"
},
{
"name": "邵家岭自助馆",
"value": [111.856979,26.59469],
"place": "祁阳县茅竹镇"
},
{
"name": "下马渡分馆",
"value": [111.895584,26.611702],
"place": "祁阳县茅竹镇"
},
{
"name": "复兴路自助馆",
"value": [111.843102,26.57896],
"place": "祁阳县茅竹镇"
},
{
"name": "七里桥分馆",
"value": [111.902703,26.571593],
"place": "祁阳县茅竹镇"
},
{
"name": "少儿馆",
"value": [111.842537,26.58196],
"place": "祁阳县茅竹镇"
},
{
"name": "茅竹镇分馆",
"value": [111.796508,26.510589],
"place": "祁阳县茅竹镇"
},
{
"name": "观音滩镇分馆",
"value": [111.897118,26.48444],
"place": "祁阳县茅竹镇"
},
{
"name": "凯俊盛科城分馆",
"value": [111.851548,26.550191],
"place": "祁阳县茅竹镇"
},
{
"name": "进宝塘镇分馆",
"value": [112.085297,26.436849],
"place": "祁阳县茅竹镇"
},
{
"name": "三口塘镇分馆",
"value": [111.819018,26.412155],
"place": "祁阳县茅竹镇"
},
{
"name": "肖家镇分馆",
"value": [112.009764,26.355137],
"place": "祁阳县茅竹镇"
},
{
"name": "潘市镇分馆",
"value": [112.051186,26.489878],
"place": "祁阳县茅竹镇"
},
{
"name": "大忠桥镇分馆",
"value": [111.873254,26.369761],
"place": "祁阳县茅竹镇"
},
{
"name": "浯溪街道分馆",
"value": [111.855175,26.574414],
"place": "祁阳县茅竹镇"
},
{
"name": "长虹街道分馆",
"value": [111.850902,26.586461],
"place": "长虹街道"
},
{
"name": "白水镇分馆",
"value": [111.989802,26.421353],
"place": "白水镇"
},
{
"name": "白竹湖自助馆",
"value": [111.862001,26.580311],
"place": "白竹湖"
"陶铸图书馆":[111.848657, 26.588519],
"龙山街道分馆":[111.86478,26.599231],
"黎家坪分馆": [111.823424,26.693962],
"大村甸分馆": [111.77655,26.663866],
"邵家岭自助馆":[111.856979,26.59469],
"下马渡分馆":[111.895584,26.611702],
"复兴路自助馆":[111.843102,26.57896],
"七里桥分馆": [111.902703,26.571593],
"少儿馆":[111.842537,26.58196],
"茅竹镇分馆":[111.796508,26.510589],
"观音滩镇分馆":[111.897118,26.48444],
"凯俊盛科城分馆":[111.851548,26.550191],
"进宝塘镇分馆":[112.085297,26.436849],
"三口塘镇分馆":[111.819018,26.412155],
"肖家镇分馆":[112.009764,26.355137],
"潘市镇分馆": [112.051186,26.489878],
"大忠桥镇分馆":[111.873254,26.369761],
"浯溪街道分馆":[111.855175,26.574414],
"长虹街道分馆":[111.850902,26.586461],
"白水镇分馆": [111.989802,26.421353],
"白竹湖自助馆":[111.862001,26.580311]
}
]

23
src/assets/json/lib2.json

@ -1,23 +0,0 @@
{
"陶铸图书馆":[111.848657, 26.588519],
"龙山街道分馆":[111.86478,26.599231],
"黎家坪分馆": [111.823424,26.693962],
"大村甸分馆": [111.77655,26.663866],
"邵家岭自助馆":[111.856979,26.59469],
"下马渡分馆":[111.895584,26.611702],
"复兴路自助馆":[111.843102,26.57896],
"七里桥分馆": [111.902703,26.571593],
"少儿馆":[111.842537,26.58196],
"茅竹镇分馆":[111.796508,26.510589],
"观音滩镇分馆":[111.897118,26.48444],
"凯俊盛科城分馆":[111.851548,26.550191],
"进宝塘镇分馆":[112.085297,26.436849],
"三口塘镇分馆":[111.819018,26.412155],
"肖家镇分馆":[112.009764,26.355137],
"潘市镇分馆": [112.051186,26.489878],
"大忠桥镇分馆":[111.873254,26.369761],
"浯溪街道分馆":[111.855175,26.574414],
"长虹街道分馆":[111.850902,26.586461],
"白水镇分馆": [111.989802,26.421353],
"白竹湖自助馆":[111.862001,26.580311]
}

6
src/assets/styles/index.scss

@ -737,7 +737,8 @@
background: url('~@/assets/images/database-icon1.png') no-repeat left top;
background-size: 100% 100%;
}
.currentNum{
.currentNum,
.lastYearTotal{
width: 48%;
height: 1.1rem;
padding-left: 1.125rem;
@ -933,6 +934,7 @@
overflow: hidden;
img{
display: block;
padding: .125rem;
width: 100%;
}
}
@ -1492,7 +1494,7 @@
}
}
.scroll-animation {
animation: myMove 15s linear infinite;
animation: myMove 16s linear infinite;
animation-fill-mode: forwards;
}

19
src/components/echart/barEcharts.vue

@ -11,7 +11,7 @@ export default {
name: 'BarEcharts',
mixins: [resize],
props: {
storageData: {
chartWeeklyData: {
type: Object,
require: true,
default: function() {
@ -34,7 +34,7 @@ export default {
}
},
watch: {
'storageData': {
'chartWeeklyData': {
handler(val) {
setTimeout(() => {
this.drawChart()
@ -247,14 +247,21 @@ export default {
}],
yAxis: [{
min: 0,
max: 100,
interval: 25,
max: function(value) {
return Math.ceil(value.max + (value.max - value.min) * 0.2)
},
minInterval: 1,
type: 'value',
axisLine: { // 线
show: false
},
axisLabel: { //
show: true,
interval: 'auto',
formatter: function(value) {
// 使formatter使
return Math.round(value)
},
textStyle: {
color: '#79B8FF',
fontSize: 16,
@ -281,7 +288,7 @@ export default {
emphasis: {
focus: 'series'
},
data: this.storageData.outStorageData,
data: this.chartWeeklyData.outchartWeeklyData,
color: '#41A3FF'
},
{
@ -292,7 +299,7 @@ export default {
emphasis: {
focus: 'series'
},
data: this.storageData.inStorageData,
data: this.chartWeeklyData.inchartWeeklyData,
color: '#F9BE1D'
}
]

262
src/components/echart/lineChart.vue

@ -1,16 +1,15 @@
<template>
<div id="main" :style="{height:height,width:width}" />
<div id="main2" :style="{height:height,width:width}" />
</template>
<script>
import echarts from 'echarts'
import resize from '@/utils/resizeMixins.js'
export default {
name: 'AcrossEcharts',
name: 'LineEcharts',
mixins: [resize],
props: {
chartData: {
chartDayData: {
type: Object,
require: true,
default: function() {
@ -28,138 +27,235 @@ export default {
},
data() {
return {
chart: null
chart: null,
option: null
}
},
watch: {
'chartData': {
chartDayData: {
deep: true,
mmediate: true,
handler(val) {
setTimeout(() => {
this.drawChart()
this.setOptions(val)
}, 100)
},
immediate: true,
deep: true
}
}
},
mounted() {
this.drawChart()
window.addEventListener('resize', this.__resizeHandler)
this.$nextTick(() => {
this.initChart()
})
this.resetPiechartDayData()
},
beforeDestroy() {
if (!this.chart) {
return
}
this.chart.dispose()
this.chart = null
},
methods: {
drawChart() {
const chartDom = document.getElementById('main')
this.chart = echarts.init(chartDom)
let option = null
option = {
grid: { //
left: '2%',
right: '2%',
bottom: '5%',
top: '8%',
containLabel: true
resetPiechartDayData() {
clearInterval(this.timeRePie)
this.timeRePie = setInterval(() => {
// debugger;
if (!this.chart) {
return
}
// chart
this.chart.clear()
this.initChart()
}, 8000)
},
initChart() {
const dom = document.getElementById('main2')
this.chart = echarts.init(dom, 'dark')
this.setOptions(this.chartDayData)
},
setOptions({ timeData, returnData, borrowedData } = {}) {
this.chart.setOption({
backgroundColor: '#01103D',
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#339cff'
backgroundColor: '#6a7985'
}
}
},
xAxis: {
type: 'category',
data: this.chartData.totalLendMonth,
axisLine: { // 线
lineStyle: {
color: 'rgba(17, 61, 114,0.5)'
legend: {
top: '4%',
right: '4%',
icon: 'rect',
itemHeight: 6,
itemWidth: 11,
textStyle: {
color: '#339CFF',
fontSize: 18
},
data: [
{
name: '借出',
icon: 'rect',
textStyle: {
color: '#41A3FF',
fontFamily: 'DingTalk_JinBuTi_Regular'
}
},
axisTick: { show: false },
axisLabel: { // x
show: true,
{
name: '归还',
icon: 'rect',
textStyle: {
color: '#fff'
color: '#FFD050',
fontFamily: 'DingTalk_JinBuTi_Regular'
}
}
]
},
grid: {
left: '2%',
right: '4%',
bottom: '4%',
containLabel: true
},
xAxis: [{
type: 'category',
data: timeData,
axisLabel: {
show: true,
formatter: function(value, idx) {
return value
},
color: '#79B8FF',
fontSize: 16,
fontFamily: 'DingTalk_JinBuTi_Regular'
},
yAxis: {
type: 'value',
min: 5000,
max: 25000,
splitNumber: 5,
axisLine: {
show: false,
lineStyle: {
width: '1',
color: '#113D72',
type: 'solid'
}
},
axisTick: {
show: false
},
axisLabel: { // x
show: true,
splitLine: {
show: false,
lineStyle: {
color: '#333'
}
},
boundaryGap: false
}],
yAxis: [
{
type: 'value',
//
max: function(value) {
return Math.ceil(value.max + (value.max - value.min) * 0.2)
},
min: 0,
axisLabel: {
interval: 'auto',
formatter: function(value) {
// 使formatter使
return Math.round(value)
},
textStyle: {
color: '#fff'
color: '#79B8FF',
fontSize: 16,
fontFamily: 'DingTalk_JinBuTi_Regular'
}
},
axisTick: { // 线
// 线
axisLine: {
show: false,
lineStyle: {
color: '#113D72',
width: '1',
type: 'solid'
}
},
//
axisTick: {
show: false
},
splitLine: { // 线
// 线
splitLine: {
show: true,
lineStyle: {
color: 'rgba(17, 61, 114,0.5)',
type: 'solid'
color: 'rgba(66, 139, 221, 0.2)',
type: 'solid',
//
opacity: 1,
width: 1
}
}
},
}
],
series: [
{
name: '借阅量',
data: this.chartData.totalLendData,
name: '归还',
type: 'line',
areaStyle: {
normal: {
color: {
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0.1,
color: 'rgba(26, 201, 255, 0.5)' // 0%
stack: 'Total',
lineStyle: {
width: 3,
color: '#FFD14F'
},
{
offset: 0.5,
color: 'rgba(26, 201, 255, 0.3)' // 0%
showSymbol: false,
itemStyle: {
color: '#FFD14F'
},
areaStyle: {
opacity: 0.6,
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0.7,
color: 'rgba(26, 201, 255, 0.2)' // 0%
offset: 0,
color: 'rgba(24, 176, 143, 0)'
},
{
offset: 0.9,
color: 'rgba(26, 201, 255, 0.1)' // 100%
}
]
}
offset: 1,
color: '#FFD14F'
}
])
},
data: returnData
},
{
name: '借出',
type: 'line',
stack: 'Total',
itemStyle: {
normal: {
color: '#339CFF', // 线
color: '#41A3FF'
},
lineStyle: {
color: 'rgba(26, 201, 255,0.5)' // 线
}
}
width: 3,
color: '#41A3FF'
},
showSymbol: false,
areaStyle: {
opacity: 0.6,
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: 'rgba(254, 128, 66, 0)'
},
{
offset: 1,
color: '#41A3FF'
}
])
},
data: borrowedData
}
]
}
option && this.chart.setOption(option)
})
}
}
}
</script>
<style lang="scss" scoped>
.h{
color: rgb(26, 201, 255);
}
</style>

259
src/components/echart/lineChartService.vue

@ -1,259 +0,0 @@
<template>
<div id="main2" :style="{height:height,width:width}" />
</template>
<script>
import echarts from 'echarts'
import resize from '@/utils/resizeMixins.js'
export default {
name: 'LineEcharts',
mixins: [resize],
props: {
chartData: {
type: Object,
require: true,
default: function() {
return {}
}
},
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '100%'
}
},
data() {
return {
chart: null,
option: null
}
},
watch: {
chartData: {
deep: true,
mmediate: true,
handler(val) {
setTimeout(() => {
this.setOptions(val)
}, 100)
}
}
},
mounted() {
this.$nextTick(() => {
this.initChart()
})
this.resetPieChartData()
},
beforeDestroy() {
if (!this.chart) {
return
}
this.chart.dispose()
this.chart = null
},
methods: {
//
resetPieChartData() {
clearInterval(this.timeRePie)
this.timeRePie = setInterval(() => {
// debugger;
if (!this.chart) {
return
}
// chart
this.chart.clear()
this.initChart()
}, 8000)
},
initChart() {
const dom = document.getElementById('main2')
this.chart = echarts.init(dom, 'dark')
this.setOptions(this.chartData)
},
setOptions({ returnData, borrowedData } = {}) {
const time = ['08:00', '10:00', '12:00', '14:00', '16:00', '18:00']
this.chart.setOption({
backgroundColor: '#01103D',
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#6a7985'
}
}
},
legend: {
top: '4%',
right: '4%',
icon: 'rect',
itemHeight: 6,
itemWidth: 11,
textStyle: {
color: '#339CFF',
fontSize: 18
},
data: [
{
name: '借出',
icon: 'rect',
textStyle: {
color: '#41A3FF',
fontFamily: 'DingTalk_JinBuTi_Regular'
}
},
{
name: '归还',
icon: 'rect',
textStyle: {
color: '#FFD050',
fontFamily: 'DingTalk_JinBuTi_Regular'
}
}
]
},
grid: {
left: '2%',
right: '4%',
bottom: '4%',
containLabel: true
},
xAxis: [{
type: 'category',
data: time.map(function(item) {
return item
}),
axisLabel: {
show: true,
formatter: function(value, idx) {
return value
},
color: '#79B8FF',
fontSize: 16,
fontFamily: 'DingTalk_JinBuTi_Regular'
},
axisLine: {
show: false,
lineStyle: {
width: '1',
color: '#113D72',
type: 'solid'
}
},
axisTick: {
show: false
},
splitLine: {
show: false,
lineStyle: {
color: '#333'
}
},
boundaryGap: false
}],
yAxis: [
{
type: 'value',
//
max: 1000,
min: 0,
interval: 250,
axisLabel: {
textStyle: {
color: '#79B8FF',
fontSize: 16,
fontFamily: 'DingTalk_JinBuTi_Regular'
}
},
// 线
axisLine: {
show: false,
lineStyle: {
color: '#113D72',
width: '1',
type: 'solid'
}
},
//
axisTick: {
show: false
},
// 线
splitLine: {
show: true,
lineStyle: {
color: 'rgba(66, 139, 221, 0.2)',
type: 'solid',
//
opacity: 1,
width: 1
}
}
}
],
series: [
{
name: '归还',
type: 'line',
stack: 'Total',
lineStyle: {
width: 3,
color: '#FFD14F'
},
showSymbol: false,
itemStyle: {
color: '#FFD14F'
},
areaStyle: {
opacity: 0.6,
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: 'rgba(24, 176, 143, 0)'
},
{
offset: 1,
color: '#FFD14F'
}
])
},
data: returnData
},
{
name: '借出',
type: 'line',
stack: 'Total',
itemStyle: {
color: '#41A3FF'
},
lineStyle: {
width: 3,
color: '#41A3FF'
},
showSymbol: false,
areaStyle: {
opacity: 0.6,
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: 'rgba(254, 128, 66, 0)'
},
{
offset: 1,
color: '#41A3FF'
}
])
},
data: borrowedData
}
]
})
}
}
}
</script>

2
src/views/pageThree/module/todayCircle.vue → src/components/echart/todayCircle.vue

@ -86,7 +86,7 @@ export default {
const count = arrCount(optionData)
if (optionData) {
const flag = optionData?.find(item => name === item.name)
if (flag) return [`{name|${name}}`, `{num|${((flag.value / count).toFixed(2)) * 100 + '%'}}`]
if (flag) return [`{name|${name}}`, `{num|${((flag.value / count * 100).toFixed(0)) + '%'}}`]
} else return name
},
textStyle: {

0
src/views/pageThree/module/yearCircle.vue → src/components/echart/yearCircle.vue

1
src/views/header/index.vue

@ -72,5 +72,4 @@ export default {
<style lang="scss">
@import "~@/assets/styles/index.scss";
// @import "~@/assets/styles/ball-running-animate.css";
</style>

46
src/views/index.vue

@ -3,23 +3,18 @@
<div v-if="isLoading" class="loading">
<dv-loading>Loading...</dv-loading>
</div>
<!-- Header -->
<Header :header-title="headerTitle" />
<div class="header-page">{{ (currentIndex+1) +' / '+ pageData.length }}</div>
<keep-alive>
<!-- 内容部分 -->
<!-- <keep-alive>
<PageOne v-if="currentIndex === 0" ref="pageOneRefs" />
</keep-alive>
<PageTwo v-if="currentIndex === 1" />
<PageThree v-if="currentIndex=== 2" />
<PageFour v-if="currentIndex === 3" />
<!-- <section>
<keep-alive v-if="shouldCacheComponent">
<component :is="currentPage && currentPage.title === 'PageOne' ? 'PageOne' : null" />
</keep-alive>
<component :is="currentPageComponent" v-else />
</section> -->
<!-- <component :is="currentPage && currentPage.title" /> -->
<PageFour v-if="currentIndex === 3" /> -->
<component :is="currentPage && currentPage.title" />
<!-- bottom -->
<div class="bottom-bg">
<div class="bottom-content">
<div class="dot-container left-dots">
@ -38,7 +33,7 @@
</template>
<script>
import { FetchInitToken, FetchInitSetting } from '@/api/library'
import { FetchInitSetting } from '@/api/library'
import Header from '@/views/header/index.vue'
import PageOne from '@/views/pageOne/index.vue'
import PageTwo from '@/views/map/index.vue'
@ -55,16 +50,16 @@ export default {
},
data() {
return {
currentIndex: 1, //
currentIndex: 0, //
currentPage: null, //
isLoading: false,
height: '',
headerTitle: '祁阳陶铸图书馆智慧大屏馆情数据总览',
pageData: [
{ id: 1, title: 'PageOne', delayed: 10, isShow: false },
{ id: 2, title: 'PageTwo', delayed: 10, isShow: false },
{ id: 3, title: 'PageThree', delayed: 10, isShow: false },
{ id: 4, title: 'PageFour', delayed: 10, isShow: false }
{ id: 1, title: 'PageOne', delayed: 20, isShow: false },
{ id: 2, title: 'PageTwo', delayed: 20, isShow: false },
{ id: 3, title: 'PageThree', delayed: 20, isShow: false },
{ id: 4, title: 'PageFour', delayed: 20, isShow: false }
],
swiperOption: null,
loadingTtimer: null,
@ -95,7 +90,6 @@ export default {
}
},
created() {
// this.getToken()
// const METAWA = require('../assets/js/META.common.min.js')
// const meta = new METAWA('665e845538d68')
// meta.callback = (r) => {
@ -104,7 +98,6 @@ export default {
this.getInitSetting()
},
beforeDestroy() {
clearInterval(this.timer2)
this.stopAutoSwitch()
clearInterval(this.timer2)
clearInterval(this.leftTimer)
@ -122,15 +115,6 @@ export default {
this.showLoading()
},
methods: {
getToken() {
const params = {
'appid': 'whfeitian',
'secret': '1f4unqcgg9j0pvx54cwvillch5xto9e5'
}
FetchInitToken(params).then(res => {
console.log(res)
})
},
startPageSwitch() {
const delay = parseInt(this.pageData[this.currentIndex].delayed) * 1000
this.intervalId = setInterval(() => {
@ -149,7 +133,6 @@ export default {
const linkSrc = process.env.VUE_APP_BASE_API
FetchInitSetting().then(res => {
const result = JSON.parse(res.data)
console.log(result)
this.wecharQrCodeSrc = linkSrc + '/downloadFile' + result.wecharQrCode
localStorage.setItem('wecharQrCodeSrc', this.wecharQrCodeSrc)
@ -167,10 +150,10 @@ export default {
}
return updatedPage
} else {
console.warn(`ID 为 ${id} 的页面未找到。`)
console.log(`ID 为 ${id} 的页面未找到。`)
return null
}
}).filter(item => item !== null) //
}).filter(item => item !== null)
this.pageData = updatedPageData
if (this.pageData) {
@ -181,6 +164,7 @@ export default {
},
stopAutoSwitch() {
clearInterval(this.intervalId)
this.intervalId = null
},
goToNextPage() {
this.currentPage = (this.currentPage + 1) % 4

117
src/views/map/index.vue

@ -1,6 +1,7 @@
<template>
<div class="map-wrapper">
<div class="map-content">
<!-- 左边图书馆基本信息 -->
<div class="lib-info">
<div class="database-title">{{ libCurrent && libCurrent.name }}</div>
<div class="lib-content">
@ -25,7 +26,7 @@
<img src="@/assets/images/map_20.png" alt="">
<p>
<span>办证量</span>
<span>{{ libCurrent && libCurrent.readerIdNum }}<i></i></span>
<span>{{ libCurrent && (libCurrent.countCard ? libCurrent.countCard : libCurrent.readerIdNum) }}<i></i></span>
</p>
</li>
</ul>
@ -43,11 +44,13 @@
</div>
</div>
</div>
<div ref="chart" style="width: calc(100% - 11.875rem); height: 100%; margin:0 .125rem; z-index: 9999;" />
<!-- map -->
<div ref="chart" style="width: 960px; height: 924px; margin:0 .125rem; z-index: 999;" />
<div class="map-hx-bg">
<div class="map-hx-small" />
<div class="map-hx-big" />
</div>
<!-- 右边排行榜 -->
<div class="read-num">
<div class="database-title">读者统计</div>
<div class="online">
@ -81,9 +84,9 @@
</template>
<script>
import { FetchLibBookTotal, FetchLibcodeDetails, FetchReadRanking, FetchLendingTotal } from '@/api/library'
import { FetchLibBookTotal, FetchUsertotal, FetchLibcodeDetails, FetchReadRanking, FetchLendingTotal } from '@/api/library'
import mapJson from '@/assets/json/qy.json'
import libJson from '@/assets/json/lib2.json'
import libJson from '@/assets/json/lib.json'
import { debounce } from 'lodash' // js,
import { swiper, swiperSlide } from 'vue-awesome-swiper'
import 'swiper/dist/css/swiper.css'
@ -114,6 +117,7 @@ export default {
cardTotal: 0,
rankingData: [],
rankingWithPercentage: [],
rankInterval: null,
timer: null,
position: 0,
speed: 2 //
@ -125,9 +129,17 @@ export default {
}
},
beforeDestroy() {
clearTimeout(this.timeTicket)
window.removeEventListener('resize', this.resize)
this.stopScrolling()
clearTimeout(this.timeTicket)
clearInterval(this.rankInterval)
clearInterval(this.timer)
localStorage.setItem('libIndexItem', this.libIndex)
localStorage.setItem('libCurrentItem', this.libCurrent)
localStorage.setItem('countItem', this.count)
this.rankInterval = null
this.timer = null
this.timeTicket = null
},
created() {
this.getLibBookTotal()
@ -135,7 +147,6 @@ export default {
this.getLendingTotal()
},
mounted() {
},
methods: {
startScrolling() {
@ -151,30 +162,22 @@ export default {
}
}, 40)
},
stopScrolling() {
if (this.timer) {
clearInterval(this.timer)
localStorage.setItem('libIndexItem', this.libIndex)
localStorage.setItem('libCurrentItem', this.libCurrent)
localStorage.setItem('countItem', this.count)
}
},
getReadRanking() {
const params = {
'libcode': 'QYTSG,SJLFG,FXLFG,SEDSG,BZHFG',
'starttime': this.getFormattedDate(new Date(), -1),
'endtime': this.getFormattedDate(new Date()),
'rownum': 10,
'nordtype': 0
'nordtype': 'QYTSG_E'
}
FetchReadRanking(params).then(res => {
const result = JSON.parse(res.data)
console.log(result.resultlist)
if (result.success && result.resultlist.length > 0) {
this.rankingData = result.resultlist
this.rankingData = result.resultlist.sort((a, b) => b.TOTALNUM - a.TOTALNUM).slice(0, 10)
this.rankingDataComputed()
setInterval(() => {
this.rankInterval = setInterval(() => {
this.currentHover = (this.currentHover + 1) % this.rankingData.length
}, 1000)
} else {
@ -219,8 +222,8 @@ export default {
getLibBookTotal() {
const params = {
'libcode': 'LSJDFG,LJPFG,DCDFG,QYTSG,SJLFG,XMDFG,FXLFG,QLQFG,SEDSG,MZZFG,GYTZFG,KJSKCFG,JBTZFG,SKTZFG,XJZFG,PSZFG,DZQZFG,WXJDFG,CHJDFG,BSZFG,BZHFG',
'starttime': this.getFormattedDate(new Date(), -1),
'endtime': this.getFormattedDate(new Date())
'starttime': '2000-01-01',
'endtime': '2034-01-01'
}
FetchLibBookTotal(params).then(res => {
const result = JSON.parse(res.data)
@ -231,18 +234,65 @@ export default {
this.libALLNum = []
}
this.getUserTotal()
.then(userTotals => {
// console.log('userTotals', userTotals)
userTotals.forEach(userTotal => {
const libCode = Object.keys(userTotal)[0]
const count = userTotal[libCode]
const foundItem = this.libALLNum.find(item => item.LIBCODE === libCode)
if (foundItem) {
foundItem.countCard = count
}
})
this.getLibcodeDetails()
})
.catch(error => {
console.error('Error', error)
this.getLibcodeDetails()
})
}).catch(error => {
console.error('Error', error)
this.libALLNum = []
this.getLibcodeDetails()
})
},
//
getTotalForLibcode(libcode) {
const params = {
'libcode': libcode,
'startdate': '2000-01-01',
'enddate': '2034-01-01',
'isrdtype': 0
}
return FetchUsertotal(params).then(res => {
const result = JSON.parse(res.data)
if (result.success && result.pagedata.length > 0) {
return { [libcode]: result.pagedata[0].count }
} else {
throw new Error('Failed' + libcode)
}
}).catch(error => {
console.error('Error' + libcode, error)
return { [libcode]: 0 }
})
},
getUserTotal() {
const libraries = ['QYTSG', 'SJLFG', 'FXLFG', 'SEDSG', 'BZHFG']
const getTotalPromises = libraries.map(libcode => this.getTotalForLibcode(libcode))
return Promise.all(getTotalPromises)
.then(results => {
return results
})
.catch(error => {
console.error('Error', error)
return 0
})
},
//
getLibcodeDetails() {
FetchLibcodeDetails().then(res => {
const result = JSON.parse(res.data)
console.log('result', result)
if (result.length !== 0) {
const libCode = {
'QYTSG': [111.848657, 26.588519],
@ -267,6 +317,7 @@ export default {
'BSZFG': [111.989802, 26.421353],
'BZHFG': [111.862001, 26.580311]
}
// console.log('this.libALLNum', this.libALLNum)
const updatedLibraries = result.map(library => {
const matchingData = this.libALLNum.find(item => item.LIBCODE === library.tcId)
if (matchingData) {
@ -274,21 +325,22 @@ export default {
...library,
GCL: matchingData.GCL,
sort: Object.keys(libCode).indexOf(library.tcId) + 1,
coordinate: libCode[library.tcId]
coordinate: libCode[library.tcId],
countCard: matchingData.countCard ? matchingData.countCard : 0
}
} else {
return {
...library,
GCL: 0,
sort: Object.keys(libCode).indexOf(library.tcId) + 1,
coordinate: libCode[library.tcId]
coordinate: libCode[library.tcId],
countCard: 0
}
}
}).sort((a, b) => a.sort - b.sort)
this.libInfoData = updatedLibraries
console.log(updatedLibraries)
// console.log('this.libInfoData', this.libInfoData)
if (localStorage.getItem('countItem')) {
this.count = parseInt(localStorage.getItem('countItem'))
} else {
@ -319,7 +371,6 @@ export default {
var mapImg = document.createElement('img')
mapImg.style.height = mapImg.height = mapImg.width = mapImg.style.width = '1px'
mapImg.src = require('../../assets/images/map-bg2.png')
console.log('this.libInfoData', this.libInfoData)
var XAData = this.libInfoData.map(item => {
return [
{ name: '陶铸图书馆' },
@ -347,7 +398,6 @@ export default {
[
['陶铸图书馆', XAData]
].forEach(function(item, i) {
console.log('item', item[1])
series.push(
{
name: item[0],
@ -382,7 +432,6 @@ export default {
show: true
},
data: item[1].map(function(dataItem) {
console.log('dataItem', dataItem)
return {
name: dataItem[1].name,
value: dataItem[1].name ? libJson[dataItem[1].name].concat([dataItem[1].value]) : '',
@ -720,7 +769,6 @@ export default {
// }
this.len = this.seriesData[0].data.length //
console.log('this.len', this.seriesData[0].data)
// this.myChart.setOption(updateOption)
this.libIndex = this.count % this.len
this.libCurrent = this.libInfoData[this.libIndex]
@ -783,14 +831,7 @@ export default {
if (item.filePath) {
item.cover = linkSrc + '/downloadFile' + item.filePath
} else {
// http://8.130.135.212:19000/MarcByIsbn?sIsbn=9787545559804
// axios.get('http://8.130.135.212:19000/MarcByIsbn?sIsbn=' + item.isbn)
// .then(response => {
// console.log(response)
// })
// .catch(error => {
// console.error('There was an error!', error)
// })
item.cover = ''
}
return item
})

637
src/views/map/index2.vue

@ -1,637 +0,0 @@
<template>
<div style="position: relative;">
<!-- <Header :header-title="headerTitle" /> -->
<div style="display: flex; justify-content: center; align-items: center; width: 100%; height:calc(100vh - 1.125rem); border: 1px solid red; overflow: hidden;">
<div style="width:6.21rem; height:8.61rem; position: relative; overflow: hidden;">
<!-- <svg-icon icon-class="map" style="width: 100%; height: 100%; " /> -->
<img class="map_img" src="@/assets/images/map.png" alt="">
<div class="place-point">
<div v-for="(item,index) in libInfoData" v-show="libIndex===index" :key="index" :class="['point'+ parseInt(index+1)]" style="position: absolute">
<p style="font-size: .14rem; ">{{ item.name }}</p>
<span class="iconfont icon-weizhi" />
<div class="pulse" />
</div>
</div>
</div>
</div>
<div class="lib-info">
<div class="lib-title">{{ libCurrent && libCurrent.name }}</div>
图片切换{{ currentIndex+1 }}
<swiper v-if="swiperOption" :key="swiperKey" ref="mySwiper" class="swiperLib" :options="swiperOption">
<swiper-slide v-for="(item,index) in displayedImages" :key="index">
<div class="book-img" style="width: 100%; height: 3rem;">
<img :src="item.cover" :onerror="defaultImg" style="width: 100%;">
</div>
</swiper-slide>
<!-- 标页码 -->
<div slot="pagination" class="swiper-pagination" />
</swiper>
<div class="lib-content">
<span>藏书量4787</span>
<span>办证量74</span>
<span>占地面积40平方米</span>
<p>关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知</p>
</div>
</div>
<div class="read-num">
<div class="lib-title">{{ libCurrent && libCurrent.name }}</div>
<h6>读者数量</h6>
<h6>借阅TOP10</h6>
</div>
</div>
</template>
<script>
import { swiper, swiperSlide } from 'vue-awesome-swiper'
import 'swiper/dist/css/swiper.css'
export default {
components: {
swiper,
swiperSlide
},
data() {
return {
isPage2: false,
defaultImg: 'this.src="' + require('@/assets/images/default-img.png') + '"',
timeTicket: null,
headerTitle: '祁阳图书馆',
libInfoData: [
{ 'id': '1', 'name': '龙山街道分管' }, { 'id': '2', 'name': '黎家坪分馆' }, { 'id': '3', 'name': '大村甸分馆' }, { 'id': '4', 'name': '陶铸图书馆' }, { 'id': '5', 'name': '邵家岭自助馆' }, { 'id': '6', 'name': '下马渡分馆' }, { 'id': '7', 'name': '复兴路自助馆' }, { 'id': '8', 'name': '七里桥分馆' }, { 'id': '9', 'name': '少儿馆' }, { 'id': '10', 'name': '茅竹镇分馆' }, { 'id': '11', 'name': '观音滩镇分馆' },
{ 'id': '12', 'name': '凯俊盛科城分馆' }, { 'id': '13', 'name': '进宝塘镇分馆' }, { 'id': '14', 'name': '三口塘镇分馆' }, { 'id': '15', 'name': '肖家镇分馆' }, { 'id': '16', 'name': '潘市镇分馆' }, { 'id': '17', 'name': '大忠桥镇分馆' }, { 'id': '18', 'name': '浯溪街道分馆' }, { 'id': '19', 'name': '长虹街道分馆' }, { 'id': '20', 'name': '白水镇分馆' }, { 'id': '21', 'name': '白竹湖自助馆' }
],
libImg: [
{
'id': 1,
'cover': require('../../assets/images/lib.jpg')
},
{
'id': 2,
'cover': require('../../assets/images/lib2.jpg')
},
{
'id': 3,
'cover': require('../../assets/images/lib3.jpg')
},
{
'id': 4,
'cover': require('../../assets/images/lib4.jpg')
},
{
'id': 5,
'cover': require('../../assets/images/lib5.jpg')
}
],
libIndex: 0,
libCurrent: null,
swiperKey: 1,
currentIndex: 0,
displayedImages: [],
swiperOption: null
}
},
computed: {
swiper() {
return this.$refs.mySwiper.swiper
}
},
beforeDestroy() {
clearTimeout(this.timeTicket)
},
mounted() {
// this.libCurrent = this.libInfoData[this.libIndex]
this.init()
},
methods: {
updatePageWithData() {
console.log('update')
console.log('_self.isPage22222', this.isPage2)
if (!this.isPage2) {
return false
}
//
const displayCountOptions = [1, 2, 3, 5]
const displayCount = displayCountOptions[Math.floor(Math.random() * displayCountOptions.length)]
// libImg
const shuffledLibImg = this.libImg.slice().sort(() => Math.random() - 0.5) //
this.displayedImages = shuffledLibImg.slice(0, displayCount)
this.currentIndex = 0
this.swiperKey += 1
console.log(this.displayedImages)
if (this.displayedImages.length === 1) {
setTimeout(() => {
this.libIndex++
this.libCurrent = this.libInfoData[this.libIndex]
this.updatePageWithData()
}, 3000)
}
},
init() {
const _self = this
this.swiperOption = {
// loop: true,
// initialSlide: 0,
notNextTick: false, // notNextTicknotNextTicktrueNextTickswiperswiper使swipertrue
// slidesPerView: 3, //
// spaceBetween: 30, //
// slidesPerGroup: 1, //
//
noSwiping: true,
observer: true, //
direction: 'horizontal', // vertical
// grabCursor: true, //
// setWrapperSize: true,
// autoHeight: true,
// centeredSlides: true,
// paginationClickable: true,
// keyboard: true, //
// mousewheelControl: true, //
autoplay: {
delay: 3000, // ms
stopOnLastSlide: false, // slide
disableOnInteraction: false // swiperautoplay
// reverseDirection: false, //
// waitForTransition: true, //slide
},
//
pagination: {
el: '.swiper-pagination',
type: 'progressbar'
// progressbarOpposite: true,
// clickable: true //
},
on: {
slideChangeTransitionEnd() {
if (_self.isPage2) {
_self.$refs.mySwiper.swiper.update()
_self.$refs.mySwiper.swiper.autoplay.start()
} else {
_self.$refs.mySwiper.swiper.autoplay.stop()
}
console.log(' this.activeIndex', this.activeIndex)
console.log('_self.libIndex', _self.libIndex)
_self.currentIndex = this.activeIndex
if (_self.currentIndex === _self.displayedImages.length - 1) {
setTimeout(() => {
if (_self.libIndex === _self.libInfoData.length - 1) {
_self.libIndex = 0
} else {
_self.libIndex++
}
_self.libCurrent = _self.libInfoData[_self.libIndex]
_self.updatePageWithData()
_self.currentIndex = 0
}, 3000)
}
}
}
}
}
}
}
</script>
<style lang="scss">
@import "~@/assets/styles/index.scss";
.map_img{
display: block;
width: 100%;
height: 100%;
margin: 0 auto;
}
.place-point{
position: relative;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
.iconfont{
font-size: .3rem;
color: yellow;
}
.bouncePoint{
-webkit-animation-name: bounce;
-moz-animation-name: bounce;
-o-animation-name: bounce;
-ms-animation-name: bounce;
animation-name: bounce;
-webkit-animation-fill-mode: both;
-moz-animation-fill-mode: both;
-o-animation-fill-mode: both;
-ms-animation-fill-mode: both;
animation-fill-mode: both;
-webkit-animation-duration: 1s;
-moz-animation-duration: 1s;
-o-animation-duration: 1s;
-ms-animation-duration: 1s;
animation-duration: 1s;
}
.point1{
left: 10px;
top: 40px;
}
.point2{
left: 90px;
top: 80px;
}
.point3{
left: 133px;
top: 138px;
}
.point4{
left: 127px;
top: 206px;
}
.point5{
left: 171px;
top: 277px;
}
.point6{
left: 176px;
top: 370px;
}
.point7{
left: 297px;
top: 424px;
}
.point8{
left: 264px;
top: 485px;
}
.point9{
left: 374px;
top: 624px;
}
.point10{
right: 49px;
bottom: 133px;
}
.point11{
right: 86px;
bottom: 251px;
}
.point12{
right: 66px;
bottom: 304px;
}
.point13{
right: 16px;
top: 254px;
}
.point14{
right: 124px;
top: 220px;
}
.point15{
right: 124px;
top: 174px;
}
.point16{
right: 169px;
top: 264px;
}
.point17{
right: 239px;
top: 170px;
}
.point18{
right: 229px;
top: 120px;
}
.point19{
right: 280px;
top: 80px;
}
.point20{
right: 289px;
top:40px;
}
.point21{
right: 380px;
top:10px;
}
}
.lib-info{
position: absolute;
left: 1rem;
top: 2rem;
width: 400px;
border: 1px solid #fff;
.lib-content{
font-size: .2rem;
}
}
.lib-title{
line-height: .45rem;
text-align: center;
}
.read-num{
position: absolute;
right: 1rem;
top: 2rem;
width: 200px;
height: 600px;
border: 1px solid #fff;
}
.pulse {
background: rgba(0,0,0,0.2);
border-radius: 50%;
height: 14px;
width: 14px;
margin: -9px 0 0 5px;
-webkit-transform: rotateX(55deg);
-moz-transform: rotateX(55deg);
-o-transform: rotateX(55deg);
-ms-transform: rotateX(55deg);
transform: rotateX(55deg);
z-index: -2;
}
.pulse:after {
content: "";
border-radius: 50%;
height: 40px;
width: 40px;
position: absolute;
margin: -13px 0 0 -13px;
-webkit-animation: pulsate 1s ease-out;
-moz-animation: pulsate 1s ease-out;
-o-animation: pulsate 1s ease-out;
-ms-animation: pulsate 1s ease-out;
animation: pulsate 1s ease-out;
-webkit-animation-iteration-count: infinite;
-moz-animation-iteration-count: infinite;
-o-animation-iteration-count: infinite;
-ms-animation-iteration-count: infinite;
animation-iteration-count: infinite;
opacity: 0;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
-webkit-box-shadow: 0 0 1px 2px #89849b;
box-shadow: 0 0 1px 2px #89849b;
-webkit-animation-delay: 1.1s;
-moz-animation-delay: 1.1s;
-o-animation-delay: 1.1s;
-ms-animation-delay: 1.1s;
animation-delay: 1.1s;
}
@-moz-keyframes pulsate {
0% {
-webkit-transform: scale(0.1, 0.1);
-moz-transform: scale(0.1, 0.1);
-o-transform: scale(0.1, 0.1);
-ms-transform: scale(0.1, 0.1);
transform: scale(0.1, 0.1);
opacity: 0;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
}
50% {
opacity: 1;
-ms-filter: none;
filter: none;
}
100% {
-webkit-transform: scale(1.2, 1.2);
-moz-transform: scale(1.2, 1.2);
-o-transform: scale(1.2, 1.2);
-ms-transform: scale(1.2, 1.2);
transform: scale(1.2, 1.2);
opacity: 0;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
}
}
@-webkit-keyframes pulsate {
0% {
-webkit-transform: scale(0.1, 0.1);
-moz-transform: scale(0.1, 0.1);
-o-transform: scale(0.1, 0.1);
-ms-transform: scale(0.1, 0.1);
transform: scale(0.1, 0.1);
opacity: 0;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
}
50% {
opacity: 1;
-ms-filter: none;
filter: none;
}
100% {
-webkit-transform: scale(1.2, 1.2);
-moz-transform: scale(1.2, 1.2);
-o-transform: scale(1.2, 1.2);
-ms-transform: scale(1.2, 1.2);
transform: scale(1.2, 1.2);
opacity: 0;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
}
}
@-o-keyframes pulsate {
0% {
-webkit-transform: scale(0.1, 0.1);
-moz-transform: scale(0.1, 0.1);
-o-transform: scale(0.1, 0.1);
-ms-transform: scale(0.1, 0.1);
transform: scale(0.1, 0.1);
opacity: 0;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
}
50% {
opacity: 1;
-ms-filter: none;
filter: none;
}
100% {
-webkit-transform: scale(1.2, 1.2);
-moz-transform: scale(1.2, 1.2);
-o-transform: scale(1.2, 1.2);
-ms-transform: scale(1.2, 1.2);
transform: scale(1.2, 1.2);
opacity: 0;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
}
}
@keyframes pulsate {
0% {
-webkit-transform: scale(0.1, 0.1);
-moz-transform: scale(0.1, 0.1);
-o-transform: scale(0.1, 0.1);
-ms-transform: scale(0.1, 0.1);
transform: scale(0.1, 0.1);
opacity: 0;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
}
50% {
opacity: 1;
-ms-filter: none;
filter: none;
}
100% {
-webkit-transform: scale(1.2, 1.2);
-moz-transform: scale(1.2, 1.2);
-o-transform: scale(1.2, 1.2);
-ms-transform: scale(1.2, 1.2);
transform: scale(1.2, 1.2);
opacity: 0;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
}
}
@-moz-keyframes bounce {
0% {
opacity: 0;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
-webkit-transform: translateY(-2000px) rotate(0);
-moz-transform: translateY(-2000px) rotate(0);
-o-transform: translateY(-2000px) rotate(0);
-ms-transform: translateY(-2000px) rotate(0);
transform: translateY(-2000px) rotate(0);
}
60% {
opacity: 1;
-ms-filter: none;
filter: none;
-webkit-transform: translateY(30px) rotate(0);
-moz-transform: translateY(30px) rotate(0);
-o-transform: translateY(30px) rotate(0);
-ms-transform: translateY(30px) rotate(0);
transform: translateY(30px) rotate(0);
}
80% {
-webkit-transform: translateY(-10px) rotate(0);
-moz-transform: translateY(-10px) rotate(0);
-o-transform: translateY(-10px) rotate(0);
-ms-transform: translateY(-10px) rotate(0);
transform: translateY(-10px) rotate(0);
}
100% {
-webkit-transform: translateY(0) rotate(0);
-moz-transform: translateY(0) rotate(0);
-o-transform: translateY(0) rotate(0);
-ms-transform: translateY(0) rotate(0);
transform: translateY(0) rotate(0);
}
}
@-webkit-keyframes bounce {
0% {
opacity: 0;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
-webkit-transform: translateY(-2000px) rotate(0);
-moz-transform: translateY(-2000px) rotate(0);
-o-transform: translateY(-2000px) rotate(0);
-ms-transform: translateY(-2000px) rotate(0);
transform: translateY(-2000px) rotate(0);
}
60% {
opacity: 1;
-ms-filter: none;
filter: none;
-webkit-transform: translateY(30px) rotate(0);
-moz-transform: translateY(30px) rotate(0);
-o-transform: translateY(30px) rotate(0);
-ms-transform: translateY(30px) rotate(0);
transform: translateY(30px) rotate(0);
}
80% {
-webkit-transform: translateY(-10px) rotate(0);
-moz-transform: translateY(-10px) rotate(0);
-o-transform: translateY(-10px) rotate(0);
-ms-transform: translateY(-10px) rotate(0);
transform: translateY(-10px) rotate(0);
}
100% {
-webkit-transform: translateY(0) rotate(0);
-moz-transform: translateY(0) rotate(0);
-o-transform: translateY(0) rotate(0);
-ms-transform: translateY(0) rotate(0);
transform: translateY(0) rotate(0);
}
}
@-o-keyframes bounce {
0% {
opacity: 0;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
-webkit-transform: translateY(-2000px) rotate(0);
-moz-transform: translateY(-2000px) rotate(0);
-o-transform: translateY(-2000px) rotate(0);
-ms-transform: translateY(-2000px) rotate(0);
transform: translateY(-2000px) rotate(0);
}
60% {
opacity: 1;
-ms-filter: none;
filter: none;
-webkit-transform: translateY(30px) rotate(0);
-moz-transform: translateY(30px) rotate(0);
-o-transform: translateY(30px) rotate(0);
-ms-transform: translateY(30px) rotate(0);
transform: translateY(30px) rotate(0);
}
80% {
-webkit-transform: translateY(-10px) rotate(0);
-moz-transform: translateY(-10px) rotate(0);
-o-transform: translateY(-10px) rotate(0);
-ms-transform: translateY(-10px) rotate(0);
transform: translateY(-10px) rotate(0);
}
100% {
-webkit-transform: translateY(0) rotate(0);
-moz-transform: translateY(0) rotate(0);
-o-transform: translateY(0) rotate(0);
-ms-transform: translateY(0) rotate(0);
transform: translateY(0) rotate(0);
}
}
@keyframes bounce {
0% {
opacity: 0;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
-webkit-transform: translateY(-2000px) rotate(0);
-moz-transform: translateY(-2000px) rotate(0);
-o-transform: translateY(-2000px) rotate(0);
-ms-transform: translateY(-2000px) rotate(0);
transform: translateY(-2000px) rotate(0);
}
60% {
opacity: 1;
-ms-filter: none;
filter: none;
-webkit-transform: translateY(30px) rotate(0);
-moz-transform: translateY(30px) rotate(0);
-o-transform: translateY(30px) rotate(0);
-ms-transform: translateY(30px) rotate(0);
transform: translateY(30px) rotate(0);
}
80% {
-webkit-transform: translateY(-10px) rotate(0);
-moz-transform: translateY(-10px) rotate(0);
-o-transform: translateY(-10px) rotate(0);
-ms-transform: translateY(-10px) rotate(0);
transform: translateY(-10px) rotate(0);
}
100% {
-webkit-transform: translateY(0) rotate(0);
-moz-transform: translateY(0) rotate(0);
-o-transform: translateY(0) rotate(0);
-ms-transform: translateY(0) rotate(0);
transform: translateY(0) rotate(0);
}
}
.swiperLib{
height: 3rem;
}
</style>

109
src/views/pageFour/index.vue

@ -44,7 +44,6 @@
<div class="four-right">
<div class="four-notice">
<div class="database-title">重要通知</div>
<!-- <div ref="marquee" class="notice-text" :style="{ top: position + 'px' }" v-html="content" /> -->
<div class="seamless-warp">
<swiper ref="mySwiper" :options="swiperOption" class="big-list">
<swiper-slide v-for="(item,index) in noticeList" :key="index">
@ -75,7 +74,7 @@
<!-- <div class="ranking-progress" style="flex:1; align-self: center;">
<el-progress :percentage="item.percentage" :stroke-width="8" :show-text="false" color="#009afb" />
</div> -->
<div style="width: 1.5rem; padding-right: .25rem; text-align: right;">{{ item.BOOKRECNO }}<i style="padding-left:.0625rem;"></i></div>
<div style="width: 1.5rem; padding-right: .25rem; text-align: right;">{{ item.TOTALNUM }}<i style="padding-left:.0625rem;"></i></div>
</li>
</ul>
</div>
@ -92,7 +91,7 @@
</template>
<script>
import { FetchTotalResource, FetchNoticeList, FetchSync36 } from '@/api/library'
import { FetchInitSetting, FetchTotalResource, FetchNoticeList, FetchSync36 } from '@/api/library'
import { swiper, swiperSlide } from 'vue-awesome-swiper'
import 'swiper/dist/css/swiper.css'
export default {
@ -112,6 +111,7 @@ export default {
rankingData: [],
noticeList: [],
noticeIndex: 0,
rankInterval: null,
swiperOption: {
direction: 'vertical',
autoHeight: true,
@ -126,7 +126,7 @@ export default {
slideChange: function() {
// index
_self.noticeIndex = this.activeIndex
console.log('当前index:' + _self.noticeIndex)
// console.log('index' + _self.noticeIndex)
}
}
}
@ -135,6 +135,7 @@ export default {
computed: {
},
beforeDestroy() {
clearInterval(this.rankInterval)
localStorage.setItem('videoIndex', this.videoIndex)
localStorage.setItem('videoCurrentTime', this.$refs.videos[this.videoIndex].currentTime)
localStorage.setItem('noticeIndex', this.noticeIndex)
@ -146,29 +147,13 @@ export default {
this.getBookRanking()
},
mounted() {
if (localStorage.getItem('videoIndex')) {
this.videoIndex = parseInt(localStorage.getItem('videoIndex'))
this.$nextTick(() => {
if (this.slideData.length !== 0) {
this.$refs.carousel.setActiveItem(this.videoIndex)
const videos = this.$refs.videos
console.log(videos)
console.log(this.videoIndex)
const nextVideo = videos[this.videoIndex]
videos.forEach((video) => {
video.pause()
video.currentTime = 0
})
setTimeout(() => {
nextVideo.currentTime = localStorage.getItem('videoCurrentTime') ? localStorage.getItem('videoCurrentTime') : 0
nextVideo.play()
}, 1000)
}
})
}
//
if (localStorage.getItem('wecharQrCodeSrc')) {
this.wecharQrCodeSrc = localStorage.getItem('wecharQrCodeSrc')
} else {
this.getInitData()
}
// index
if (localStorage.getItem('noticeIndex')) {
this.$nextTick(() => {
const index = localStorage.getItem('noticeIndex')
@ -177,20 +162,17 @@ export default {
}
},
methods: {
getInitData() {
// wecharQrCode /downloadFile/+wecharQrCode
const linkSrc = process.env.VUE_APP_BASE_API
FetchInitSetting().then(res => {
const result = JSON.parse(res.data)
this.wecharQrCodeSrc = linkSrc + '/downloadFile' + result.wecharQrCode
})
},
getNotice() {
FetchNoticeList().then(res => {
this.noticeList = res.data
// this.noticeList.push({
// 'id': '4028e3c3909abc5f01909ac027440002',
// 'title': '222',
// 'context': '07463222340',
// 'startTime': '2024-07-10T03:45:00.000+0000',
// 'endTime': '2034-07-10T03:45:00.000+0000',
// 'creater': 'f8ccafbb791cb89e017968aae4470000',
// 'createTime': '2024-07-10T03:46:42.513+0000',
// 'updater': 'f8ccafbb791cb89e017968aae4470000',
// 'updateTime': '2024-07-10T03:46:42.513+0000'
// })
this.$nextTick(() => {
this.noticeList.forEach((item, index) => {
this.$refs['marqueeItem' + index] = this.$el.querySelectorAll('.notice-text p')[index]
@ -205,7 +187,6 @@ export default {
this.noticeList.forEach((item, index) => {
const containerHeight = this.$el.querySelector('.seamless-warp').offsetHeight
const contentHeight = this.$refs['marqueeItem' + index].offsetHeight
// CSS --container-height便 CSS 使
this.$refs['marqueeItem' + index].parentElement.style.setProperty('--container-height', `${contentHeight + 30}px`)
@ -225,32 +206,27 @@ export default {
if (item.filePath) {
item.cover = linkSrc + '/downloadFile' + item.filePath
} else {
// http://8.130.135.212:19000/MarcByIsbn?sIsbn=9787545559804
// axios.get('http://8.130.135.212:19000/MarcByIsbn?sIsbn=' + item.isbn)
// .then(response => {
// console.log(response)
// })
// .catch(error => {
// console.error('There was an error!', error)
// })
item.cover = null
}
return item
})
// this.slideData.push({
// title: '',
// cover: require('@/assets/video/Atlas2021Boston Dynamics.mp4')
// // videos: [{ video: require('@/assets/video/Atlas2021Boston Dynamics.mp4') }]
// },
// {
// title: '',
// cover: require('@/assets/video/1608277325000.mp4')
// // videos: [{ video: require('@/assets/video/1608277325000.mp4') }]
// },
// {
// title: '',
// cover: require('@/assets/video/20220414085212.mp4')
// // videos: [{ video: require('@/assets/video/20220414085212.mp4') }]
// })
//
if (localStorage.getItem('videoIndex')) {
this.videoIndex = parseInt(localStorage.getItem('videoIndex'))
this.$nextTick(() => {
this.$refs.carousel.setActiveItem(this.videoIndex)
const videos = this.$refs.videos
const nextVideo = videos[this.videoIndex]
videos.forEach((video) => {
video.pause()
video.currentTime = 0
})
setTimeout(() => {
nextVideo.currentTime = localStorage.getItem('videoCurrentTime') ? localStorage.getItem('videoCurrentTime') : 0
nextVideo.play()
}, 1000)
})
}
}).catch(error => {
console.error('Error', error)
})
@ -269,7 +245,6 @@ export default {
},
playNextVideo(index) {
const videos = this.$refs.videos
console.log('videos', videos)
let nextIndex = index
this.videoIndex = nextIndex
if (index < this.slideData.length - 1) {
@ -277,7 +252,6 @@ export default {
} else {
nextIndex = 0
}
console.log('nextIndex', nextIndex)
const carousel = this.$refs.carousel
carousel.setActiveItem(nextIndex)
const nextVideo = videos[nextIndex]
@ -285,16 +259,13 @@ export default {
video.pause()
video.currentTime = 0
})
// if (this.videoIndex === this.slideData.length - 1) {
// this.$parent.autoPagination(1)
// }
setTimeout(() => {
nextVideo.play()
}, 1000)
},
getBookRanking() {
const params = {
'libcode': 'QYTSG',
'libcode': 'DCDFG,QYTSG,SEDSG,SJLFG,FXLFG,BZHFG',
'starttime': this.getFormattedDate(new Date(), -1),
'endtime': this.getFormattedDate(new Date()),
'rownum': 6
@ -302,8 +273,8 @@ export default {
FetchSync36(params).then(res => {
const result = JSON.parse(res.data)
if (result.success && result.resultlist.length > 0) {
this.rankingData = result.resultlist
setInterval(() => {
this.rankingData = result.resultlist.sort((a, b) => b.TOTALNUM - a.TOTALNUM).slice(0, 6)
this.rankInterval = setInterval(() => {
this.currentHover = (this.currentHover + 1) % this.rankingData.length
}, 1000)
} else {
@ -331,7 +302,6 @@ video {
height: 100vh;
overflow: hidden;
}
.swiper-container-vertical .swiper-wrapper{
flex-direction: column;
}
@ -339,7 +309,4 @@ video {
width: 100%;
height: 100%;
}
.in-list .swiper-slide {
height: auto;
}
</style>

289
src/views/pageFour/module/video.vue

@ -1,289 +0,0 @@
<template>
<div id="carousel">
<h4>{{ slideData[beginValue].title }}</h4>
<div
ref="carousel"
class="carousel"
:style="{ height: height + 'px' }"
>
<transition-group tag="ul" class="slide clearfix" :name="transitionName">
<li
v-for="(item, index) in slideData"
v-show="index == beginValue"
:key="index"
:style="{ height: height + 'px' }"
style="display: flex"
>
<!-- 播放视频 -->
<div v-for="(v, e) in item.videos" :key="e" class="videos">
<video
ref="videoPlay"
muted=""
:src="v.video"
controls="controls"
:autoplay="autoPlay"
loop="loop"
style="width: 100%; height: 100%"
@timeupdate="handleTimeUpdate"
/>
</div>
<!-- <div class="up" @click="up"> &lt; </div>
<div class="next" @click="next"> &gt;</div> -->
</li>
</transition-group>
</div>
</div>
</template>
<script>
import 'videojs-contrib-hls'
export default {
name: 'Carousel',
props: {
height: {
type: Number,
default: 710
},
dot: {
type: Boolean,
default: true
},
arrow: {
type: Boolean,
default: true
},
interval: {
type: Number,
default: 5000
},
begin: {
type: Number,
default: 0
},
slideData: {
type: Array,
default: function() {
return []
}
}
},
data() {
return {
setInterval: '',
beginValue: 0,
transitionName: 'slide',
mytime_02: true,
videoDuration: 0,
currentTime: 0
}
},
beforeDestroy() {
// ,
clearInterval(this.setInterval)
},
mounted() {
// var box = this.$refs.carousel; //
// box.addEventListener("mouseover", () => {
// this.mouseOver();
// });
// box.addEventListener("mouseout", () => {
// this.mouseOut();
// });
this.beginValue = this.begin
this.play()
},
methods: {
handleTimeUpdate(e) {
this.currentTime = parseInt(e.target.currentTime)
this.videoDuration = Math.floor(e.target.duration)
if (!this.mytime_02) {
return
} //
this.mytime_02 = false
setTimeout(() => {
console.log('currentTime', this.currentTime)
console.log('e.target.duration', this.videoDuration)
if (this.currentTime === this.videoDuration) {
this.next()
}
this.mytime_02 = true //
}, 1000)
},
//
change(key) {
if (key > this.slideData.length - 1) {
key = 0
}
if (key < 0) {
key = this.slideData.length - 1
}
this.beginValue = key
},
autoPlay() {
this.transitionName = 'slide'
this.beginValue++
console.log('this.beginValue', this.beginValue)
if (this.beginValue >= this.slideData.length) {
this.beginValue = 0
return
}
},
play() {
// this.setInterval = setInterval(this.autoPlay, this.interval);
this.autoPlay
},
mouseOver() {
//
// console.log('over')
// clearInterval(this.setInterval);
},
mouseOut() {
//
// console.log('out')
// this.play();
},
up() {
//
--this.beginValue
this.transitionName = 'slideBack'
this.change(this.beginValue)
},
next() {
console.log('next', this.beginValue)
//
++this.beginValue
console.log('next2', this.beginValue)
this.transitionName = 'slide'
this.change(this.beginValue)
}
}
}
</script>
<style lang="scss">
@import "~@/assets/styles/index.scss";
.slide {
position: relative;
margin: 0;
padding: 0;
overflow: hidden;
width: 100%;
height: 8.875rem;
margin-top: 0.475rem;
}
.slide li {
list-style: none;
position: absolute;
width: 100%;
height: 8.875rem;
}
.slide li img {
height: 8.875rem;
cursor: pointer;
}
.slide li .title {
position: absolute;
left: 0;
bottom: 0;
padding: 10px 20px;
width: 100%;
background: rgba(0, 0, 0, 0.35);
color: #fff;
font-size: larger;
text-align: center;
}
.videos {
width: 100%;
height: 100%;
}
.videos:nth-child(1) {
margin-right: 0.2rem;
}
.slideDot {
position: absolute;
z-index: 999;
bottom: 0.2rem;
right: 1.85rem;
}
.slideDot span {
display: inline-block;
width: 0.07rem;
height: 0.07rem;
background: rgba(255, 255, 255, 0.65);
margin-left: 0.05rem;
}
.slideDot span.active {
background: rgba(255, 255, 255, 1);
}
.up,
.next {
position: absolute;
left: 0;
top: 50%;
margin-top: 0;
cursor: pointer;
font-size: 50px;
width: 80px;
height: 80px;
background-repeat: no-repeat;
background-position: 50% 50%;
}
.up {
left: 0.25rem;
}
.next {
left: auto;
right: 0.25rem;
}
/* .up:hover {
background-color: rgba(0, 0, 0, 0.3);
} */
/* .next:hover {
background-color: rgba(0, 0, 0, 0.3);
} */
/*进入过渡生效时的状态*/
.slide-enter-active {
transform: translateX(0);
transition: all 1s ease;
}
/*进入开始状态*/
.slide-enter {
transform: translateX(-100%);
}
/*离开过渡生效时的状态*/
.slide-leave-active {
transform: translateX(100%);
transition: all 1s ease;
}
/*离开过渡的开始状态*/
.slide-leave {
transform: translateX(0);
}
/*进入过渡生效时的状态*/
.slideBack-enter-active {
transform: translateX(0);
transition: all 1s ease;
}
/*进入开始状态*/
.slideBack-enter {
transform: translateX(100%);
}
/*离开过渡生效时的状态*/
.slideBack-leave-active {
transform: translateX(-100%);
transition: all 1s ease;
}
/*离开过渡的开始状态*/
.slideBack-leave {
transform: translateX(0);
}
</style>

266
src/views/pageOne/index.vue

@ -8,7 +8,7 @@
<li
v-for="(item, index) in leftData"
:key="index"
:class="[{'allTotal': item.id === 'allTotal'}, {'currentNum': item.id === 'currentNum'}]"
:class="[{'allTotal': item.id === 'allTotal'}, {'lastYearTotal': item.id === 'lastYearTotal'}]"
>
<div class="pageLeft-flop-box">
<div>
@ -23,7 +23,7 @@
</li>
</ul>
<ul class="pageOne-left-progress">
<li v-for="(item,index) in progressdata" :key="index" :class="[{'blue-progress':item.type===1 || item.type === 2},{'orange-progress':item.type===3 || item.type === 4}]">
<li v-for="(item,index) in progressData" :key="index" :class="[{'blue-progress':item.type===1 || item.type === 2},{'orange-progress':item.type===3 || item.type === 4}]">
<p>{{ item.name }}</p>
<span class="progress-num">{{ item.value }}<i></i></span>
<el-progress :percentage="computedPercentage(item)" :stroke-width="8" :show-text="false" />
@ -165,6 +165,7 @@ export default {
name: 'PageOne',
data() {
return {
intervalLeft: null,
isDataLoaded: false,
pageOneVisitBase: '0', //
wecharQrCodeSrc: null,
@ -173,31 +174,11 @@ export default {
listData2: [],
defaultImg: 'this.src="' + require('@/assets/images/book_03.png') + '"',
leftData: [],
progressdata: [
{
name: '今日到馆',
value: 2300,
type: 1
},
{
name: '本月到馆',
value: 5630,
type: 2
},
{
name: '昨日到馆',
value: 1269,
type: 3
},
{
name: '上月到馆',
value: 6457,
type: 4
}
],
progressData: [],
hotTagData: [],
middleData: [],
tagList: [],
//
radius: 160,
dtr: Math.PI / 180,
d: 200,
@ -261,18 +242,16 @@ export default {
}
},
async created() {
this.getHotSearch()
this.getInitData()
this.getNewBook()
this.getMiddleAllData()
this.getHotSearch()
this.getNewBook()
},
beforeDestroy() {
clearTimeout(this.timer2)
clearInterval(this.intervalLeft)
this.intervalLeft = null
},
mounted() {
// setTimeout(() => {
// this.$parent.autoPagination(2)
// }, 8000)
},
methods: {
getInitData() {
@ -284,9 +263,152 @@ export default {
const result = JSON.parse(res.data)
this.pageOneVisitBase = result.visitBase
this.wecharQrCodeSrc = linkSrc + '/downloadFile' + result.wecharQrCode
this.initDataPreview()
this.initLeftPreview(result)
// this.intervalLeft = setInterval(() => {
// this.getInitData()
// }, 10000)
})
},
initLeftPreview(result) {
this.progressData = []
this.leftData = []
// /12=
// /28293031=
// =+-2050
// =+-100200
// 8:00-18:0010
// 8:00-9:00 19:00-10:002
// /10=
// = * N+-510
// = * dd/+ -100200
// =*+-100200
//
// visitBase
// visitBaseCheck 0false 1true
// lastYearVisitBase
// todayVisitBase
// todayVisitBaseCheck
// yesterdayVisitBase
// yesterdayVisitBaseCheck
// thisMonthVisitBase
// thisMonthVisitBaseCheck
// lastMonthVisitBase
// lastMonthVisitBaseCheck
const baseTotal = this.pageOneVisitBase //
console.log('假设本年到馆人数', baseTotal)
const monthBase = Math.floor(baseTotal / 12) //
console.log('月基数', monthBase)
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) //
console.log('日基数', dayBase)
let yesterdayCount = 0
if (result.yesterdayVisitBaseCheck === '1') {
yesterdayCount = result.yesterdayVisitBase
} else {
const randomDay = Math.floor(Math.random() * (50 - (-20) + 1)) + (-20) // -2050
yesterdayCount = localStorage.getItem('yesterdayCountCache') ? localStorage.getItem('yesterdayCountCache') : dayBase + randomDay //
}
console.log('昨日到馆', yesterdayCount)
const randomMonth = Math.floor(Math.random() * (200 - (-100) + 1)) + (-100) // -100200
let lastMonthCount = 0
if (result.lastMonthVisitBaseCheck === '1') {
lastMonthCount = result.lastMonthVisitBase
} else {
lastMonthCount = localStorage.getItem('lastMonthCountCache') ? localStorage.getItem('lastMonthCountCache') : monthBase + randomMonth
}
console.log('上月到馆', lastMonthCount)
const hourBase = Math.floor(dayBase / 10) //
console.log('小时基数', hourBase)
const openTime = 8 //
const closeTime = 18 //
const currentHour = now.getHours() //
let todayCount = 0
if (result.todayVisitBaseCheck === '1') {
todayCount = result.todayVisitBase
} else {
if (currentHour < openTime || currentHour >= closeTime) {
console.log('当前时间不在图书馆营业时间内')
} else {
const N = currentHour - openTime
console.log('第N个小时', N)
const randomHour = Math.floor(Math.random() * (10 - (-5) + 1)) + (-5) // -510
todayCount = Math.floor(hourBase * N + randomHour) //
}
}
console.log('今日到馆', todayCount)
let nowMonthCount = 0
if (result.thisMonthVisitBaseCheck === '1') {
nowMonthCount = result.thisMonthVisitBase
} else {
nowMonthCount = Math.floor(monthBase * (now.getDate() / daysInMonth) + randomMonth) //
}
console.log('本月到馆', nowMonthCount)
const nowYearCount = Math.floor(monthBase * month + randomMonth) //
console.log('本年累计', nowYearCount)
this.progressData.push(
{
name: '今日到馆',
value: todayCount,
type: 1
},
{
name: '本月到馆',
value: nowMonthCount,
type: 2
},
{
name: '昨日到馆',
value: yesterdayCount,
type: 3
},
{
name: '上月到馆',
value: lastMonthCount,
type: 4
}
)
this.leftData.push({
id: 'allTotal',
name: '本年累计到馆',
value: this.$parent.formatter(nowYearCount),
valueArr: this.$parent.formatter(nowYearCount).split('')
},
{
id: 'lastYearTotal',
name: '去年累计到馆',
value: this.$parent.formatter(result.lastYearVisitBase),
valueArr: this.$parent.formatter(result.lastYearVisitBase).split('')
})
this.$parent.timedRefresh(this.leftData, 'left')
localStorage.setItem('yesterdayCountCache', yesterdayCount)
localStorage.setItem('lastMonthCountCache', lastMonthCount)
},
//
getHotSearch() {
const params = {
@ -333,7 +455,6 @@ export default {
valueArr: this.$parent.formatter(lendingTotal).toString().split('')
}
)
console.log('this.middleData', this.middleData)
this.$parent.timedRefresh(this.middleData, 'middle')
// setTimeout(() => {
// this.$parent.timedRefresh(this.middleData, 'middle')
@ -346,8 +467,8 @@ export default {
getLibBookTotal() {
const params = {
'libcode': 'LSJDFG,LJPFG,DCDFG,QYTSG,SJLFG,XMDFG,FXLFG,QLQFG,SEDSG,MZZFG,GYTZFG,KJSKCFG,JBTZFG,SKTZFG,XJZFG,PSZFG,DZQZFG,WXJDFG,CHJDFG,BSZFG,BZHFG',
'starttime': this.getFormattedDate(new Date(), -1),
'endtime': this.getFormattedDate(new Date())
'starttime': '2000-01-01',
'endtime': '2034-01-01'
}
return FetchLibBookTotal(params).then(res => {
const result = JSON.parse(res.data)
@ -422,20 +543,35 @@ 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
this.newList = res.data.map((item, index) => {
// 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) => {
if (item.nbImgPath) {
item.nbImgPath = linkSrc + '/downloadFile' + item.nbImgPath
return true
} else {
// http://8.130.135.212:19000/MarcByIsbn?sIsbn=9787545559804
// axios.get('http://8.130.135.212:19000/MarcByIsbn?sIsbn=' + item.isbn)
// .then(response => {
// console.log(response)
// })
// .catch(error => {
// console.error('There was an error!', error)
// })
// 'nbImgPath/srcurl/base64
return false
}
return item
})
const halfLength = Math.ceil(this.newList.length / 2)
@ -444,48 +580,22 @@ export default {
})
},
getType1Value() {
const type1Item = this.progressdata.find(item => item.type === 1)
const type1Item = this.progressData.find(item => item.type === 1)
return type1Item ? type1Item.value : 0
},
getType2Value() {
const type2Item = this.progressdata.find(item => item.type === 2)
const type2Item = this.progressData.find(item => item.type === 2)
return type2Item ? type2Item.value : 0
},
getType3Value() {
const type3Item = this.progressdata.find(item => item.type === 3)
const type3Item = this.progressData.find(item => item.type === 3)
return type3Item ? type3Item.value : 0
},
getType4Value() {
const type4Item = this.progressdata.find(item => item.type === 4)
const type4Item = this.progressData.find(item => item.type === 4)
return type4Item ? type4Item.value : 0
},
async initDataPreview() {
//
const previewData = {
'code': 0,
'data': {
'allUserOpenNumCount': 68
},
'message': 'success'
}
if (previewData.code !== 0) return
this.leftData = []
this.leftData.push({
id: 'allTotal',
name: '本年累计到馆',
value: this.$parent.formatter(this.pageOneVisitBase),
valueArr: this.$parent.formatter(this.pageOneVisitBase).split('')
}, {
id: 'currentNum',
name: '当前在馆人数',
value: this.$parent.formatter(previewData.data.allUserOpenNumCount),
valueArr: this.$parent.formatter(previewData.data.allUserOpenNumCount).split('')
})
this.$parent.timedRefresh(this.leftData, 'left')
// setTimeout(() => {
// this.$parent.timedRefresh(this.leftData, 'left')
// }, 1000)
},
//
//
sineCosine(a, b, c) {
@ -767,7 +877,7 @@ export default {
ul{
display: flex;
height: 2rem;
overflow: hidden;
// overflow: hidden;
li{
width: 1.375rem;
height: 2rem;
@ -781,8 +891,8 @@ export default {
.book-img{
width: 1.375rem;
height: 2rem;
background: url('~@/assets/images/book_03.png') no-repeat center center;
background-size: contain;
// background: url('~@/assets/images/book_03.png') no-repeat center center;
// background-size: contain;
display: flex;
align-items: center;
overflow: hidden;

121
src/views/pageThree/index.vue

@ -96,13 +96,13 @@
<div class="three-item three03">
<div class="database-title">今日借阅趋势</div>
<div class="chart-wrapper" style="height: calc(100% - 35px);">
<LineChartService :chart-data="chartData" />
<LineChart :chart-day-data="chartDayData" />
</div>
</div>
<div class="three-item three04">
<div class="database-title">近7日借阅统计</div>
<div class="chart-wrapper" style="height: calc(100% - 20px);">
<BarEcharts :storage-data="storageData" />
<BarEcharts :chart-weekly-data="chartWeeklyData" />
</div>
</div>
</div>
@ -110,15 +110,15 @@
</template>
<script>
import { FetchLibcodeDetails, FetchLendingTotal } from '@/api/library'
import LineChartService from '@/components/echart/lineChartService'
import { FetchLibcodeDetails, FetchLendingTotal, FetchTodayJH, FetchWeekJH } from '@/api/library'
import LineChart from '@/components/echart/lineChart'
import BarEcharts from '@/components/echart/barEcharts'
import YearCircle from './module/yearCircle'
import TodayCircle from './module/todayCircle'
import YearCircle from '@/components/echart/yearCircle'
import TodayCircle from '@/components/echart/todayCircle'
export default {
name: 'PageThree',
components: {
LineChartService,
LineChart,
BarEcharts,
YearCircle,
TodayCircle
@ -126,13 +126,14 @@ export default {
data() {
return {
currentHover: -1,
chartData: {
returnData: [220, 132, 10, 134, 90, 230],
borrowedData: [20, 182, 191, 234, 290, 330]
chartDayData: {
timeData: [],
returnData: [],
borrowedData: []
},
storageData: {
inStorageData: [60, 92, 10, 68, 90, 76, 80],
outStorageData: [20, 82, 191, 134, 90, 56, 30]
chartWeeklyData: {
inchartWeeklyData: [],
outchartWeeklyData: []
},
todayTotal: [],
yearTotal: [],
@ -147,16 +148,22 @@ export default {
todayAllNum: {
headerLib: 0,
branchLib: 0
}
},
rankInterval: null
}
},
computed: {
},
beforeDestroy() {
clearInterval(this.rankInterval)
this.rankInterval = null
},
created() {
this.getLendingTotal()
this.getTodayJH()
this.getWeekJH()
},
mounted() {
},
methods: {
paddingNum(num, length) {
@ -170,7 +177,7 @@ export default {
FetchLendingTotal().then(res => {
const result = JSON.parse(res.data)
if (result.success & result.resultlist.length !== 0) {
console.log('result.resultlist', result.resultlist)
// console.log('result.resultlist', result.resultlist)
// JCC_YEAR
// JCC_DAY
const dayNum = result.resultlist.filter(item => item.LIBCODE !== '999').reduce((acc, obj) => acc + obj.JCC_DAY, 0)
@ -188,15 +195,11 @@ export default {
valueArr: this.$parent.formatter(yearNum).split('')
})
this.$parent.timedRefresh(this.todayTotal, 'todayTotal')
this.$parent.timedRefresh(this.yearTotal, 'yearTotal')
// QYTSG999
this.yearAllNum = {
'headerLib': result.resultlist.filter(item => item.LIBCODE === 'QYTSG')[0].JCC_YEAR,
'branchLib': result.resultlist.filter(item => item.LIBCODE !== 'QYTSG' && item.LIBCODE !== '999').reduce((acc, obj) => acc + obj.JCC_YEAR, 0)
}
this.todayAllNum = {
'headerLib': result.resultlist.filter(item => item.LIBCODE === 'QYTSG')[0].JCC_DAY,
'branchLib': result.resultlist.filter(item => item.LIBCODE !== 'QYTSG' && item.LIBCODE !== '999').reduce((acc, obj) => acc + obj.JCC_DAY, 0)
@ -204,6 +207,9 @@ export default {
// 6
this.getLibcodeDetails(result.resultlist)
this.$parent.timedRefresh(this.todayTotal, 'todayTotal')
this.$parent.timedRefresh(this.yearTotal, 'yearTotal')
} else {
this.todayTotal = []
this.yearTotal = []
@ -238,7 +244,7 @@ export default {
this.rankingTodayData = newDataArray.sort((a, b) => b.JCC_DAY - a.JCC_DAY).slice(0, 6)
this.rankingTodayWithPercentage = this.rankingDataComputed(this.rankingTodayData, 'JCC_DAY')
setInterval(() => {
this.rankInterval = setInterval(() => {
this.currentHover = (this.currentHover + 1) % this.rankingYearWithPercentage.length
}, 1000)
}
@ -252,6 +258,79 @@ export default {
const percentage = (item[numType] / firstPlaceNum) * 100
return { ...item, percentage }
})
},
//
getTodayJH() {
FetchTodayJH().then(res => {
const result = res.data
if (result.length !== 0) {
this.chartDayData.timeData = result.map(item => {
const hour = item.logHour.toString().padStart(2, '0')
return `${hour}:00`
})
this.chartDayData.returnData = result.map(item => item.jccDay)
this.chartDayData.borrowedData = result.map(item => item.hccDay)
// console.log('this.chartDayData ', this.chartDayData)
} else {
this.chartDayData = {
timeData: [],
returnData: [],
borrowedData: []
}
}
}).catch(error => {
console.error('Error', error)
})
},
getWeekJH() {
FetchWeekJH().then(res => {
// console.log(res)
const result = res.data
if (result.length !== 0) {
// in
this.chartWeeklyData.inchartWeeklyData = this.barSevenDaysData(result).map(item => item.hccDayTotal)
// out
this.chartWeeklyData.outchartWeeklyData = this.barSevenDaysData(result).map(item => item.jccDayTotal)
} else {
this.chartWeeklyData = {
inchartWeeklyData: [],
outchartWeeklyData: []
}
}
}).catch(error => {
console.error('Error', error)
})
},
// 2024-7-21
barSevenDaysData(data) {
const currentDate = new Date()
currentDate.setUTCHours(0, 0, 0, 0)
const dateRange = []
for (let i = 0; i < 7; i++) {
const date = new Date(currentDate)
date.setDate(date.getDate() - i)
dateRange.push(date.toISOString().slice(0, 10))
}
const datesInData = data.map(item => item.createTime.slice(0, 10))
for (const date of dateRange) {
if (!datesInData.includes(date)) {
data.push({
'jccDayTotal': 0,
'hccDayTotal': 0,
'createTime': date
})
}
}
data.sort((a, b) => {
if (a.createTime < b.createTime) return -1
if (a.createTime > b.createTime) return 1
return 0
})
if (data.length > 7) {
data = data.slice(data.length - 7)
}
return data
}
}
}

Loading…
Cancel
Save