Commit 0ac1c9e6 authored by baixian's avatar baixian

1111111

parent af02c5e2
import { routerRedux } from 'dva/router';
import { message } from 'antd';
import queryString from 'qs';
import { delay } from 'redux-saga';
import {
LocalStorage,
SessionStorage,
isExpired,
} from '../utils/index';
import errorcode from '../common/errorcode';
import * as newregister from '../services/newregister';
import * as schoolajax from '../services/schooladd';
export default {
namespace: 'deployschool',
state: {
deployType: 3, // 类型 1-口才 2-美术 3-书法 4-跆拳道 5-通用
},
subscriptions: {
setup({ dispatch, history }) { // eslint-disable-line
},
},
effects: {
* developSchool({ payload }, { call, put, select }) {
const { deployType, schoolId } = yield select(state => state.newregister);
const { sid } = yield select(state => state.webapp);
const data = yield call(newregister.deploySchool, {
school_id: schoolId || sid,
type: deployType,
});
if (data.code == 200) {
yield put({
type: 'updateState',
payload: {
deployType: 3,
},
});
} else {
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data,
},
});
}
},
* developSkip({ payload }, { call, put, select }) {
const { schoolId } = yield select(state => state.newregister);
const { sid } = yield select(state => state.webapp);
const data = yield call(newregister.deploySchool, {
school_id: schoolId || sid,
type: 6,
});
if (data.code == 200) {
yield put(routerRedux.push({
pathname: '/sjd/indexstaic',
}));
} else {
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data,
},
});
}
},
* goHome({ payload }, { put }) {
yield put(routerRedux.push({
pathname: '/sjd/indexstaic',
}));
},
* pageInit({ payload }, { call, put, select }) {
yield put({
type: 'updateState',
payload: {
deployType: 3,
},
});
},
},
reducers: {
updateState(state, { payload }) {
return {
...state,
...payload,
};
},
},
};
......@@ -47,6 +47,7 @@ import uploadcourseware from './uploadcourseware';
import classrecord from './classrecord';
import newregister from './newregister';
import userguide from './userguide';
import deployschool from './deployschool';
export default {
loginModel,
indexstaicModel,
......@@ -88,4 +89,5 @@ export default {
classrecord,
newregister,
userguide,
deployschool,
};
......@@ -56,7 +56,7 @@ class DeploySchoolForm extends React.Component {
});
}, 45);
dispatch({
type: 'newregister/developSchool',
type: 'deployschool/developSchool',
payload: {
},
});
......@@ -69,7 +69,7 @@ class DeploySchoolForm extends React.Component {
handleChooseType = (id) => {
const { dispatch } = this.props;
dispatch({
type: 'newregister/updateState',
type: 'deployschool/updateState',
payload: {
deployType: id,
},
......@@ -78,7 +78,7 @@ class DeploySchoolForm extends React.Component {
goHome = () => {
const { dispatch } = this.props;
dispatch({
type: 'newregister/goHome',
type: 'deployschool/goHome',
payload: {
},
});
......@@ -86,30 +86,16 @@ class DeploySchoolForm extends React.Component {
handleSkip = () => {
const { dispatch } = this.props;
dispatch({
type: 'newregister/developSkip',
type: 'deployschool/developSkip',
payload: {
},
});
}
render() {
const { getFieldDecorator } = this.props.form;
const {
countdown,
deployType,
} = this.props;
const { deployVisible, curStep, numberPercent } = this.state;
const tailFormItemLayout = {
wrapperCol: {
xs: {
span: 24,
offset: 0,
},
sm: {
span: 16,
offset: 5,
},
},
};
const typeList = [
{ id: 3, title: '书法练字', img: '/developschool/type_icon1.png' },
{ id: 2, title: '美术创意', img: '/developschool/type_icon2.png' },
......@@ -273,21 +259,11 @@ DeploySchool.propTypes = {
};
function mapStateToProps(state) {
const {
gettingVerifyCoding, countdown, counting, registering, resolves, modalVisible, protocolData,
location_address,
deployType,
} = state.newregister;
} = state.deployschool;
const { locationQuery } = state.webapp;
return {
gettingVerifyCoding,
countdown,
counting,
registering,
resolves,
locationQuery,
modalVisible,
protocolData,
location_address,
deployType,
};
}
......
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