Commit 2db46dc5 authored by wangxuelai's avatar wangxuelai

''

parents f11f305f 24361d03
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>轻校</title><link rel="shortcut icon" href="https://cdn.img.shangjiadao.cn/qingxiao/biz/image/qxlogo4.png"><meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0;" name="viewport"><meta http-equiv="X-UA-Compatible" content="IE=edge"><!-- Polyfills --><!--[if lt IE 10]> <!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>轻校</title><link rel="shortcut icon" href="https://cdn.img.shangjiadao.cn/qingxiao/biz/image/qxlogo4.png"><meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0;" name="viewport"><meta http-equiv="X-UA-Compatible" content="IE=edge"><!-- Polyfills --><!--[if lt IE 10]>
<script src="js/console-polyfill.js"></script> <script src="js/console-polyfill.js"></script>
<![endif]--><script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp&key=XSZBZ-5LHCV-5I2P7-UQHPW-6456F-JBB3B"></script><link href="/dist/index.css?1566285021308" rel="stylesheet"><script src="/lib/vendor.dll.js?3" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/console-polyfill.js?3" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/es6-shim.min.js?3" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/es5-shim.js?3" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/es5-sham.min.js?3" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/json3.min.js?3" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/html5shiv.min.js?3" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/polyfill.js?3" charset="utf-8"></script></head><body><div id="root"></div><script src="/dist/index.js?1566285021308" charset="utf-8"></script></body></html> <![endif]--><script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp&key=XSZBZ-5LHCV-5I2P7-UQHPW-6456F-JBB3B"></script><link href="/dist/index.css?1566309763096" rel="stylesheet"><script src="/lib/vendor.dll.js?3" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/console-polyfill.js?3" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/es6-shim.min.js?3" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/es5-shim.js?3" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/es5-sham.min.js?3" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/json3.min.js?3" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/html5shiv.min.js?3" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/polyfill.js?3" charset="utf-8"></script></head><body><div id="root"></div><script src="/dist/index.js?1566309763096" charset="utf-8"></script></body></html>
\ No newline at end of file \ No newline at end of file
...@@ -3,6 +3,7 @@ import { routerRedux } from 'dva/router'; ...@@ -3,6 +3,7 @@ import { routerRedux } from 'dva/router';
import { message } from 'antd'; import { message } from 'antd';
import { delay } from 'redux-saga'; import { delay } from 'redux-saga';
import co from 'co'; import co from 'co';
import moment from 'moment';
import { import {
LocalStorage, LocalStorage,
SessionStorage, SessionStorage,
...@@ -57,6 +58,10 @@ export default { ...@@ -57,6 +58,10 @@ export default {
addCourseTimeShow: false, addCourseTimeShow: false,
timeArr: [], timeArr: [],
addTimeSubmitting: false, addTimeSubmitting: false,
chartStartDate: '',
chartEndDate: '',
start_time: '',
end_time: '',
}, },
subscriptions: { subscriptions: {
setup({ dispatch, history }) { // eslint-disable-line setup({ dispatch, history }) { // eslint-disable-line
...@@ -378,8 +383,12 @@ export default { ...@@ -378,8 +383,12 @@ export default {
type: 'querychartstatic', type: 'querychartstatic',
payload: { payload: {
sid, sid,
days: 7, days: 30,
init: true, init: true,
start_date: moment().startOf('week').unix() * 1000,
end_date: moment().endOf('week').unix() * 1000,
start_time: (moment().startOf('week')).format('YYYY-MM-DD'),
end_time: (moment().endOf('week')).format('YYYY-MM-DD'),
}, },
}); });
yield put({ yield put({
...@@ -393,9 +402,23 @@ export default { ...@@ -393,9 +402,23 @@ export default {
}); });
}, },
* querychartstatic({ payload }, { call, put, select }) { * querychartstatic({ payload }, { call, put, select }) {
const { sid, days, init } = payload; const {
sid, days, init, start_date, end_date, end_time, start_time,
} = payload;
yield put({
type: 'updateState',
payload: {
chartStartDate: start_date,
chartEndDate: end_date,
},
});
const loadmessage = message.loading('加载中...', 0); const loadmessage = message.loading('加载中...', 0);
const clockCharts = yield call(indexstaticajax.clockCharts, { schoolId: sid, days }); const clockCharts = yield call(indexstaticajax.clockCharts, {
schoolId: sid,
days,
start_time,
end_time,
});
setTimeout(loadmessage); setTimeout(loadmessage);
if (clockCharts.code == 200) { if (clockCharts.code == 200) {
yield put({ yield put({
...@@ -405,6 +428,8 @@ export default { ...@@ -405,6 +428,8 @@ export default {
clockCharts: clockCharts.data, clockCharts: clockCharts.data,
clockChartsSuccess: true, clockChartsSuccess: true,
days, days,
start_time,
end_time,
}, },
}); });
} else { } else {
......
This diff is collapsed.
...@@ -7,9 +7,9 @@ export function statistical({ schoolId }) { ...@@ -7,9 +7,9 @@ export function statistical({ schoolId }) {
method: 'GET', method: 'GET',
}); });
} }
export function clockCharts({ schoolId, days }) { export function clockCharts({ schoolId, start_time, end_time }) {
return request({ return request({
url: `${api.indexstaic.clockCharts}?school_id=${schoolId}&days=${days}`, url: `${api.indexstaic.clockCharts}?school_id=${schoolId}&start_time=${start_time}&end_time=${end_time}`,
method: 'GET', method: 'GET',
}); });
} }
......
...@@ -677,6 +677,22 @@ function hasBtnPower(key, value) { ...@@ -677,6 +677,22 @@ function hasBtnPower(key, value) {
} }
return false; return false;
} }
// 获取天数差
/**
* @return {number}
*/
function DayCount(date1, date2) {
const startTime = date1.replace(/-/g, '/');
const endTime = date2.replace(/-/g, '/');
const newStart = new Date(startTime);
const newEnd = new Date(endTime);
const days = newEnd.getTime() - newStart.getTime();
// eslint-disable-next-line radix
const day = parseInt(days / (1000 * 60 * 60 * 24));
return (day + 1);
}
export { export {
pageIn, pageIn,
SessionStorage, SessionStorage,
...@@ -716,4 +732,5 @@ export { ...@@ -716,4 +732,5 @@ export {
videoorigin, videoorigin,
getBetweenDays, getBetweenDays,
hasBtnPower, hasBtnPower,
DayCount,
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment