Commit 61575590 authored by wangxuelai's avatar wangxuelai

''

parent 625c66fa
......@@ -20,7 +20,7 @@ export default {
],
"theme": {
"primary-color": "#1890FF",
"imagepath": process.env.NODE_ENV !== 'production' ? "'https://cdn.img.shangjiadao.cn/qingxiao/biz/image/'" : "'http://localhost:80/image/'",
"imagepath": process.env.NODE_ENV == 'production' ? "'https://cdn.img.shangjiadao.cn/qingxiao/biz/image/'" : "'http://localhost:80/image/'",
},
es5ImcompatibleVersions: true,
"proxy": {
......
<!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>
<![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?1566523768377" 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?1566523768377" charset="utf-8"></script>
</body>
</html>
\ No newline at end of file
<![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?1566539046840" 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?1566539046840" charset="utf-8"></script></body></html>
\ No newline at end of file
......@@ -315,7 +315,7 @@ class CallStudentsForm extends React.Component {
render: (text, record, index) => {
return (
<div className={pageStyle.classNamebox}>
{record.surplus}课时
{(record.surplus) || 0}课时
</div>
);
},
......
......@@ -318,7 +318,7 @@ export default {
ELE.remark = decodeURIComponent(ele.remark);
ELE.name = ele.formal_school_student.name;
ELE.mobile = ele.formal_school_student.mobile;
ELE.surplus = ele.surplus;
ELE.surplus = (ele.student_course && ele.student_course.surplus) || 0;
callStudentOperateList.push(ELE);
});
yield put({
......
......@@ -42,55 +42,6 @@ export default {
},
});
},
* generateteacherqrcode({ payload }, { call, put }) { // eslint-disable-line
yield put({
type: 'generateQrcodeFunction',
payload: {
needQuery: false,
},
});
},
* generateQrcodeFunction({ payload }, { call, put }) {
const { needQuery } = payload;
const randomString = getRandomString();
const Qrcode = yield call(commonAjax.generateQrcode, {
scene: `code=${randomString}`,
page: 'src/pages/teacherpclogin/index',
});
if (Qrcode.data.url) {
yield put({
type: 'updateState',
payload: {
randomString,
generateing: false,
teacherLoginQrcode: Qrcode.data.url,
generateSuccess: true,
},
});
if (!needQuery) return;
let loginStatusCheck = true;
while (loginStatusCheck) {
const teachertoken = yield call(login.getTeachertoken, { code: randomString });
if (teachertoken.data.token) { // 成功了
loginStatusCheck = false;
LocalStorage.setItem('teacher', {
token: teachertoken.data.token,
});
}
yield delay(3000);
}
} else {
yield put({
type: 'updateState',
payload: {
randomString,
generateing: false,
teacherLoginQrcode: '',
generateSuccess: false,
},
});
}
},
*fetch({ payload }, { call, put }) { // eslint-disable-line
yield put({ type: 'save' });
},
......@@ -142,6 +93,7 @@ export default {
id: (newLoginData.data.business && newLoginData.data.business.id) || 0,
memberId: (newLoginData.data.business && newLoginData.data.business.member_id) || 0,
mobile: (newLoginData.data.business && newLoginData.data.business.mobile) || '',
expiresDateTime: newLoginData.data.expiresDateTime || '',
nickname: (newLoginData.data.business && newLoginData.data.business.nickname) || '',
});
message.success('登录成功!', 1);
......@@ -180,69 +132,6 @@ export default {
}
setTimeout(loadmessage);
},
* tabshift({ payload }, { call, put, select }) {
const { type } = payload;
const { teacherLoginQrcode, randomString } = yield select(state => state.login);
yield put({
type: 'updateState',
payload: {
tabtype: type,
},
});
if (type == 1) {
if (teacherLoginQrcode == '') { // 重新生成qrcode
yield put({
type: 'generateQrcodeFunction',
payload: {
needQuery: true,
},
});
} else { // 直接调用轮询接口
let loginStatusCheck = true;
while (loginStatusCheck) {
const teachertoken = yield call(login.getTeachertoken, { code: randomString });
if (teachertoken.data.token) { // 成功了
loginStatusCheck = false;
LocalStorage.setItem('teacher', {
token: teachertoken.data.token,
});
LocalStorage.setItem('dakarole', 2);
yield put({
type: 'webapp/updateState',
payload: {
dakarole: 2,
},
});
const teachersSchools = yield call(users.teachersSchools);
if (teachersSchools.data.list.length > 0) {
LocalStorage.setItem('sid', teachersSchools.data.list[0].id);
yield put({
type: 'updateState',
payload: {
logining: false,
},
});
yield put({
type: 'webapp/updateState',
payload: {
sid: teachersSchools.data.list[0].id,
},
});
yield put(routerRedux.push({
pathname: '/sjd/indexstaic',
}));
} else {
// yield put(routerRedux.push({
// pathname: '/sjd/schooladd',
// }));
}
}
yield delay(3000);
}
}
}
},
* goregister({ payload }, { put }) {
yield put(routerRedux.push({
pathname: '/register',
......
......@@ -80,6 +80,7 @@ export default {
memberId: (newLoginData.data.business && newLoginData.data.business.member_id) || 0,
mobile: (newLoginData.data.business && newLoginData.data.business.mobile) || '',
nickname: (newLoginData.data.business && newLoginData.data.business.nickname) || '',
expiresDateTime: newLoginData.data.expiresDateTime || '',
});
message.success('注册成功!', 1);
yield put({
......
......@@ -53,7 +53,7 @@ export default {
* goSchoolSystem({ payload }, { call, put, select }) {
const { school, sid } = payload;
LocalStorage.setItem('sid', sid || school.id);
LocalStorage.setItem('role', school.school_teacher ? school.school_teacher.type : '');
LocalStorage.setItem('role', school.school_teacher ? school.school_teacher.type : 5);
if (school.school_teacher) {
LocalStorage.setItem('rootMap', rootMap.rootMap);
} else {
......
import { routerRedux } from 'dva/router';
import queryString from 'query-string';
import { message } from 'antd';
import { message, Modal } from 'antd';
import { delay } from 'redux-saga';
import errorcode from '../common/errorcode';
import menuConfig from '../common/menuconfig';
......@@ -55,6 +55,54 @@ export default {
return history.listen(({
pathname, search, query,
}) => {
const user = LocalStorage.getItem('user');
const departmentid = LocalStorage.getItem('departmentid');
const role = LocalStorage.getItem('role');
const rootMap = LocalStorage.getItem('rootMap');
const sid = LocalStorage.getItem('sid');
let userUserful = true;
if (!user || !user.token || (new Date()).getTime() > user.expiresDateTime * 1000) {
userUserful = false;
} else {
userUserful = true;
if (pathname == '/login') {
dispatch(routerRedux.replace({
pathname: '/schoollist',
}));
}
}
if (['/joinschooladd', '/schoollist', '/schooladd', '/usersetting'].indexOf(pathname) != -1 || pathname.indexOf('sjd') != -1) {
if (!userUserful) { // 检测已sjd开头的url或者headquarters开头的路由
Modal.warn({
title: '登录信息丢失,请重新登录',
onOk: () => {
dispatch(routerRedux.replace({
pathname: '/login',
}));
localStorage.clear();
},
});
return;
}
}
console.log(role === null, 'role === null');
if (pathname.indexOf('sjd') != -1 && pathname.indexOf('headquarters') == -1) {
if (!role || !rootMap || !sid) {
dispatch(routerRedux.replace({
pathname: '/schoollist',
}));
return;
}
}
if (pathname.indexOf('headquarters') != -1) {
if (!departmentid) {
dispatch(routerRedux.replace({
pathname: '/schoollist',
}));
return;
}
}
// 监听路由变化 判断缓存是否存在 实现路由守卫的功能
if (pathname.indexOf('headquarters') == -1) {
dispatch({
type: 'updateState',
......@@ -87,31 +135,13 @@ export default {
},
});
if (pathname === '/login') {
dispatch({
type: 'webapp/judgeexpire',
payload: {
isLogin: true,
},
});
dispatch({
type: 'login/generateteacherqrcode',
});
console.log('/login');
}
if (pathname === '/register') {
dispatch({
type: 'webapp/judgeexpire',
payload: {
isLogin: false,
},
});
console.log('/register');
}
if (pathname === '/resetpsd') {
dispatch({
type: 'webapp/judgeexpire',
payload: {
isLogin: false,
},
});
console.log('/resetpsd');
}
if (pathname === '/sjd/registerinfo') {
dispatch({
......@@ -577,6 +607,14 @@ export default {
type: 'thememgt/pageInit',
});
},
* onPageEnter({ payload }, { put, call, select }) {
console.log('dddddddddddd');
const { pathname } = payload;
console.log(pathname, 'pathname');
yield put({
type: 'updateState',
});
},
* judgeexpire({ payload }, { put, call, select }) {
// const webapp = yield select(state => state.webapp);
// const { userInfo } = webapp;
......
......@@ -14,7 +14,7 @@ class Errorpage extends React.Component {
<div>
<h1 className="fade">温馨提示:您访问的地址不存在!</h1>
<p className="fade">你正在寻找的页面无法找到。
<a style={{ opacity: '1' }} className="link" href="#/sjd/activemanager">返回首页</a>
<a style={{ opacity: '1' }} className="link" href="#/sjd/indexstaic">返回首页</a>
</p>
</div>
</div>
......
......@@ -39,11 +39,11 @@ class SjdIndex extends React.Component {
const {
collapsed, location, userInfo, showExpired, menuDrawerShow, screenIsBig,
} = this.props;
let hasRoot = false;
if ((LocalStorage.getItem('user') && LocalStorage.getItem('user').token) || (LocalStorage.getItem('teacher') && LocalStorage.getItem('teacher').token)) {
hasRoot = true;
}
const redirectDom = (<Redirect to={{ pathname: '/login', state: { from: location } }} />);
// let hasRoot = false;
// if ((LocalStorage.getItem('user') && LocalStorage.getItem('user').token) || (LocalStorage.getItem('teacher') && LocalStorage.getItem('teacher').token)) {
// hasRoot = true;
// }
// const redirectDom = (<Redirect to={{ pathname: '/login', state: { from: location } }} />);
let contentMarginLeft = 0;
let paddingRight = 20;
let paddingLeft = 20;
......@@ -116,9 +116,9 @@ class SjdIndex extends React.Component {
</Modal>
</div>
);
const renderDom = hasRoot ? mainDom : redirectDom;
// const renderDom = hasRoot ? mainDom : redirectDom;
return (
renderDom
mainDom
);
}
}
......
......@@ -215,6 +215,7 @@ class EditClassModal extends React.Component {
pattern: /^[1-9]\d*$/,
message: '请输入大于0的整数',
},
// { required: true, message: '上课次数不能为空' },
],
})(<InputNumber placeholder="请输入上课次数" style={{ width: '100%' }} />)}
</Form.Item>
......
......@@ -153,7 +153,7 @@ function RouterConfig({ history }) {
path="/sjd"
render={() => (
<SjdIndex>
<Route path="/sjd/officialweb" exact component={Officialweb} />
<Route path="/sjd/officialweb" config={{ needAuth: true }} exact component={Officialweb} />
<Route path="/sjd/officialwebeditor" exact component={OfficialwebEditor} />
<Route path="/sjd" exact render={() => (<Redirect to="/sjd/indexstaic" />)} />
<Route path="/sjd/404" exact component={Errorpage} />
......@@ -184,7 +184,7 @@ function RouterConfig({ history }) {
<Route path="/register" exact component={Register} />
<Route path="/resetpsd" exact component={ResetPsd} />
<Route path="/usersetting" exact component={UserSetting} />
<Route render={() => (<Errorpage />)} />
<Route path="/404" render={() => (<Errorpage />)} />
</Switch>
</Router>
</LocaleProvider>
......
......@@ -6,6 +6,7 @@ export function login(params) {
return request({
url: `${api.login}`,
method: 'POST',
needAuth: false,
data,
});
}
......
......@@ -7,6 +7,7 @@ export function register(params) {
url: `${api.userRegister}`,
method: 'POST',
data,
needAuth: false,
});
}
export function getVerifyCode(params) {
......
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