U.School.js 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. Namespace.register("U.School"); //自定义回话框等区域
  2. U.School = function (Udiv, Uit) {
  3. var _UT = new U.SchoolT(Udiv);
  4. _UT.init();
  5. return _UT;
  6. }
  7. U.SchoolT = function (Udiv, Uit) {
  8. this.Udiv = Udiv;
  9. this.Uit = Uit;
  10. }
  11. U.SchoolT.prototype = {
  12. init: function () {
  13. this.Odiv();
  14. this.sumbit(this.Uit);
  15. },
  16. Odiv: function () {
  17. this.winWidth = document.body.offsetWidth
  18. var U_S_Out = $$("div", { "id": "U_S_Out", "className": "U_C_Out" }, this.Udiv);
  19. var U_S_O_L = $$("div", { "id": "U_S_O_L", "className": "U_C_O_L U_C_left", "innerHTML": "教育信息:" }, U_S_Out);
  20. var U_S_O_R = $$("div", { "id": "U_S_O_R", "className": "U_C_O_R U_C_right" }, U_S_Out);
  21. var U_S_O_C = $$("div", { "id": "U_S_O_C", "className": "U_C_O_C U_C_left", "innerHTML": "未填写教育信息" }, U_S_O_R);
  22. var U_S_O_R_D = $$("div", { "id": "U_S_O_R_D", "className": "U_C_O_R_T U_C_right", "innerHTML": "编辑", "onclick": [[this.view, [this]]] }, U_S_O_R);
  23. },
  24. view: function (_this) {
  25. var r = U.ACD.Request(U.CD.AjaxUrl, [U.CD.Host, U.CD.Database, "US_S_Select_place"], "", ["", "bb", _this]);
  26. var U_S_Out = $("#U_S_Out").animate({ "height": "100px" }, 200);
  27. var U_S_Content = $$("div", { "id": "U_S_Content", "className": "U_S_Content" }, U_S_Out);
  28. var U_S_O_R = $("#U_S_O_R")[0];
  29. $("#U_S_O_R_D")[0].style.display = "none";
  30. $("#U_S_O_C")[0].style.display = "none";
  31. $$("div", { "id": "U_S_O_R_P", "className": "U_C_O_R_T U_C_right", "innerHTML": "收起", "onclick": [[City.pickup, [U_S_Content, "S"]]] }, U_S_O_R);
  32. $$("div", { "id": "U_S_O_R_Remind", "className": "U_C_O_R_Remind", "innerHTML": "填写教育信息,能帮助你在微博上快速找到许久不见的老同学" }, U_S_Content)
  33. var U_S_Content_D = $$("div", { "id": "U_S_Content_D", "className": "U_S_Content_D" }, U_S_Content);
  34. $$("div", { "innerHTML": "学校名称", "className": "U_S_T_right U_C_left", "style": { "width": "55px"} }, U_S_Content_D);
  35. var U_S_icon = $$("div", { "id": "U_S_icon", "className": "U_S_icon" }, U_S_Content_D)
  36. var U_S_input = $$("input", { "className": "U_S_input", "type": "text", "id": "U_S_input", "placeholder": "点击选择学校", "onclick": [[_this.place, [r]]] }, U_S_icon)
  37. if (_this.value) {
  38. U_S_input.value = _this.value;
  39. }
  40. },
  41. place: function (r) {
  42. $("#U_S_input")[0].blur();
  43. var U_S_N_D = $$("div", { "id": "U_S_N_D", "className": "U_S_N_D", "style": { "width": US.Width + "px", "height": US.Height + "px"} }, $("body")[0])
  44. var U_S_N_B = $$("div", { "id": "U_S_N_B", "className": "U_S_N_B", "style": { "left": (US.Width - 860) / 2 + "px", "top": (US.Height - 392) / 2 + "px"} }, $("body")[0]);
  45. var U_S_Title = $$("div", { "className": "U_S_Title" }, U_S_N_B)
  46. $$("div", { "innerHTML": "选择学校", "title": "选择学校", "className": "U_C_left" }, U_S_Title);
  47. $$("div", { "id": "U_S_B_Close", "className": "U_S_B_Close U_C_right", "onclick": [[City.destroy, ["", [U_S_N_D, U_S_N_B]]]], "innerHTML": "×" }, U_S_Title)
  48. var U_S_B = $$("div", { "id": "U_S_B", "className": "U_S_B" }, U_S_N_B);
  49. var U_S_B_L_T = $$("div", {}, U_S_B);
  50. $$("div", { "innerHTML": "城市选择:", "className": "U_S_color U_C_left" }, U_S_B_L_T);
  51. $$("div", { "innerHTML": "学校选择:", "className": "U_S_color U_C_left", "style": { "margin-left": "190px"} }, U_S_B_L_T);
  52. var U_S_B_L = $$("div", { "id": "U_S_B_L", "className": "U_S_B_L U_C_left" }, U_S_B);
  53. var U_S_B_L_Pro = $$("div", {}, U_S_B_L)
  54. for (var i = 0; i < r.value[0].length; i++) {
  55. var U_S_Select = $$("div", { "id": "U_S_Select_" + i, "className": "U_S_Select U_C_left U_C_Select", "innerHTML": r.value[0][i].place, "onclick": [[r.context[2].call, [[r.value[0][i].place, r.context[2], "U_S_Select_" + i]]]] }, U_S_B_L_Pro)
  56. if (r.value[0][i].place == r.context[2].area) {
  57. U_S_Select.style.border = "1px solid #A6A1A1";
  58. }
  59. }
  60. var U_S_B_L_Text = $$("div", { "id": "U_S_B_L_Text", "className": "U_S_B_L_Text" }, U_S_B_L);
  61. var U_S_B_L_Nofind = $$("div", { "innerHTML": "找不到我学校?", "className": "U_C_M_B_Text U_S_B_L_Nofind" }, U_S_B_L_Text);
  62. var U_S_B_L_input = $$("input", { "id": "U_S_B_L_input", "className": "U_C_B_L_input U_S_B_L_input", "placeholder": "例子:广东-深圳技师学院", "type": "text" }, U_S_B_L_Text)
  63. var U_S_B_L_submit = $$("div", { "id": "U_S_B_L_submit", "className": "U_S_B_L_submit" }, U_S_B_L_Text)
  64. var U_S_B_L_submit_t = $$("div", { "innerHTML": "确定", "onclick": [[r.context[2].YOrF, [U_S_B_L_input, r]]] }, U_S_B_L_submit)
  65. U_S_B_L_Nofind.onclick = function () { U_S_B_L_input.focus() }
  66. var U_S_B_R = $$("div", { "id": "U_S_B_R", "className": "U_S_B_R U_C_left" }, U_S_B);
  67. U.ACD.Request(U.CD.AjaxUrl, [U.CD.Host, U.CD.Database, "US_S_Select_school", r.context[2].area ? r.context[2].area : "北京"]), r.context[2].school, ["", "bb", r.context[2], "北京"];
  68. },
  69. call: function (r) {
  70. for (var i = 0; i < 33; i++) {
  71. $("#U_S_Select_" + i)[0].className = "U_S_Select U_C_left U_C_Select";
  72. }
  73. $("#" + r[2])[0].className = "U_S_Select U_C_left border U_C_Select";
  74. U.ACD.Request(U.CD.AjaxUrl, [U.CD.Host, U.CD.Database, "US_S_Select_school", r[0]], r[1].school, ["", "bb", r]);
  75. },
  76. YOrF: function (str, r) {
  77. var S = str.value.split("-");
  78. var flg = false;
  79. var reg = /[\u4E00-\u9FA5\uF900-\uFA2D]/;
  80. if (S.length != 2) { alert("填下信息有错,例子:广东-深圳技师学院"); return; }
  81. for (var i = 0; i < r.value[0].length; i++) {
  82. if (r.value[0][i].place == S[0]) { flg = true; break; }
  83. }
  84. if (flg == true) {
  85. if (reg.test(S[1])) {
  86. r.context[2].result[S[1], S[0], r.context[2]];
  87. }
  88. } else { alert("输入的省份有错"); }
  89. },
  90. school: function (r) {
  91. U_S_B_R.innerHTML = "";
  92. var city, _this;
  93. r.context[3] != undefined ? city = r.context[3] : city = r.context[2][0];
  94. r.context[2][1] != undefined ? _this = r.context[2][1] : _this = r.context[2];
  95. for (var k = 0; k < r.value[0].length; k++) {
  96. $$("div", { "id": "U_S_School_" + k, "className": "U_S_School U_C_left", "innerHTML": r.value[0][k].name, "onclick": [[_this.result, [[r.value[0][k].name, city, _this]]]] }, U_S_B_R);
  97. }
  98. },
  99. result: function (r) {
  100. $("#U_S_N_B")[0].parentNode.removeChild($("#U_S_N_B")[0]);
  101. $("#U_S_N_D")[0].parentNode.removeChild($("#U_S_N_D")[0]);
  102. r[2].area = r[1];
  103. $("#U_S_input")[0].value = r[2].value = r[0];
  104. $("#U_S_O_C")[0].innerHTML = r[0];
  105. },
  106. sumbit: function (Uit) { //这里是返回一个数组, 数组的值是用户选择的值
  107. if (Uit == undefined) {
  108. return;
  109. }
  110. Uit.onclick = (function (that) {
  111. return function () {
  112. }
  113. })(this)
  114. }
  115. }