Browse Source

24小时/api请求

master
xuhuajiao 2 years ago
parent
commit
693782e774
  1. 10
      .env.development
  2. 2
      package.json
  3. 25
      src/api/library.js
  4. 6
      src/assets/styles/index.scss
  5. 32
      src/components/echart/lineChart.vue
  6. 202
      src/components/echart/lineChartService.vue
  7. 10
      src/main.js
  8. 24
      src/router/index.js
  9. 12
      src/utils/request.js
  10. 0
      src/views/accessToLibrary/index.vue
  11. 14
      src/views/header/index.vue
  12. 20
      src/views/index.vue
  13. 63
      src/views/indexSelfService.vue
  14. 28
      src/views/lengingRanking/index.vue
  15. 2
      src/views/newBookRecommend/index.vue
  16. 0
      src/views/notice/index.vue
  17. 2
      src/views/readStar/index.vue
  18. 61
      src/views/todayBorrowed/index.vue
  19. 55
      src/views/totalLending/index.vue
  20. 8
      vue.config.js

10
.env.development

@ -3,17 +3,17 @@ ENV = 'development'
# 接口地址 # 接口地址
#内网服务地址 #内网服务地址
VUE_APP_BASE_API = 'http://192.168.99.107:7070'
VUE_APP_WS_API = 'ws://192.168.99.107:7071'
VUE_APP_CAMERA_API = '192.168.99.107'
#VUE_APP_BASE_API = 'http://192.168.99.107:7070'
#VUE_APP_WS_API = 'ws://192.168.99.107:7071'
#VUE_APP_CAMERA_API = '192.168.99.107'
# 刘力-本地服地址 # 刘力-本地服地址
#VUE_APP_BASE_API = 'http://192.168.99.65:7070' #VUE_APP_BASE_API = 'http://192.168.99.65:7070'
#VUE_APP_WS_API = 'ws://192.168.99.65:7071' #VUE_APP_WS_API = 'ws://192.168.99.65:7071'
# 许镇-本地服地址 # 许镇-本地服地址
#VUE_APP_BASE_API = 'http://192.168.99.84:7070'
#VUE_APP_WS_API = 'ws://192.168.99.84:7070'
VUE_APP_BASE_API = 'http://192.168.99.84:8080'
VUE_APP_WS_API = 'ws://192.168.99.84:8081'
# 是否启用 babel-plugin-dynamic-import-node插件 # 是否启用 babel-plugin-dynamic-import-node插件
VUE_CLI_BABEL_TRANSPILE_MODULES = true VUE_CLI_BABEL_TRANSPILE_MODULES = true

2
package.json

@ -15,7 +15,7 @@
"axios": "^0.27.2", "axios": "^0.27.2",
"core-js": "^3.6.4", "core-js": "^3.6.4",
"echarts": "^4.6.0", "echarts": "^4.6.0",
"element-ui": "^2.15.9",
"element-ui": "^2.15.10",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-awesome": "^4.0.2", "vue-awesome": "^4.0.2",
"vue-count-to": "^1.0.13", "vue-count-to": "^1.0.13",

25
src/api/library.js

@ -0,0 +1,25 @@
import request from '@/utils/request'
// import qs from 'qs'
// 总借阅量
export function FetchHalfYearBorrowNum(params) {
return request({
url: '/txhtsg/getHalfYearBorrowNum',
method: 'get',
params: params
})
}
// 借阅排行榜
export function FetchBorrowRank(params) {
return request({
url: '/txhtsg/borrowRank',
method: 'get',
params: params
})
}
export default {
FetchHalfYearBorrowNum,
FetchBorrowRank
}

6
src/assets/styles/index.scss

@ -149,8 +149,8 @@
height: 4.125rem; height: 4.125rem;
} }
.big-module{ .big-module{
height: 6.675rem;
margin:0.1625rem 0;
height: 6.8125rem;
// margin:0.1625rem 0;
} }
//排行榜-推荐 - list //排行榜-推荐 - list
@ -221,7 +221,7 @@
// 视频 // 视频
.video-box{ .video-box{
width: 100%; width: 100%;
height: 5.225rem;
height: 5.2125rem;
} }
// 阅读之星 // 阅读之星

32
src/components/echart/lineChart.vue

@ -10,7 +10,7 @@ export default {
name: 'AcrossEcharts', name: 'AcrossEcharts',
mixins: [resize], mixins: [resize],
props: { props: {
addArcivesData: {
chartData: {
type: Object, type: Object,
require: true, require: true,
default: function() { default: function() {
@ -32,7 +32,7 @@ export default {
} }
}, },
watch: { watch: {
'addArcivesData': {
'chartData': {
handler(val) { handler(val) {
setTimeout(() => { setTimeout(() => {
this.drawChart() this.drawChart()
@ -67,22 +67,10 @@ export default {
backgroundColor: '#339cff' backgroundColor: '#339cff'
} }
} }
// formatter: function(params) {
// var res = "<div style='width:100%;height:24px;margin-bottom:5px;padding:0 12px;line-height:24px;'><p>" + echarts.format.formatTime('yyyyM', new Date(params[0].name)) + ' </p></div>'
// for (var i = 0; i < params.length; i++) {
// res += `<div style="color: #fff;font-size: 14px; padding:0 12px;line-height: 24px">
// <span style="display:inline-block;margin-right:5px;border-radius:2px;width:10px;height:10px;background-color:${[params[i].color]};"></span>
// ${params[i].seriesName}
// ${params[i].data}
// </div>`
// }
// return res
// }
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
// data: this.addArcivesData.addArcivesMonth,
data: ['2022-01', '2022-02', '2022-03', '2022-04', '2022-05', '2022-06'],
data: this.chartData.totalLendMonth,
axisLine: { // 线 axisLine: { // 线
lineStyle: { lineStyle: {
color: 'rgba(17, 61, 114,0.5)' color: 'rgba(17, 61, 114,0.5)'
@ -94,9 +82,6 @@ export default {
textStyle: { textStyle: {
color: '#fff' color: '#fff'
} }
// formatter: function(value) {
// return echarts.format.formatTime('M', new Date(value))
// }
} }
}, },
yAxis: { yAxis: {
@ -104,10 +89,7 @@ export default {
min: 0, min: 0,
max: 1000, max: 1000,
splitNumber: 5, splitNumber: 5,
axisLine: { // 线
// lineStyle: {
// color: '#113D72'
// }
axisLine: {
show: false show: false
}, },
axisLabel: { // x axisLabel: { // x
@ -128,9 +110,8 @@ export default {
}, },
series: [ series: [
{ {
name: '新增档案',
// data: this.addArcivesData.addArcivesNum,
data: [100, 200, 300, 500, 600, 800],
name: '借阅量',
data: this.chartData.totalLendData,
type: 'line', type: 'line',
areaStyle: { areaStyle: {
normal: { normal: {
@ -157,7 +138,6 @@ export default {
color: 'rgba(26, 201, 255, 0.1)' // 100% color: 'rgba(26, 201, 255, 0.1)' // 100%
} }
] ]
// globalCoord: false // false
} }
} }
}, },

202
src/components/echart/lineChartService.vue

@ -0,0 +1,202 @@
<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: {
className: {
type: String,
default: ''
},
chartData: {
type: Object,
required: true
},
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: 'calc(100% - 20px)'
}
},
data() {
return {
chart: null
}
},
watch: {
chartData: {
deep: true,
handler(val) {
this.setOptions(val)
}
}
},
mounted() {
this.$nextTick(() => {
this.initChart()
})
},
beforeDestroy() {
if (!this.chart) {
return
}
this.chart.dispose()
this.chart = null
},
methods: {
initChart() {
const dom = document.getElementById('main2')
this.chart = echarts.init(dom, 'dark')
this.setOptions(this.chartData)
},
setOptions({ returnData, borrowedData } = {}) {
this.chart.setOption({
backgroundColor: '#010326',
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#6a7985'
}
}
},
legend: {
top: '4%',
right: '4%',
icon: 'rect',
itemHeight: 4,
itemWidth: 26,
textStyle: {
fontSize: '16px',
color: '#339CFF'
},
data: ['借出', '归还']
},
grid: {
left: '2%',
right: '4%',
bottom: '0',
containLabel: true
},
xAxis: [{
type: 'category',
boundaryGap: false,
// 线
axisLine: {
show: true,
lineStyle: {
width: '1',
color: '#113D72',
type: 'solid'
}
},
axisLabel: {
fontWeight: 'bold',
color: '#fff'
},
data: ['04:00', '08:00', '12:00', '16:00', '20:00', '24:00']
}],
yAxis: [
{
type: 'value',
//
max: 1000,
min: 0,
interval: 250,
axisLabel: {
textStyle: {
color: '#fff',
fontWeight: 'bold'
}
},
// 线
axisLine: {
show: true,
lineStyle: {
color: '#113D72',
width: '1',
type: 'solid'
}
},
//
axisTick: {
show: false
},
// 线
splitLine: {
show: true,
lineStyle: {
color: '#113D72',
type: 'dashed',
//
opacity: 1,
width: 1
}
}
}
],
series: [
{
name: '归还',
type: 'line',
smooth: 0.6,
lineStyle: {
width: 1,
color: '#18B08F'
},
showSymbol: false,
areaStyle: {
opacity: 0.6,
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: 'rgba(24, 176, 143, 0)'
},
{
offset: 1,
color: 'rgba(23, 175, 142, 1)'
}
])
},
data: returnData
},
{
name: '借出',
type: 'line',
smooth: 0.4,
lineStyle: {
width: 1,
color: '#FE8042'
},
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: 'rgba(254, 128, 66, 1)'
}
])
},
data: borrowedData
}
]
})
}
}
}
</script>

10
src/main.js

@ -3,6 +3,10 @@ import App from './App.vue'
import router from './router' import router from './router'
import store from './store' import store from './store'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI)
// 适配flex // 适配flex
import '@/common/flexible.js' import '@/common/flexible.js'
@ -11,6 +15,10 @@ import './assets/styles/style.scss'
import './assets/iconfont/iconfont.js' import './assets/iconfont/iconfont.js'
import './assets/fonts/fonts.css' import './assets/fonts/fonts.css'
// 按需引入然后注册在vue原型上
import { Message } from 'element-ui'
Vue.prototype.$message = Message
import axios from 'axios' import axios from 'axios'
Vue.prototype.$axios = axios Vue.prototype.$axios = axios
@ -22,7 +30,7 @@ import scroll from 'vue-seamless-scroll'
Vue.use(scroll) Vue.use(scroll)
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.component(Message.name, Message)
new Vue({ new Vue({
router, router,
store, store,

24
src/router/index.js

@ -3,14 +3,24 @@ import VueRouter from 'vue-router'
Vue.use(VueRouter) Vue.use(VueRouter)
const routes = [{
path: '/',
name: 'index',
component: () => import('../views/index.vue'),
meta: {
title: '智慧大屏'
const routes = [
{
path: '/',
name: 'index',
component: () => import('../views/index.vue'),
meta: {
title: '智慧大屏'
}
},
{
path: '/selfServiceLibrary',
name: 'selfServiceLibrary',
component: () => import('../views/indexSelfService.vue'),
meta: {
title: '24小时自助图书馆'
}
} }
}]
]
const router = new VueRouter({ const router = new VueRouter({
mode: 'history', mode: 'history',

12
src/utils/request.js

@ -1,5 +1,5 @@
import axios from 'axios' import axios from 'axios'
import { Message } from 'element-ui'
// import { Message } from 'element-ui'
// 创建axios实例 // 创建axios实例
const service = axios.create({ const service = axios.create({
@ -29,15 +29,7 @@ service.interceptors.request.use(
// response 拦截器 // response 拦截器
service.interceptors.response.use( service.interceptors.response.use(
response => { response => {
const errorMsg = response.data.message
if (response.data.code === 200) {
return response.data.data
} else {
Message.error({
message: errorMsg,
duration: 5000
})
}
return response.data
}, },
error => { error => {
return Promise.reject(error) return Promise.reject(error)

0
src/views/accessToLibrary.vue → src/views/accessToLibrary/index.vue

14
src/views/header/index.vue

@ -10,7 +10,7 @@
<div /> <div />
<div /> <div />
</div> </div>
<h2>东西湖区图书馆</h2>
<h2>{{ headerTitle }}</h2>
<div class="ball-running-dots right-dots"> <div class="ball-running-dots right-dots">
<div /> <div />
<div /> <div />
@ -33,11 +33,23 @@
import { getCurrentTime } from '@/utils/index' import { getCurrentTime } from '@/utils/index'
export default { export default {
name: 'Header', name: 'Header',
props: {
headerTitle: {
type: String,
default: function() {
return ''
}
}
},
data() { data() {
return { return {
nowDate: '' nowDate: ''
} }
}, },
watch: {
headerTitle: function() {
}
},
created() { created() {
this.timer = setInterval(() => { this.timer = setInterval(() => {
this.nowDate = getCurrentTime() this.nowDate = getCurrentTime()

20
src/views/index.vue

@ -1,6 +1,6 @@
<template> <template>
<div id="screen-container"> <div id="screen-container">
<Header />
<Header :header-title="headerTitle" />
<div class="screen-main"> <div class="screen-main">
<div class="screen-left"> <div class="screen-left">
<TotalLending /> <TotalLending />
@ -25,12 +25,12 @@
<script> <script>
import Header from '@/views/header/index.vue' import Header from '@/views/header/index.vue'
import TotalLending from '@/views/totalLending.vue'
import LengingRanking from '@/views/lengingRanking.vue'
import AccessToLibrary from '@/views/accessToLibrary.vue'
import Notice from '@/views/notice.vue'
import NewBookRecommend from '@/views/newBookRecommend.vue'
import ReadStar from '@/views/readStar.vue'
import TotalLending from '@/views/totalLending/index.vue'
import LengingRanking from '@/views/lengingRanking/index.vue'
import AccessToLibrary from '@/views/accessToLibrary/index.vue'
import Notice from '@/views/notice/index.vue'
import NewBookRecommend from '@/views/newBookRecommend/index.vue'
import ReadStar from '@/views/readStar/index.vue'
export default { export default {
name: 'Home', name: 'Home',
components: { components: {
@ -44,8 +44,10 @@ export default {
}, },
data() { data() {
return { return {
poster: 'https://image.chinamcloud.com/hbrb/upload/Image/default/2021/04/12/d0b5a55806fd45d2b4232e2fc3c7f257/0_640_400_1994.jpg',
src: 'https://hbrbvod.chinamcache.com/hbrb/vod/2021/04/12/d0b5a55806fd45d2b4232e2fc3c7f257/d0b5a55806fd45d2b4232e2fc3c7f257_h264_1000k_mp4.mp4'
headerTitle: '东西湖区图书馆',
poster: 'https://qiniu.aiyxlib.com/1658104787005.jpg',
// src: 'https://hbrbvod.chinamcache.com/hbrb/vod/2021/04/12/d0b5a55806fd45d2b4232e2fc3c7f257/d0b5a55806fd45d2b4232e2fc3c7f257_h264_1000k_mp4.mp4'
src: 'https://qiniu.aiyxlib.com/1658104739000.mp4'
} }
}, },
created() { created() {

63
src/views/indexSelfService.vue

@ -0,0 +1,63 @@
<template>
<div id="screen-container">
<Header :header-title="headerTitle" />
<div class="screen-main">
<div class="screen-left">
<TodayBorrowed :chart-data="chartData" />
<LengingRanking />
</div>
<div class="screen-middle">
<AccessToLibrary />
<div class="video-box">
<video width="100%" height="100%" controls loop autoplay muted :poster="poster">
<source :src="src" type="video/mp4">
</video>
</div>
<ReadStar />
</div>
<div class="screen-right">
<Notice />
<NewBookRecommend />
</div>
</div>
</div>
</template>
<script>
import Header from '@/views/header/index.vue'
import TodayBorrowed from '@/views/todayBorrowed/index.vue'
import LengingRanking from '@/views/lengingRanking/index.vue'
import AccessToLibrary from '@/views/accessToLibrary/index.vue'
import Notice from '@/views/notice/index.vue'
import NewBookRecommend from '@/views/newBookRecommend/index.vue'
import ReadStar from '@/views/readStar/index.vue'
export default {
name: 'Home',
components: {
Header,
TodayBorrowed,
LengingRanking,
AccessToLibrary,
ReadStar,
Notice,
NewBookRecommend
},
data() {
return {
headerTitle: '24小时自助图书馆',
poster: 'https://qiniu.aiyxlib.com/1658104787005.jpg',
src: 'https://qiniu.aiyxlib.com/1658104739000.mp4'
}
},
created() {
},
mounted() {
},
methods: {
}
}
</script>
<style lang="scss">
@import "~@/assets/styles/index.scss";
</style>

28
src/views/lengingRanking.vue → src/views/lengingRanking/index.vue

@ -4,22 +4,22 @@
<div class="common-title">借阅排行榜</div> <div class="common-title">借阅排行榜</div>
<vue-seamless-scroll :data="rankingList" :class-option="defaultOption" class="big-module module-content"> <vue-seamless-scroll :data="rankingList" :class-option="defaultOption" class="big-module module-content">
<div v-for="(item,index) in rankingList" :key="index" class="book-list-item"> <div v-for="(item,index) in rankingList" :key="index" class="book-list-item">
<img class="book-img" :src="item.img">
<img class="book-img" :src="item.cover">
<div class="book-info"> <div class="book-info">
<h4 class="title-item">{{ item.title }}</h4>
<h4 class="title-item">{{ item.bookName }}</h4>
<p>{{ item.author }}</p> <p>{{ item.author }}</p>
</div> </div>
<div class="ranking-num"> <div class="ranking-num">
<svg v-if="item.ranking === 1" class="icon" aria-hidden="true">
<svg v-if="index === 0" class="icon" aria-hidden="true">
<use xlink:href="#icon-a-no1" /> <use xlink:href="#icon-a-no1" />
</svg> </svg>
<svg v-if="item.ranking === 2" class="icon" aria-hidden="true">
<svg v-if="index === 1" class="icon" aria-hidden="true">
<use xlink:href="#icon-a-no21" /> <use xlink:href="#icon-a-no21" />
</svg> </svg>
<svg v-if="item.ranking === 3" class="icon" aria-hidden="true">
<svg v-if="index === 2" class="icon" aria-hidden="true">
<use xlink:href="#icon-a-no3" /> <use xlink:href="#icon-a-no3" />
</svg> </svg>
<p>NO.{{ item.ranking }}</p>
<p>NO.{{ index+1 }}</p>
</div> </div>
</div> </div>
</vue-seamless-scroll> </vue-seamless-scroll>
@ -27,7 +27,8 @@
</template> </template>
<script> <script>
import data from './data'
// import data from '../data'
import { FetchBorrowRank } from '@/api/library'
// import scrollMixins from '@/common/scrollMixins' // import scrollMixins from '@/common/scrollMixins'
export default { export default {
@ -47,9 +48,10 @@ export default {
} }
}, },
created() { created() {
this.rankingList = data.ranking
// this.rankingList = data.ranking
}, },
mounted() { mounted() {
this.getBorrowRank()
// this.dataCompleteFun() // this.dataCompleteFun()
}, },
destroyed() { destroyed() {
@ -60,6 +62,16 @@ export default {
this.scrollTimer = null this.scrollTimer = null
}, },
methods: { methods: {
getBorrowRank() {
FetchBorrowRank().then(res => {
if (res.errCode === 0) {
console.log(res)
this.rankingList = res.data
} else {
this.$message.error('接口错误')
}
})
},
dataCompleteFun() { dataCompleteFun() {
this.scrollDom = this.$refs.lendList this.scrollDom = this.$refs.lendList
this.interval = 50 this.interval = 50

2
src/views/newBookRecommend.vue → src/views/newBookRecommend/index.vue

@ -31,7 +31,7 @@
</template> </template>
<script> <script>
import data from './data'
import data from '../data'
import scrollMixins from '@/common/scrollMixins' import scrollMixins from '@/common/scrollMixins'
import { swiper, swiperSlide } from 'vue-awesome-swiper' import { swiper, swiperSlide } from 'vue-awesome-swiper'
import 'swiper/dist/css/swiper.css' import 'swiper/dist/css/swiper.css'

0
src/views/notice.vue → src/views/notice/index.vue

2
src/views/readStar.vue → src/views/readStar/index.vue

@ -23,7 +23,7 @@
<script> <script>
import scrollMixins from '@/common/scrollMixins' import scrollMixins from '@/common/scrollMixins'
import data from './data'
import data from '../data'
export default { export default {
name: 'ReadStar', name: 'ReadStar',
mixins: [scrollMixins], mixins: [scrollMixins],

61
src/views/todayBorrowed/index.vue

@ -0,0 +1,61 @@
<template>
<!-- 今日图书借还 -->
<div class="screen-item total-lending">
<div class="common-title">今日图书借还</div>
<div class="small-module module-content">
<div class="chart-wrapper" style="height: calc(100%);">
<LineChartService :chart-data="chartData" />
</div>
</div>
</div>
</template>
<script>
import LineChartService from '@/components/echart/lineChartService'
import { FetchHalfYearBorrowNum } from '@/api/library'
export default {
name: 'TodayBorrowed',
components: {
LineChartService
},
data() {
return {
chartData: {
returnData: [0, 232, 101, 264, 90, 500, 250],
borrowedData: [130, 60, 400, 234, 120, 340, 600]
}
}
},
created() {
},
mounted() {
// this.getHalfYearBorrowNum()
},
methods: {
getHalfYearBorrowNum() {
const params = {
ip: '111'
}
FetchHalfYearBorrowNum(params).then(res => {
console.log(res)
if (res.errCode === 0) {
// this.totalLendData = res.data.total
// this.chartData.totalLendMonth = res.data.list.map(item => {
// return item.date
// })
// this.chartData.totalLendData = res.data.list.map(item => {
// return item.total
// })
} else {
this.$message.error('接口错误')
}
})
}
}
}
</script>
<style lang="scss">
@import "~@/assets/styles/index.scss";
</style>

55
src/views/totalLending.vue → src/views/totalLending/index.vue

@ -9,7 +9,7 @@
</div> </div>
</div> </div>
<div class="chart-wrapper" style="height: calc(100% - 68px);"> <div class="chart-wrapper" style="height: calc(100% - 68px);">
<LineChart />
<LineChart :chart-data="chartData" />
</div> </div>
</div> </div>
</div> </div>
@ -17,6 +17,7 @@
<script> <script>
import LineChart from '@/components/echart/lineChart' import LineChart from '@/components/echart/lineChart'
import { FetchHalfYearBorrowNum } from '@/api/library'
export default { export default {
name: 'TotalLending', name: 'TotalLending',
components: { components: {
@ -24,18 +25,44 @@ export default {
}, },
data() { data() {
return { return {
chartNum: ['0', '0', '0', '0', '0', '0', '0', '0', '0']
totalLendData: null,
chartNum: ['0', '0', '0', '0', '0', '0', '0', '0', '0'],
chartData: {
totalLendMonth: [],
totalLendData: []
}
} }
}, },
created() { created() {
},
mounted() {
this.$nextTick(() => { this.$nextTick(() => {
this.start() this.start()
}) })
this.getHalfYearBorrowNum()
},
mounted() {
}, },
methods: { methods: {
start() {
getHalfYearBorrowNum() {
const params = {
ip: null
}
FetchHalfYearBorrowNum(params).then(res => {
if (res.errCode === 0) {
this.totalLendData = res.data.total
this.chartData.totalLendMonth = res.data.list.map(item => {
return item.date
})
this.chartData.totalLendData = res.data.list.map(item => {
return item.total
})
this.toOrderNum(this.totalLendData)
this.setNumberTransform()
} else {
this.$message.error('接口错误')
}
})
},
start(total) {
var strHtml = '' var strHtml = ''
for (var i = 0; i < this.chartNum.length; i++) { for (var i = 0; i < this.chartNum.length; i++) {
strHtml += '<li class="number-item">\n' + strHtml += '<li class="number-item">\n' +
@ -43,22 +70,16 @@ export default {
' </li>' ' </li>'
} }
document.getElementById('TNum').innerHTML = strHtml document.getElementById('TNum').innerHTML = strHtml
//
const _this = this
setInterval(() => {
_this.toOrderNum('123456')
_this.setNumberTransform()
}, 1000)
}, },
toOrderNum(num) { toOrderNum(num) {
num = num.toString() //
if (num.length < 9) { // "0"
num = num.toString()
if (num.length < 9) {
num = '0' + num num = '0' + num
this.toOrderNum(num) // "0"
} else if (num.length === 9) { //
this.chartNum = num.split('') // 便
this.toOrderNum(num)
} else if (num.length === 9) {
this.chartNum = num.split('')
} else { } else {
alert('显示异常')
console.log('借阅数据总数显示异常')
} }
}, },
setNumberTransform() { setNumberTransform() {

8
vue.config.js

@ -10,21 +10,21 @@ module.exports = {
lintOnSave: process.env.NODE_ENV === 'development', lintOnSave: process.env.NODE_ENV === 'development',
productionSourceMap: false, productionSourceMap: false,
devServer: { devServer: {
port: 3000,
port: 8080,
open: true, open: true,
overlay: { overlay: {
warnings: false, warnings: false,
errors: true errors: true
}, },
proxy: { proxy: {
'/api': {
'/txhtsg/': {
target: process.env.VUE_APP_BASE_API, target: process.env.VUE_APP_BASE_API,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
'^/api': 'api'
'^/txhtsg': 'txhtsg'
} }
}, },
'/auth': {
'/auth/': {
target: process.env.VUE_APP_BASE_API, target: process.env.VUE_APP_BASE_API,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {

Loading…
Cancel
Save