Commit cc385435 by 姜雷

修改初始化参数

parent 5fa401c7
...@@ -17,6 +17,7 @@ import store from '../../store/index'; ...@@ -17,6 +17,7 @@ import store from '../../store/index';
import UserInfoContext from '../../context/userinfo-context'; import UserInfoContext from '../../context/userinfo-context';
import offCheckIcon from '../../images/Check/radio_off_btn@2x.png'; import offCheckIcon from '../../images/Check/radio_off_btn@2x.png';
import onCheckIcon from '../../images/Check/radio_on_btn@2x.png'; import onCheckIcon from '../../images/Check/radio_on_btn@2x.png';
import { emojiFilter } from '../../utils/index';
class ReprtRepair extends Component { class ReprtRepair extends Component {
constructor(props) { constructor(props) {
...@@ -29,9 +30,9 @@ class ReprtRepair extends Component { ...@@ -29,9 +30,9 @@ class ReprtRepair extends Component {
repairCellphone: props.userinfo.cellphone, repairCellphone: props.userinfo.cellphone,
applyIdentity: '学生', applyIdentity: '学生',
area: '', area: '',
areaId: '', areaId: [],
term: '', term: '',
termId: '', termId: [],
address: '', address: '',
uploadImg: [null, null, null], uploadImg: [null, null, null],
}, },
...@@ -79,9 +80,9 @@ class ReprtRepair extends Component { ...@@ -79,9 +80,9 @@ class ReprtRepair extends Component {
repairCellphone: userinfo.cellphone, repairCellphone: userinfo.cellphone,
applyIdentity: '学生', applyIdentity: '学生',
area: '', area: '',
areaId: '', areaId: [],
term: '', term: '',
termId: '', termId: [],
address: '', address: '',
uploadImg: [null, null, null], uploadImg: [null, null, null],
}, },
...@@ -92,7 +93,7 @@ class ReprtRepair extends Component { ...@@ -92,7 +93,7 @@ class ReprtRepair extends Component {
this.setState(({ applyForm }) => ({ this.setState(({ applyForm }) => ({
applyForm: { applyForm: {
...applyForm, ...applyForm,
[name]: value, [name]: emojiFilter(value),
}, },
})); }));
}; };
...@@ -141,11 +142,11 @@ class ReprtRepair extends Component { ...@@ -141,11 +142,11 @@ class ReprtRepair extends Component {
Toast.fail('请选择报修人身份!'); Toast.fail('请选择报修人身份!');
return; return;
} }
if (!applyForm.areaId) { if (!applyForm.areaId.length) {
Toast.fail('请选择报修区域!'); Toast.fail('请选择报修区域!');
return; return;
} }
if (!applyForm.termId) { if (!applyForm.termId.length) {
Toast.fail('请选择报修项目!'); Toast.fail('请选择报修项目!');
return; return;
} }
...@@ -203,14 +204,12 @@ class ReprtRepair extends Component { ...@@ -203,14 +204,12 @@ class ReprtRepair extends Component {
const { history } = this.props; const { history } = this.props;
console.log('resetForm'); console.log('resetForm');
this.resetApplyForm(); this.resetApplyForm();
Toast.hide();
Toast.success(data.msg); Toast.success(data.msg);
history.replace('/repair/RepairList'); history.replace('/repair/RepairList');
}) })
.catch(err => { .catch(err => {
console.log(err); console.log(err);
const { data } = err; const { data } = err;
Toast.hide();
Toast.fail(data.msg || '提交失败!'); Toast.fail(data.msg || '提交失败!');
}); });
}; };
...@@ -369,7 +368,7 @@ class ReprtRepair extends Component { ...@@ -369,7 +368,7 @@ class ReprtRepair extends Component {
this.setState(({ applyForm }) => ({ this.setState(({ applyForm }) => ({
applyForm: { applyForm: {
...applyForm, ...applyForm,
address: val.replace(/\n/, ''), address: emojiFilter(val.replace(/\n/, '')),
}, },
})) }))
} }
......
...@@ -30,3 +30,7 @@ export function formatDate(date, fmt) { ...@@ -30,3 +30,7 @@ export function formatDate(date, fmt) {
function padLeftZero(str) { function padLeftZero(str) {
return ('00' + str).substr(str.length); return ('00' + str).substr(str.length);
} }
export const emojiFilter = str => {
return str.replace(/\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]/g, '');
};
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