websocket.blade.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. @extends('layouts.base')
  2. @section('title', 'WebSocket设置')
  3. @section('content')
  4. <style>
  5. .panel{
  6. margin-bottom:10px!important;
  7. padding-left: 20px;
  8. border-radius: 10px;
  9. }
  10. .panel .active a {
  11. background-color: #29ba9c!important;
  12. border-radius: 18px!important;
  13. color:#fff;
  14. }
  15. .panel a{
  16. border:none!important;
  17. background-color:#fff!important;
  18. }
  19. .content{
  20. background: #eff3f6;
  21. padding: 10px!important;
  22. }
  23. .con{
  24. padding-bottom:20px;
  25. position:relative;
  26. min-height:100vh;
  27. background-color:#fff;
  28. border-radius: 8px;
  29. }
  30. .con .setting .block{
  31. padding:10px;
  32. background-color:#fff;
  33. border-radius: 8px;
  34. }
  35. .con .setting .block .title{
  36. display:flex;
  37. align-items:center;
  38. margin-bottom:15px;
  39. }
  40. .confirm-btn{
  41. width: calc(100% - 266px);
  42. position:fixed;
  43. bottom:0;
  44. right:0;
  45. margin-right:10px;
  46. line-height:63px;
  47. background-color: #ffffff;
  48. box-shadow: 0px 8px 23px 1px
  49. rgba(51, 51, 51, 0.3);
  50. background-color:#fff;
  51. text-align:center;
  52. }
  53. b{
  54. font-size:14px;
  55. }
  56. </style>
  57. <div id='re_content' >
  58. @include('layouts.newTabs')
  59. <div class="con">
  60. <div class="setting">
  61. <div class="block">
  62. <div class="title"><span style="width: 4px;height: 18px;background-color: #29ba9c;margin-right:15px;display:inline-block;"></span><b>WebSocket设置</b></div>
  63. <el-form ref="form" :model="form" label-width="15%">
  64. <el-form-item label="WebSocket" prop="service_type">
  65. <el-radio v-model="form.is_open" :label="1">开启</el-radio>
  66. <el-radio v-model="form.is_open" :label="0">关闭</el-radio>
  67. </el-form-item>
  68. </el-form>
  69. </div>
  70. </div>
  71. <div class="confirm-btn">
  72. <el-button type="primary" @click="onSubmit">提交</el-button>
  73. </div>
  74. </div>
  75. </div>
  76. <script>
  77. var app = new Vue({
  78. el: '#re_content',
  79. delimiters: ['[[', ']]'],
  80. data() {
  81. // 默认数据
  82. let temp = JSON.parse('{!! $setting !!}');
  83. if (!temp || temp.length === 0) {
  84. temp = {
  85. }
  86. }
  87. return {
  88. form: temp,
  89. loading: false,
  90. formLoading: false,
  91. centerDialogVisible: false,
  92. }
  93. },
  94. mounted: function () {
  95. console.log(this.form)
  96. },
  97. methods: {
  98. onSubmit() {
  99. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  100. if (this.formLoading) {
  101. return;
  102. }
  103. this.formLoading = true;
  104. this.$refs.form.validate((valid) => {
  105. console.log(valid)
  106. });
  107. this.$http.post("{!! yzWebUrl('siteSetting.store.websocket') !!}", {'setting': this.form}).then(response => {
  108. //console.log(response.data);
  109. // return;
  110. if (response.data.result) {
  111. this.$message({
  112. message: response.data.msg,
  113. type: 'success'
  114. });
  115. } else {
  116. this.$message({
  117. message: response.data.msg,
  118. type: 'error'
  119. });
  120. }
  121. this.formLoading = false;
  122. loading.close();
  123. location.reload();
  124. }, response => {
  125. console.log(response);
  126. });
  127. },
  128. }
  129. });
  130. </script>
  131. @endsection