web.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. {extend name="common/base"/}
  2. <!-- 主体 -->
  3. {block name="body"}
  4. <form class="layui-form p-4">
  5. <h3 class="pb-3">系统配置</h3>
  6. <table class="layui-table layui-table-form">
  7. <tr>
  8. <td class="layui-td-gray-2">系统名称<font>*</font>
  9. </td>
  10. <td>
  11. <input type="hidden" name="id" value="{$id}">
  12. <input type="text" name="admin_title" lay-verify="required" autocomplete="off" placeholder="请输入系统名称"
  13. lay-reqText="请输入系统名称" class="layui-input" {notempty name="$config.admin_title" }
  14. value="{$config.admin_title}" {/notempty}>
  15. </td>
  16. <td class="layui-td-gray">网站名称<font>*</font>
  17. </td>
  18. <td>
  19. <input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入网站平台名称"
  20. lay-reqText="请输入网站名称" class="layui-input" {notempty name="$config.title" } value="{$config.title}"
  21. {/notempty}>
  22. </td>
  23. <td rowspan="3" class="layui-td-gray">系统LOGO</td>
  24. <td rowspan="3" style="width: 240px;">
  25. <div class="layui-upload" style="width: 240px;">
  26. <div class="layui-upload-list" id="demo1" style="width: 100%; height:100px; overflow: hidden;">
  27. <img src='{notempty name="$config.logo"}{$config.logo}{/notempty}'
  28. style="max-width: 100%; width: 100%;" />
  29. <input type="hidden" name="logo" {notempty name="$config.logo" } value="{$config.logo}"
  30. {/notempty}>
  31. </div>
  32. <button type="button" class="layui-btn layui-btn-normal" style="width: 100%;"
  33. id="uploadBtn">上传LOGO</button>
  34. </div>
  35. </td>
  36. </tr>
  37. <tr>
  38. <td class="layui-td-gray">网站域名<font>*</font>
  39. </td>
  40. <td>
  41. <input type="text" name="domain" lay-verify="required" autocomplete="off" placeholder="请输入网站域名"
  42. lay-reqText="请输入网站域名" class="layui-input" {notempty name="$config.domain" } value="{$config.domain}"
  43. {/notempty}>
  44. </td>
  45. <td class="layui-td-gray">ICP备案号</td>
  46. <td>
  47. <input type="text" name="icp" autocomplete="off" placeholder="请输入ICP备案号" class="layui-input" {notempty
  48. name="$config.icp" } value="{$config.icp}" {/notempty}>
  49. </td>
  50. </tr>
  51. <tr>
  52. <td class="layui-td-gray">SEO关键词<font>*</font>
  53. </td>
  54. <td>
  55. <input type="text" name="keywords" lay-verify="required" autocomplete="off" placeholder="多个关键词用“,”隔开"
  56. lay-reqText="请输入SEO关键字" class="layui-input" {notempty name="$config.keywords" }
  57. value="{$config.keywords}" {/notempty}>
  58. </td>
  59. <td class="layui-td-gray-2">公安备案号</td>
  60. <td>
  61. <input type="text" name="beian" autocomplete="off" placeholder="请输入公安备案号" class="layui-input" {notempty
  62. name="$config.beian" } value="{$config.beian}" {/notempty}>
  63. </td>
  64. </tr>
  65. <tr>
  66. <td class="layui-td-gray">SEO描述<font>*</font>
  67. </td>
  68. <td colspan="5">
  69. <textarea name="desc" lay-verify="required" placeholder="请输入网站描述" lay-reqText="请输入网站描述"
  70. class="layui-textarea">{notempty name="$config.desc"}{$config.desc} {/notempty}</textarea>
  71. </td>
  72. </tr>
  73. <tr>
  74. <td class="layui-td-gray">统计代码</td>
  75. <td colspan="5">
  76. <textarea name="code" placeholder="请输入完整的统计代码"
  77. class="layui-textarea">{notempty name="$config.code"} value={$config.code}{/notempty}</textarea>
  78. </td>
  79. </tr>
  80. <tr>
  81. <td class="layui-td-gray">版权信息</td>
  82. <td colspan="3">
  83. <input type="text" name="copyright" autocomplete="off" placeholder="请输入版权信息" lay-reqText="请输入版权信息"
  84. class="layui-input" {notempty name="$config.copyright" } value="{$config.copyright}" {/notempty}>
  85. </td>
  86. <td class="layui-td-gray-2">代码版本号<font>*</font>
  87. </td>
  88. <td>
  89. <input type="text" lay-verify="required" name="version" autocomplete="off" placeholder="请输入版本号"
  90. lay-reqText="请输入版本号" class="layui-input" {notempty name="$config.version" }
  91. value="{$config.version}" {/notempty}>
  92. </td>
  93. </tr>
  94. </table>
  95. <div class="py-3">
  96. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
  97. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  98. </div>
  99. </form>
  100. {/block}
  101. <!-- /主体 -->
  102. <!-- 脚本 -->
  103. {block name="script"}
  104. <script>
  105. const moduleInit = ['tool'];
  106. function gouguInit() {
  107. var form = layui.form, tool = layui.tool, upload = layui.upload;
  108. //监听提交
  109. form.on('submit(webform)', function (data) {
  110. let callback = function (e) {
  111. layer.msg(e.msg);
  112. if (e.code == 0) {
  113. parent.layui.tool.close(1000);
  114. }
  115. }
  116. tool.post("/admin/conf/edit", data.field, callback);
  117. return false;
  118. });
  119. //logo上传
  120. var uploadInst = upload.render({
  121. elem: '#uploadBtn',
  122. url: "/admin/api/upload",
  123. done: function (res) {
  124. if (res.code == 1) {
  125. layer.msg('上传失败');
  126. } else {
  127. layer.msg('上传成功');
  128. $('#demo1 input').attr('value', res.data.filepath);
  129. $('#demo1 img').attr('src', res.data.filepath);
  130. }
  131. }
  132. });
  133. }
  134. </script>
  135. {/block}
  136. <!-- /脚本 -->