Browse Source

需要优化

master
xuhuajiao 1 month ago
parent
commit
a563f305ef
  1. 2
      README.md
  2. 2
      package.json
  3. 2
      public/static/config.js
  4. 12
      src/api/library.js
  5. 2
      src/assets/json/lib.json
  6. 9
      src/assets/styles/index.scss
  7. 2
      src/main.js
  8. 2
      src/views/index.vue
  9. 10
      src/views/map/index.vue
  10. 76
      src/views/pageOne/index.vue
  11. 12
      src/views/pageThree/index.vue
  12. 4
      vue.config.js

2
README.md

@ -1,4 +1,4 @@
大湾社区城市书房智慧大屏
葛店城市书房智慧大屏
```bash ```bash
# install dependency # install dependency

2
package.json

@ -1,7 +1,7 @@
{ {
"name": "qy-big-screen", "name": "qy-big-screen",
"version": "1.0.0", "version": "1.0.0",
"description": "大湾社区城市书房智慧大屏",
"description": "葛店城市书房智慧大屏",
"scripts": { "scripts": {
"serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve", "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
"build": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build", "build": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build",

2
public/static/config.js

@ -1,5 +1,5 @@
window.g = { window.g = {
AXIOS_TIMEOUT: 10000, AXIOS_TIMEOUT: 10000,
ApiUrl: 'http://127.0.0.1:8080', // 配置服务器地址,
ApiUrl: 'http://192.168.110.39:8080', // 配置服务器地址,
LibUrl: 'http://118.253.150.248:8099' // 图创地址 LibUrl: 'http://118.253.150.248:8099' // 图创地址
} }

12
src/api/library.js

@ -154,6 +154,15 @@ export function FetchWeekJH(params) {
}) })
} }
// initIntoNum
export function FetchInitIntoNum(params) {
return request({
url: '/dxhtsg/initIntoNum' + '?' + qs.stringify(params, { indices: false }),
method: 'get',
urlType: 'local'
})
}
export default { export default {
FetchInitToken, FetchInitToken,
FetchLibBookTotal, FetchLibBookTotal,
@ -171,5 +180,6 @@ export default {
FetchSync36, FetchSync36,
FetchTotalResource, FetchTotalResource,
FetchTodayJH, FetchTodayJH,
FetchWeekJH
FetchWeekJH,
FetchInitIntoNum
} }

2
src/assets/json/lib.json

@ -1,3 +1,3 @@
{ {
"大湾社区城市书房":[114.664064,30.478882]
"葛店城市书房":[114.664064,30.478882]
} }

9
src/assets/styles/index.scss

@ -844,15 +844,16 @@
// 左边进度条 // 左边进度条
.pageOne-left-progress{ .pageOne-left-progress{
display: flex; display: flex;
justify-content: space-between;
flex-direction: column;
// justify-content: space-between;
flex-wrap: wrap; flex-wrap: wrap;
padding: 0 .25rem;
padding: 0 .5rem;
li{ li{
position: relative; position: relative;
width: 2.5rem;
width: 100%;
font-size: .225rem; font-size: .225rem;
padding-left: .1625rem; padding-left: .1625rem;
margin-top: .7rem;
margin-top: .35rem;
p{ p{
position: relative; position: relative;
&::before{ &::before{

2
src/main.js

@ -26,7 +26,7 @@ import { Message } from 'element-ui'
Vue.prototype.$message = Message Vue.prototype.$message = Message
// 馆代码 1201为东西湖馆代码 / 本地测试用FTZN // 馆代码 1201为东西湖馆代码 / 本地测试用FTZN
Vue.prototype.libcode = '1201'
Vue.prototype.libcode = 'DWSF'
// 全局注册过滤 - 时间 // 全局注册过滤 - 时间
import { parseTime, getFormattedDate } from '@/utils/index.js' import { parseTime, getFormattedDate } from '@/utils/index.js'

2
src/views/index.vue

@ -59,7 +59,7 @@ export default {
currentPage: null, // currentPage: null, //
isLoading: false, isLoading: false,
height: '', height: '',
headerTitle: '大湾社区城市书房智慧大屏',
headerTitle: '葛店城市书房智慧大屏',
pageData: [ pageData: [
{ id: 1, title: 'PageOne', delayed: 20, isShow: false }, { id: 1, title: 'PageOne', delayed: 20, isShow: false },
{ id: 2, title: 'PageTwo', delayed: 20, isShow: false }, { id: 2, title: 'PageTwo', delayed: 20, isShow: false },

10
src/views/map/index.vue

@ -237,7 +237,7 @@ export default {
const result = JSON.parse(res.data) const result = JSON.parse(res.data)
if (result.success & result.resultlist.length !== 0) { if (result.success & result.resultlist.length !== 0) {
// BZL_YEAR // BZL_YEAR
this.cardTotal = result.resultlist.filter(item => item.LIBCODE !== '999').reduce((acc, obj) => acc + obj.BZL_YEAR, 0)
this.cardTotal = result.resultlist.filter(item => item.LIBCODE === 'DWSF').reduce((acc, obj) => acc + obj.BZL_YEAR, 0)
} else { } else {
this.cardTotal = 0 this.cardTotal = 0
} }
@ -304,7 +304,7 @@ export default {
}) })
}, },
getUserTotal() { getUserTotal() {
const libraries = ['1201']
const libraries = ['DWSF']
const getTotalPromises = libraries.map(libcode => this.getTotalForLibcode(libcode)) const getTotalPromises = libraries.map(libcode => this.getTotalForLibcode(libcode))
return Promise.all(getTotalPromises) return Promise.all(getTotalPromises)
.then(results => { .then(results => {
@ -321,7 +321,7 @@ export default {
const result = JSON.parse(res.data) const result = JSON.parse(res.data)
if (result.length !== 0) { if (result.length !== 0) {
const libCode = { const libCode = {
'1201': [114.664064, 30.478882]
'DWSF': [114.664064, 30.478882]
} }
// console.log('this.libALLNum', this.libALLNum) // console.log('this.libALLNum', this.libALLNum)
const updatedLibraries = result.map(library => { const updatedLibraries = result.map(library => {
@ -376,7 +376,7 @@ export default {
mapImg.src = require('../../assets/images/map-bg2.png') mapImg.src = require('../../assets/images/map-bg2.png')
var XAData = this.libInfoData.map(item => { var XAData = this.libInfoData.map(item => {
return [ return [
{ name: '大湾社区城市书房' },
{ name: '葛店城市书房' },
{ name: item.name, value: item.address } { name: item.name, value: item.address }
] ]
}) })
@ -399,7 +399,7 @@ export default {
} }
var series = []; var series = [];
[ [
['大湾社区城市书房', XAData]
['葛店城市书房', XAData]
].forEach(function(item, i) { ].forEach(function(item, i) {
series.push( series.push(
{ {

76
src/views/pageOne/index.vue

@ -65,7 +65,7 @@
</div> </div>
</div> </div>
<span v-if="item.id === 'totalBook'" class="middle-unit"></span> <span v-if="item.id === 'totalBook'" class="middle-unit"></span>
<span v-if="item.id === 'fansNum'" class="middle-unit"></span>
<span v-if="item.id === 'fansNum'" class="middle-unit"></span>
<span v-if="item.id === 'cardNum'" class="middle-unit"></span> <span v-if="item.id === 'cardNum'" class="middle-unit"></span>
<span v-if="item.id === 'lendingNum'" class="middle-unit"></span> <span v-if="item.id === 'lendingNum'" class="middle-unit"></span>
</div> </div>
@ -134,7 +134,8 @@
</template> </template>
<script> <script>
import { FetchInitSetting, FetchUsertotal, FetchLibBookTotal, FetchHotSearch, FetchFansCount, FetchLendingTotal, FetchNewBook, FetchMarcByISBN } from '@/api/library'
// FetchFansCount
import { FetchInitSetting, FetchInitIntoNum, FetchUsertotal, FetchLibBookTotal, FetchHotSearch, FetchLendingTotal, FetchNewBook, FetchMarcByISBN } from '@/api/library'
export default { export default {
name: 'PageOne', name: 'PageOne',
data() { data() {
@ -255,9 +256,52 @@ export default {
const result = JSON.parse(res.data) const result = JSON.parse(res.data)
this.pageOneVisitBase = result.visitBase this.pageOneVisitBase = result.visitBase
this.wecharQrCodeSrc = linkSrc + '/downloadFile' + result.wecharQrCode this.wecharQrCodeSrc = linkSrc + '/downloadFile' + result.wecharQrCode
this.initLeftPreview(result)
// this.initLeftPreview(result)
this.initIntoNum()
}) })
}, },
initIntoNum() {
// 使
this.progressData = []
this.leftData = []
FetchInitIntoNum()
.then(res => {
console.log('InitIntoNum response:', res)
const result = res?.data || {}
const progressDataConfig = [
{ name: '今日出馆', key: 'dayOutNUm', type: 3 },
{ name: '本月到馆', key: 'monthPeopleNum', type: 2 },
{ name: '本年到馆', key: 'historyPeopleNum', type: 1 }
]
this.progressData = progressDataConfig.map(item => ({
name: item.name,
value: result[item.key] || 0,
type: item.type
}))
//
const dayPeopleNum = result.dayPeopleNum || 0
const formattedNum = this.$parent.formatter(dayPeopleNum)
const newData = [{
id: 'totayTotal',
name: '今日到馆',
value: formattedNum,
valueArr: formattedNum.split(''),
timestamp: Date.now()
}]
//
this.$set(this, 'leftData', newData)
this.$parent.timedRefresh(this.leftData, 'left')
})
.catch(error => {
console.error('获取入馆数据失败:', error)
})
},
initLeftPreview(result) { initLeftPreview(result) {
this.progressData = [] this.progressData = []
this.leftData = [] this.leftData = []
@ -471,13 +515,13 @@ export default {
}, },
{ {
id: 'fansNum', id: 'fansNum',
name: '粉丝数量',
name: '今日归还',
value: fansNum, value: fansNum,
valueArr: this.$parent.formatter(fansNum).toString().split('') valueArr: this.$parent.formatter(fansNum).toString().split('')
}, },
{ {
id: 'lendingNum', id: 'lendingNum',
name: '累计借出',
name: '今日借出',
value: lendingTotal, value: lendingTotal,
valueArr: this.$parent.formatter(lendingTotal).toString().split('') valueArr: this.$parent.formatter(lendingTotal).toString().split('')
} }
@ -532,7 +576,7 @@ export default {
}) })
}, },
getUserTotal() { getUserTotal() {
const libraries = ['1201']
const libraries = ['DWSF']
const getTotalPromises = libraries.map(libcode => this.getTotalForLibcode(libcode)) const getTotalPromises = libraries.map(libcode => this.getTotalForLibcode(libcode))
return Promise.all(getTotalPromises) return Promise.all(getTotalPromises)
.then(counts => counts.reduce((sum, count) => sum + parseInt(count, 10), 0)) .then(counts => counts.reduce((sum, count) => sum + parseInt(count, 10), 0))
@ -542,9 +586,23 @@ export default {
}) })
}, },
// //
// getFansNum() {
// return FetchFansCount().then(res => {
// return res.data ? parseInt(res.data) : 0
// }).catch(error => {
// console.error('Error', error)
// return 0
// })
// },
//
getFansNum() { getFansNum() {
return FetchFansCount().then(res => {
return res.data ? parseInt(res.data) : 0
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 => { }).catch(error => {
console.error('Error', error) console.error('Error', error)
return 0 return 0
@ -555,7 +613,7 @@ export default {
return FetchLendingTotal().then(res => { return FetchLendingTotal().then(res => {
const result = JSON.parse(res.data) const result = JSON.parse(res.data)
if (result.success & result.resultlist.length !== 0) { if (result.success & result.resultlist.length !== 0) {
return result.resultlist.filter(item => item.LIBCODE !== '999').reduce((acc, obj) => acc + obj.JCC, 0)
return result.resultlist.filter(item => item.LIBCODE === 'DWSF').reduce((acc, obj) => acc + obj.JCC_DAY, 0)
} else { } else {
return 0 return 0
} }

12
src/views/pageThree/index.vue

@ -244,8 +244,8 @@ export default {
if (result.success & result.resultlist.length !== 0) { if (result.success & result.resultlist.length !== 0) {
// JCC_YEAR // JCC_YEAR
// JCC_DAY // JCC_DAY
const dayNum = result.resultlist.filter(item => item.LIBCODE !== '999').reduce((acc, obj) => acc + obj.JCC_DAY, 0)
const yearNum = result.resultlist.filter(item => item.LIBCODE !== '999').reduce((acc, obj) => acc + obj.JCC_YEAR, 0)
const dayNum = result.resultlist.filter(item => item.LIBCODE === 'DWSF').reduce((acc, obj) => acc + obj.JCC_DAY, 0)
const yearNum = result.resultlist.filter(item => item.LIBCODE === 'DWSF').reduce((acc, obj) => acc + obj.JCC_YEAR, 0)
this.todayTotal.push({ this.todayTotal.push({
id: 'todayTotal', id: 'todayTotal',
name: '今日累计借阅', name: '今日累计借阅',
@ -261,12 +261,12 @@ export default {
// QYTSG999 // QYTSG999
this.yearAllNum = { 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)
'headerLib': result.resultlist.filter(item => item.LIBCODE === 'DWSF')[0].JCC_YEAR,
'branchLib': result.resultlist.filter(item => item.LIBCODE !== 'DWSF' && item.LIBCODE !== '999').reduce((acc, obj) => acc + obj.JCC_YEAR, 0)
} }
this.todayAllNum = { 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)
'headerLib': result.resultlist.filter(item => item.LIBCODE === 'DWSF')[0].JCC_DAY,
'branchLib': result.resultlist.filter(item => item.LIBCODE !== 'DWSF' && item.LIBCODE !== '999').reduce((acc, obj) => acc + obj.JCC_DAY, 0)
} }
// 6 // 6

4
vue.config.js

@ -2,7 +2,7 @@ const path = require('path')
const resolve = dir => { const resolve = dir => {
return path.join(__dirname, dir) return path.join(__dirname, dir)
} }
const name = '大湾社区城市书房智慧大屏'
const name = '葛店城市书房智慧大屏'
const webpack = require('webpack') const webpack = require('webpack')
module.exports = { module.exports = {
publicPath: process.env.NODE_ENV === 'development' ? '/' : './', publicPath: process.env.NODE_ENV === 'development' ? '/' : './',
@ -79,7 +79,7 @@ module.exports = {
config.plugin('html') config.plugin('html')
.tap(args => { .tap(args => {
args[0].title = '大湾社区城市书房智慧大屏'
args[0].title = '葛店城市书房智慧大屏'
return args return args
}) })
} }

Loading…
Cancel
Save