Commit a26a5a2d authored by wangxuelai's avatar wangxuelai

''

parent f89c0670
......@@ -94,6 +94,9 @@
transform: translateY(-50%);
cursor: pointer;
}
.callguide {
}
}
:global {
.UserGuideModal {
......
......@@ -10,22 +10,50 @@ import {
import errorcode from '../common/errorcode';
import * as newregister from '../services/newregister';
import * as schoolajax from '../services/schooladd';
import * as commonajax from '../services/common';
import rootMap from '../common/constants';
export default {
namespace: 'deployschool',
state: {
deployType: 3, // 类型 1-口才 2-美术 3-书法 4-跆拳道 5-通用
sid: 0,
schoolUserInfo: {},
},
subscriptions: {
setup({ dispatch, history }) { // eslint-disable-line
},
},
effects: {
* queryinfo({ payload }, { call, put, select }) { // 释放该页面存储的所有状态
const { id } = payload;
yield put({
type: 'updateState',
payload: {
sid: id,
},
});
yield put({
type: 'querymemberinfo',
});
},
* querymemberinfo({ payload }, { call, put, select }) { // 释放该页面存储的所有状态
const { sid } = yield select(state => state.deployschool);
const nickname = yield call(commonajax.myNickname, {
school_id: sid,
});
if (nickname.code == 200) {
yield put({
type: 'updateState',
payload: {
schoolUserInfo: nickname.data,
},
});
}
},
* developSchool({ payload }, { call, put, select }) {
const { deployType } = yield select(state => state.deployschool);
const { schoolId } = yield select(state => state.newregister);
const { sid } = yield select(state => state.webapp);
const { deployType, sid } = yield select(state => state.deployschool);
const data = yield call(newregister.deploySchool, {
school_id: schoolId || sid,
school_id: sid,
type: deployType,
});
if (data.code == 200) {
......@@ -45,13 +73,30 @@ export default {
}
},
* developSkip({ payload }, { call, put, select }) {
const { schoolId } = yield select(state => state.newregister);
const { sid } = yield select(state => state.webapp);
const { schoolUserInfo, sid } = yield select(state => state.deployschool);
const data = yield call(newregister.deploySchool, {
school_id: schoolId || sid,
school_id: sid,
type: 6,
});
if (data.code == 200) {
LocalStorage.setItem('sid', sid);
LocalStorage.setItem('role', schoolUserInfo.schoolTeacher ? schoolUserInfo.schoolTeacher.type : 5);
if (schoolUserInfo.schoolTeacher.school_teacher) {
LocalStorage.setItem('rootMap', rootMap.rootMap);
} else {
LocalStorage.setItem('rootMap', rootMap.emptyRootMap);
}
yield put({
type: 'webapp/updateState',
payload: {
sid,
role: schoolUserInfo.schoolTeacher ? schoolUserInfo.schoolTeacher.type : '',
},
});
yield call(commonajax.schoolLoginTime, {
id: sid,
type: 1,
});
yield put(routerRedux.push({
pathname: '/sjd/indexstaic',
}));
......@@ -64,10 +109,37 @@ export default {
});
}
},
* goHome({ payload }, { put }) {
* goHome({ payload }, { put, call, select }) {
const { schoolUserInfo, sid } = yield select(state => state.deployschool);
LocalStorage.setItem('sid', sid);
LocalStorage.setItem('role', schoolUserInfo.schoolTeacher ? schoolUserInfo.schoolTeacher.type : 5);
if (schoolUserInfo.schoolTeacher) {
LocalStorage.setItem('rootMap', rootMap.rootMap);
} else {
LocalStorage.setItem('rootMap', rootMap.emptyRootMap);
}
yield put({
type: 'webapp/updateState',
payload: {
sid,
role: schoolUserInfo.schoolTeacher ? schoolUserInfo.schoolTeacher.type : '',
},
});
yield call(commonajax.schoolLoginTime, {
id: sid,
type: 1,
});
yield put(routerRedux.push({
pathname: '/sjd/indexstaic',
}));
yield delay(200);
yield put({
type: 'userguide/updateState',
payload: {
guideShow: true, // 引导是否开启
guideStep: 1, // 引导步骤
},
});
},
* pageInit({ payload }, { call, put, select }) {
yield put({
......
......@@ -90,44 +90,44 @@ export default {
token: data.data.token,
});
if (schooladd.code === 200) {
LocalStorage.setItem('sid', schooladd.data.id);
// LocalStorage.setItem('sid', schooladd.data.id);
// yield put({
// type: 'webapp/updateState',
// payload: {
// sid: LocalStorage.getItem('sid'),
// },
// });
// yield put({
// type: 'updateState',
// payload: {
// schoolId: schooladd.data.id,
// },
// });
yield put({
type: 'webapp/updateState',
type: 'updateState',
payload: {
sid: LocalStorage.getItem('sid'),
registering: false,
userInfo: LocalStorage.getItem('user'),
location_address: '',
},
});
yield put({
type: 'updateState',
type: 'schooladd/updateState',
payload: {
schoolId: schooladd.data.id,
longitude: '',
latitude: '',
locationAddress: '',
province: '',
city: '',
district: '',
address: '',
},
});
// yield delay(200);
yield put(routerRedux.push({
pathname: `/deploySchool/${schooladd.data.id}`,
}));
}
yield put({
type: 'updateState',
payload: {
registering: false,
userInfo: LocalStorage.getItem('user'),
location_address: '',
},
});
yield put({
type: 'schooladd/updateState',
payload: {
longitude: '',
latitude: '',
locationAddress: '',
province: '',
city: '',
district: '',
address: '',
},
});
yield delay(200);
yield put(routerRedux.push({
pathname: '/deploySchool',
}));
} else {
message.error(data.msg, 1);
yield put({
......
......@@ -15,7 +15,7 @@ const pathToRegexp = require('path-to-regexp');
export default {
namespace: 'userguide',
state: {
guideShow: true, // 引导是否开启
guideShow: false, // 引导是否开启
guideStep: 1, // 引导步骤
position: {},
},
......
......@@ -944,6 +944,15 @@ export default {
},
});
}
const deploySchoolMath = pathToRegexp('/deploySchool/:id').exec(pathname);
if (deploySchoolMath) {
dispatch({
type: 'deployschool/queryinfo',
payload: {
id: deploySchoolMath[1],
},
});
}
});
},
},
......
......@@ -299,7 +299,7 @@ function RouterConfig({ history }) {
<Route path="/login" exact component={Login} />
<Route path="/register" exact component={NewRegister} />
<Route path="/rechargedesc" exact component={RechargeDesc} />
<Route path="/deploySchool" exact component={DeploySchool} />
<Route path="/deploySchool/:id" exact component={DeploySchool} />
<Route path="/404" render={() => (<Errorpage />)} />
</Switch>
</Router>
......
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