publish.html 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>地址编辑</title>
  6. <meta name="renderer" content="webkit">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  8. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  9. <link rel="stylesheet" href="/static/public/layui/css/layui.css" media="all">
  10. <link rel="stylesheet" href="/static/public/font-awesome/css/font-awesome.min.css" media="all" />
  11. <link rel="stylesheet" href="/static/admin/css/admin.css" media="all">
  12. <script src="/static/public/layui/layui.js"></script>
  13. <script src="/static/public/jquery/jquery.min.js"></script>
  14. </head>
  15. <style>
  16. .layui-upload-img{
  17. cursor: pointer;
  18. width:150px;
  19. height:150px;
  20. background: url('/static/public/images/uploadimg.jpg');
  21. background-size:contain;
  22. border-radius: 2px;
  23. border-width: 1px;
  24. border-style: solid;
  25. border-color: #e6e6e6;
  26. }
  27. </style>
  28. <body style="padding:10px;">
  29. <div class="tplay-body-div">
  30. {empty name="$data"}
  31. <div class="layui-tab">
  32. <ul class="layui-tab-title">
  33. <li><a href="index" class="a_menu">列表</a></li>
  34. <li class="layui-this">新增</li>
  35. </ul>
  36. </div>
  37. {/empty}
  38. <div style="margin-top: 20px;"></div>
  39. <form class="layui-form" id="publish" method="post">
  40. <!-- 输入框 -->
  41. <div class="layui-form-item">
  42. <label class="layui-form-label">标题</label>
  43. <div class="layui-input-inline" style="max-width:300px;">
  44. <input name="title" autocomplete="off" placeholder="请输入" class="layui-input" type="text" {notempty name="$data"}value="{$data.title}"{/notempty}>
  45. </div>
  46. </div>
  47. <!-- 输入框 -->
  48. <div class="layui-form-item">
  49. <label class="layui-form-label">地址</label>
  50. <div class="layui-input-inline" style="max-width:300px;">
  51. <input name="address" autocomplete="off" placeholder="请输入" class="layui-input" type="text" {notempty name="$data"}value="{$data.address}"{/notempty}>
  52. </div>
  53. </div>
  54. {notempty name="$data"}
  55. <input type="hidden" name="id" value="{$data.id}">
  56. {/notempty}
  57. <div class="layui-form-item">
  58. <div class="layui-input-block">
  59. <button class="layui-btn" lay-submit lay-filter="admin">立即提交</button>
  60. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  61. </div>
  62. </div>
  63. </form>
  64. <script>
  65. layui.use(['layer', 'form' ,'laydate'], function () {
  66. var layer = layui.layer,
  67. $ = layui.jquery,
  68. form = layui.form;
  69. var laydate = layui.laydate;
  70. $(window).on('load', function () {
  71. form.on('submit(admin)', function (data) {
  72. $.ajax({
  73. url: "{:url('publish')}",
  74. data: $('#publish').serialize(),
  75. type: 'post',
  76. dataType: 'json',
  77. async: false,
  78. success: function (res) {
  79. if (res.code == 1) {
  80. if (res.msg == "添加成功") {
  81. layer.alert(res.msg, function (index) {
  82. location.href = res.url;
  83. })
  84. }else{
  85. layer.confirm(res.msg, {
  86. btn: ['关闭', '继续编辑']
  87. }, function (index) {
  88. window.parent.tab.close('tplay_address{$data.id|default=0}');
  89. }, function (index, layero) {
  90. location.href = res.url;
  91. });
  92. }
  93. } else {
  94. layer.msg(res.msg);
  95. }
  96. }
  97. })
  98. return false;
  99. });
  100. });
  101. });
  102. </script>
  103. </div>
  104. </body>
  105. </html>