question.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. $(function(){
  2. $("#form-question").Validform({
  3. tiptype: function (msg, o, cssctl) {
  4. if (o.type == 3) {//失败
  5. layer.msg(msg, {icon: 5, time: 3000});
  6. $(window).scrollTop(o.obj.offset().top - 40);
  7. }
  8. },
  9. datatype: {//自定义验证类型
  10. },
  11. ignoreHidden: true,
  12. tipSweep: true, //若为true,则只在表单提交时验证
  13. ajaxPost: true, //异步提交
  14. beforeCheck: function (curform) { //验证通过之前执行的函数
  15. },
  16. beforeSubmit: function (curform) { //验证通过之后执行的函数
  17. var questionProfileText = UE.getEditor('questionProfileText').getContent();
  18. if(questionProfileText == null || questionProfileText == ""){
  19. vailErrorMsg($("#questionProfile"),"未填写问题描述");
  20. return false;
  21. }
  22. $("#questionProfile").val(questionProfileText);
  23. },
  24. callback: function (data) {//异步回调函数
  25. if (data) {
  26. var index = layer.alert(data.resultMsg, function (index) {
  27. if (data.resultCode == 200) {
  28. location.href = url_path + "/admin/complaintQuestion/question_page";
  29. } else {
  30. layer.close(index);
  31. }
  32. });
  33. }
  34. }
  35. });
  36. })