Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function handleSubmit() {
if (!value) return
if (!userInfo.username) return message.warn('您未登陆,请登录后再试。')
setSubmitting(true)
axios
.post('/discuss', { articleId: props.articleId, content: value, userId: userInfo.userId })
.then(res => {
setSubmitting(false)
setValue('')
props.setCommentList(res.rows)
})
.catch(e => setSubmitting(false))
}
handleOk() {
const reg = new RegExp(
'^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$',
); //正则表达式
if (!this.state.email) {
message.warn('邮箱不能为空!');
} else if (!reg.test(this.state.email)) {
message.warn('请输入格式正确的邮箱!');
} else if (!this.state.name) {
message.warn('用户名不能为空!');
} else if (!this.state.password) {
message.warn('密码不能为空!');
} else {
this.register(this.state);
}
const re = /^(((13[0-9]{1})|(15[0-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
if (this.state.phone && !re.test(this.state.phone)) {
message.warn('请输入正确的手机号!');
}
}
handleOAuth() {
callback: (response) => {
if (response.code === 0) {
message.success("修改成功");
} else {
message.warn(response.msg);
}
}
});
copyCode = keys => {
const { params } = this.state;
const { dispatch } = this.props;
if (keys.length === 0) {
message.warn('请先选择一条数据!');
return;
}
if (keys.length > 1) {
message.warn('只能选择一条数据!');
return;
}
Modal.confirm({
title: '代码配置复制确认',
content: '是否复制选中模块的配置?',
okText: '确定',
okType: 'danger',
cancelText: '取消',
async onOk() {
const response = await copyCodes({ id: keys[0] });
if (response.success) {
message.success(response.msg);
dispatch(CODE_LIST(params));
} else {
message.error(response.msg || '复制失败');
}
form.validateFields((err, values) => {
if (err) {
message.warn(err);
return;
}
let editType = '添加';
let apiUrl = 'http://localhost:3000/book';
let method = 'post';
if (editTarget) {
editType = '编辑';
apiUrl += '/' + editTarget.id;
method = 'put';
}
request(method, apiUrl, values)
.then((res) => {
if (res.id) {
message.success(editType + '书本成功');
function getJSON(e){
let url = getFieldValue("jsonURL");
if(!url){
message.warn("请输入地址");
return;
}
props.dispatch({
type:"global/getJSON",
url
})
}
handleUpdate() {
let name = this.refs.name.refs.input.value;
let file = this.refs.file.refs.input.files;
if (!name) {
message.warn('请填写大集合名称');
return;
} else if (file.length === 0) {
message.warn('请上传集合文件');
return;
}
util.uploadFiles(apiConfig.uploadBigset, 'file', this.refs.file.refs.input.files[0], {
param: {
app: 'flyflow',
key: name
}
});
message.info('创建成功');
setTimeout(() => {
this.setState({
updateIsShow: false
*addRule(params, { call, put }) {
const { payload, callback, fetchValue } = params;
const json = yield call(addRule, payload);
if (json.code === 200) {
message.success("添加成功");
callback();
yield put({ type: "reloadRule", fetchValue });
} else {
message.warn(json.message);
}
},