Brak opisu

edit.js 1.2KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /**
  2. * Created by TT on 2018/1/29.
  3. */
  4. ;
  5. spa_define(function () {
  6. return $.use(["spa", "util", "form"], function (spa, util, fb) {
  7. return {
  8. modal: function (data) {
  9. var root = spa.findInModal(".sys_answer_edit");
  10. var form = fb.build(root.find(".newForm"));
  11. root.find(".modal-ctrl .icon-times").on("click", function () {
  12. spa.closeModal();
  13. });
  14. util.get("../ajax/qa/answer?id=" + data.id, null, function (answer) {
  15. if (answer) {
  16. form.val({cnt: answer.cnt});
  17. } else {
  18. util.alert("此回答不存在");
  19. }
  20. });
  21. root.find(".opt-save").on("click", function () {
  22. util.post("../ajax/qa/answer/modify", {
  23. cnt:form.val().cnt,
  24. id:data.id
  25. }, function () {
  26. spa.closeModal();
  27. if (data.hand) {
  28. data.hand();
  29. }
  30. }, {});
  31. });
  32. }
  33. }
  34. });
  35. });