my.html 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <!DOCTYPE html>
  2. <html lang="zh-cn">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="format-detection" content="telephone=no"/>
  6. <meta name="format-detection" content="email=no"/>
  7. <title>my</title>
  8. <link rel="stylesheet" href="../css/reset.css">
  9. <link rel="stylesheet" href="../css/style.css">
  10. <script src="../script/flexible.js"></script>
  11. <style>
  12. html,body{
  13. height: 100%;
  14. }
  15. .my{
  16. height: 100%;
  17. background-color: #f7f7f7;
  18. padding-top: 0.23rem;
  19. }
  20. .my_con li{
  21. height: 1.5rem;
  22. line-height: 1.5rem;
  23. color: #212121;
  24. font-size: .42rem;
  25. background-color: #fff;
  26. padding: 0 .3rem;
  27. border-bottom: 1px solid #efefef;
  28. }
  29. .my_con li span:nth-of-type(2){
  30. color: #b5b5b5;
  31. font-size: .42rem;
  32. }
  33. </style>
  34. </head>
  35. <body>
  36. <div class="my">
  37. <div class="my_con">
  38. <ul>
  39. <li class="clearFix">
  40. <span class="left">个人资料</span><span class="right">〉</span>
  41. </li>
  42. <li class="clearFix">
  43. <span class="left">修改密码</span><span class="right">〉</span>
  44. </li>
  45. <li class="clearFix">
  46. <span class="left">变电柜维护</span><span class="right">〉</span>
  47. </li>
  48. <li class="clearFix">
  49. <span class="left">添加变电柜</span><span class="right">〉</span>
  50. </li>
  51. <li class="clearFix">
  52. <span class="left">添加街道</span><span class="right">〉</span>
  53. </li>
  54. <li class="clearFix">
  55. <span class="left">注销登录</span><span class="right">〉</span>
  56. </li>
  57. </ul>
  58. </div>
  59. </div>
  60. <script src="../script/jqueryMin.js"></script>
  61. <script src="../script/publicData.js"></script>
  62. <script type="text/javascript" src="../script/api.js"></script>
  63. <script>
  64. apiready=function () {
  65. getStreet();
  66. getDistrict();
  67. $(".my_con").on('click','li',function () {
  68. switch ($(this).index()){
  69. case 0:toUserData();
  70. break;
  71. case 1:changePW();
  72. break;
  73. case 2:toMaintain();
  74. break;
  75. case 3:toAdd();
  76. getStreet();
  77. break;
  78. case 4:addStreet();
  79. getDistrict();
  80. break;
  81. case 5:toLogin();
  82. break;
  83. }
  84. })
  85. function toUserData() {
  86. api.openWin({
  87. name: 'userdata',
  88. url: './userdata.html',
  89. animation: {
  90. type: 'push',
  91. subType: 'from_right',
  92. duration: 400
  93. },
  94. delay:300
  95. });
  96. }
  97. function toMaintain() {
  98. api.execScript({
  99. script: 'toFrame(8);'
  100. });
  101. }
  102. function changePW() {
  103. api.openWin({
  104. name: 'changePW',
  105. url: './changePW.html',
  106. animation: {
  107. type: 'push',
  108. subType: 'from_right',
  109. duration: 400
  110. },
  111. delay:300
  112. });
  113. }
  114. function toAdd() {
  115. api.openWin({
  116. name: 'addBDG',
  117. url: './addBDG.html',
  118. animation: {
  119. type: 'push',
  120. subType: 'from_right',
  121. duration: 400
  122. },
  123. reload:true,
  124. delay:300
  125. });
  126. }
  127. function addStreet() {
  128. api.openWin({
  129. name: 'addStreet',
  130. url: './addStreet.html',
  131. animation: {
  132. type: 'push',
  133. subType: 'from_right',
  134. duration: 400
  135. },
  136. reload:true,
  137. delay:300
  138. });
  139. }
  140. function getDistrict() {
  141. api.ajax({
  142. url: pageUrl+"/index/street/all-guanqu",
  143. method: 'get',
  144. timeout: 30,
  145. dataType: 'text',
  146. returnAll: false,
  147. data: {
  148. values: {user_id:$api.getStorage("user").id}
  149. }
  150. }, function (data, err) {
  151. var data=JSON.parse(data),districtData=[];
  152. // alert(JSON.stringify(data))
  153. for(var i in data){
  154. districtData[i]={
  155. id:data[i]['id'],
  156. text: data[i]['title'],
  157. status: 'normal'
  158. }
  159. }
  160. $api.setStorage("districtList",districtData);
  161. api.execScript({
  162. name: 'root',
  163. script: 'totalTime(0);'
  164. });
  165. });
  166. }
  167. function getStreet() {
  168. api.ajax({
  169. url: pageUrl+"/index/street/jiedao",
  170. method: 'get',
  171. timeout: 30,
  172. dataType: 'text',
  173. returnAll: false,
  174. data: {
  175. values: {user_id:$api.getStorage("user").id}
  176. }
  177. }, function (data, err) {
  178. var data=JSON.parse(data).data,streetData=[],obj={};
  179. // alert(JSON.stringify(data))
  180. for(var i in data){
  181. if(!data[i]["street"]) continue;
  182. obj={
  183. id:data[i]["street"]['id'],
  184. text: data[i]["street"]['title'],
  185. status: 'normal'
  186. }
  187. streetData.push(obj)
  188. }
  189. $api.setStorage("streetList",streetData);
  190. api.execScript({
  191. name: 'root',
  192. script: 'totalTime(0);'
  193. });
  194. });
  195. }
  196. function toLogin() {
  197. api.actionSheet({
  198. title: '确定要注销当前账号吗?',
  199. cancelTitle: '取消',
  200. destructiveTitle: '确认',
  201. style:{
  202. itemNormalColor:'#fff',
  203. fontNormalColor:'#4796ff'
  204. }
  205. }, function(ret, err) {
  206. var index = ret.buttonIndex;
  207. if(index==1){
  208. $api.rmStorage("user");
  209. $api.rmStorage("userdata");
  210. api.openWin({
  211. name: 'login',
  212. url: './login.html',
  213. animation: {
  214. type: 'movein',
  215. subType: 'from_right',
  216. duration: 400
  217. },
  218. delay:300
  219. });
  220. }
  221. });
  222. }
  223. }
  224. </script>
  225. </body>
  226. </html>