add-note.html 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. <link rel="stylesheet" type="text/css" href="../../../css/index/index-admin/common-add.css" />
  12. </head>
  13. <body>
  14. <header id="header" class="mui-bar mui-bar-nav">
  15. <a class="mui-action-back mui-icon mui-icon-arrowleft">
  16. <span class="back">返回</span>
  17. </a>
  18. <h1 class="mui-title">添加记事本</h1>
  19. <a class="mui-btn-link mui-pull-right fz fb">保存</a>
  20. </header>
  21. <div class="mui-content">
  22. <div class="note-box">
  23. <div>
  24. <span class="color-word">标题</span>
  25. <span>
  26. <input id="title" type="text" placeholder="请输入标题"/>
  27. </span>
  28. </div>
  29. <div>
  30. <textarea id="content" class="sm-mo-word">请输入内容</textarea>
  31. </div>
  32. </div>
  33. </div>
  34. <script src="../../../libs/mui.min.js"></script>
  35. <script type="text/javascript">
  36. mui.init();
  37. window.onload = function() {
  38. mui(document.body).on('tap', '.fb', function() {
  39. addNote()
  40. })
  41. mui(document.body).on('tap', 'textarea', function() {
  42. mui('textarea')[0].style.color = '#000000';
  43. mui('textarea')[0].innerHTML = "";
  44. })
  45. }
  46. function addNote() {
  47. mui.plusReady(function() {
  48. var str = plus.storage.getItem('user');
  49. var user = JSON.parse(str);
  50. var token = user.Data.Token;
  51. var self = plus.webview.currentWebview();
  52. var code = self.code;
  53. var title = mui('#title')[0].value;
  54. var content = mui('#content')[0].value;
  55. if(title != '' && content != '') {
  56. var postdata = {
  57. Tilte: title, //标题
  58. Content: content, //内容
  59. }
  60. mui.ajax("http://www.bosshand.cn/api/Customer/AddUpdateNotepad", {
  61. headers: {
  62. authorization: token
  63. },
  64. type: "post",
  65. data: postdata,
  66. success: function(data) {
  67. mui.toast('发布成功')
  68. var old_back = mui.back;
  69. mui.back = function() {
  70. if(code != '123') {
  71. var wobj = plus.webview.getWebviewById("../home-index-admin/note.html");
  72. } else {
  73. var wobj = plus.webview.getWebviewById("tpl/home-index/home-index-menu/admin.html");
  74. }
  75. wobj.reload(true);
  76. old_back()
  77. }
  78. mui.back()
  79. },
  80. error: function(xhr, status) {
  81. }
  82. });
  83. } else {
  84. mui.toast('请输入内容');
  85. }
  86. })
  87. }
  88. </script>
  89. </body>
  90. </html>