redis-key-add.html 3.1 KB

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