diff --git a/.env.development b/.env.development index 41e54d6..82bda74 100644 --- a/.env.development +++ b/.env.development @@ -3,7 +3,7 @@ ENV = 'development' # 接口地址 # 许镇-本地服地址 -VUE_APP_BASE_API = 'http://192.168.99.67:8080' +VUE_APP_BASE_API = 'http://192.168.99.67:6066' # VUE_APP_BASE_API = 'http://27.19.209.92:13244' VUE_APP_LIB_API = 'http://118.253.150.248:8099' diff --git a/public/static/config.js b/public/static/config.js index d02709c..862e0f3 100644 --- a/public/static/config.js +++ b/public/static/config.js @@ -1,5 +1,5 @@ window.g = { AXIOS_TIMEOUT: 10000, - ApiUrl: 'http://27.16.212.58:11100', // 配置服务器地址, + ApiUrl: 'http://192.168.99.107:6066', // 配置服务器地址, LibUrl: 'http://118.253.150.248:8099' // 图创地址 } diff --git a/src/assets/styles/index.scss b/src/assets/styles/index.scss index 6f19580..5304a62 100644 --- a/src/assets/styles/index.scss +++ b/src/assets/styles/index.scss @@ -735,26 +735,26 @@ justify-content: space-between; align-items: center; flex-wrap: nowrap; - padding: .625rem .275rem 0 .125rem; + padding: .625rem .125rem 0 0; .allTotal{ - width: 48%; + width: 50%; height: 1.1rem; - padding-left: 1.125rem; + padding-left: 1.15rem; background: url('~@/assets/images/database-icon1.png') no-repeat left top; background-size: 100% 100%; } .currentNum, .lastYearTotal{ - width: 48%; + width: 50%; height: 1.1rem; - padding-left: 1.125rem; + padding-left: 1.1rem; background: url('~@/assets/images/database-icon2.png') no-repeat left top; background-size: 100% 100%; } .flop-figure { position: relative; display: inline-block; - width: .275rem; + width: .28rem; height: 100%; line-height: 0.15rem; overflow: hidden; @@ -826,10 +826,10 @@ display: flex; justify-content: space-between; flex-wrap: wrap; - padding: 0 .375rem 0 .5rem; + padding: 0 .25rem 0 .38rem; li{ position: relative; - width: 2.2rem; + width: 2.38rem; font-size: .225rem; padding-left: .1625rem; margin-top: .7rem; diff --git a/src/views/index.vue b/src/views/index.vue index 1519add..0aa9db5 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -158,7 +158,7 @@ export default { // selectorder 显示的屏和顺序 1第一屏 2第二屏 // show1 第一屏显示时间 // show2 第二屏显示时间 - const linkSrc = process.env.VUE_APP_BASE_API + const linkSrc = process.env.NODE_ENV === 'production' ? window.g.ApiUrl : process.env.VUE_APP_BASE_API FetchInitSetting().then(res => { const result = JSON.parse(res.data) this.wecharQrCodeSrc = linkSrc + '/downloadFile' + result.wecharQrCode diff --git a/src/views/map/index.vue b/src/views/map/index.vue index d12a517..82fe568 100644 --- a/src/views/map/index.vue +++ b/src/views/map/index.vue @@ -858,7 +858,7 @@ export default { }, updatePageWithData() { this.displayedImages = [] - const linkSrc = process.env.VUE_APP_BASE_API + const linkSrc = process.env.NODE_ENV === 'production' ? window.g.ApiUrl : process.env.VUE_APP_BASE_API const params = { 'branchId': this.libCurrent.id } diff --git a/src/views/pageFour/index.vue b/src/views/pageFour/index.vue index b815c90..aee333b 100644 --- a/src/views/pageFour/index.vue +++ b/src/views/pageFour/index.vue @@ -193,7 +193,8 @@ export default { }, getInitData() { // wecharQrCode 二维码 用/downloadFile/+wecharQrCode - const linkSrc = process.env.VUE_APP_BASE_API + const linkSrc = process.env.NODE_ENV === 'production' ? window.g.ApiUrl : process.env.VUE_APP_BASE_API + console.log('linkSrc', linkSrc) FetchInitSetting().then(res => { const result = JSON.parse(res.data) this.wecharQrCodeSrc = linkSrc + '/downloadFile' + result.wecharQrCode @@ -230,7 +231,7 @@ export default { getVideoResource() { FetchTotalResource().then(res => { const result = JSON.parse(res.data) - const linkSrc = process.env.VUE_APP_BASE_API + const linkSrc = process.env.NODE_ENV === 'production' ? window.g.ApiUrl : process.env.VUE_APP_BASE_API this.slideData = result.map((item, index) => { if (item.filePath) { item.cover = linkSrc + '/downloadFile' + item.filePath diff --git a/src/views/pageOne/index.vue b/src/views/pageOne/index.vue index 134b08c..b076848 100644 --- a/src/views/pageOne/index.vue +++ b/src/views/pageOne/index.vue @@ -242,6 +242,12 @@ export default { } }, async created() { + if (localStorage.getItem('yesterdayCountCache')) { + localStorage.removeItem('yesterdayCountCache') + } + if (localStorage.getItem('lastMonthCountCache')) { + localStorage.removeItem('lastMonthCountCache') + } // this.getInitData() this.getMiddleAllData() this.getHotSearch() @@ -269,7 +275,8 @@ export default { // visitBase 本年到馆基础数 // wecharQrCode 二维码 用/downloadFile/+wecharQrCode // iNotice 公告 - const linkSrc = process.env.VUE_APP_BASE_API + const linkSrc = process.env.NODE_ENV === 'production' ? window.g.ApiUrl : process.env.VUE_APP_BASE_API + console.log('linkSrc', linkSrc) FetchInitSetting().then(res => { const result = JSON.parse(res.data) this.pageOneVisitBase = result.visitBase @@ -302,10 +309,10 @@ export default { // lastMonthVisitBaseCheck 是否显示 const baseTotal = this.pageOneVisitBase // 本年到馆人数 - // console.log('假设本年到馆人数', baseTotal) + console.log('假设本年到馆人数', baseTotal) // 本年到馆/12个月 = 月基数 const monthBase = Math.floor(baseTotal / 12) // 月基数 - // console.log('月基数', monthBase) + console.log('月基数', monthBase) // 月随机数(-100到200之间) const randomMonth = Math.floor(Math.random() * (200 - (-100) + 1)) + (-100) @@ -313,10 +320,10 @@ export default { const year = now.getFullYear() // 当前年份 const month = now.getMonth() + 1 // 当前月份 const daysInMonth = new Date(year, month, 0).getDate() // 当月天数 - // console.log('当月天数', daysInMonth) + console.log('当月天数', daysInMonth) // 月基数/当月天数(28、29、30、31)= 日基数 const dayBase = Math.floor(monthBase / daysInMonth) // 日基数 - // console.log('日基数', dayBase) + console.log('日基数', dayBase) // 本年累计=月基数*月份+月随机数(-100到200之间) let nowYearCount if (result.visitBaseCheck === '1') { @@ -324,28 +331,30 @@ export default { } else { nowYearCount = Math.floor(monthBase * month + randomMonth) // 本年累计 } - // console.log('本年累计', nowYearCount) + console.log('本年累计', nowYearCount) // 昨日到馆=日基数+日随机数(-20到50之间) let yesterdayCount = 0 if (result.yesterdayVisitBaseCheck === '1') { yesterdayCount = result.yesterdayVisitBase } else { 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 // 昨日到馆 + yesterdayCount = dayBase + randomDay // 昨日到馆 } - // console.log('昨日到馆', yesterdayCount) + console.log('昨日到馆', yesterdayCount) // 上月到馆=月基数+月随机数(-100到200之间) let lastMonthCount = 0 if (result.lastMonthVisitBaseCheck === '1') { lastMonthCount = result.lastMonthVisitBase } else { - lastMonthCount = localStorage.getItem('lastMonthCountCache') ? localStorage.getItem('lastMonthCountCache') : monthBase + randomMonth + // lastMonthCount = localStorage.getItem('lastMonthCountCache') ? localStorage.getItem('lastMonthCountCache') : monthBase + randomMonth + lastMonthCount = monthBase + randomMonth } - // console.log('上月到馆', lastMonthCount) + console.log('上月到馆', lastMonthCount) // 日基数/10小时=小时基数 const hourBase = Math.floor(dayBase / 10) // 小时基数 - // console.log('小时基数', hourBase) + console.log('小时基数', hourBase) // 图书馆营业时间(8:00-18:00共10小时) // 8:00-9:00 算第1个小时、9:00-10:00算第2个小时、以此类推 const openTime = 8 // 开门时间 @@ -367,15 +376,19 @@ export default { todayCount = Math.floor(hourBase * N + randomHour) // 今日到馆 } } - // console.log('今日到馆', todayCount) + console.log('今日到馆', todayCount) // 本月到馆=月基数 * (当前月的日期dd/当前月的天数)+ 月随机数(-100到200之间) let nowMonthCount = 0 if (result.thisMonthVisitBaseCheck === '1') { nowMonthCount = result.thisMonthVisitBase } else { - nowMonthCount = Math.floor(monthBase * (now.getDate() / daysInMonth) + randomMonth) // 本月到馆 + if (now.getDate() === 1) { + nowMonthCount = todayCount + } else { + nowMonthCount = Math.floor(monthBase * (now.getDate() / daysInMonth) + randomMonth) // 本月到馆 + } } - // console.log('本月到馆', nowMonthCount) + console.log('本月到馆', nowMonthCount) this.progressData.push( { @@ -416,8 +429,8 @@ export default { this.$parent.timedRefresh(this.leftData, 'left') // 昨日到馆、上月到馆存一个缓存!当前第一次计算好之后就不变了! - localStorage.setItem('yesterdayCountCache', yesterdayCount) - localStorage.setItem('lastMonthCountCache', lastMonthCount) + // localStorage.setItem('yesterdayCountCache', yesterdayCount) + // localStorage.setItem('lastMonthCountCache', lastMonthCount) }, // 热门搜索 @@ -553,7 +566,7 @@ 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 + const linkSrc = process.env.NODE_ENV === 'production' ? window.g.ApiUrl : process.env.VUE_APP_BASE_API this.newList = res.data.map(item => { if (item.nbImgPath) { item.nbImgPath = linkSrc + '/downloadFile' + item.nbImgPath