|
@ -1,14 +1,17 @@ |
|
|
import React from 'react'; |
|
|
|
|
|
|
|
|
import React, { useRef, useState, useEffect } from 'react'; |
|
|
import { BsFillLaptopFill } from 'react-icons/bs'; |
|
|
import { BsFillLaptopFill } from 'react-icons/bs'; |
|
|
import { AiFillCalendar } from 'react-icons/ai'; |
|
|
import { AiFillCalendar } from 'react-icons/ai'; |
|
|
import { GoPrimitiveDot } from 'react-icons/go'; |
|
|
import { GoPrimitiveDot } from 'react-icons/go'; |
|
|
|
|
|
import { MdWbSunny, MdBedtime } from 'react-icons/md'; |
|
|
import { IoIosMore } from 'react-icons/io'; |
|
|
import { IoIosMore } from 'react-icons/io'; |
|
|
|
|
|
import { FaSortAmountDown } from 'react-icons/fa'; |
|
|
import { DropDownListComponent } from '@syncfusion/ej2-react-dropdowns'; |
|
|
import { DropDownListComponent } from '@syncfusion/ej2-react-dropdowns'; |
|
|
|
|
|
|
|
|
import { Stacked, Pie, Button, LineChart, SparkLine } from '../components'; |
|
|
import { Stacked, Pie, Button, LineChart, SparkLine } from '../components'; |
|
|
import { earningData, medicalproBranding, recentTransactions, weeklyStats, dropdownData, SparklineAreaData, ecomPieChartData } from '../data/dummy'; |
|
|
import { earningData, medicalproBranding, recentTransactions, weeklyStats, dropdownData, SparklineAreaData, ecomPieChartData } from '../data/dummy'; |
|
|
import { useStateContext } from '../contexts/ContextProvider'; |
|
|
import { useStateContext } from '../contexts/ContextProvider'; |
|
|
import product9 from '../data/product9.jpg'; |
|
|
import product9 from '../data/product9.jpg'; |
|
|
|
|
|
import { getDayScreenUseTime } from '../service/getDayScreenUseTime/index' |
|
|
|
|
|
|
|
|
const DropDown = ({ currentMode }) => ( |
|
|
const DropDown = ({ currentMode }) => ( |
|
|
<div className="w-28 border-1 border-color px-2 py-1 rounded-md"> |
|
|
<div className="w-28 border-1 border-color px-2 py-1 rounded-md"> |
|
@ -17,13 +20,64 @@ const DropDown = ({ currentMode }) => ( |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
const Ecommerce = () => { |
|
|
const Ecommerce = () => { |
|
|
const { currentColor, currentMode } = useStateContext(); |
|
|
|
|
|
|
|
|
const { currentColor, currentMode } = useStateContext() |
|
|
|
|
|
let [earningData2, setEarningData2] = useState(earningData) |
|
|
|
|
|
|
|
|
|
|
|
useEffect(async () => { |
|
|
|
|
|
var today = new Date(); |
|
|
|
|
|
var dd = String(today.getDate()).padStart(2, '0'); |
|
|
|
|
|
var mm = String(today.getMonth() + 1).padStart(2, '0'); |
|
|
|
|
|
var yyyy = today.getFullYear(); |
|
|
|
|
|
const receivedJson = await getDayScreenUseTime(yyyy + '-' + mm + '-' + dd); |
|
|
|
|
|
console.log(receivedJson); |
|
|
|
|
|
setEarningData2([ |
|
|
|
|
|
{ |
|
|
|
|
|
icon: <BsFillLaptopFill />, |
|
|
|
|
|
amount: receivedJson.data.getDayScreenUseTimeH + '小时' + receivedJson.data.getDayScreenUseTimeM + '分' + receivedJson.data.getDayScreenUseTimeS + '秒', |
|
|
|
|
|
percentage: '+38%', |
|
|
|
|
|
title: '今日屏幕使用时间', |
|
|
|
|
|
iconColor: 'rgb(228, 106, 118)', |
|
|
|
|
|
iconBg: 'rgb(255, 244, 229)', |
|
|
|
|
|
|
|
|
|
|
|
pcColor: 'green-600', |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
icon: <MdWbSunny />, |
|
|
|
|
|
amount: receivedJson.data.firstScreenTime, |
|
|
|
|
|
percentage: '-4%', |
|
|
|
|
|
title: '第一次屏幕使用', |
|
|
|
|
|
iconColor: '#03C9D7', |
|
|
|
|
|
iconBg: '#E5FAFB', |
|
|
|
|
|
pcColor: 'red-600', |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
icon: <MdBedtime />, |
|
|
|
|
|
amount: receivedJson.data.lastScreenTime, |
|
|
|
|
|
percentage: '+23%', |
|
|
|
|
|
title: '最后一次屏幕使用', |
|
|
|
|
|
iconColor: 'rgb(255, 244, 229)', |
|
|
|
|
|
iconBg: 'rgb(0,0,0)', |
|
|
|
|
|
pcColor: 'black-600', |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
icon: <FaSortAmountDown />, |
|
|
|
|
|
amount: receivedJson.data.getScreenTimeSpanH + '小时' + receivedJson.data.getScreenTimeSpanM + '分' + receivedJson.data.getScreenTimeSpanS + '秒', |
|
|
|
|
|
percentage: '-12%', |
|
|
|
|
|
title: '时间跨度', |
|
|
|
|
|
iconColor: 'rgb(0, 194, 146)', |
|
|
|
|
|
iconBg: 'rgb(235, 250, 242)', |
|
|
|
|
|
pcColor: 'red-600', |
|
|
|
|
|
}, |
|
|
|
|
|
]) |
|
|
|
|
|
}, []) |
|
|
|
|
|
|
|
|
|
|
|
console.log(earningData2); |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<div className="mt-24"> |
|
|
<div className="mt-24"> |
|
|
{/* 第一行四个盒子 */} |
|
|
{/* 第一行四个盒子 */} |
|
|
<div className="flex flex-wrap lg:flex-nowrap justify-center "> |
|
|
<div className="flex flex-wrap lg:flex-nowrap justify-center "> |
|
|
<div className="bg-white dark:text-gray-200 dark:bg-secondary-dark-bg h-44 rounded-xl w-full lg:w-80 p-8 pt-9 m-3 bg-hero-pattern bg-no-repeat bg-cover bg-center"> |
|
|
|
|
|
|
|
|
<div className="bg-white dark:text-gray-200 darbaok:bg-secondary-dark-bg h-44 rounded-xl w-full lg:w-80 p-8 pt-9 m-3 bg-hero-pattern bg-no-repeat bg-cover bg-center"> |
|
|
<div className="flex justify-between items-center"> |
|
|
<div className="flex justify-between items-center"> |
|
|
<div> |
|
|
<div> |
|
|
<p className="font-bold text-gray-400">日期</p> |
|
|
<p className="font-bold text-gray-400">日期</p> |
|
@ -52,7 +106,7 @@ const Ecommerce = () => { |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div className="flex m-3 flex-wrap justify-center gap-1 items-center"> |
|
|
<div className="flex m-3 flex-wrap justify-center gap-1 items-center"> |
|
|
{earningData.map((item) => ( |
|
|
|
|
|
|
|
|
{earningData2.map((item) => ( |
|
|
<div key={item.title} className="bg-white h-44 dark:text-gray-200 dark:bg-secondary-dark-bg md:w-56 p-4 pt-9 rounded-2xl "> |
|
|
<div key={item.title} className="bg-white h-44 dark:text-gray-200 dark:bg-secondary-dark-bg md:w-56 p-4 pt-9 rounded-2xl "> |
|
|
<button |
|
|
<button |
|
|
type="button" |
|
|
type="button" |
|
|