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,