note.html 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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,maximum-scale=1,user-scalable=no">
  7. <meta name="apple-mobile-web-app-capable" content="yes">
  8. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  9. <link rel="stylesheet" type="text/css" href="../../../css/common/mui.min.css" />
  10. <link rel="stylesheet" href="../../../css/common/common.css">
  11. <style type="text/css">
  12. .color-word {
  13. color: #C0C0C0;
  14. font-size: 12px;
  15. white-space: nowrap;
  16. overflow: hidden;
  17. /* 内容超出宽度时隐藏超出部分的内容 */
  18. text-overflow: ellipsis
  19. }
  20. .mui-table-view-cell span#rg {
  21. position: absolute;
  22. top: 0px;
  23. right: -40px;
  24. color: #CCCCCC;
  25. font-size: 12px;
  26. }
  27. </style>
  28. </head>
  29. <body>
  30. <header id="header" class="mui-bar mui-bar-nav">
  31. <a class="mui-action-back mui-icon mui-icon-arrowleft">
  32. <span class="back">返回</span>
  33. </a>
  34. <h1 class="mui-title">记事本</h1>
  35. </header>
  36. <div class="mui-content">
  37. <ul class="mui-table-view mui-table-view-chevron">
  38. </ul>
  39. </div>
  40. <!--固定的菜单选项-->
  41. <div class="fixed-box">
  42. <div>
  43. <a id="add-note.html" onclick="hrefTo(this.id)">新建</a>
  44. </div>
  45. <div class="mo-word xx">
  46. <img src="../../../img/home-index/add.png" />
  47. </div>
  48. </div>
  49. <script src="../../../libs/mui.min.js"></script>
  50. <script src="../../../libs/href.js" type="text/javascript" charset="utf-8"></script>
  51. <script>
  52. window.onload = function() {
  53. //固定菜单
  54. var count = 0;
  55. mui(document.body).on('tap', '.xx', function() {
  56. if(count % 2 == 0) {
  57. mui('.fixed-box')[0].childNodes[1].className = 'move1';
  58. mui('.fixed-box')[0].childNodes[3].className = 'mo-word xx move7';
  59. } else {
  60. mui('.fixed-box')[0].childNodes[1].className = 'move4';
  61. mui('.fixed-box')[0].childNodes[3].className = 'mo-word xx move8';
  62. }
  63. count++
  64. });
  65. //查询记事本
  66. mui.plusReady(function() {
  67. var str = plus.storage.getItem('user');
  68. var user = JSON.parse(str);
  69. var token = user.Data.Token;
  70. var postdata = {
  71. exist: "-1", //名称
  72. pageIndex: 1, //页码
  73. pageSize: 100 //页码大小
  74. }
  75. mui.ajax("http://www.bosshand.cn/api/Customer/GetNotepadPageList", {
  76. headers: {
  77. authorization: token
  78. },
  79. type: "post",
  80. data: postdata,
  81. success: function(data) {
  82. var data = data.Data.list;
  83. var html = '';
  84. for(var i = 0; i < data.length; i++) {
  85. html += '<li class="mui-table-view-cell">'
  86. html += '<div class="mui-slider-right mui-disabled">'
  87. html += '<a class="mui-btn mui-btn-red" onclick="clearNote(' + data[i].Code + ',this)">删除</a>'
  88. html += '</div>'
  89. html += '<div class="mui-slider-handle" onclick="openDetails(' + data[i].Code + ')">'
  90. html += '<div class="sm-mo-word">' + data[i].Tilte + ' </div>'
  91. html += '<div class ="color-word" >' + data[i].Content + '</div>'
  92. html += '<span id ="rg">' + getLocalDate(data[i].CreateTime) + '</span>'
  93. html += '</div>'
  94. html += '</li>'
  95. mui('.mui-content ul')[0].innerHTML = html;
  96. }
  97. }
  98. });
  99. })
  100. };
  101. //删除记事本
  102. function clearNote(code, This) {
  103. mui.plusReady(function() {
  104. var str = plus.storage.getItem('user');
  105. var user = JSON.parse(str);
  106. var token = user.Data.Token;
  107. var postdata = {
  108. "": code
  109. }
  110. mui.ajax("http://www.bosshand.cn/api/Customer/DeleteListNotepad", {
  111. headers: {
  112. authorization: token
  113. },
  114. type: "post",
  115. data: postdata,
  116. success: function(data) {
  117. mui(This)[0].parentNode.parentNode.parentNode.removeChild(mui(This)[0].parentNode.parentNode)
  118. }
  119. });
  120. })
  121. }
  122. //详情跳转
  123. function openDetails(code) {
  124. mui.openWindow({
  125. url: 'note-details.html',
  126. extras: {
  127. code: code
  128. },
  129. createNew: true, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
  130. show: {
  131. autoShow: true, //页面loaded事件发生后自动显示,默认为true
  132. },
  133. waiting: {
  134. autoShow: false, //自动显示等待框,默认为true
  135. }
  136. })
  137. }
  138. //时间修改
  139. function getLocalDate(now) {
  140. var date = now.replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '');
  141. var arr = date.split(' ');
  142. //日期
  143. var arrDate = arr[0].split('-');
  144. //时间
  145. var arrTime = arr[1].split(':');
  146. return arrDate[0] + '年' + arrDate[1] + '月' + arrDate[2] + '日';
  147. }
  148. </script>
  149. </body>
  150. </html>