index.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <div v-loading="loading" class=" b_box" id="app">
  2. <div class="nav">
  3. 基础设置
  4. </div>
  5. <div class="form_setting_box">
  6. <el-form label-position="right" label-width="180px" :model="form">
  7. <el-form-item label="是否开启一键导入功能">
  8. <el-col :span="15">
  9. <el-switch v-model="form.is_export" :active-value="1" :inactive-value="0">
  10. </el-switch>
  11. </el-col>
  12. <br/>
  13. <div class="tips-text" style="line-height: 24px;">
  14. 配合表单单行文本组件使用,如开启,则会员可以一键导入单行文本内容
  15. </div>
  16. </el-form-item>
  17. <el-form-item label="是否开启协议">
  18. <el-col :span="15">
  19. <el-switch v-model="form.agree_on" :active-value="1" :inactive-value="0">
  20. </el-switch>
  21. </el-col>
  22. </el-form-item>
  23. </el-form>
  24. <div class="setting_form_brtn_box">
  25. <!-- <el-button size="small">取消</el-button> -->
  26. <el-button size="small" type="primary" style="margin-left: 20px;" @click="save">保存</el-button>
  27. </div>
  28. </div>
  29. </div>
  30. <script>
  31. new Vue({
  32. el: '#app',
  33. data() {
  34. return {
  35. loading: true,
  36. form: {
  37. is_export: 0,
  38. agree_on: 0
  39. }
  40. }
  41. },
  42. created() {
  43. this.getInfo()
  44. },
  45. methods: {
  46. getInfo() {
  47. request({
  48. params: {
  49. r: 'smart-form/setting/info'
  50. },
  51. method: 'GET',
  52. }).then(res => {
  53. this.loading = false;
  54. if (res.data.code == 0) {
  55. if (res.data.data != null) {
  56. this.form.is_export = res.data.data.is_export
  57. this.form.agree_on = res.data.data.agree_on
  58. }
  59. } else {
  60. this.$message.error(res.data.msg);
  61. }
  62. })
  63. },
  64. save() {
  65. this.loading = true
  66. request({
  67. params: {
  68. r: 'smart-form/setting/index'
  69. },
  70. data: {
  71. ...this.form
  72. },
  73. method: 'post',
  74. }).then(res => {
  75. if (res.data.code == 0) {
  76. this.$message.success(res.data.msg);
  77. this.getInfo()
  78. } else {
  79. this.$message.error(res.data.msg);
  80. }
  81. })
  82. }
  83. }
  84. })
  85. </script>
  86. <style>
  87. .setting_form_brtn_box {
  88. width: 100%;
  89. margin-top: 80px;
  90. padding: 0 50px;
  91. box-sizing: border-box;
  92. display: flex;
  93. align-items: center;
  94. }
  95. .b_box {
  96. min-height: 100vh;
  97. background: #f3f3f3;
  98. }
  99. .nav {
  100. background: #ffffff;
  101. border-radius: 5px;
  102. padding: 26px 24px;
  103. display: flex;
  104. align-items: center;
  105. justify-content: space-between;
  106. margin-bottom: 10px;
  107. }
  108. .form_setting_box {
  109. width: 100%;
  110. margin-top: 10px;
  111. background-color: #ffffff;
  112. border-radius: 8px;
  113. min-height: 300px;
  114. padding: 20px;
  115. box-sizing: border-box;
  116. }
  117. .set_label_ti {
  118. font-size: 14px;
  119. margin-left: 20px;
  120. }
  121. </style>