123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8" />
- <title>欢迎页面-X-admin2.0</title>
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
- <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
- <link rel="stylesheet" href="./static/css/font.css">
- <link rel="stylesheet" href="./static/css/xadmin.css">
- <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
- <script src="./static/lib/layui/layui.js" charset="utf-8"></script>
- <script type="text/javascript" src="./static/js/xadmin.js"></script>
- </head>
- <body>
- <input type="text" id="token" value={{.token}} hidden=true>
- <div class="x-body layui-anim layui-anim-up">
- <blockquote class="layui-elem-quote">
- <input class="layui-btn" type="button" onclick="OpenAddItem()" value=新增>
- </blockquote>
- </div>
- <dialog open id="modalAdd" class="x-body layui-anim layui-anim-up" hidden=true style = "center;">
- <form action="role" method="post" class="layui-form layui-form-pane">
- <input id="channel" name="channel" placeholder="渠道" type="text" lay-verify="required" class="layui-input">
- <br>
- <input id="version" name="version" placeholder="版本" type="text" lay-verify="required" class="layui-input">
- <br>
- <input id="addr" name="addr" placeholder="下载地址" type="text" lay-verify="required" class="layui-input">
- <br>
- <input id="filesize" name="filesize" placeholder="文件大小" type="text" lay-verify="required" class="layui-input">
- <hr class="hr15">
- <input value="新增" class="layui-btn" style="width:100%;" type="button" onclick="addItem()">
- <br>
- <br>
- <input value="关闭" class="layui-btn" style="width:100%;" type="button" onclick="closeModalAdd()">
- <hr class="hr20" >
- </form>
- </dialog>
- <dialog open id="modalModify" class="x-body layui-anim layui-anim-up" hidden=true style = "center;">
- <form action="role" method="put" class="layui-form layui-form-pane">
- <input id="modify_id" hidden=true type="text">
- <input id="channelmodify" name="channelmodify" placeholder="渠道" type="text" lay-verify="required" class="layui-input">
- <br>
- <input id="versionmodify" name="versionmodify" placeholder="版本" type="text" lay-verify="required" class="layui-input">
- <br>
- <input id="addrmodify" name="addrmodify" placeholder="下载地址" type="text" lay-verify="required" class="layui-input">
- <br>
- <input id="filesizemodify" name="filesizemodify" placeholder="文件大小" type="text" lay-verify="required" class="layui-input">
- <hr class="hr15">
- <input value="修改" class="layui-btn" style="width:100%;" type="button" onclick="modifyItem()">
- <br>
- <br>
- <input value="关闭" class="layui-btn" style="width:100%;" type="button" onclick="closeModifyItem()">
- <hr class="hr20" >
- </form>
- </dialog>
- <table class="radio-table" border="1">
- <thead>
- <th style="width:256px;">操作</th>
- <th style="width:64px;">Id</th>
- <th style="width:64px;">渠道</th>
- <th style="width:256px;">版本</th>
- <th style="width:256px;">下载地址</th>
- <th style="width:256px;">文件大小</th>
- <th style="width:256px;">创建时间</th>
- <th style="width:256px;">修改时间</th>
- </thead>
- <tbody>
- {{range .infoList}}
- <tr>
- <td style = "text-align:center;">
- <input class="layui-btn" type="button" onclick="OpenModifyItem({{.Id}}, {{.Channel}}, {{.Version}}, {{.DowloadAddr}}, {{.FileSize}})" value=修改>
- {{" | "}}
- <input class="layui-btn" type="button" onclick="clickDelete({{.Id}})" value=删除>
- </td>
- <td style = "text-align:center;">{{.Id}}</td>
- <td style = "text-align:center;">{{.Channel}}</td>
- <td style = "text-align:center;">{{.Version}}</td>
- <td style = "text-align:center;">{{.DowloadAddr}}</td>
- <td style = "text-align:center;">{{.FileSize}}</td>
- <td style = "text-align:center;">{{TimeToStr .CreateTs}}</td>
- <td style = "text-align:center;">{{TimeToStr .ModifyTs}}</td>
- </tr>
- {{end}}
- </tbody>
- </table>
- <script language="JavaScript">
- function OpenAddItem() {
- document.getElementById("modalAdd").hidden = false;
- }
- function closeModalAdd() {
- document.getElementById("modalAdd").hidden = true;
- }
- function addItem () {
- var channel = document.getElementById("channel").value;
- var version = document.getElementById("version").value;
- var addr = document.getElementById("addr").value;
- var filesize = document.getElementById("filesize").value;
-
- if (channel.length <= 0){
- alert("请设置渠道!");
- return;
- }
- if (version.length <= 0){
- alert("请设置版本!");
- return;
- }
- if (filesize.length <= 0){
- alert("请设置文件大小!");
- return;
- }
- var text = "channel=" + encodeURI(channel) + "&version=" + encodeURI(version) + "&addr=" + encodeURI(addr) + "&filesize=" + encodeURI(filesize) + "&action=add";
-
- $.ajax({
- type:"post",
- url:"/hotfix?" + text,
- success:function (data) {
- // alert(data.status);
- if (data.status){
- window.location.href="/hotfix";
- if (data.info){
- layer.msg(data.info,{icon:1,time:1000});
- }
- }else{
- if (data.info){
- alert(data.info);
- }else{
- window.location.href="/accountlogin";
- }
- }
- }
- });
- }
- function OpenModifyItem(id, channel, version, addr, filesize) {
- document.getElementById("modify_id").value = id;
- document.getElementById("channelmodify").value = channel;
- document.getElementById("versionmodify").value = version;
- document.getElementById("addrmodify").value = addr;
- document.getElementById("filesizemodify").value = filesize;
- document.getElementById("modalModify").hidden = false;
- }
- function closeModifyItem() {
- document.getElementById("modalModify").hidden = true;
- }
-
- function modifyItem () {
- var id = document.getElementById("modify_id").value;
- var channel = document.getElementById("channelmodify").value;
- var version = document.getElementById("versionmodify").value;
- var addr = document.getElementById("addrmodify").value;
- var filesize = document.getElementById("filesizemodify").value;
- var text = "channel=" + encodeURI(channel) + "&version=" + encodeURI(version) + "&addr=" + encodeURI(addr) + "&filesize=" + encodeURI(filesize) + "&id=" + encodeURI(id) + "&action=modify";
-
- $.ajax({
- type:"put",
- url:"/hotfix?" + text,
- success:function (data) {
- // alert(data.status);
- if (data.status){
- window.location.href="/hotfix";
- if (data.info){
- layer.msg(data.info,{icon:1,time:1000});
- }
- }else{
- if (data.info){
- alert(data.info);
- }else{
- window.location.href="/accountlogin";
- }
- }
- }
- });
- }
-
- function clickDelete (id) {
- var text = "id=" + encodeURI(id) + "&action=delete";
-
- $.ajax({
- type:"delete",
- url:"/hotfix?" + text,
- success:function (data) {
- // alert(data.status);
- if (data.status){
- window.location.href="/hotfix";
- if (data.info){
- layer.msg(data.info,{icon:1,time:1000});
- }
- }else{
- if (data.info){
- alert(data.info);
- }else{
- window.location.href="/accountlogin";
- }
- }
- }
- });
- }
- </script>
- </body>
- </html>
|