From c8eed99f5d1c8f1a8a0798339a08e356deb338a8 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Fri, 26 Nov 2021 10:59:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5-=E8=B4=A1?= =?UTF-8?q?=E7=8C=AE=E5=BA=A6=E6=97=A0=E6=95=B0=E6=8D=AE=E6=97=B6=E5=8F=AA?= =?UTF-8?q?=E6=98=BE=E7=A4=BAx/y=E8=BD=B4=E7=9A=84=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/AppConfig.js | 2 +- src/forge/users/Echart/Calendar.jsx | 25 ++++++++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/AppConfig.js b/src/AppConfig.js index 30eb7e9aa..665e85f0f 100644 --- a/src/AppConfig.js +++ b/src/AppConfig.js @@ -25,7 +25,7 @@ if (isDev) { } debugType = window.location.search.indexOf('debug=t') !== -1 ? 'teacher' : window.location.search.indexOf('debug=s') !== -1 ? 'student' : - window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'student' + window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'admin' } window._debugType = debugType; export function initAxiosInterceptors(props) { diff --git a/src/forge/users/Echart/Calendar.jsx b/src/forge/users/Echart/Calendar.jsx index c081f8bde..c7daad665 100644 --- a/src/forge/users/Echart/Calendar.jsx +++ b/src/forge/users/Echart/Calendar.jsx @@ -35,12 +35,23 @@ function Calendar({ userLogin , time , chooseTime }) { const url = `/users/${userLogin}/headmaps.json`; Axios.get(url).then(result=>{ if(result && result.data){ - // result.data.headmaps let m = []; + let flag = true; + if(result.data.headmaps && result.data.headmaps.length>0){ + m = result.data.headmaps; + flag = true; + }else{ + var date = +echarts.number.parseDate(baginT); + let d = timestampToTime(date); + m=[{ + contributions:"",date:d + }] + flag = false; + } m.sort(compare('contributions')); let max = m[m.length -1].contributions; - - Init(m,max); + + Init(m,max,flag); } }).catch(error=>{}) } @@ -54,7 +65,6 @@ function Calendar({ userLogin , time , chooseTime }) { } function getVirtulData(data) { - debugger; var date = +echarts.number.parseDate(baginT); var end = +echarts.number.parseDate(endT); var dayTime = 3600 * 24 * 1000; @@ -79,7 +89,7 @@ function Calendar({ userLogin , time , chooseTime }) { return Y+M+D; } - function Init(data,max) { + function Init(data,max,flag) { var huan_val = document.getElementById("Calendar"); var myEcharts = echarts.init(huan_val); let option = { @@ -99,8 +109,9 @@ function Calendar({ userLogin , time , chooseTime }) { left: 'center', bottom: 40, inRange:{ - color:['#fafafa', '#216e39'] - } + color:flag ? ['#fafafa', '#216e39'] :['#fff','#fff'] + }, + show:flag }, calendar: { top: 50,