Geen omschrijving

new.js 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /**
  2. * Created by TT on 2017/5/18.
  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_professor_new");
  10. var form = fb.build(root.find(".newForm"));
  11. var id = util.data("loginUser").id;
  12. var saveBtn = root.find(".opt-save"),
  13. gotoBtn = root.find(".opt-goto"),
  14. save = function (boolean) {
  15. form.val({cuserId: id, professorState: 2, authentication: 1});
  16. if (form.val().orgType == null) {
  17. form.val({orgType: 1});
  18. }
  19. if (form.val().name == null) {
  20. util.alert("请输入专家姓名");
  21. } else if (form.val().orgName == null) {
  22. util.alert("请输入所在机构名称")
  23. } else
  24. form.doPost("../ajax/sys/professor", function (id) {
  25. spa.closeModal();
  26. if (data) {
  27. data();
  28. }
  29. if (boolean) {
  30. window.open('http://www.ekexiu.com/information-console.html?professorId=' + id);
  31. }
  32. }, function (data) {
  33. util.alert(data.msg);
  34. });
  35. };
  36. root.find(".modal-ctrl .icon-times").on("click", function () {
  37. spa.closeModal();
  38. });
  39. $.fn.citySelect();
  40. $(document).on("click", "#City li a", function () {
  41. var aVal = $(this).text();
  42. $(this).parent().parent().parent().find('.mr_show').text(aVal);
  43. $(this).parent().parent().parent().find('input[name=cho_City]').val(aVal);
  44. if ($("#ocity").text() == "请选择城市") {
  45. $("#ocity").removeClass("mr_select");
  46. } else {
  47. $("#ocity").addClass("mr_select");
  48. }
  49. if ($("#oprovince").text() != "请选择省份") {
  50. form.val({province: $("#oprovince").text()});
  51. }
  52. if ($("#ocity").text() != "请选择城市") {
  53. form.val({address: $("#ocity").text()});
  54. }
  55. });
  56. saveBtn.on("click", function () {
  57. save();
  58. });
  59. gotoBtn.on("click", function () {
  60. save(true);
  61. });
  62. }
  63. }
  64. });
  65. });