index.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. {include file="common/header"/}
  2. <div class="LM-container">
  3. <div class="LM-main">
  4. <fieldset class="layui-elem-field layui-field-title">
  5. <legend>{:lang('config')}{:lang('list')}</legend>
  6. </fieldset>
  7. <div class="layui-tab">
  8. <ul class="layui-tab-title">
  9. <li class="layui-this">{:lang('site setting')}</li>
  10. <li class="">{:lang('email setting')}</li>
  11. <li class="">{:lang('sms setting')}</li>
  12. <li class="">{:lang('upload setting')}</li>
  13. </ul>
  14. <div class="layui-tab-content">
  15. <!--网站配置-->
  16. <div class="layui-tab-item layui-show">
  17. <form class="layui-form layui-form-pane" lay-filter="form-config">
  18. <div class="layui-form-item">
  19. <label class="layui-form-label required">{:lang('site name')}</label>
  20. <div class="layui-input-block">
  21. <input type="text" name="site_name" lay-verify="required" lay-reqtext="{:lang('site name can not empty')}"
  22. placeholder="{:lang('site name')}" value="" class="layui-input">
  23. <!-- <tip>填写自己部署网站的名称。</tip>-->
  24. </div>
  25. </div>
  26. <div class="layui-form-item">
  27. <label class="layui-form-label required">{:lang('site domain')}</label>
  28. <div class="layui-input-block">
  29. <input type="text" name="site_domain" lay-verify="url" lay-reqtext="{:lang('site domain can not empty')}"
  30. placeholder="{:lang('site domain')}" value="" class="layui-input">
  31. </div>
  32. </div>
  33. <div class="layui-form-item">
  34. <label class="layui-form-label required">{:lang('site email')}</label>
  35. <div class="layui-input-block">
  36. <input type="text" name="site_email" lay-verify="email" lay-reqtext="{:lang('site email can not empty')}"
  37. placeholder="{:lang('site email')}" value="" class="layui-input">
  38. </div>
  39. </div>
  40. <div class="layui-form-item">
  41. <label class="layui-form-label">{:lang('site logo')}</label>
  42. <input type="hidden" name="site_logo" id="logo">
  43. <div class="layui-input-block">
  44. <div class="layui-upload">
  45. <button type="button" class="layui-btn layui-btn-primary" id="logoBtn"><i
  46. class="icon icon-upload3"></i>{:lang('upload')}
  47. </button>
  48. <div class="layui-upload-list">
  49. <img class="layui-upload-img" id="site_logo">
  50. <p id="demoText"></p>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. <div class="layui-form-item layui-form-text">
  56. <label class="layui-form-label required">{:lang('site title')}</label>
  57. <div class="layui-input-block">
  58. <textarea name="site_seo_title" placeholder="{:lang('site title')}" class="layui-textarea"></textarea>
  59. </div>
  60. </div>
  61. <div class="layui-form-item layui-form-text">
  62. <label class="layui-form-label">{:lang('meta keywords')}</label>
  63. <div class="layui-input-block">
  64. <textarea name="site_seo_keywords" class="layui-textarea"
  65. placeholder="多个关键词用英文状态 , 号分割"></textarea>
  66. </div>
  67. </div>
  68. <div class="layui-form-item layui-form-text">
  69. <label class="layui-form-label">{:lang('meta description')}</label>
  70. <div class="layui-input-block">
  71. <textarea name="site_seo_desc" placeholder="建议200字以内"
  72. class="layui-textarea"></textarea>
  73. </div>
  74. </div>
  75. <div class="layui-form-item layui-form-text">
  76. <label class="layui-form-label required">{:lang('all right')}</label>
  77. <div class="layui-input-block">
  78. <textarea name="site_copyright" class="layui-textarea">© 2019 www.lemocms.com MIT license</textarea>
  79. </div>
  80. </div>
  81. <div class="layui-form-item">
  82. <button type="button" class="layui-btn" lay-submit lay-filter="submit">{:lang('submit')}</button>
  83. <button type="reset" class="layui-btn layui-btn-primary" lay-submit lay-filter="cancel">{:lang('reset')}</button>
  84. </div>
  85. </form>
  86. </div>
  87. <!--邮箱设置-->
  88. <div class="layui-tab-item">
  89. <form class="layui-form layui-form-pane" lay-filter="form-config">
  90. <div class="layui-form-item">
  91. <label class="layui-form-label required">{:lang('email server')}</label>
  92. <div class="layui-input-block">
  93. <input type="text" name="email_host" lay-verify="required" lay-reqtext="{:lang('email server is not empty')}"
  94. placeholder="{:lang('email server')}" value="" class="layui-input">
  95. </div>
  96. </div>
  97. <div class="layui-form-item">
  98. <label class="layui-form-label required">{:lang('email port')}</label>
  99. <div class="layui-input-block">
  100. <input type="text" name="email_port" lay-verify="required" lay-reqtext="{:lang('port can not empty')}"
  101. placeholder="{:lang('email port')}" value="" class="layui-input">
  102. </div>
  103. </div>
  104. <div class="layui-form-item">
  105. <label class="layui-form-label required">{:lang('email addr')}</label>
  106. <div class="layui-input-block">
  107. <input type="text" name="email_addr" lay-verify="required" lay-reqtext="{:lang('email addr can not empty')}"
  108. placeholder="{:lang('email addr')}" value="" class="layui-input">
  109. </div>
  110. </div>
  111. <div class="layui-form-item">
  112. <label class="layui-form-label required">{:lang('send email person')}</label>
  113. <div class="layui-input-block">
  114. <input type="text" name="email_id" placeholder="{:lang('send email person')}" value=""
  115. class="layui-input">
  116. </div>
  117. </div>
  118. <div class="layui-form-item">
  119. <label class="layui-form-label required">{:lang('email password')}</label>
  120. <div class="layui-input-block">
  121. <input type="text" name="email_pass" placeholder="{:lang('email password')}" value=""
  122. class="layui-input">
  123. </div>
  124. </div>
  125. <div class="layui-form-item">
  126. <label class="layui-form-label required">{:lang('server mailbox protocol')}</label>
  127. <div class="layui-input-block">
  128. <input type="text" name="email_secure" placeholder="{:lang('Server mailbox protocol')}" value=""
  129. class="layui-input">
  130. </div>
  131. </div>
  132. <div class="layui-form-item">
  133. <button type="button" class="layui-btn" lay-submit lay-filter="submit">{:lang('submit')}</button>
  134. <button type="reset" class="layui-btn layui-btn-primary" lay-submit lay-filter="cancel">{:lang('reset')}</button>
  135. </div>
  136. </form>
  137. </div>
  138. <!-- 短信设置-->
  139. <div class="layui-tab-item">
  140. <form class="layui-form layui-form-pane" lay-filter="form-config">
  141. <div class="layui-form-item">
  142. <label class="layui-form-label required">{:lang('sms appid')}</label>
  143. <div class="layui-input-block">
  144. <input type="text" name="sms_appid" lay-verify="required" placeholder="{:lang('sms appid')}" value=""
  145. class="layui-input">
  146. </div>
  147. </div>
  148. <div class="layui-form-item">
  149. <label class="layui-form-label required">{:lang('sms appsecret')}</label>
  150. <div class="layui-input-block">
  151. <input type="text" name="sms_secret" lay-verify="required" placeholder="{:lang('sms appsecret')}" value=""
  152. class="layui-input">
  153. </div>
  154. </div>
  155. <div class="layui-form-item">
  156. <label class="layui-form-label required">{:lang('sms product name')}</label>
  157. <div class="layui-input-block">
  158. <input type="text" name="sms_product" lay-verify="required" placeholder="{:lang('sms product name')}" value=""
  159. class="layui-input">
  160. </div>
  161. </div>
  162. <div class="layui-form-item">
  163. <label class="layui-form-label required">{:lang('sms template id')}</label>
  164. <div class="layui-input-block">
  165. <input type="text" name="sms_template" lay-verify="required" placeholder="{:lang('sms template id')}" value=""
  166. class="layui-input">
  167. </div>
  168. </div>
  169. <div class="layui-form-item">
  170. <button type="button" class="layui-btn" lay-submit lay-filter="submit">{:lang('submit')}</button>
  171. <button type="reset" class="layui-btn layui-btn-primary" lay-submit lay-filter="cancel">{:lang('reset')}</button>
  172. </div>
  173. </form>
  174. </div>
  175. <!--上传配置-->
  176. <div class="layui-tab-item">
  177. <form class="layui-form layui-form-pane" lay-filter="form-config">
  178. <div class="layui-form-item">
  179. <label class="layui-form-label">{:lang('file type')}</label>
  180. <div class="layui-input-block">
  181. <input type="text" name="upload_file_type"
  182. value="bmp|png|gif|jpg|jpeg|zip|rar|txt|ppt|xls|doc|mp3|mp4"
  183. class="layui-input">
  184. </div>
  185. </div>
  186. <div class="layui-form-item">
  187. <label class="layui-form-label">{:lang('maxfilesize')}</label>
  188. <div class="layui-input-inline" style="width: 80px;">
  189. <input type="text" name="upload_file_max" lay-verify="number" value="2048"
  190. class="layui-input">
  191. </div>
  192. <div class="layui-input-inline layui-input-company"><label class="layui-form-label">M</label></div>
  193. <div class="layui-form-mid layui-word-aux">{:lang('tips')}:1 M = 1024 KB</div>
  194. </div>
  195. <div class="layui-form-item">
  196. <div class="layui-input-inline">
  197. <button type="button" class="layui-btn" lay-submit lay-filter="submit">{:lang('submit')}</button>
  198. <button type="reset" class="layui-btn layui-btn-primary" lay-submit lay-filter="cancel">{:lang('reset')}</button>
  199. </div>
  200. </div>
  201. </form>
  202. </div>
  203. </div>
  204. </div>
  205. </div>
  206. </div>
  207. {include file="common/footer"/}
  208. <script>
  209. layui.use(['form', 'layer','upload','element'], function () {
  210. var form = layui.form,layer = layui.layer,upload = layui.upload,$ = layui.jquery,element = layui.element;
  211. var config = {$config|raw};
  212. console.log(config)
  213. form.val("form-config", config);
  214. $('#site_logo').attr('src',config.site_logo);
  215. //普通图片上传
  216. var uploadInst = upload.render({
  217. elem: '#logoBtn'
  218. ,url: '{:url("uploads/uploads")}'
  219. ,before: function(obj){
  220. //预读本地文件示例,不支持ie8
  221. obj.preview(function(index, file, result){
  222. $('#site_logo').attr('src', result); //图片链接(base64)
  223. });
  224. }
  225. ,done: function(res){
  226. //上传成功
  227. if(res.code>0){
  228. $('#logo').val(res.url);
  229. }else{
  230. //如果上传失败
  231. return layer.msg('上传失败');
  232. }
  233. }
  234. ,error: function(){
  235. //演示失败状态,并实现重传
  236. var demoText = $('#demoText');
  237. demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
  238. demoText.find('.demo-reload').on('click', function(){
  239. uploadInst.upload();
  240. });
  241. }
  242. });
  243. //提交监听
  244. form.on('submit(submit)', function (data) {
  245. loading =layer.load(1, {shade: [0.1,'#fff']});
  246. $.post("{:url('system/site')}",data.field,function(res){
  247. layer.close(loading);
  248. if(res.code > 0){
  249. layer.msg(res.msg,{icon: 1, time: 1000},function(){
  250. location.href = res.url;
  251. });
  252. }else{
  253. layer.msg(res.msg,{icon: 2, time: 1000});
  254. }
  255. });
  256. })
  257. })
  258. </script>