No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 
 

245 líneas
8.3 KiB

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title></title>
  6. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  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 type="text/css">
  11. #username,
  12. #sex,
  13. #birth,
  14. #phone,
  15. #gexin {
  16. margin-right: 40px;
  17. white-space: normal;
  18. margin-left: 100px;
  19. }
  20. .mui-content-padded {
  21. margin-top: 25px;
  22. }
  23. .mui-btn {
  24. padding: 10px;
  25. }
  26. </style>
  27. <script src="js/mui.min.js"></script>
  28. <script type="text/javascript" src="js/serverurl.js"></script>
  29. <script type="text/javascript" src="js/userinfos.js"></script>
  30. <script type="text/javascript" src="js/tools.js"></script>
  31. <script src="js/mui.picker.min.js"></script>
  32. <script type="text/javascript">
  33. function OpenSexPicker() {
  34. userPicker.show(function(items) {
  35. document.getElementById("sex").innerText = items[0].text;
  36. document.getElementById("hidsex").value = items[0].value;
  37. });
  38. }
  39. function RefreshUserInfo() {
  40. mui.post(api + '/user/getStuByUserId', {
  41. data: users.ID
  42. }, function(des) {
  43. if (des.code == "200") {
  44. SetLogin(des.data)
  45. plus.webview.currentWebview().close();
  46. plus.nativeUI.toast("修改成功。");
  47. }
  48. }, 'json')
  49. }
  50. function OpenSelectedDate(inputobj, typename) {
  51. var optionsJson = '{"type":"' + typename + '","beginYear":1910,"endYear":2100}';
  52. var options = JSON.parse(optionsJson);
  53. var picker = new mui.DtPicker(options);
  54. picker.show(function(rs) {
  55. //input赋值
  56. document.getElementById(inputobj).innerText = rs.text;
  57. if (typename == "date") {
  58. document.getElementById(inputobj + "Text").innerText = rs.text;
  59. }
  60. picker.dispose();
  61. });
  62. }
  63. var userPicker;
  64. function jsonDateFormatDateTime(strDate) { //json日期格式转换为正常格式
  65. if(strDate != undefined && strDate != null) {
  66. var date = eval('new Date(' + strDate.replace(/\d+(?=-[^-]+$)/,
  67. function(a) {
  68. return parseInt(a, 10) - 1;
  69. }).match(/\d+/g) + ')');
  70. return formatDateTime(date);
  71. } else {
  72. return '';
  73. }
  74. }
  75. mui.plusReady(function() {
  76. if (CheckLogin()) {
  77. document.getElementById("username").innerText = users.username;
  78. document.getElementById("ids").innerText = users.ids;
  79. document.getElementById("hidsex").value = users.sex;
  80. document.getElementById("sex").innerText = users.sexname;
  81. document.getElementById("birth").innerText = jsonDateFormatDateTime(users.birth);
  82. document.getElementById("phone").innerText = users.phone;
  83. if (users.photo != undefined && users.photo != null) {
  84. document.getElementById("photo").src = web + '/' + users.photo;
  85. //document.getElementById("hidphoto").value = users.photo;
  86. }
  87. userPicker = new mui.PopPicker();
  88. GetDictionaryData(userPicker, "usersex");
  89. //头像
  90. mui(".mui-table-view-cell").on("tap", "#head", function(e) {
  91. var a = [{
  92. title: "拍照"
  93. }, {
  94. title: "从手机相册选择"
  95. }];
  96. plus.nativeUI.actionSheet({
  97. title: "修改头像",
  98. cancel: "取消",
  99. buttons: a
  100. }, function(b) {
  101. switch (b.index) {
  102. case 0:
  103. break;
  104. case 1:
  105. getImage();
  106. break;
  107. case 2:
  108. galleryImg();
  109. break;
  110. default:
  111. break
  112. }
  113. })
  114. });
  115. //性别
  116. mui(".mui-table-view-cell").on("tap", "#asex", function(e) {
  117. e.detail.gesture.preventDefault();
  118. OpenSexPicker();
  119. });
  120. //出生年月
  121. mui(".mui-table-view-cell").on("tap", "#abirth", function(e) {
  122. e.detail.gesture.preventDefault();
  123. OpenSelectedDate("birth", "month");
  124. });
  125. //身份证
  126. mui(".mui-table-view-cell").on("tap", "#aid", function(e) {
  127. e.detail.gesture.preventDefault();
  128. var btnArray = ['确定', '取消'];
  129. mui.prompt('请输入您的身份证号:', '您的身份证号', '修改身份证号', btnArray, function(e) {
  130. if (e.index == 0) {
  131. if (!isIdCardNo(e.value)) {
  132. plus.nativeUI.toast("请您填写正确的身份证号。");
  133. } else {
  134. document.getElementById("ids").innerText = e.value;
  135. }
  136. } else {
  137. }
  138. });
  139. });
  140. document.getElementById("saveuserinfo").addEventListener("tap", function() {
  141. // var xhr = new plus.net.XMLHttpRequest();
  142. // xhr.responseType = "json";
  143. // xhr.onreadystatechange = function() {
  144. // switch(xhr.readyState) {
  145. // case 4:
  146. // if(xhr.status == 200) {
  147. // plus.nativeUI.closeWaiting();
  148. // if(xhr.response.result == "ok") {
  149. // plus.webview.currentWebview().opener().evalJS("document.getElementById('username').innerText='" + document.getElementById('username').innerText + "';");
  150. // plus.webview.currentWebview().opener().evalJS("document.getElementById('phone').innerText='" + document.getElementById('phone').innerText + "';");
  151. // plus.webview.currentWebview().opener().evalJS("document.getElementById('photo').src='" + serverdomain + '/' + document.getElementById('hidphoto').value + "';");
  152. // RefreshUserData();
  153. // plus.webview.currentWebview().close();
  154. // plus.nativeUI.toast("修改成功。");
  155. // } else {
  156. // plus.nativeUI.toast("操作失败,请重试。");
  157. // }
  158. // } else {
  159. // plus.nativeUI.closeWaiting();
  160. // plus.nativeUI.toast("操作失败,请重试。");
  161. // }
  162. // break;
  163. // default:
  164. // break;
  165. // }
  166. // }
  167. // xhr.open("GET", encodeURI(serverdomain + "/WebService/UserService.ashx?Action=teacherModify&content={'mobile':'" + document.getElementById("phone").innerText +
  168. // "','photo':'" + document.getElementById("hidphoto").value +
  169. // "','realName':'" + document.getElementById("username").innerText +
  170. // "','sexID':'" + document.getElementById("hidsex").value +
  171. // "','birthDate':'" + document.getElementById("birth").innerText + "','ids':'" + document.getElementById("ids").value + "'}"));
  172. // xhr.send();
  173. plus.nativeUI.showWaiting("加载中..."); //
  174. var param = {
  175. sex: document.getElementById("hidsex").value, //
  176. ids: document.getElementById("ids").innerText,
  177. birthday: document.getElementById("birth").innerText,
  178. id: users.ID
  179. }
  180. mui.post(api + '/user/updateStuByStuTerminal', {
  181. data: JSON.stringify(param)
  182. }, function(res) {
  183. plus.nativeUI.closeWaiting();
  184. if (res.code == "200") {
  185. RefreshUserInfo()
  186. }
  187. }, 'json')
  188. });
  189. }
  190. });
  191. </script>
  192. </head>
  193. <body>
  194. <header class="mui-bar mui-bar-nav">
  195. <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
  196. <h1 class="mui-title">个人信息</h1>
  197. </header>
  198. <div class="mui-content">
  199. <div class="mui-scroll-wrapper kuang">
  200. <div class="mui-scroll">
  201. <ul class="mui-table-view">
  202. <li class="mui-table-view-cell">
  203. <a id="head" class="mui-navigate-right">头像
  204. <span class="mui-pull-right head">
  205. <img class="head-img rightph" id="photo" src="images/user-photo.png" />
  206. <input type="hidden" id="hidphoto" />
  207. </span>
  208. </a>
  209. </li>
  210. <li class="mui-table-view-cell">
  211. <a id="ausername">姓名<span class="mui-pull-right " id="username"></span></a>
  212. </li>
  213. <li class="mui-table-view-cell">
  214. <input type="hidden" id="hidsex" />
  215. <a id="asex">性别<span class="mui-pull-right mui-navigate-right" id="sex">女</span></a>
  216. </li>
  217. <li class="mui-table-view-cell">
  218. <a id="abirth">出生年月<span class="mui-pull-right mui-navigate-right" id="birth"></span></a>
  219. </li>
  220. <li class="mui-table-view-cell">
  221. <a id="aid">身份证号<span class="mui-pull-right " id="ids" maxlength="18" min="15"></span></a>
  222. </li>
  223. <li class="mui-table-view-cell">
  224. <a id="aphone">手机号<span class="mui-pull-right " id="phone"></span></a>
  225. </li>
  226. </ul>
  227. <div class="mui-content-padded">
  228. <button id='saveuserinfo' class="mui-btn mui-btn-block mui-btn-primary">保存</button>
  229. </div>
  230. </div>
  231. </div>
  232. </div>
  233. </body>
  234. </html>