Browse Source

pageOne云标签适配

master
xuhuajiao 2 years ago
parent
commit
df74b4f16a
  1. 1
      src/utils/request.js
  2. 25
      src/views/pageOne/index.vue
  3. 5
      src/views/pageThree/index.vue

1
src/utils/request.js

@ -1,6 +1,5 @@
import axios from 'axios' import axios from 'axios'
// import { Message } from 'element-ui' // import { Message } from 'element-ui'
console.log('window.g.ApiUrl', window.g.ApiUrl)
// 创建axios实例 // 创建axios实例
const service = axios.create({ const service = axios.create({
// baseURL: process.env.NODE_ENV === 'production' ? process.env.VUE_APP_BASE_API : '/', // api 的 base_url // baseURL: process.env.NODE_ENV === 'production' ? process.env.VUE_APP_BASE_API : '/', // api 的 base_url

25
src/views/pageOne/index.vue

@ -302,10 +302,10 @@ export default {
// lastMonthVisitBaseCheck 是否显示 // lastMonthVisitBaseCheck 是否显示
const baseTotal = this.pageOneVisitBase // 本年到馆人数 const baseTotal = this.pageOneVisitBase // 本年到馆人数
console.log('假设本年到馆人数', baseTotal)
// console.log('假设本年到馆人数', baseTotal)
// 本年到馆/12个月 = 月基数 // 本年到馆/12个月 = 月基数
const monthBase = Math.floor(baseTotal / 12) // 月基数 const monthBase = Math.floor(baseTotal / 12) // 月基数
console.log('月基数', monthBase)
// console.log('月基数', monthBase)
// 月随机数(-100到200之间) // 月随机数(-100到200之间)
const randomMonth = Math.floor(Math.random() * (200 - (-100) + 1)) + (-100) const randomMonth = Math.floor(Math.random() * (200 - (-100) + 1)) + (-100)
@ -313,10 +313,10 @@ export default {
const year = now.getFullYear() // 当前年份 const year = now.getFullYear() // 当前年份
const month = now.getMonth() + 1 // 当前月份 const month = now.getMonth() + 1 // 当前月份
const daysInMonth = new Date(year, month, 0).getDate() // 当月天数 const daysInMonth = new Date(year, month, 0).getDate() // 当月天数
console.log('当月天数', daysInMonth)
// console.log('当月天数', daysInMonth)
// 月基数/当月天数(28、29、30、31)= 日基数 // 月基数/当月天数(28、29、30、31)= 日基数
const dayBase = Math.floor(monthBase / daysInMonth) // 日基数 const dayBase = Math.floor(monthBase / daysInMonth) // 日基数
console.log('日基数', dayBase)
// console.log('日基数', dayBase)
// 本年累计=月基数*月份+月随机数(-100到200之间) // 本年累计=月基数*月份+月随机数(-100到200之间)
let nowYearCount let nowYearCount
if (result.visitBaseCheck === '1') { if (result.visitBaseCheck === '1') {
@ -324,7 +324,7 @@ export default {
} else { } else {
nowYearCount = Math.floor(monthBase * month + randomMonth) // 本年累计 nowYearCount = Math.floor(monthBase * month + randomMonth) // 本年累计
} }
console.log('本年累计', nowYearCount)
// console.log('本年累计', nowYearCount)
// 昨日到馆=日基数+日随机数(-20到50之间) // 昨日到馆=日基数+日随机数(-20到50之间)
let yesterdayCount = 0 let yesterdayCount = 0
if (result.yesterdayVisitBaseCheck === '1') { if (result.yesterdayVisitBaseCheck === '1') {
@ -333,7 +333,7 @@ export default {
const randomDay = Math.floor(Math.random() * (50 - (-20) + 1)) + (-20) // 日随机数(-20到50之间) const randomDay = Math.floor(Math.random() * (50 - (-20) + 1)) + (-20) // 日随机数(-20到50之间)
yesterdayCount = localStorage.getItem('yesterdayCountCache') ? localStorage.getItem('yesterdayCountCache') : dayBase + randomDay // 昨日到馆 yesterdayCount = localStorage.getItem('yesterdayCountCache') ? localStorage.getItem('yesterdayCountCache') : dayBase + randomDay // 昨日到馆
} }
console.log('昨日到馆', yesterdayCount)
// console.log('昨日到馆', yesterdayCount)
// 上月到馆=月基数+月随机数(-100到200之间) // 上月到馆=月基数+月随机数(-100到200之间)
let lastMonthCount = 0 let lastMonthCount = 0
if (result.lastMonthVisitBaseCheck === '1') { if (result.lastMonthVisitBaseCheck === '1') {
@ -341,11 +341,11 @@ export default {
} else { } else {
lastMonthCount = localStorage.getItem('lastMonthCountCache') ? localStorage.getItem('lastMonthCountCache') : monthBase + randomMonth lastMonthCount = localStorage.getItem('lastMonthCountCache') ? localStorage.getItem('lastMonthCountCache') : monthBase + randomMonth
} }
console.log('上月到馆', lastMonthCount)
// console.log('上月到馆', lastMonthCount)
// 日基数/10小时=小时基数 // 日基数/10小时=小时基数
const hourBase = Math.floor(dayBase / 10) // 小时基数 const hourBase = Math.floor(dayBase / 10) // 小时基数
console.log('小时基数', hourBase)
// console.log('小时基数', hourBase)
// 图书馆营业时间(8:00-18:00共10小时) // 图书馆营业时间(8:00-18:00共10小时)
// 8:00-9:00 算第1个小时、9:00-10:00算第2个小时、以此类推 // 8:00-9:00 算第1个小时、9:00-10:00算第2个小时、以此类推
const openTime = 8 // 开门时间 const openTime = 8 // 开门时间
@ -362,12 +362,12 @@ export default {
todayCount = 0 todayCount = 0
} else { } else {
const N = currentHour - openTime const N = currentHour - openTime
console.log('第N个小时', N)
// console.log('第N个小时', N)
const randomHour = Math.floor(Math.random() * (10 - (-5) + 1)) + (-5) // 小时随机数(-5到10之间) const randomHour = Math.floor(Math.random() * (10 - (-5) + 1)) + (-5) // 小时随机数(-5到10之间)
todayCount = Math.floor(hourBase * N + randomHour) // 今日到馆 todayCount = Math.floor(hourBase * N + randomHour) // 今日到馆
} }
} }
console.log('今日到馆', todayCount)
// console.log('今日到馆', todayCount)
// 本月到馆=月基数 * (当前月的日期dd/当前月的天数)+ 月随机数(-100到200之间) // 本月到馆=月基数 * (当前月的日期dd/当前月的天数)+ 月随机数(-100到200之间)
let nowMonthCount = 0 let nowMonthCount = 0
if (result.thisMonthVisitBaseCheck === '1') { if (result.thisMonthVisitBaseCheck === '1') {
@ -375,7 +375,7 @@ export default {
} else { } else {
nowMonthCount = Math.floor(monthBase * (now.getDate() / daysInMonth) + randomMonth) // 本月到馆 nowMonthCount = Math.floor(monthBase * (now.getDate() / daysInMonth) + randomMonth) // 本月到馆
} }
console.log('本月到馆', nowMonthCount)
// console.log('本月到馆', nowMonthCount)
this.progressData.push( this.progressData.push(
{ {
@ -471,7 +471,7 @@ export default {
// this.$parent.timedRefresh(this.middleData, 'middle') // this.$parent.timedRefresh(this.middleData, 'middle')
// }, 8000) // }, 8000)
}).catch(error => { }).catch(error => {
console.error('Error fetching data:', error)
console.error('Error:', error)
}) })
}, },
// 馆藏量 // 馆藏量
@ -641,6 +641,7 @@ export default {
phi = Math.random() * (Math.PI) phi = Math.random() * (Math.PI)
theta = Math.random() * (2 * Math.PI) theta = Math.random() * (2 * Math.PI)
} }
this.radius = this.oList.offsetWidth / 2 - 40
// 坐标变换 // 坐标变换
this.mcList[i - 1].cx = this.radius * Math.cos(theta) * Math.sin(phi) this.mcList[i - 1].cx = this.radius * Math.cos(theta) * Math.sin(phi)
this.mcList[i - 1].cy = this.radius * Math.sin(theta) * Math.sin(phi) this.mcList[i - 1].cy = this.radius * Math.sin(theta) * Math.sin(phi)

5
src/views/pageThree/index.vue

@ -229,9 +229,6 @@ export default {
this.$parent.timedRefresh(this.todayTotal, 'todayTotal') this.$parent.timedRefresh(this.todayTotal, 'todayTotal')
this.$parent.timedRefresh(this.yearTotal, 'yearTotal') this.$parent.timedRefresh(this.yearTotal, 'yearTotal')
console.log('this.todayTotal', this.todayTotal)
console.log('this.yearTotal', this.yearTotal)
} else { } else {
this.todayTotal = [] this.todayTotal = []
this.yearTotal = [] this.yearTotal = []
@ -383,8 +380,6 @@ export default {
this.chartWeeklyData.inchartWeeklyData = completeData.map(item => item.hccDayTotal) this.chartWeeklyData.inchartWeeklyData = completeData.map(item => item.hccDayTotal)
// // out 借出 // // out 借出
this.chartWeeklyData.outchartWeeklyData = completeData.map(item => item.jccDayTotal) this.chartWeeklyData.outchartWeeklyData = completeData.map(item => item.jccDayTotal)
console.log(this.chartWeeklyData.date)
} else { } else {
this.chartWeeklyData = { this.chartWeeklyData = {
date: [], date: [],

Loading…
Cancel
Save