index.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <?php
  2. /**
  3. * @link:http://www.gdqijianshi.com/
  4. * @copyright: Copyright (c) 2020 广东七件事集团
  5. * Created by PhpStorm
  6. * Author: lun
  7. * Date: 2021-10-23
  8. * Time: 16:11
  9. */
  10. use common\helpers\ComponentHelper;
  11. ComponentHelper::loadComponentView('com-image');
  12. ?>
  13. <div id="app" v-cloak>
  14. <el-card class="box-card" v-loading="loading" shadow="never" style="border:0;min-width: 1500px;"
  15. body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  16. <div slot="header">
  17. <div>
  18. <span>基础设置</span>
  19. </div>
  20. </div>
  21. <div class="form_box">
  22. <el-form :model="ruleForm" size="small" ref="ruleForm" label-width="150px">
  23. <el-card shadow="never">
  24. <div style="display: flex;align-items: center;padding-bottom: 20px;border-bottom: 1px solid #E4E7ED;margin:10px 0 10px 15px;font-size:14px;">
  25. <div>装修风格设置</div>
  26. </div>
  27. <div>
  28. <el-row>
  29. <el-col :span="16">
  30. <el-form-item label="自定义页面装修风格" style="box-sizing:border-box;padding-top: 18px">
  31. <el-col :span="12">
  32. <el-radio-group v-model="ruleForm.style">
  33. <div class="show-type-radio-group">
  34. <div class="show-type-radio">
  35. <el-radio :label="1">风格1</el-radio>
  36. <el-image
  37. class="radio-group-img"
  38. src="resources/addons/course/default_home_style1.png"
  39. :preview-src-list="['resources/addons/course/default_home_style1.png']"
  40. ></el-image>
  41. </div>
  42. <div class="show-type-radio">
  43. <el-radio :label="2">风格2</el-radio>
  44. <el-image
  45. class="radio-group-img"
  46. src="resources/addons/course/default_home_style2.png"
  47. :preview-src-list="['resources/addons/course/default_home_style2.png']"
  48. ></el-image>
  49. </div>
  50. </div>
  51. </el-radio-group>
  52. </el-col>
  53. </el-form-item>
  54. </el-col>
  55. </el-row>
  56. </div>
  57. </el-card>
  58. </el-form>
  59. <el-button :loading="btnLoading" class="button-item" type="primary" style="margin-top: 24px;"
  60. @click="store('ruleForm')" size="small">保存
  61. </el-button>
  62. </div>
  63. </el-card>
  64. </div>
  65. <script>
  66. const app = new Vue({
  67. el: '#app',
  68. data() {
  69. return {
  70. loading: false,
  71. btnLoading: false,
  72. dialogVisible:false,
  73. ruleForm: {
  74. style: 1,
  75. },
  76. radioOptions: []
  77. }
  78. },
  79. mounted: function () {
  80. this.loadData();
  81. },
  82. methods: {
  83. loadData() {
  84. this.loading = true;
  85. request({
  86. params: {
  87. r: 'course/setting/index',
  88. },
  89. method: 'get'
  90. }).then(e => {
  91. this.loading = false;
  92. if (e.data.code == 0 && !isEmpty(e.data.data)) {
  93. this.ruleForm = e.data.data;
  94. }
  95. }).catch(e => {
  96. this.loading = false;
  97. })
  98. },
  99. store(formName) {
  100. this.$refs[formName].validate((valid) => {
  101. if (valid) {
  102. this.btnLoading = true;
  103. request({
  104. params: {
  105. r: 'course/setting/index',
  106. },
  107. method: 'post',
  108. data: this.ruleForm
  109. }).then(e => {
  110. this.btnLoading = false;
  111. if (e.data.code == 0) {
  112. this.$message.success(e.data.msg);
  113. } else {
  114. this.$message.error(e.data.msg);
  115. }
  116. }).catch(e => {
  117. this.$message.error(e);
  118. this.btnLoading = false;
  119. })
  120. } else {
  121. this.btnLoading = false;
  122. console.log('error submit!!');
  123. return false;
  124. }
  125. });
  126. },
  127. showImageModal(imageSrc) {
  128. this.dialogVisible = true; // 显示模态框
  129. this.dialogImageSrc = imageSrc; // 设置模态框中的图片地址
  130. },
  131. }
  132. });
  133. </script>
  134. <style>
  135. .form_box {
  136. background-color: #f3f3f3;
  137. padding: 0 0 20px;
  138. }
  139. .button-item {
  140. margin-top: 12px;
  141. padding: 9px 25px;
  142. }
  143. .show-type-radio-group{
  144. display: flex;
  145. }
  146. .show-type-radio {
  147. display: flex !important;
  148. flex-direction: column !important;
  149. align-items: center !important;
  150. }
  151. .show-type-radio + .show-type-radio {
  152. margin-left: 30px;
  153. }
  154. .radio-group-img {
  155. margin-top: 10px;
  156. width: 150px;
  157. }
  158. </style>