更新代码
This commit is contained in:
parent
bf30559510
commit
2a45029c77
|
@ -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) => {
|
||||
|
|
Loading…
Reference in New Issue