You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

329 lines
12 KiB

  1. <!DOCTYPE html>
  2. <html class="ui-page-login">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  6. <title></title>
  7. <link href="css/mui.min.css" rel="stylesheet" />
  8. <link href="css/style.css" rel="stylesheet" />
  9. <link rel="stylesheet" type="text/css" href="css/mui.picker.min.css" />
  10. <style>
  11. .area {
  12. margin: 20px auto 0px auto;
  13. }
  14. .mui-input-group:first-child {
  15. margin-top: 20px;
  16. }
  17. .mui-input-group label {
  18. width: 30%;
  19. text-align: center;
  20. }
  21. .mui-input-row label~input,
  22. .mui-input-row label~select,
  23. .mui-input-row label~textarea {
  24. width: 70%;
  25. }
  26. .mui-checkbox input[type=checkbox],
  27. .mui-radio input[type=radio] {
  28. top: 6px;
  29. }
  30. .mui-content-padded {
  31. margin-top: 25px;
  32. }
  33. .mui-btn {
  34. padding: 10px;
  35. }
  36. #sextext,
  37. #culturetext,
  38. #schooltext,
  39. #departtext,
  40. #provincetext {
  41. line-height: 40px;
  42. text-overflow: ellipsis;
  43. overflow: hidden;
  44. }
  45. </style>
  46. <script src="js/mui.min.js"></script>
  47. <script src="js/serverurl.js"></script>
  48. <script src="js/userinfos.js"></script>
  49. <script type="text/javascript" src="js/tools.js"></script>
  50. <script src="js/mui.picker.min.js"></script>
  51. <script src="js/city.data-3.js" type="text/javascript" charset="utf-8"></script>
  52. <script type="text/javascript">
  53. function OpenAndSetPicker(picker, field) {
  54. picker.show(function(items) {
  55. if (items[0].value != undefined && items[0].value != null && items[0].value != '') {
  56. document.getElementById(field + "text").innerText = items[0].text;
  57. document.getElementById(field + "id").value = items[0].value;
  58. if (field == "school") {
  59. var whcdid = document.getElementById("cultureid").value;
  60. if (whcdid == "") {
  61. plus.nativeUI.toast("请选择文化程度。");
  62. return;
  63. }
  64. GetDepartData(userPickerdepart, "" + items[0].value + "", "" + whcdid + "");
  65. }
  66. } else {
  67. plus.nativeUI.toast("当前校区暂无对应专业。");
  68. return false;
  69. }
  70. });
  71. }
  72. var userPickersex, userPickerculture, userPickerschool, userPickerdepart;
  73. var provincePicker;
  74. var _getParam = function(obj, param) {
  75. return obj[param] || '';
  76. };
  77. mui.plusReady(function() {
  78. var userid = plus.webview.currentWebview().userid;
  79. if (CheckLogin()) {
  80. userPickersex = new mui.PopPicker();
  81. userPickerculture = new mui.PopPicker();
  82. userPickerschool = new mui.PopPicker();
  83. userPickerdepart = new mui.PopPicker();
  84. var provincePicker = new mui.PopPicker({
  85. layer: 3
  86. });
  87. provincePicker.setData(cityData3);
  88. var showCityPickerButton = document.getElementById('selprovince');
  89. showCityPickerButton.addEventListener('tap', function(event) {
  90. provincePicker.show(function(items) {
  91. document.getElementById("provinceid").value = _getParam(items[0], 'text');
  92. document.getElementById("cityid").value = _getParam(items[1], 'text');
  93. document.getElementById("areaid").value = _getParam(items[2], 'text');
  94. document.getElementById("provincetext").innerText = _getParam(items[0], 'text') + " " + _getParam(items[1],
  95. 'text') + " " + _getParam(items[2], 'text');
  96. //返回 false 可以阻止选择框的关闭
  97. //return false;
  98. });
  99. }, false);
  100. GetDictionaryData(userPickersex, "usersex"); //性别
  101. GetDictionaryDataBySource(userPickerculture, "DegreeOfEducation"); //文化程度
  102. GetSchoolData(userPickerschool); //绑定校区
  103. document.getElementById("selsex").addEventListener("tap", function() {
  104. OpenAndSetPicker(userPickersex, "sex");
  105. });
  106. document.getElementById("selculture").addEventListener("tap", function() {
  107. OpenAndSetPicker(userPickerculture, "culture");
  108. });
  109. document.getElementById("selschool").addEventListener("tap", function() {
  110. OpenAndSetPicker(userPickerschool, "school");
  111. });
  112. document.getElementById("seldepart").addEventListener("tap", function() {
  113. OpenAndSetPicker(userPickerdepart, "depart");
  114. });
  115. document.getElementById("reg").addEventListener("tap", function() {
  116. if (document.getElementById("username").value == "" || document.getElementById("sexid").value == "" ||
  117. document.getElementById("phone").value == "" ||
  118. document.getElementById("address").value == "" || document.getElementById("cultureid").value == "" ||
  119. document.getElementById("schoolid").value == "" || document.getElementById("departid") == "" ||
  120. document.getElementById("paymentQuota").value == "" || document.getElementById("provinceid").value == "" ||
  121. document.getElementById("cityid").value == "" || document.getElementById("areaid").value == "") {
  122. plus.nativeUI.toast("提交失败!请您填写完整表单信息。");
  123. return;
  124. }
  125. if (!isIdCardNo(document.getElementById("ids").value)) {
  126. plus.nativeUI.toast("请您填写正确的身份证号。");
  127. return;
  128. }
  129. var moneytest = /^(0|[1-9]\d*|(0|[1-9]\d*)\.\d*[1-9])$/;
  130. if (!moneytest.test(document.getElementById("paymentQuota").value)) {
  131. plus.nativeUI.toast("请您填写正确的金额。");
  132. return;
  133. }
  134. var phonereg = /(^0?[1][3578][0-9]{9}$)/;
  135. if (!phonereg.test(document.getElementById("phone").value)) {
  136. plus.nativeUI.toast("请您填写正确的手机号。");
  137. return;
  138. }
  139. if (userid != undefined && userid != null) {
  140. plus.nativeUI.showWaiting("加载中...");
  141. var param = {
  142. id: userid,
  143. username: document.getElementById("username").value,
  144. sex: document.getElementById("sexid").value,
  145. phone: document.getElementById("phone").value,
  146. address: document.getElementById("address").value,
  147. culture: document.getElementById("cultureid").value,
  148. school: document.getElementById("schoolid").value,
  149. depart: document.getElementById("departid").value,
  150. paymentQuota: document.getElementById("paymentQuota").value,
  151. rTeacher: users.ID,
  152. ids: document.getElementById("ids").value,
  153. renarks: document.getElementById("renarks").value,
  154. province: document.getElementById("provinceid").value,
  155. city: document.getElementById("cityid").value,
  156. county: document.getElementById("areaid").value
  157. }
  158. mui.post(api + '/user/updatestu', {
  159. data: JSON.stringify(param)
  160. }, function(res) {
  161. plus.nativeUI.closeWaiting();
  162. if (res.code == "200") {
  163. plus.webview.currentWebview().opener().opener().evalJS('GetCount();');
  164. plus.webview.currentWebview().opener().evalJS('GetData(1, "tablereg");');
  165. plus.webview.currentWebview().close();
  166. plus.nativeUI.toast("修改成功。");
  167. }
  168. }, 'json')
  169. } else {
  170. var param = {
  171. username: document.getElementById("username").value,
  172. sex: document.getElementById("sexid").value,
  173. phone: document.getElementById("phone").value,
  174. address: document.getElementById("address").value,
  175. culture: document.getElementById("cultureid").value,
  176. school: document.getElementById("schoolid").value,
  177. depart: document.getElementById("departid").value,
  178. paymentQuota: document.getElementById("paymentQuota").value,
  179. rTeacher: users.ID,
  180. ids: document.getElementById("ids").value,
  181. renarks: document.getElementById("renarks").value,
  182. province: document.getElementById("provinceid").value,
  183. city: document.getElementById("cityid").value,
  184. county: document.getElementById("areaid").value
  185. }
  186. mui.post(api + '/user/register', {
  187. data: JSON.stringify(param)
  188. }, function(res) {
  189. if (res.code == "200") {
  190. plus.webview.currentWebview().opener().evalJS('GetCount();');
  191. plus.webview.currentWebview().close();
  192. plus.nativeUI.toast("录入成功。");
  193. }
  194. }, 'json')
  195. }
  196. });
  197. //绑定数据
  198. if (userid != undefined && userid != null) {
  199. GetData(userid);
  200. }
  201. } else {
  202. }
  203. });
  204. function GetData(uid) {
  205. plus.nativeUI.showWaiting("加载中...");
  206. mui.post(api + '/user/getstubyid', {
  207. data: uid
  208. }, function(res) {
  209. plus.nativeUI.closeWaiting();
  210. if (res.code == "200") {
  211. document.getElementById("username").value = res.data.username;
  212. document.getElementById("sexid").value = res.data.sexid;
  213. document.getElementById("sextext").innerText = res.data.sex;
  214. document.getElementById("phone").value = res.data.phone;
  215. document.getElementById("address").value = res.data.address;
  216. document.getElementById("ids").value = res.data.ids;
  217. document.getElementById("cultureid").value = res.data.cultureid;
  218. document.getElementById("culturetext").innerText = res.data.culture;
  219. document.getElementById("schoolid").value = res.data.schoolid;
  220. document.getElementById("schooltext").innerText = res.data.school;
  221. GetDepartData(userPickerdepart, "" + res.data.schoolid + "", "" + res.data.cultureid + "");
  222. document.getElementById("departid").value = res.data.departid;
  223. document.getElementById("departtext").innerText = res.data.depart;
  224. document.getElementById("paymentQuota").value = res.data.paymentQuota;
  225. document.getElementById("renarks").value = res.data.renarks;
  226. document.getElementById("provinceid").value = res.data.province;
  227. document.getElementById("cityid").value = res.data.city;
  228. document.getElementById("areaid").value = res.data.county;
  229. document.getElementById("provincetext").innerText = res.data.province + " " + res.data.city + " " + res.data.county;
  230. }
  231. }, 'json')
  232. }
  233. </script>
  234. </head>
  235. <body>
  236. <header class="mui-bar mui-bar-nav">
  237. <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
  238. <h1 class="mui-title">录入学生信息</h1>
  239. </header>
  240. <div class="mui-content">
  241. <form class="mui-input-group">
  242. <div class="mui-input-row">
  243. <label>姓&nbsp;&nbsp;&nbsp;名</label>
  244. <input id='username' type="text" class="mui-input-clear mui-input" placeholder="请输入姓名">
  245. </div>
  246. <div class="mui-input-row" id="selsex">
  247. <label>性&nbsp;&nbsp;&nbsp;别</label>
  248. <input type="hidden" id="sexid" />
  249. <span id="sextext">请选择</span><span class="mui-pull-right mui-navigate-right"></span>
  250. </div>
  251. <div class="mui-input-row">
  252. <label>手&nbsp;机&nbsp;号</label>
  253. <input id='phone' type="number" class="mui-input-clear mui-input-numbox" placeholder="请输入手机号">
  254. </div>
  255. <div class="mui-input-row" id="selprovince">
  256. <label>省市县/区</label>
  257. <input type="hidden" id="provinceid" />
  258. <input type="hidden" id="cityid" />
  259. <input type="hidden" id="areaid" />
  260. <span id="provincetext">请选择</span><span class="mui-pull-right mui-navigate-right"></span>
  261. </div>
  262. <div class="mui-input-row">
  263. <label>家庭住址</label>
  264. <input id='address' type="text" class="mui-input-clear mui-input" placeholder="乡镇/村/街/号">
  265. </div>
  266. <div class="mui-input-row">
  267. <label>身份证号</label>
  268. <input id='ids' type="text" class="mui-input-clear mui-input" placeholder="" maxlength="18" min="15">
  269. </div>
  270. <div class="mui-input-row" id="selculture">
  271. <label>文化程度</label>
  272. <input type="hidden" id="cultureid" />
  273. <span id="culturetext">请选择</span><span class="mui-pull-right mui-navigate-right"></span>
  274. </div>
  275. <div class="mui-input-row" id="selschool">
  276. <label>报考校区</label>
  277. <input type="hidden" id="schoolid" />
  278. <span id="schooltext">请选择</span><span class="mui-pull-right mui-navigate-right"></span>
  279. </div>
  280. <div class="mui-input-row" id="seldepart">
  281. <label>报考专业</label>
  282. <input type="hidden" id="departid" />
  283. <span id="departtext">请选择</span><span class="mui-pull-right mui-navigate-right"></span>
  284. </div>
  285. <div class="mui-input-row">
  286. <label>缴费额度</label>
  287. <input id='paymentQuota' type="number" class="mui-input-clear mui-input-numbox" placeholder="请输入缴费额度" value="0">
  288. </div>
  289. <div class="mui-input-row" style="height: 125px;">
  290. <label>备&nbsp;&nbsp;&nbsp;注</label>
  291. <textarea id="renarks" rows="5" placeholder=""></textarea>
  292. </div>
  293. </form>
  294. <div class="mui-content-padded">
  295. <button id='reg' class="mui-btn mui-btn-block mui-btn-primary">提交</button>
  296. </div>
  297. </div>
  298. </body>
  299. </html>