Commit a9138e61 authored by baixian's avatar baixian

闯关优化

parent ead687d9
......@@ -18,5 +18,5 @@
</head>
<body>
<div id="root"></div>
<script type="text/javascript" src="/dist/main.43cf75.js"></script></body>
<script type="text/javascript" src="/dist/main.008db9.js"></script></body>
</html>
\ No newline at end of file
......@@ -180,6 +180,7 @@ export default {
unlockSubjectList: `${dakaapi}member/unlock_subject/index`,
edit_unlock_subject: `${dakaapi}member/unlock_subject/update`,
unlockSubjectDetail: `${dakaapi}member/unlock_subject/detail`,
unlockAddSubjectCount: `${dakaapi}member/unlock_subject/add_subject_count`,
},
getschooluuid: `${dakaapi}member/school_uuid`,
analyzeCenter: {
......
......@@ -1689,7 +1689,7 @@ export default {
const loadmessage = message.loading('小程序码生成中...', 0);
const data = yield call(commonAjax.generateQrcode, {
scene: `i=${record.class_id}&t=${record.id}`,
page: 'src/pages/morethemeindex/index',
page: 'src/pages/sharemoretheme/index',
width: 430,
});
if (data.code === 200) {
......@@ -1740,6 +1740,116 @@ export default {
pathname: `/sjd/addCustomsContent/${id}`,
}));
},
* addStoreCount({ payload }, { call, put, select }) {
const { id } = payload;
yield put(routerRedux.push({
pathname: `/sjd/addStoreCount/${id}`,
}));
},
// 额外关卡提交方法
* addSubjectCount({ payload }, { call, put, select }) {
const { sid } = yield select(state => state.webapp);
const {
emigrateLoading,
emigrateParams,
emigratedObj,
storeId,
} = yield select(state => state.createtheme);
if (emigrateLoading) {
return;
}
yield put({
type: 'updateState',
payload: {
emigrateLoading: true,
},
});
const newParams = { ...emigrateParams };
const {
is_cheat,
is_encrypt,
title,
text_require_status,
text_require_num,
image_require_status,
image_require_num,
video_require_status,
video_require_num,
audio_require_status,
audio_require_num,
force_status,
force_num,
callBack,
} = payload;
const loadmessage = message.loading('保存中...', 0);
const subjectCountData = yield call(themeAjax.unlockAddSubjectCount, {
id: emigratedObj.id,
school_id: sid,
});
if (subjectCountData.code == 200) {
const data = yield call(themeAjax.addTheme, Object.assign(newParams,
{
is_cheat,
is_encrypt,
title,
class_id: emigratedObj.class_id,
school_id: sid,
text_require_status,
text_require_num,
image_require_status,
image_require_num,
video_require_status,
video_require_num,
audio_require_status,
audio_require_num,
force_status,
force_num,
subject_type: 3,
unlock_mode_id: emigratedObj.id,
content: JSON.stringify(newParams.content),
sort: subjectCountData.data.subject_count,
},
));
yield put({
type: 'updateState',
payload: {
emigrateLoading: false,
},
});
setTimeout(loadmessage);
if (data.code === 200) {
if (callBack && (typeof callBack == 'function')) {
callBack();
}
yield put(routerRedux.goBack());
yield put({
type: 'updateState',
payload: {
isShowCustoms: false,
emigrateParams: {
title: '',
content: [],
},
},
});
message.success('保存成功', 0.5);
} else {
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data,
},
});
}
} else {
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data: subjectCountData.data,
},
});
}
},
* goEditShowCustoms({ payload }, { call, put, select }) {
const { item } = payload;
console.log(item);
......
......@@ -116,7 +116,7 @@ export default {
case 3:
params = {
scene: `i=${record.class_id}&t=${record.id}`,
page: 'src/pages/morethemeindex/index',
page: 'src/pages/sharemoretheme/index',
width: 430,
};
break;
......
......@@ -872,6 +872,39 @@ export default {
},
});
}
const addStoreCountActive = pathToRegexp('/sjd/addStoreCount/:id').exec(pathname);
if (addStoreCountActive) {
dispatch({
type: 'createtheme/pageInit',
payload: {
},
});
dispatch({
type: 'createtheme/createThemeModalfindEmigrated',
payload: {
store_id: addStoreCountActive[1],
},
});
dispatch({
type: 'updateState',
payload: {
breadcrumbList: [
{
path: 'sjd/classmgt',
name: '班级管理',
},
{
path: pathname,
name: '主题详情',
},
{
path: pathname,
name: '新建闯关打卡',
},
],
},
});
}
const editStoreActive = pathToRegexp('/sjd/editCustoms/:id').exec(pathname);
if (editStoreActive) {
dispatch({
......
This diff is collapsed.
......@@ -26,6 +26,7 @@ const FormItem = Form.Item;
const { Option } = Select;
const { TextArea } = Input;
const { RangePicker } = DatePicker;
const { confirm } = Modal;
class SuccessStoreForm extends React.Component {
constructor(props) {
super(props);
......@@ -57,7 +58,21 @@ class SuccessStoreForm extends React.Component {
addStore = (id) => {
const { dispatch, customsNumberList } = this.props;
if (customsNumberList.length == 0) {
message.warning('关卡数量已满', 0.5);
confirm({
title: '提示',
content: '确认新增额外关卡?\n',
icon: <Icon type="info-circle" theme="filled" style={{ color: '#1890ff', fontSize: 30 }} />,
onOk() {
dispatch({
type: 'createtheme/addStoreCount',
payload: {
id,
},
});
},
onCancel() {
},
});
return;
}
dispatch({
......
......@@ -271,6 +271,11 @@ const UnclockDetail = props => (
{ UnclockDetail => (<UnclockDetail {...props} />) }
</Bundle>
);
const AddStoreCount = props => (
<Bundle load={() => import(/* webpackChunkName:"AddStoreCount" */'./pages/newtheme/customsclock/addStoreCount')}>
{ AddStoreCount => (<AddStoreCount {...props} />) }
</Bundle>
);
function RouterConfig({ history }) {
return (
<ConfigProvider locale={zhCN}>
......@@ -322,6 +327,7 @@ function RouterConfig({ history }) {
<Route path="/sjd/editCustoms/:id" exact component={EditCustoms} />
<Route path="/sjd/editCustomsContent/:id" exact component={UnclockDetail} />
<Route path="/sjd/addCustomsContent/:id" exact component={UnclockDetail} />
<Route path="/sjd/addStoreCount/:id" exact component={AddStoreCount} />
<Route component={Errorpage} />
</Switch>
</SjdIndex>
......
......@@ -93,3 +93,11 @@ export function getUnlockSubjectDetail(params) {
data,
});
}
export function unlockAddSubjectCount(params) {
const data = qs.stringify(params);
return request({
url: `${api.createtheme.unlockAddSubjectCount}`,
method: 'POST',
data,
});
}
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