fantasy
fantasy copied to clipboard
欸,在调试评论么?
刚下载安装了一下发现 评论刷新后消失
madevo.net 系统 debian8x64 环境 nginx1.14 php7.2
欸,我测试没事正常的,最少要5个字符好像
@Seevil 你好,请问如何去掉评论的默认验证方法,我异步时希望在submit之前作一下验证,作用在submit上的方法不会让默认验证生效
@xuthus5 我也不清楚,你看下css/script.js 里面有写
我需要你的帮助,谢谢。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
我该怎么做才能进行表单验证?可以你尝试一下http://xblogs.cn/article/11a20d45-54d0-4c16-828c-005e9f66d266实例的评论效果吗?希望给出中肯的解决意见,谢谢@Seevil
js这块真不懂,你可以问问原作者dalao看看https://github.com/PCDotFan/Aragaki @xuthus5