mongoDB_config.blade.php 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. @extends('layouts.base')
  2. @section('content')
  3. @section('title', trans('MONGODB设置'))
  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. border-radius: 8px;
  26. min-height:100vh;
  27. background-color:#fff;
  28. position:relative;
  29. }
  30. .con .setting .block{
  31. padding:10px;
  32. margin-bottom:10px;
  33. border-radius: 8px;
  34. }
  35. .con .setting .block .title{
  36. font-size:18px;
  37. margin-bottom:15px;
  38. display:flex;
  39. align-items:center;
  40. }
  41. .el-form-item__label{
  42. margin-right:30px;
  43. }
  44. .confirm-btn{
  45. width: calc(100% - 266px);
  46. position:fixed;
  47. bottom:0;
  48. right:0;
  49. margin-right:10px;
  50. line-height:63px;
  51. background-color: #ffffff;
  52. box-shadow: 0px 8px 23px 1px
  53. rgba(51, 51, 51, 0.3);
  54. background-color:#fff;
  55. text-align:center;
  56. }
  57. b{
  58. font-size:14px;
  59. }
  60. </style>
  61. <div id='re_content' >
  62. @include('layouts.newTabs')
  63. <div class="con">
  64. <div class="setting">
  65. <el-form ref="form" :model="form" label-width="15%">
  66. <div class="block">
  67. <div class="title"><span style="width: 4px;height: 18px;background-color: #29ba9c;margin-right:15px;display:inline-block;"></span><b>MONGO设置</b></div>
  68. <el-form-item label="域名(mongodb_host)">
  69. <el-input v-model="form.host" placeholder="" style="width:70%;"></el-input>
  70. <div style="font-size:12px;">为空时默认为127.0.0.1</div>
  71. </el-form-item>
  72. <el-form-item label="用户名(username)">
  73. <el-input v-model="form.username" placeholder="" style="width:70%;"></el-input>
  74. <div style="font-size:12px;">为空时默认为空</div>
  75. </el-form-item>
  76. <el-form-item label="密码(password)">
  77. <el-input v-model="form.password" placeholder="" style="width:70%;" type="password"></el-input>
  78. <div style="font-size:12px;">为空时默认为NULL</div>
  79. </el-form-item>
  80. <el-form-item label="端口(port)">
  81. <el-input v-model="form.port" placeholder="" style="width:70%;"></el-input>
  82. <div style="font-size:12px;">为空时默认为27017</div>
  83. </el-form-item>
  84. <el-form-item label="库(database)">
  85. <el-input v-model="form.database" placeholder="" style="width:70%;"></el-input>
  86. <div style="font-size:12px;">默认跟mysql数据库名称一致,切勿随意更改</div>
  87. </el-form-item>
  88. </div>
  89. </div>
  90. <div class="confirm-btn">
  91. <el-button @click="submit" type="primary">提交</el-button>
  92. </div>
  93. </el-form>
  94. </div>
  95. </div>
  96. <script>
  97. var vm = new Vue({
  98. el: "#re_content",
  99. delimiters: ['[[', ']]'],
  100. data() {
  101. let data = {!! $set ?: '{}' !!}
  102. return {
  103. activeName: 'first',
  104. form:{
  105. host : data.host ? data.host : '',
  106. username : data.username ? data.username : '',
  107. password : data.password ? data.password : '',
  108. port : data.port ? data.port : '',
  109. database : data.database ? data.database : '',
  110. },
  111. }
  112. },
  113. mounted () {
  114. //this.getData();
  115. },
  116. methods: {
  117. submit() {
  118. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  119. this.$http.post('{!! yzWebFullUrl('siteSetting.index.mongoDB-config') !!}',{'mongoDB':this.form}).then(function (response){
  120. if (response.data.result) {
  121. this.$message({message: response.data.msg,type: 'success'});
  122. }else {
  123. this.$message({message: response.data.msg,type: 'error'});
  124. }
  125. loading.close();
  126. location.reload();
  127. },function (response) {
  128. this.$message({message: response.data.msg,type: 'error'});
  129. })
  130. },
  131. getData(){
  132. this.$http.post('{!! yzWebFullUrl('siteSetting.index.mongoDB-config') !!}').then(function (response){
  133. if (response.data.result) {
  134. if(response.data.data.set){
  135. for(let i in response.data.data.set){
  136. this.form[i]=response.data.data.set[i]
  137. }
  138. }
  139. }else {
  140. this.$message({message: response.data.msg,type: 'error'});
  141. }
  142. },function (response) {
  143. this.$message({message: response.data.msg,type: 'error'});
  144. })
  145. }
  146. },
  147. });
  148. </script>
  149. @endsection