feat: 接口修改
This commit is contained in:
parent
025a2a2aa6
commit
6290f2cc3a
@ -420,7 +420,7 @@ onUnmounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.item_header {
|
.item_header {
|
||||||
margin-left: 20px;
|
margin-left: 10px;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
max-width: 450px;
|
max-width: 450px;
|
||||||
@ -445,7 +445,8 @@ onUnmounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.item_time {
|
.item_time {
|
||||||
margin-right: 40px;
|
// margin-right: 70px;
|
||||||
|
padding-right: 30px;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
color: #7E8990;
|
color: #7E8990;
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,8 @@ import cloneDeep from 'lodash/cloneDeep'
|
|||||||
import dataJson from './data.json'
|
import dataJson from './data.json'
|
||||||
export const includes = []
|
export const includes = []
|
||||||
const BAR_ITEM_DEFAULT_COLORS = [
|
const BAR_ITEM_DEFAULT_COLORS = [
|
||||||
{ color: "#61DDAA", wfColor: "#8F7830" },
|
{ color: "#23B2D3", wfColor: "#8F7830" },
|
||||||
{ color: "#AF380E", wfColor: "#BD1408" },
|
{ color: "#9B7E2D", wfColor: "#BD1408" },
|
||||||
{ color: "#047DB0", wfColor: "#02BBD1" },
|
{ color: "#047DB0", wfColor: "#02BBD1" },
|
||||||
{ color: "#01E5A9", wfColor: "#01C97F" },
|
{ color: "#01E5A9", wfColor: "#01C97F" },
|
||||||
];
|
];
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"barOptions": [
|
"barOptions": [
|
||||||
{"location": "河北省.唐山市", "items":[{"tall":100}]},
|
{"location": "河北省.唐山市", "items":[{"tall":100},{"tall":40}]},
|
||||||
{"location": "辽宁省.大连市", "items":[{"tall":100}]},
|
{"location": "辽宁省.大连市", "items":[{"tall":100},{"tall":40}]},
|
||||||
{"location": "江苏省.常州市", "items":[{"tall":200}]},
|
{"location": "江苏省.常州市", "items":[{"tall":200},{"tall":40}]},
|
||||||
{"location": "江苏省.南京市", "items":[{"tall":200}]},
|
{"location": "江苏省.南京市", "items":[{"tall":200},{"tall":40}]},
|
||||||
{"location": "吉林省.长春市", "items":[{"tall":100}]}
|
{"location": "吉林省.长春市", "items":[{"tall":100},{"tall":40}]}
|
||||||
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -54,9 +54,9 @@ const selectButton = (id: number) => {
|
|||||||
const updateChartData = async (buttonId: number) => {
|
const updateChartData = async (buttonId: number) => {
|
||||||
let dataToRender: BarOption[] = [];
|
let dataToRender: BarOption[] = [];
|
||||||
if (buttonId === 1) {
|
if (buttonId === 1) {
|
||||||
dataToRender = await fetchData('/spaceMap');
|
dataToRender = await fetchData('/spaceMapMock');
|
||||||
} else if (buttonId === 2) {
|
} else if (buttonId === 2) {
|
||||||
dataToRender = await fetchData('/dayMap');
|
dataToRender = await fetchData('/dayMapMock');
|
||||||
} else {
|
} else {
|
||||||
console.warn(`未知的按钮ID: ${buttonId},将使用默认数据。`);
|
console.warn(`未知的按钮ID: ${buttonId},将使用默认数据。`);
|
||||||
}
|
}
|
||||||
@ -65,6 +65,11 @@ const updateChartData = async (buttonId: number) => {
|
|||||||
console.log(`已为按钮 ${buttonId} 加载 ${dataToRender.length} 条数据。`);
|
console.log(`已为按钮 ${buttonId} 加载 ${dataToRender.length} 条数据。`);
|
||||||
};
|
};
|
||||||
const fetchData = async (url: string) => {
|
const fetchData = async (url: string) => {
|
||||||
|
if (url == '/spaceMapMock') {
|
||||||
|
return dataJson.barOptions;
|
||||||
|
} else if (url == '/dayMapMock') {
|
||||||
|
return [{ "location": "四川省.成都市", "items": [{ "tall": 120, "color": "#ff4757" }, { "tall": 50, "color": "#3A86FF" }] }, { "location": "广东省.深圳市", "items": [{ "tall": 90, "color": "#5352ed" }, { "tall": 40, "color": "#5352ed" }] }, { "location": "浙江省.杭州市", "items": [{ "tall": 150, "color": "#ff4757" }, { "tall": 70, "color": "#4ECDC4" }] }, { "location": "江苏省.南京市", "items": [{ "tall": 100, "color": "#ff4757" }, { "tall": 45, "color": "#FFD166" }] }, { "location": "湖北省.武汉市", "items": [{ "tall": 110, "color": "#ff4757" }, { "tall": 52, "color": "#6A0572" }] }, { "location": "陕西省.西安市", "items": [{ "tall": 85, "color": "#ff4757" }, { "tall": 38, "color": "#1A535C" }] }, { "location": "山东省.青岛市", "items": [{ "tall": 130, "color": "#ff4757" }, { "tall": 60, "color": "#FF8C42" }] }, { "location": "河南省.郑州市", "items": [{ "tall": 95, "color": "#ff4757" }, { "tall": 43, "color": "#7209B7" }] }, { "location": "福建省.厦门市", "items": [{ "tall": 140, "color": "#ff4757" }, { "tall": 65, "color": "#06D6A0" }] }, { "location": "辽宁省.大连市", "items": [{ "tall": 88, "color": "#ff4757" }, { "tall": 41, "color": "#118AB2" }] }]
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const response = await axios.get(`/dev${url}`);
|
const response = await axios.get(`/dev${url}`);
|
||||||
if (response.data.state === true && response.data.value && response.data.value.length > 0) {
|
if (response.data.state === true && response.data.value && response.data.value.length > 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user