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.
 
 
 
 
 
 

220 lines
7.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 OpenSelectedDate(inputobj, typename) {
  40. var optionsJson = '{"type":"' + typename + '","beginYear":1910,"endYear":2100}';
  41. var options = JSON.parse(optionsJson);
  42. var picker = new mui.DtPicker(options);
  43. picker.show(function(rs) {
  44. //input赋值
  45. document.getElementById(inputobj).innerText = rs.text;
  46. if(typename == "date") {
  47. document.getElementById(inputobj + "Text").innerText = rs.text;
  48. }
  49. picker.dispose();
  50. });
  51. }
  52. var userPicker;
  53. mui.plusReady(function() {
  54. if(CheckLogin()) {
  55. document.getElementById("username").innerText = users.username;
  56. document.getElementById("hidsex").value = users.sex;
  57. document.getElementById("sex").innerText = users.sexname;
  58. document.getElementById("birth").innerText = users.birth;
  59. document.getElementById("phone").innerText = users.phone;
  60. if(users.photo != undefined && users.photo != null) {
  61. document.getElementById("photo").src = web + '/' + users.photo;
  62. document.getElementById("hidphoto").value = users.photo;
  63. }
  64. document.getElementById("gexin").innerText = users.gexin;
  65. userPicker = new mui.PopPicker();
  66. GetDictionaryData(userPicker, "usersex");
  67. //头像
  68. mui(".mui-table-view-cell").on("tap", "#head", function(e) {
  69. var a = [{
  70. title: "拍照"
  71. }, {
  72. title: "从手机相册选择"
  73. }];
  74. plus.nativeUI.actionSheet({
  75. title: "修改头像",
  76. cancel: "取消",
  77. buttons: a
  78. }, function(b) {
  79. switch(b.index) {
  80. case 0:
  81. break;
  82. case 1:
  83. getImage();
  84. break;
  85. case 2:
  86. galleryImg();
  87. break;
  88. default:
  89. break
  90. }
  91. })
  92. });
  93. //姓名
  94. mui(".mui-table-view-cell").on("tap", "#ausername", function(e) {
  95. e.detail.gesture.preventDefault();
  96. var btnArray = ['确定', '取消'];
  97. mui.prompt('请输入您的新姓名:', '您的姓名', '修改姓名', btnArray, function(e) {
  98. if(e.index == 0) {
  99. document.getElementById("username").innerText = e.value;
  100. } else {}
  101. })
  102. });
  103. //性别
  104. mui(".mui-table-view-cell").on("tap", "#asex", function(e) {
  105. e.detail.gesture.preventDefault();
  106. OpenSexPicker();
  107. });
  108. //出生年月
  109. mui(".mui-table-view-cell").on("tap", "#abirth", function(e) {
  110. e.detail.gesture.preventDefault();
  111. OpenSelectedDate("birth", "month");
  112. });
  113. //手机
  114. mui(".mui-table-view-cell").on("tap", "#aphone", function(e) {
  115. e.detail.gesture.preventDefault();
  116. var btnArray = ['确定', '取消'];
  117. mui.prompt('请输入您的新手机:', '您的手机', '修改手机', btnArray, function(e) {
  118. if(e.index == 0) {
  119. document.getElementById("phone").innerText = e.value;
  120. } else {
  121. }
  122. })
  123. });
  124. //个性签名
  125. mui(".mui-table-view-cell").on("tap", "#agexin", function(e) {
  126. e.detail.gesture.preventDefault();
  127. var btnArray = ['确定', '取消'];
  128. mui.prompt('请输入您的新个性签名:', '您的个性签名', '修改个性签名', btnArray, function(e) {
  129. if(e.index == 0) {
  130. document.getElementById("gexin").innerText = e.value;
  131. } else {
  132. }
  133. })
  134. });
  135. document.getElementById("saveuserinfo").addEventListener("tap", function() {
  136. var param={
  137. id:users.ID,
  138. photo:document.getElementById("phone").innerText,
  139. realName:document.getElementById("username").innerText,
  140. sexID:document.getElementById("hidsex").value,
  141. remark:document.getElementById("gexin").innerText,
  142. birthDate:document.getElementById("birth").innerText//
  143. }
  144. console.log(JSON.stringify(param))//
  145. mui.post(api+'/user/updatetea',{data:JSON.stringify(param)},function(res){
  146. plus.nativeUI.closeWaiting();
  147. if(res.code=="200"){
  148. plus.webview.currentWebview().opener().evalJS("document.getElementById('username').innerText='" + document.getElementById('username').innerText + "';");
  149. plus.webview.currentWebview().opener().evalJS("document.getElementById('phone').innerText='" + document.getElementById('phone').innerText + "';");
  150. users.username=param.realName;
  151. users.phone=param.photo;
  152. users.sexid=param.sexID;
  153. users.gexin=param.remark;
  154. users.birth=param.birthDate;
  155. localStorage.setItem('taigangteacherUserModel', JSON.stringify(users));//
  156. RefreshUserData();
  157. plus.webview.currentWebview().close();
  158. plus.nativeUI.toast("修改成功。");
  159. }
  160. },'json')
  161. });
  162. }
  163. });
  164. </script>
  165. </head>
  166. <body>
  167. <header class="mui-bar mui-bar-nav">
  168. <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
  169. <h1 class="mui-title">个人信息</h1>
  170. </header>
  171. <div class="mui-content">
  172. <div class="mui-scroll-wrapper kuang">
  173. <div class="mui-scroll">
  174. <ul class="mui-table-view">
  175. <li class="mui-table-view-cell">
  176. <a id="head" class="mui-navigate-right">头像
  177. <span class="mui-pull-right head">
  178. <img class="head-img rightph" id="photo" src="images/user-photo.png"/>
  179. <input type="hidden" id="hidphoto" />
  180. </span>
  181. </a>
  182. </li>
  183. <li class="mui-table-view-cell">
  184. <a id="ausername">姓名<span class="mui-pull-right mui-navigate-right" id="username"></span></a>
  185. </li>
  186. <li class="mui-table-view-cell">
  187. <input type="hidden" id="hidsex" />
  188. <a id="asex">性别<span class="mui-pull-right mui-navigate-right" id="sex">女</span></a>
  189. </li>
  190. <li class="mui-table-view-cell">
  191. <a id="abirth">出生年月<span class="mui-pull-right mui-navigate-right" id="birth"></span></a>
  192. </li>
  193. <li class="mui-table-view-cell">
  194. <a id="aphone">手机号<span class="mui-pull-right mui-navigate-right" id="phone"></span></a>
  195. </li>
  196. <li class="mui-table-view-cell">
  197. <a id="agexin">个性签名<span class="mui-pull-right mui-navigate-right" id="gexin"></span></a>
  198. </li>
  199. </ul>
  200. <div class="mui-content-padded">
  201. <button id='saveuserinfo' class="mui-btn mui-btn-block mui-btn-primary">保存</button>
  202. </div>
  203. </div>
  204. </div>
  205. </div>
  206. </body>
  207. </html>