Compare commits

...

2 Commits

Author SHA1 Message Date
xielue fba56eb861 Merge branch 'main' of https://git.positivepole.cn/dev/GScreenWEB_TPMes 2025-05-23 18:35:26 +08:00
xielue 5d744eef17 接口优化 2025-05-23 18:32:43 +08:00
8 changed files with 71 additions and 40 deletions

View File

@ -1,35 +1,82 @@
<template>
<div id="app">
<datav2 v-if="dataType==4"/>
<datav3 v-else-if="dataType==5"/>
<datav v-else/>
<component :is="currentComponent" />
</div>
</template>
<script>
import datav from './components/baozuo-demo/index.vue'
import datav2 from './components/baozuo-demo2/index.vue'
import datav3 from './components/baozuo-demo3/index.vue'
// import datav from './components/datav/index.vue'
// import datav from './components/zidingyi/index.vue'
import api from './api.js'
//import testRes from './components/baozuo-demo/test'
const queryParams = new URLSearchParams(window.location.search);
const dataTypeParam = queryParams.get('q');
export default {
name: 'app',
components: {
datav,datav2,datav3
},
data() {
return {
dataType: ''
dataType: '',
//testRes
currentComponent: null
}
},
components: {
//
datav2: () => import('./components/baozuo-demo2/index.vue'),
datav: () => import('./components/baozuo-demo/index.vue')
},
created() {
this.dataType = dataTypeParam;
if (this.dataType == '3') {
this.init();
} else {
this.currentComponent = this.dataType == 4 ? 'datav2' : 'datav';
}
},
computed: {
},
methods: {
init() {
/**
* 获取当前地址
* @returns {string} 当前地址
*/
function getCurrentAddress() {
if (typeof window !== 'undefined' && window.location) {
return window.location.origin;
} else {
console.warn('当前环境非浏览器环境,无法使用 window.location 获取地址');
return null;
}
}
console.log(api.baseURL)
if (getCurrentAddress().includes('192.168') || api.baseURL.includes('natool')) {
console.log('当前环境为开发环境');
api.post2('/api/web/getBiData', ["yx_v_scgdgk", "yx_v_byzcl", "yx_v_wwcscdd", "yx_v_bzcl1w", "yx_v_bzcl6m", "yx_v_pgjd"]).then(res => {
window.htd_bidata = res;
console.log(window.htd_bidata);
this.currentComponent = 'datav';
}).catch(() => {
//window.htd_bidata = testRes;
console.log(window.htd_bidata);
this.currentComponent = 'datav';
})
} else {
//window.htd_bidata = testRes;
this.currentComponent = 'datav';
}
}
}
}
</script>

View File

@ -8,6 +8,8 @@ const api = {
baseURL: 'http://36.139.158.169:9261',
baseURL3: 'http://vmikhs.demo.natool.cn',
get (url) {
return new Promise((resolve, reject) => {
axios({

View File

@ -29,7 +29,7 @@
<script>
import LabelTag from './LabelTag'
import testRes from './test'
let testRes = window.htd_bidata;
let timer = null;
export default {
name: 'BottomCharts',

View File

@ -122,7 +122,8 @@
import LabelTag from './LabelTag'
import PieChart from './pieChart.vue'
import * as echarts from 'echarts';
import testRes from './test'
let testRes = window.htd_bidata;
console.log(testRes)
export default {

View File

@ -26,7 +26,8 @@ function getRecentWeekDates() {
}
import * as echarts from 'echarts';
import testRes from './test';
let testRes = window.htd_bidata;
console.log(testRes)
export default {
name: 'RoseChart',

View File

@ -23,7 +23,8 @@ function getRecentSixMonths() {
return months;
}
import testRes from './test';
let testRes = window.htd_bidata;
console.log(testRes)
export default {
name: 'RoseChart',

View File

@ -36,7 +36,7 @@
<script>
import * as echarts from 'echarts';
import testRes from './test'
let testRes = window.htd_bidata;
console.log(testRes)
export default {
name: 'RoseChart',

View File

@ -1,4 +1,4 @@
import api from '../../api.js'
let testRes = {
"code": "200",
"data": {
@ -3197,28 +3197,7 @@ let testRes = {
]
}
}
/**
* 获取当前地址
* @returns {string} 当前地址
*/
function getCurrentAddress() {
if (typeof window !== 'undefined' && window.location) {
return window.location.origin;
} else {
console.warn('当前环境非浏览器环境,无法使用 window.location 获取地址');
return null;
}
}
if(getCurrentAddress().includes('192.168')){
console.log('当前环境为开发环境');
api.post2('/api/web/getBiData').then(res => {
if(res.code === 200){
testRes = res;
}
})
}else{
console.log('当前环境为生产环境');
}
export default testRes