index.php 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <?php
  2. /**
  3. * @link:http://www.goodmall.com/
  4. * @copyright: Copyright (c) 2020
  5. * Author: james
  6. * Date: 2020-04-20
  7. * Time: 15:41
  8. */
  9. use common\helpers\ComponentHelper;
  10. ComponentHelper::loadComponentView('com-dialog-select');
  11. ?>
  12. <style>
  13. @media screen and (min-width:1370px) {
  14. .form-body {
  15. padding: 20px 0;
  16. padding-right: 50%;
  17. min-width: 1400px;
  18. }
  19. }
  20. @media screen and (max-width:1369px) {
  21. .form-body {
  22. padding: 20px 0;
  23. padding-right: 20%;
  24. }
  25. }
  26. .form-body {
  27. background-color: #fff;
  28. margin-bottom: 20px;
  29. }
  30. .form-button {
  31. margin: 0 !important;
  32. }
  33. .form-button .el-form-item__content {
  34. margin-left: 0 !important;
  35. }
  36. .button-item {
  37. padding: 9px 25px;
  38. }
  39. .agent-item-input {
  40. display: flex;
  41. align-items: center;
  42. margin-top: 16px;
  43. }
  44. .agent-item-input .item-lab-title {
  45. width: 80px;
  46. margin-right: 20px;
  47. }
  48. </style>
  49. <div id="app" v-cloak>
  50. <el-card style="border:0;min-width: 800px;" shadow="never" body-style="background-color: #f3f3f3;padding: 10px 0 0;" v-loading="loading">
  51. <div slot="header">基础设置</div>
  52. <div v-if="load">
  53. <div class="form-body">
  54. <el-form ref="form" :model="form" :rules="rules" label-width="120px" size="small">
  55. <el-form-item label="页面名称" prop="page_name">
  56. <el-input placeholder="运营笔记" style="width: 400px;" maxlength="200" v-model="form.page_name"></el-input>
  57. <br/>
  58. <div class="tips-text" style="line-height: 24px;">
  59. 功能命名
  60. </div>
  61. </el-form-item>
  62. <el-form-item label="显示搜索" prop="hidden_search">
  63. <el-switch v-model="form.hidden_search" :active-value="1" :inactive-value="0" active-text="显示" inactive-text="不显示">
  64. </el-switch>
  65. <div v-if="form.hidden_search==1">
  66. <el-input placeholder="请输入搜索标题名称" style="width: 400px;" maxlength="200" v-model="form.search_title"></el-input>
  67. </div>
  68. <br/>
  69. <div class="tips-text" style="line-height: 24px;">
  70. 前端是否显示搜索功能,通过搜索找到对应笔记
  71. </div>
  72. </el-form-item>
  73. <el-form-item label="允许发布" prop="allow_user_create">
  74. <el-switch v-model="form.allow_user_create" :active-value="1" :inactive-value="0" active-text="允许" inactive-text="不允许">
  75. </el-switch>
  76. <br/>
  77. <div class="tips-text" style="line-height: 24px;">
  78. 开启则允许前端用户发布笔记,关闭则只能后台商家发布笔记
  79. </div>
  80. </el-form-item>
  81. <el-form-item label="是否需要审核" prop="need_check">
  82. <el-switch v-model="form.need_check" :active-value="1" :inactive-value="0" active-text="开启" inactive-text="关闭">
  83. </el-switch>
  84. <br/>
  85. <div class="tips-text" style="line-height: 24px;">
  86. 前端笔记发布是否需要审核
  87. </div>
  88. </el-form-item>
  89. <el-form-item label="分享者显示" prop="share_user_show">
  90. <el-switch v-model="form.share_user_show" :active-value="1" :inactive-value="0" active-text="开启" inactive-text="关闭">
  91. </el-switch>
  92. <br/>
  93. <div class="tips-text" style="line-height: 24px;">
  94. 笔记发布是否显示发布会员
  95. </div>
  96. </el-form-item>
  97. </el-form>
  98. </div>
  99. <el-button class="button-item" :loading="btnLoading" type="primary" size="small" @click="store('form')" style="margin-bottom: 15px;">保存</el-button>
  100. </div>
  101. </el-card>
  102. </div>
  103. <script>
  104. const app = new Vue({
  105. el: '#app',
  106. data() {
  107. return {
  108. testSelect: '',
  109. loading: false,
  110. load: false,
  111. btnLoading: false,
  112. selectedGoodList: [],
  113. checkedCities1: [0], //这个放多选选中的项
  114. cities: ['消费次数', '消费金额', '消费商品'],
  115. form: {
  116. page_name: '',
  117. hidden_search: '',
  118. search_title: '',
  119. allow_user_create: '',
  120. need_check: '',
  121. share_user_show: '',
  122. // is_can_use_sensitive: false, // 是否可以打开敏感词检测
  123. },
  124. rules: {
  125. },
  126. };
  127. },
  128. created() {
  129. this.loadData();
  130. },
  131. methods: {
  132. // 敏感词检测开关切换
  133. CheckSwich(val) {
  134. if (val == 1 && !this.is_can_use_sensitive) {
  135. this.$alert('系统尚未配置百度敏感词检测功能,请先到 设置->商城设置->敏感词过滤 配置相应数据', '提示', {
  136. confirmButtonText: '确定',
  137. });
  138. this.form.client_status = 0;
  139. return false;
  140. }
  141. },
  142. // 0.0.1 选中状态的值
  143. checkBoxArr() {
  144. console.log(this.checkedCities1);
  145. },
  146. // 0.2 拿到设置信息
  147. loadData() {
  148. this.loading = true;
  149. request({
  150. params: {
  151. r: 'operating-note/config/index'
  152. }
  153. }).then(e => {
  154. this.loading = false;
  155. if (e.data.code == 0) {
  156. // this.is_can_use_sensitive = e.data.data.is_can_use_sensitive;
  157. if (e.data.data) {
  158. this.form = e.data.data;
  159. }
  160. this.load = true;
  161. } else {
  162. this.$message.error(e.data.msg);
  163. }
  164. }).catch(e => {
  165. this.btnLoading = false;
  166. });
  167. },
  168. // 提交表单
  169. store(formName) {
  170. console.log(this.form);
  171. this.$refs[formName].validate((valid) => {
  172. if (valid) {
  173. this.btnLoading = true;
  174. let postForm = this.form;
  175. request({
  176. params: {
  177. r: 'operating-note/config/index'
  178. },
  179. method: 'post',
  180. data: {
  181. // form: JSON.stringify(postForm),
  182. form: postForm
  183. }
  184. }).then(e => {
  185. this.btnLoading = false;
  186. if (e.data.code == 0) {
  187. this.$message.success(e.data.msg);
  188. this.loadData();
  189. } else {
  190. this.$message.error(e.data.msg)
  191. }
  192. }).catch(e => {
  193. // this.$message.error(e);
  194. this.btnLoading = false;
  195. });
  196. } else {
  197. this.btnLoading = false;
  198. return false;
  199. }
  200. })
  201. },
  202. },
  203. filters: {
  204. checkedStatus(status) {
  205. if (this.checkedCities1.indexOf(status) > -1) {
  206. return true
  207. } else {
  208. return false;
  209. }
  210. }
  211. },
  212. });
  213. </script>