Browse Source

需求更新

master
xuhuajiao 2 months ago
parent
commit
f55b6dff67
  1. 4
      .env.development
  2. 34
      src/api/library.js
  3. 11
      src/components/echart/lineChartService.vue
  4. 7
      src/main.js
  5. 8
      src/utils/index.js
  6. 40
      src/views/lengingRanking/index.vue
  7. 10
      src/views/newBookRecommend/index.vue
  8. 41
      src/views/readStar/index.vue
  9. 32
      src/views/todayBorrowed/index.vue
  10. 7
      vue.config.js

4
.env.development

@ -8,8 +8,8 @@ ENV = 'development'
#VUE_APP_CAMERA_API = '192.168.99.107' #VUE_APP_CAMERA_API = '192.168.99.107'
# 许镇-本地服地址 # 许镇-本地服地址
VUE_APP_BASE_API = 'http://192.168.99.67:8080'
VUE_APP_WS_API = 'ws://192.168.99.67:8081'
VUE_APP_BASE_API = 'http://192.168.99.72:8080'
VUE_APP_WS_API = 'ws://192.168.99.72:8081'
# 是否启用 babel-plugin-dynamic-import-node插件 # 是否启用 babel-plugin-dynamic-import-node插件
VUE_CLI_BABEL_TRANSPILE_MODULES = true VUE_CLI_BABEL_TRANSPILE_MODULES = true

34
src/api/library.js

@ -1,5 +1,5 @@
import request from '@/utils/request' import request from '@/utils/request'
// import qs from 'qs'
import qs from 'qs'
// 总借阅量 // 总借阅量
export function FetchHalfYearBorrowNum(params) { export function FetchHalfYearBorrowNum(params) {
@ -83,6 +83,33 @@ export function FetchCoverByISBN(params) {
}) })
} }
// 获取当日每小时借还信息
export function FetchTodayJH(params) {
return request({
url: '/qyzt/getTodayJH' + '?' + qs.stringify(params, { indices: false }),
method: 'get',
urlType: 'local'
})
}
// 借阅排行榜
export function FetchSync36(params) {
return request({
url: '/qyzt/sync36' + '?' + qs.stringify(params, { indices: false }),
method: 'get',
urlType: 'local'
})
}
// page2 读者借阅排行榜
export function FetchReadRanking(params) {
return request({
url: '/qyzt/sync37' + '?' + qs.stringify(params, { indices: false }),
method: 'get',
urlType: 'local'
})
}
export default { export default {
FetchHalfYearBorrowNum, FetchHalfYearBorrowNum,
FetchBorrowRank, FetchBorrowRank,
@ -91,5 +118,8 @@ export default {
FetchInitNotice, FetchInitNotice,
FetchInitIntoNum, FetchInitIntoNum,
FetchHalfYearBRNum, FetchHalfYearBRNum,
FetchShowFileList
FetchShowFileList,
FetchTodayJH,
FetchSync36,
FetchReadRanking
} }

11
src/components/echart/lineChartService.vue

@ -59,8 +59,8 @@ export default {
this.chart = echarts.init(dom, 'dark') this.chart = echarts.init(dom, 'dark')
this.setOptions(this.chartData) this.setOptions(this.chartData)
}, },
setOptions({ returnData, borrowedData } = {}) {
const time = ['00:00', '01:00', '02:00', '03:00', '04:00', '05:00', '06:00', '07:00', '08:00', '09:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00', '23:00', '24:00']
setOptions({ timeData, returnData, borrowedData } = {}) {
// const time = ['00:00', '01:00', '02:00', '03:00', '04:00', '05:00', '06:00', '07:00', '08:00', '09:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00', '23:00', '24:00']
this.chart.setOption({ this.chart.setOption({
backgroundColor: '#010326', backgroundColor: '#010326',
tooltip: { tooltip: {
@ -92,11 +92,10 @@ export default {
}, },
xAxis: [{ xAxis: [{
type: 'category', type: 'category',
data: time.map(function(item) {
return item
}),
data: timeData,
axisLabel: { axisLabel: {
interval: 5,
show: true,
// interval: 5,
formatter: function(value, idx) { formatter: function(value, idx) {
return value return value
}, },

7
src/main.js

@ -19,6 +19,13 @@ import './assets/fonts/fonts.css'
import { Message } from 'element-ui' import { Message } from 'element-ui'
Vue.prototype.$message = Message Vue.prototype.$message = Message
// 全局注册过滤 - 时间
import { parseTime, getFormattedDate } from '@/utils/index.js'
Vue.filter('parseTime', function(time, cFormat) {
return parseTime(time, cFormat)
})
Vue.prototype.getFormattedDate = getFormattedDate
// 馆代码 1201为东西湖馆代码 / 本地测试用FTZN // 馆代码 1201为东西湖馆代码 / 本地测试用FTZN
// Vue.prototype.libcode = 'FTZN' // Vue.prototype.libcode = 'FTZN'
Vue.prototype.libcode = '1201' Vue.prototype.libcode = '1201'

8
src/utils/index.js

@ -90,3 +90,11 @@ export function getCurrentTime() {
const time = yy + '年' + mm + '月' + dd + '日 ' + hh + ':' + mf + ':' + ss const time = yy + '年' + mm + '月' + dd + '日 ' + hh + ':' + mf + ':' + ss
return time return time
} }
export function getFormattedDate(date, yearOffset = 0) {
date.setFullYear(date.getFullYear() + yearOffset)
const year = date.getFullYear()
const month = (date.getMonth() + 1).toString().padStart(2, '0')
const day = date.getDate().toString().padStart(2, '0')
return `${year}-${month}-${day}`
}

40
src/views/lengingRanking/index.vue

@ -17,8 +17,8 @@
<img :src="item.cover" :onerror="defaultImg"> <img :src="item.cover" :onerror="defaultImg">
</div> </div>
<div class="book-info"> <div class="book-info">
<h4 class="title-item">{{ item.bookName }}</h4>
<p>{{ item.author }}</p>
<h4 class="title-item">{{ item.TITLE }}</h4>
<p>{{ item.AUTHOR }}</p>
</div> </div>
<div class="ranking-num"> <div class="ranking-num">
<svg v-if="index === 0" class="icon" aria-hidden="true"> <svg v-if="index === 0" class="icon" aria-hidden="true">
@ -38,7 +38,7 @@
</template> </template>
<script> <script>
import { FetchBorrowRank, FetchCoverByISBN } from '@/api/library'
import { FetchBorrowRank, FetchCoverByISBN, FetchSync36 } from '@/api/library'
export default { export default {
name: 'LengingRanking', name: 'LengingRanking',
@ -60,7 +60,7 @@ export default {
} }
}, },
created() { created() {
this.getBorrowRank()
this.getBookRanking()
}, },
mounted() { mounted() {
}, },
@ -77,6 +77,35 @@ export default {
} }
}) })
}, },
getBookRanking() {
const currentDate = new Date() //
currentDate.setDate(currentDate.getDate() - 30) // 30
const year = currentDate.getFullYear() //
const month = currentDate.getMonth() + 1 // 01
const day = currentDate.getDate() //
const formattedDate = `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`
const params = {
'libcode': this.libcode,
'starttime': formattedDate,
'endtime': this.getFormattedDate(new Date()),
'rownum': 10
}
FetchSync36(params).then(res => {
const result = JSON.parse(res.data)
if (result.success && result.resultlist.length > 0) {
let data = []
data = result.resultlist.sort((a, b) => b.TOTALNUM - a.TOTALNUM).slice(0, 10)
data.forEach(item => {
this.getCoverByISBN(item.ISBN.replace(/\-/g, ''), item)
})
} else {
throw new Error('Failed' + this.libcode)
}
}).catch(error => {
console.error('Error', error)
})
},
getCoverByISBN(isbn, item) { getCoverByISBN(isbn, item) {
const params = { const params = {
isbn: isbn isbn: isbn
@ -84,12 +113,13 @@ export default {
FetchCoverByISBN(params).then((res) => { FetchCoverByISBN(params).then((res) => {
console.log('RES', res) console.log('RES', res)
if (res) { if (res) {
// item.cover = window.URL.createObjectURL(res)
item.cover = res item.cover = res
} else { } else {
item.cover = '' item.cover = ''
} }
console.log(item.cover) console.log(item.cover)
this.rankingList.push(item)
console.log('this.rankingList', this.rankingList)
this.$refs.listData.reset() this.$refs.listData.reset()
}) })
} }

10
src/views/newBookRecommend/index.vue

@ -123,16 +123,6 @@ export default {
height: 6rem !important; height: 6rem !important;
margin: .4rem 0; margin: .4rem 0;
overflow: hidden; overflow: hidden;
.swiper-wrapper{
// display: flex;
// flex-wrap: wrap;
// flex-direction: row !important;
// justify-content: flex-start;
}
&.gallery-thumbs {
// margin: 0.4rem 0;
}
&.gallery-thumbs .swiper-slide { &.gallery-thumbs .swiper-slide {
width: calc(100% / 3); width: calc(100% / 3);
height: 2.8rem !important; height: 2.8rem !important;

41
src/views/readStar/index.vue

@ -14,7 +14,7 @@
<use xlink:href="#icon-a-3" /> <use xlink:href="#icon-a-3" />
</svg> </svg>
<span v-else class="star-num">{{ index+1 }}</span> <span v-else class="star-num">{{ index+1 }}</span>
<p class="star-info title-item"> 读者{{ item.readerName }}上周借阅图书{{ item.borrowNum }}</p>
<p class="star-info title-item"> 读者{{ item.RDNAME }}上周借阅图书{{ item.TOTALNUM }}</p>
<p class="star-date">{{ mondayDate }}</p> <p class="star-date">{{ mondayDate }}</p>
</div> </div>
</div> </div>
@ -22,7 +22,7 @@
</template> </template>
<script> <script>
import { FetchBorrowStar } from '@/api/library'
import { FetchBorrowStar, FetchReadRanking } from '@/api/library'
// import { parseTime } from '@/utils/index.js' // import { parseTime } from '@/utils/index.js'
export default { export default {
name: 'ReadStar', name: 'ReadStar',
@ -35,9 +35,44 @@ export default {
created() { created() {
}, },
mounted() { mounted() {
this.getBorrowStar()
this.getReadRanking()
}, },
methods: { methods: {
getReadRanking() {
const currentDate = new Date() //
currentDate.setDate(currentDate.getDate() - 30) // 30
const year = currentDate.getFullYear() //
const month = currentDate.getMonth() + 1 // 01
const day = currentDate.getDate() //
const formattedDate = `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`
const params = {
'libcode': this.libcode,
'starttime': formattedDate,
'endtime': this.getFormattedDate(new Date()),
'rownum': 6,
'nordtype': 'JXTSG_E'
}
FetchReadRanking(params).then(res => {
const result = JSON.parse(res.data)
if (result.success && result.resultlist.length > 0) {
this.readstarList = result.resultlist.sort((a, b) => b.TOTALNUM - a.TOTALNUM).slice(0, 10)
// this.rankingDataComputed()
// this.rankInterval = setInterval(() => {
// this.currentHover = (this.currentHover + 1) % this.rankingData.length
// }, 1000)
console.log('this.readstarList', this.readstarList)
this.getMondayDate()
} else {
throw new Error('Failed' + this.libcode)
}
}).catch(error => {
console.error('Error', error)
return null
})
},
// list // list
getBorrowStar() { getBorrowStar() {
FetchBorrowStar().then(res => { FetchBorrowStar().then(res => {

32
src/views/todayBorrowed/index.vue

@ -12,7 +12,7 @@
<script> <script>
import LineChartService from '@/components/echart/lineChartService' import LineChartService from '@/components/echart/lineChartService'
import { FetchHalfYearBRNum } from '@/api/library'
import { FetchHalfYearBRNum, FetchTodayJH } from '@/api/library'
export default { export default {
name: 'TodayBorrowed', name: 'TodayBorrowed',
components: { components: {
@ -29,7 +29,7 @@ export default {
created() { created() {
}, },
mounted() { mounted() {
this.getHalfYearBRNum()
this.getTodayJH()
}, },
methods: { methods: {
getHalfYearBRNum() { getHalfYearBRNum() {
@ -41,6 +41,34 @@ export default {
this.$message.error('接口错误') this.$message.error('接口错误')
} }
}) })
},
getTodayJH() {
FetchTodayJH().then(res => {
this.chartData = {
timeData: [],
returnData: [],
borrowedData: []
}
const result = res.data
const time = ['07:00', '08:00', '09:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00']
time.forEach((hour, index) => {
// result logHour
const foundItem = result.find(item => item.logHour === index + 7) // logHour 7 7
if (foundItem) {
// logHour chartDayData
this.chartData.timeData.push(`${foundItem.logHour}:00`)
this.chartData.returnData.push(foundItem.hccDay)
this.chartData.borrowedData.push(foundItem.jccDay)
} else {
// logHour chartDayData
this.chartData.timeData.push(`${hour}`)
this.chartData.returnData.push(0) // 0
this.chartData.borrowedData.push(0) // 0
}
})
}).catch(error => {
console.error('Error', error)
})
} }
} }
} }

7
vue.config.js

@ -24,6 +24,13 @@ module.exports = {
'^/dxhtsg': 'dxhtsg' '^/dxhtsg': 'dxhtsg'
} }
}, },
'/qyzt/': {
target: process.env.VUE_APP_BASE_API,
changeOrigin: true,
pathRewrite: {
'^/qyzt': 'qyzt'
}
},
'/auth/': { '/auth/': {
target: process.env.VUE_APP_BASE_API, target: process.env.VUE_APP_BASE_API,
changeOrigin: true, changeOrigin: true,

Loading…
Cancel
Save