How to use the antd.message.warn function in antd

To help you get started, we’ve selected a few antd examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gershonv / react-blog / src / components / Discuss / index.jsx View on Github external
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))
  }
github biaochenxuying / blog-react / src / components / register / register.js View on Github external
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() {
github mojisrc / fashop-admin / src / pages / setting / sms / index.js View on Github external
callback: (response) => {
                        if (response.code === 0) {
                            message.success("修改成功");
                        } else {
                            message.warn(response.msg);
                        }
                    }
                });
github chillzhuang / Sword / src / pages / System / Code / Code.js View on Github external
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 || '复制失败');
        }
github awaw00 / react-curd / src / components / BookEditor.js View on Github external
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 + '书本成功');
github YueHui / codeGenerator / src / pages / index.js View on Github external
function getJSON(e){
        let url = getFieldValue("jsonURL");
        if(!url){
            message.warn("请输入地址");
            return;
        }
        props.dispatch({
            type:"global/getJSON",
            url
        })
    }
github niyingfeng / antd-auto / src / page / bigset.jsx View on Github external
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
github Dromara / soul-dashboard / src / models / spring.js View on Github external
*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);
      }
    },