Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

欸,在调试评论么? #1

Open
madlifer opened this issue Oct 20, 2018 · 5 comments
Open

欸,在调试评论么? #1

madlifer opened this issue Oct 20, 2018 · 5 comments

Comments

@madlifer
Copy link

刚下载安装了一下发现 评论刷新后消失

madevo.net 系统 debian8x64 环境 nginx1.14 php7.2

@Seevil
Copy link
Owner

Seevil commented Oct 20, 2018

欸,我测试没事正常的,最少要5个字符好像
image

@xuthus5
Copy link

xuthus5 commented Oct 30, 2018

@Seevil 你好,请问如何去掉评论的默认验证方法,我异步时希望在submit之前作一下验证,作用在submit上的方法不会让默认验证生效

@Seevil
Copy link
Owner

Seevil commented Oct 30, 2018

@xuthus5 我也不清楚,你看下css/script.js 里面有写

@xuthus5
Copy link

xuthus5 commented Nov 2, 2018

我需要你的帮助,谢谢。https://gitee.com/xuthus5/GoMD/blob/master/views/fantasy/page.html

            <div class="comment_trigger">
                <div class="avatar">
                    <img src="/static/index/fantasy/visitor.png"/>
                </div>
                <div class="trigger_title">撰写评论</div>
            </div>
            <div class="new_comment">
                <textarea name="content" cols="50" rows="2" class="textarea_box" required></textarea>
                <span class="comment_error"></span>
            </div>
            <div class="comment_triggered">
                <div class="input_body">
                    <ul class="ident">
                        <li>
                            <input type="hidden" name="aid" value="{{.Id}}">
                            <input type="text" name="name" value="" required placeholder="昵称"/>
                        </li>
                        <li>
                            <input type="text" name="email" value="" placeholder="邮箱"/>
                        </li>
                        <li>
                            <input type="text" name="link" value="" placeholder="网站:不要输入http://"/>
                        </li>
                    </ul>
                    <input type="button" id="submit" value="提交评论" class="comment_submit_button c_button"/>
                </div>
            </div>
        </form>

我给input->button绑定了id为submit,使用jquery获得点击事件。

<script src="/static/admin/layer/layer.js"></script>
<script>
    // 定义layer主题名称
    layer.config({
        skin: 'layer-class'
    });
    $("#submit").click(function () {
        const postData = $("#new_comment_form").serialize();
        $.post("/api/comment/add", postData, function (res) {
            if (res.Error === 0) {
               // 弹窗提示
                layer.open({
                    title: res.Title
                    , content: res.Msg,
                    yes: function (index) {
                        window.location.reload();
                        //点击确定 进行yes回调,重载页面
                    }
                });
            } else {
                layer.msg(res.Title + res.Msg, {
                    icon: 2,
                    shade: [0.8, '#393D49'], // 透明度  颜色
                    time: 2000
                });
            }
        }, "json");
        return false;
    });
</script>

我该怎么做才能进行表单验证?你可以尝试一下http://xblogs.cn/article/11a20d45-54d0-4c16-828c-005e9f66d266 实例的评论效果吗?希望给出中肯的解决意见,谢谢 @Seevil

@Seevil
Copy link
Owner

Seevil commented Nov 4, 2018

我该怎么做才能进行表单验证?可以你尝试一下http://xblogs.cn/article/11a20d45-54d0-4c16-828c-005e9f66d266实例的评论效果吗?希望给出中肯的解决意见,谢谢@Seevil

js这块真不懂,你可以问问原作者dalao看看https://github.com/PCDotFan/Aragaki @xuthus5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants