hotfix.tpl 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8" />
  5. <title>欢迎页面-X-admin2.0</title>
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7. <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
  8. <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
  9. <link rel="stylesheet" href="./static/css/font.css">
  10. <link rel="stylesheet" href="./static/css/xadmin.css">
  11. <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
  12. <script src="./static/lib/layui/layui.js" charset="utf-8"></script>
  13. <script type="text/javascript" src="./static/js/xadmin.js"></script>
  14. </head>
  15. <body>
  16. <input type="text" id="token" value={{.token}} hidden=true>
  17. <div class="x-body layui-anim layui-anim-up">
  18. <blockquote class="layui-elem-quote">
  19. <input class="layui-btn" type="button" onclick="OpenAddItem()" value=新增>
  20. </blockquote>
  21. </div>
  22. <dialog open id="modalAdd" class="x-body layui-anim layui-anim-up" hidden=true style = "center;">
  23. <form action="role" method="post" class="layui-form layui-form-pane">
  24. <input id="channel" name="channel" placeholder="渠道" type="text" lay-verify="required" class="layui-input">
  25. <br>
  26. <input id="version" name="version" placeholder="版本" type="text" lay-verify="required" class="layui-input">
  27. <br>
  28. <input id="addr" name="addr" placeholder="下载地址" type="text" lay-verify="required" class="layui-input">
  29. <br>
  30. <input id="filesize" name="filesize" placeholder="文件大小" type="text" lay-verify="required" class="layui-input">
  31. <hr class="hr15">
  32. <input value="新增" class="layui-btn" style="width:100%;" type="button" onclick="addItem()">
  33. <br>
  34. <br>
  35. <input value="关闭" class="layui-btn" style="width:100%;" type="button" onclick="closeModalAdd()">
  36. <hr class="hr20" >
  37. </form>
  38. </dialog>
  39. <dialog open id="modalModify" class="x-body layui-anim layui-anim-up" hidden=true style = "center;">
  40. <form action="role" method="put" class="layui-form layui-form-pane">
  41. <input id="modify_id" hidden=true type="text">
  42. <input id="channelmodify" name="channelmodify" placeholder="渠道" type="text" lay-verify="required" class="layui-input">
  43. <br>
  44. <input id="versionmodify" name="versionmodify" placeholder="版本" type="text" lay-verify="required" class="layui-input">
  45. <br>
  46. <input id="addrmodify" name="addrmodify" placeholder="下载地址" type="text" lay-verify="required" class="layui-input">
  47. <br>
  48. <input id="filesizemodify" name="filesizemodify" placeholder="文件大小" type="text" lay-verify="required" class="layui-input">
  49. <hr class="hr15">
  50. <input value="修改" class="layui-btn" style="width:100%;" type="button" onclick="modifyItem()">
  51. <br>
  52. <br>
  53. <input value="关闭" class="layui-btn" style="width:100%;" type="button" onclick="closeModifyItem()">
  54. <hr class="hr20" >
  55. </form>
  56. </dialog>
  57. <table class="radio-table" border="1">
  58. <thead>
  59. <th style="width:256px;">操作</th>
  60. <th style="width:64px;">Id</th>
  61. <th style="width:64px;">渠道</th>
  62. <th style="width:256px;">版本</th>
  63. <th style="width:256px;">下载地址</th>
  64. <th style="width:256px;">文件大小</th>
  65. <th style="width:256px;">创建时间</th>
  66. <th style="width:256px;">修改时间</th>
  67. </thead>
  68. <tbody>
  69. {{range .infoList}}
  70. <tr>
  71. <td style = "text-align:center;">
  72. <input class="layui-btn" type="button" onclick="OpenModifyItem({{.Id}}, {{.Channel}}, {{.Version}}, {{.DowloadAddr}}, {{.FileSize}})" value=修改>
  73. {{" | "}}
  74. <input class="layui-btn" type="button" onclick="clickDelete({{.Id}})" value=删除>
  75. </td>
  76. <td style = "text-align:center;">{{.Id}}</td>
  77. <td style = "text-align:center;">{{.Channel}}</td>
  78. <td style = "text-align:center;">{{.Version}}</td>
  79. <td style = "text-align:center;">{{.DowloadAddr}}</td>
  80. <td style = "text-align:center;">{{.FileSize}}</td>
  81. <td style = "text-align:center;">{{TimeToStr .CreateTs}}</td>
  82. <td style = "text-align:center;">{{TimeToStr .ModifyTs}}</td>
  83. </tr>
  84. {{end}}
  85. </tbody>
  86. </table>
  87. <script language="JavaScript">
  88. function OpenAddItem() {
  89. document.getElementById("modalAdd").hidden = false;
  90. }
  91. function closeModalAdd() {
  92. document.getElementById("modalAdd").hidden = true;
  93. }
  94. function addItem () {
  95. var channel = document.getElementById("channel").value;
  96. var version = document.getElementById("version").value;
  97. var addr = document.getElementById("addr").value;
  98. var filesize = document.getElementById("filesize").value;
  99. if (channel.length <= 0){
  100. alert("请设置渠道!");
  101. return;
  102. }
  103. if (version.length <= 0){
  104. alert("请设置版本!");
  105. return;
  106. }
  107. if (filesize.length <= 0){
  108. alert("请设置文件大小!");
  109. return;
  110. }
  111. var text = "channel=" + encodeURI(channel) + "&version=" + encodeURI(version) + "&addr=" + encodeURI(addr) + "&filesize=" + encodeURI(filesize) + "&action=add";
  112. $.ajax({
  113. type:"post",
  114. url:"/hotfix?" + text,
  115. success:function (data) {
  116. // alert(data.status);
  117. if (data.status){
  118. window.location.href="/hotfix";
  119. if (data.info){
  120. layer.msg(data.info,{icon:1,time:1000});
  121. }
  122. }else{
  123. if (data.info){
  124. alert(data.info);
  125. }else{
  126. window.location.href="/accountlogin";
  127. }
  128. }
  129. }
  130. });
  131. }
  132. function OpenModifyItem(id, channel, version, addr, filesize) {
  133. document.getElementById("modify_id").value = id;
  134. document.getElementById("channelmodify").value = channel;
  135. document.getElementById("versionmodify").value = version;
  136. document.getElementById("addrmodify").value = addr;
  137. document.getElementById("filesizemodify").value = filesize;
  138. document.getElementById("modalModify").hidden = false;
  139. }
  140. function closeModifyItem() {
  141. document.getElementById("modalModify").hidden = true;
  142. }
  143. function modifyItem () {
  144. var id = document.getElementById("modify_id").value;
  145. var channel = document.getElementById("channelmodify").value;
  146. var version = document.getElementById("versionmodify").value;
  147. var addr = document.getElementById("addrmodify").value;
  148. var filesize = document.getElementById("filesizemodify").value;
  149. var text = "channel=" + encodeURI(channel) + "&version=" + encodeURI(version) + "&addr=" + encodeURI(addr) + "&filesize=" + encodeURI(filesize) + "&id=" + encodeURI(id) + "&action=modify";
  150. $.ajax({
  151. type:"put",
  152. url:"/hotfix?" + text,
  153. success:function (data) {
  154. // alert(data.status);
  155. if (data.status){
  156. window.location.href="/hotfix";
  157. if (data.info){
  158. layer.msg(data.info,{icon:1,time:1000});
  159. }
  160. }else{
  161. if (data.info){
  162. alert(data.info);
  163. }else{
  164. window.location.href="/accountlogin";
  165. }
  166. }
  167. }
  168. });
  169. }
  170. function clickDelete (id) {
  171. var text = "id=" + encodeURI(id) + "&action=delete";
  172. $.ajax({
  173. type:"delete",
  174. url:"/hotfix?" + text,
  175. success:function (data) {
  176. // alert(data.status);
  177. if (data.status){
  178. window.location.href="/hotfix";
  179. if (data.info){
  180. layer.msg(data.info,{icon:1,time:1000});
  181. }
  182. }else{
  183. if (data.info){
  184. alert(data.info);
  185. }else{
  186. window.location.href="/accountlogin";
  187. }
  188. }
  189. }
  190. });
  191. }
  192. </script>
  193. </body>
  194. </html>