config.html 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. {extend name="app/admin/view/base.html"/}
  2. {block name="resources"}
  3. <style>
  4. .ns-form {margin-top: 0;}
  5. </style>
  6. {/block}
  7. {block name="main"}
  8. <div class="layui-form ns-form">
  9. <div class="layui-form-item">
  10. <label class="layui-form-label">是否开启:</label>
  11. <div class="layui-input-block" id="isOpen">
  12. <input type="checkbox" name="status" lay-filter="isOpen" value="1" lay-skin="switch" {if condition="$info.value && $info.value.status == 1"} checked {/if} />
  13. </div>
  14. <div class="ns-word-aux">当前使用阿里云短信配置</div>
  15. </div>
  16. <div class="layui-form-item">
  17. <label class="layui-form-label">APP_KEY:</label>
  18. <div class="layui-input-block">
  19. <input type="text" name="access_key_id" placeholder="请输入内容APP_KEY" {if $info.value } value="{$info.value.access_key_id}" {/if} autocomplete="off" class="layui-input ns-len-long">
  20. </div>
  21. </div>
  22. <div class="layui-form-item">
  23. <label class="layui-form-label">SECRET_KEY:</label>
  24. <div class="layui-input-block">
  25. <input type="text" name="access_key_secret" placeholder="请输入SECRET_KEY" {if $info.value } value="{$info.value.access_key_secret}" {/if} autocomplete="off" class="layui-input ns-len-long">
  26. </div>
  27. </div>
  28. <div class="layui-form-item">
  29. <label class="layui-form-label">短信内容签名:</label>
  30. <div class="layui-input-block">
  31. <input type="text" name="smssign" placeholder="请输入短信内容签名" {if $info.value } value="{$info.value.smssign}" {/if} autocomplete="off" class="layui-input ns-len-long">
  32. </div>
  33. </div>
  34. <!-- 表单操作 -->
  35. <div class="ns-form-row">
  36. <button class="layui-btn ns-bg-color" lay-submit lay-filter="save">保存</button>
  37. <button class="layui-btn layui-btn-primary" onclick="back()">返回</button>
  38. </div>
  39. </div>
  40. {/block}
  41. {block name="script"}
  42. <script>
  43. layui.use('form', function() {
  44. var form = layui.form,
  45. repeat_flag = false; //防重复标识
  46. form.render();
  47. form.on('submit(save)', function(data) {
  48. if (repeat_flag) return;
  49. repeat_flag = true;
  50. $.ajax({
  51. url: ns.url("alisms://admin/sms/config"),
  52. data: data.field,
  53. dataType: 'JSON',
  54. type: 'POST',
  55. success: function(res) {
  56. repeat_flag = false;
  57. if (res.code == 0) {
  58. layer.confirm('编辑成功', {
  59. title:'操作提示',
  60. btn: ['返回列表', '继续操作'],
  61. yes: function(){
  62. location.href = ns.url("admin/message/sms")
  63. },
  64. btn2: function() {
  65. location.reload();
  66. }
  67. });
  68. }else{
  69. layer.msg(res.message);
  70. }
  71. }
  72. });
  73. });
  74. });
  75. function back() {
  76. location.href = ns.url("admin/message/sms");
  77. }
  78. </script>
  79. {/block}