Merge pull request '更新代码' (#87) from anln into main

Reviewed-on: https://git.wishpal.cn/wishpal_ironfan/tiefen_space_web/pulls/87
This commit is contained in:
yezian 2024-07-01 20:27:37 +08:00
commit 5e47447ad7
1 changed files with 12 additions and 6 deletions

View File

@ -17,6 +17,16 @@ export default function IncomeQuerry({ children }) {
useEffect(() => {
getData();
}, []);
useEffect(() => {
if(databoard.current&&data.week_dashboard){
createDataBoard(data.week_dashboard);
}
}, [databoard.current]);
useEffect(() => {
if(incomeOrgin.current && data.income_from_dashboard){
createIncomeOrgin(data.income_from_dashboard);
}
}, [incomeOrgin.current]);
const getData = async () => {
const base = webviewBaseRequest();
const signature = generateSignature({
@ -40,12 +50,11 @@ export default function IncomeQuerry({ children }) {
return total + item.income;
}, 0);
data && setData({ ...data, weekIncom });
createDataBoard(data.week_dashboard);
createIncomeOrgin(data.income_from_dashboard);
} catch (error) {}
};
const createDataBoard = (data) => {
if (databoard.current) {
var myChart = echarts.init(databoard.current, "dark");
var option;
option = {
@ -114,10 +123,8 @@ export default function IncomeQuerry({ children }) {
],
};
option && myChart.setOption(option);
}
};
const createIncomeOrgin = (data) => {
if (incomeOrgin.current) {
var myChart = echarts.init(incomeOrgin.current, "dark");
var option;
option = {
@ -179,7 +186,6 @@ export default function IncomeQuerry({ children }) {
],
};
option && myChart.setOption(option);
}
};
const getDateStr = (data) => {