redis-key-add.html 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Redis-key值添加</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  6. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  7. <!-- 所有的 css & js 资源 -->
  8. <link rel="stylesheet" href="https://unpkg.com/element-ui@2.13.0/lib/theme-chalk/index.css">
  9. <link rel="stylesheet" href="../../static/sa.css">
  10. <script src="../../static/kj/vue.min.js"></script>
  11. <script src="../../static/kj/element-ui/index.js"></script>
  12. <script src="../../static/kj/httpVueLoader.js"></script>
  13. <script src="../../static/kj/jquery.min.js"></script>
  14. <script src="../../static/kj/layer/layer.js"></script>
  15. <script src="../../static/sa.js"></script>
  16. <style type="text/css">
  17. .c-panel .c-label{width: 6em;}
  18. /* 普通文本和富文本一起变长 */
  19. .c-panel .el-form .el-input, .c-panel .el-form .el-textarea__inner{width: 600px;}
  20. body{background-color: #FFF;}
  21. </style>
  22. </head>
  23. <body>
  24. <div class="vue-box sbot" style="display: none;" :style="'display: block;'">
  25. <!-- ------- 内容部分 ------- -->
  26. <div class="s-body">
  27. <div class="c-panel">
  28. <div class="c-title">数据添加</div>
  29. <el-form v-if="m">
  30. <div class="c-item br">
  31. <label class="c-label">key:</label>
  32. <el-input v-model="m.key"></el-input>
  33. </div>
  34. <div class="c-item br">
  35. <label class="c-label" style="vertical-align: top;">value:</label>
  36. <div style="display: inline-block;">
  37. <el-input v-model="m.value" type="textarea" :autosize="{ minRows: 14, maxRows: 20}"></el-input>
  38. </div>
  39. </div>
  40. <div class="c-item br">
  41. <label class="c-label">ttl:</label>
  42. <el-input v-model="m.ttl" placeholder="过期时间 单位/毫秒"></el-input>
  43. </div>
  44. </el-form>
  45. </div>
  46. </div>
  47. <!-- ------- 底部按钮 ------- -->
  48. <div class="s-foot">
  49. <el-button type="primary" @click="ok()">确定</el-button>
  50. <el-button @click="sa.closeCurrIframe()">取消</el-button>
  51. </div>
  52. </div>
  53. <script type="text/javascript">
  54. function crate_model() {
  55. return {
  56. key: '',
  57. value: '',
  58. ttl: '',
  59. is_show: true
  60. }
  61. }
  62. </script>
  63. <script>
  64. var app = new Vue({
  65. el: '.vue-box',
  66. data: {
  67. sa: sa, // 超级对象
  68. m: crate_model()
  69. },
  70. methods: {
  71. // 修改
  72. ok: function(){
  73. // 开始验证
  74. var m = this.m;
  75. if(m.key == ''){
  76. return sa.error('请输入键');
  77. }
  78. if(m.value == ''){
  79. return sa.error('请输入值');
  80. }
  81. if(m.ttl == ''){
  82. return sa.error('请输入ttl (过期时间)');
  83. }
  84. if(isNaN(m.ttl)) {
  85. return sa.error('ttl 必须是一个数字 ');
  86. }
  87. // 添加
  88. m.ttl = parseInt(m.ttl);
  89. sa.ajax('/sp-admin/RedisConsole/set', m, function(res){
  90. sa.closeCurrIframe();
  91. parent.app.dataListShow.unshift(m);
  92. parent.sa.msg('添加成功');
  93. parent.sa.f5TableHeight(); // 刷新表格高度
  94. }.bind(this));
  95. }
  96. },
  97. mounted: function(){
  98. }
  99. })
  100. </script>
  101. </body>
  102. </html>