|
|
|
@ -45,7 +45,7 @@ const ojForUserReducer = (state = initialState, action) => {
|
|
|
|
|
}
|
|
|
|
|
case types.USER_PROGRAM_DETAIL:
|
|
|
|
|
const { hack, test_case } = action.payload;
|
|
|
|
|
const { code }= hack;
|
|
|
|
|
const { code } = hack;
|
|
|
|
|
let tempCode = Base64.decode(code)
|
|
|
|
|
let tempDesc;
|
|
|
|
|
try {
|
|
|
|
@ -53,7 +53,7 @@ const ojForUserReducer = (state = initialState, action) => {
|
|
|
|
|
} catch (error) {
|
|
|
|
|
tempDesc = hack.description;
|
|
|
|
|
}
|
|
|
|
|
Object.assign(hack, {code: tempCode, description: tempDesc});
|
|
|
|
|
Object.assign(hack, { code: tempCode, description: tempDesc });
|
|
|
|
|
return {
|
|
|
|
|
...state,
|
|
|
|
|
hack: Object.assign({}, hack),
|
|
|
|
@ -87,7 +87,7 @@ const ojForUserReducer = (state = initialState, action) => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case types.COMMIT_RECORD:
|
|
|
|
|
const {records, records_count} = action.payload;
|
|
|
|
|
const { records, records_count } = action.payload;
|
|
|
|
|
return {
|
|
|
|
|
...state,
|
|
|
|
|
commitRecord: records,
|
|
|
|
@ -137,6 +137,7 @@ const ojForUserReducer = (state = initialState, action) => {
|
|
|
|
|
} else {
|
|
|
|
|
curHack['code'] = '';
|
|
|
|
|
}
|
|
|
|
|
curHack['modify_code'] = false
|
|
|
|
|
return {
|
|
|
|
|
...state,
|
|
|
|
|
hack: Object.assign({}, state.hack, curHack),
|
|
|
|
@ -204,7 +205,7 @@ const ojForUserReducer = (state = initialState, action) => {
|
|
|
|
|
let _user_praise = state.hack.user_praise;
|
|
|
|
|
_count = +action.payload > 0 ? _count + 1 : _count - 1;
|
|
|
|
|
_user_praise = +action.payload > 0 ? true : false;
|
|
|
|
|
const _hack = Object.assign({}, state.hack, {praises_count: _count, user_praise: _user_praise});
|
|
|
|
|
const _hack = Object.assign({}, state.hack, { praises_count: _count, user_praise: _user_praise });
|
|
|
|
|
return {
|
|
|
|
|
...state,
|
|
|
|
|
hack: _hack
|
|
|
|
@ -212,10 +213,10 @@ const ojForUserReducer = (state = initialState, action) => {
|
|
|
|
|
case types.CHANGE_RECORD_PAGINATION_PAGE:
|
|
|
|
|
return {
|
|
|
|
|
...state,
|
|
|
|
|
pages: Object.assign({}, state.pages, { page: action.payload})
|
|
|
|
|
pages: Object.assign({}, state.pages, { page: action.payload })
|
|
|
|
|
}
|
|
|
|
|
case types.UPDATE_OJ_FOR_USER_COMMENT_COUNT:
|
|
|
|
|
const {comments_count} = state.hack;
|
|
|
|
|
const { comments_count } = state.hack;
|
|
|
|
|
const _comments_count = action.payload === 'add' ? comments_count + 1 : comments_count - 1;
|
|
|
|
|
return {
|
|
|
|
|
...state,
|
|
|
|
@ -223,18 +224,18 @@ const ojForUserReducer = (state = initialState, action) => {
|
|
|
|
|
}
|
|
|
|
|
// 修改笔记内容
|
|
|
|
|
case types.UPDATE_NOTE_CONTENT:
|
|
|
|
|
const _hack1 = Object.assign({}, state.hack, {notes: action.payload });
|
|
|
|
|
const _hack1 = Object.assign({}, state.hack, { notes: action.payload });
|
|
|
|
|
return {
|
|
|
|
|
...state,
|
|
|
|
|
hack: _hack1
|
|
|
|
|
}
|
|
|
|
|
// 修改 hack passed值
|
|
|
|
|
case types.UPDATE_HACK_PASSED:
|
|
|
|
|
const _hack2 = Object.assign({}, state.hack, {passed: action.payload });
|
|
|
|
|
return {
|
|
|
|
|
...state,
|
|
|
|
|
hack: _hack2
|
|
|
|
|
}
|
|
|
|
|
const _hack2 = Object.assign({}, state.hack, { passed: action.payload });
|
|
|
|
|
return {
|
|
|
|
|
...state,
|
|
|
|
|
hack: _hack2
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
return state;
|
|
|
|
|
}
|
|
|
|
|