更新代码 #87

Merged
yezian merged 1 commits from anln into main 2024-07-01 20:27:37 +08:00
1 changed files with 12 additions and 6 deletions
Showing only changes of commit 2a45029c77 - Show all commits

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) => {