platformsetting.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <basic-container>
  3. <avue-tabs :option="tabOption" @change="(data)=>tabChange(data.prop)">
  4. </avue-tabs>
  5. <avue-form ref="form" v-model="form" :option="option" @submit="updateSetting">
  6. </avue-form>
  7. </basic-container>
  8. </template>
  9. <script>
  10. import {getPlatformSetting, updatePlatformValue} from "@/api/sing_desk/platformsetting";
  11. export default {
  12. data() {
  13. return {
  14. form: {},
  15. tabOption: {
  16. column: [{
  17. icon: 'el-icon-s-operation',
  18. label: '页面设置',
  19. prop: 'PAGE_INTERFACE_SHOW',
  20. }, {
  21. icon: 'iconfont iconicon_task',
  22. label: '活动设置',
  23. prop: 'ACTIVE_SETTING',
  24. }]
  25. },
  26. option: {
  27. submitText: '保存',
  28. labelWidth: 120,
  29. emptyBtn: false,
  30. column: []
  31. },
  32. key: "",
  33. }
  34. },
  35. created() {
  36. this.tabChange(this.tabOption.column[0].prop);
  37. },
  38. methods: {
  39. /**
  40. * 获取平台设置
  41. */
  42. getSetting(key) {
  43. getPlatformSetting(key).then(res => {
  44. this.form = JSON.parse(res.data.data);
  45. });
  46. },
  47. /**
  48. * 更新平台设置
  49. */
  50. updateSetting(row, loading) {
  51. const data = {};
  52. this.option.column.forEach(ele=>{
  53. data[ele.prop] = this.form[ele.prop];
  54. });
  55. updatePlatformValue({
  56. key: this.key,
  57. value: JSON.stringify(data)
  58. }).then(() => {
  59. this.$message.success("修改成功");
  60. }).finally(() => {
  61. loading();
  62. });
  63. },
  64. /**
  65. * 选项卡变化
  66. */
  67. tabChange(key) {
  68. this.key = key;
  69. //活动页面
  70. if (this.key === "PAGE_INTERFACE_SHOW") {
  71. this.option.column = [
  72. {
  73. label: "主页标题",
  74. prop: "indexTitle",
  75. span: 24,
  76. rules: [{
  77. required: true,
  78. message: "请输入主页标题",
  79. trigger: "blur"
  80. }],
  81. },
  82. {
  83. label: "移动授权标题",
  84. prop: "cmccAuthTitle",
  85. span: 24,
  86. rules: [{
  87. required: true,
  88. message: "请输入移动授权标题",
  89. trigger: "blur"
  90. }],
  91. },
  92. {
  93. label: "移动授权内容",
  94. prop: "cmccAuthContent",
  95. component: 'AvueUeditor',
  96. options: {
  97. action: '/api/blade-resource/oss/endpoint/put-file',
  98. propsHttp: {
  99. res: 'data',
  100. url: 'link'
  101. },
  102. },
  103. hide: true,
  104. minRows: 6,
  105. span: 24,
  106. rules: [{
  107. required: true,
  108. message: "请输入活动内容",
  109. trigger: "blur"
  110. }]
  111. },
  112. {
  113. label: "主页轮播图",
  114. prop: "indexImageList",
  115. type: 'dynamic',
  116. span: 24,
  117. children: {
  118. align: 'center',
  119. headerAlign: 'center',
  120. column: [{
  121. label: '轮播图',
  122. prop: "url",
  123. dataType: "string",
  124. type: 'upload',
  125. propsHttp: {
  126. res: 'data',
  127. url: 'link'
  128. },
  129. listType: 'picture-img',
  130. tip: '只能上传jpg/png文件,且不超过500kb',
  131. action: '/api/blade-resource/oss/endpoint/put-file',
  132. rules: [{
  133. required: true,
  134. message: "请输入类型",
  135. trigger: "blur"
  136. }]
  137. },{
  138. label: '类型',
  139. prop: "type",
  140. rules: [{
  141. required: true,
  142. message: "请输入类型",
  143. trigger: "blur"
  144. }],
  145. },{
  146. label: '地址',
  147. prop: "path",
  148. rules: [{
  149. required: true,
  150. message: "请输入地址",
  151. trigger: "blur"
  152. }],
  153. }]
  154. }
  155. }
  156. ]
  157. } else if(this.key === "ACTIVE_SETTING"){
  158. this.option.column = [
  159. {
  160. label: "默认活动",
  161. prop: "defaultActiveId",
  162. // type: "select",
  163. // dicUrl:"/api/sing_active/activerecord/list?current=1&size=999",
  164. // props: {
  165. // label: 'title',
  166. // value: 'id',
  167. // desc: 'content',
  168. // res: "data.records"
  169. // },
  170. span: 12,
  171. rules: [{
  172. required: true,
  173. message: "请选择默认活动",
  174. trigger: "blur"
  175. }],
  176. },
  177. {
  178. label: "热力值/票",
  179. prop: "voteAndHeatRate",
  180. type: "number",
  181. span: 12,
  182. rules: [{
  183. required: true,
  184. message: "请输入热力值/票",
  185. trigger: "blur"
  186. }],
  187. },
  188. {
  189. label: "普法积分值/票",
  190. prop: "voteAndPointRate",
  191. type: "number",
  192. span: 12,
  193. rules: [{
  194. required: true,
  195. message: "请输入普法积分值/票",
  196. trigger: "blur"
  197. }],
  198. },
  199. ]
  200. } else {
  201. this.option.column = [];
  202. }
  203. this.form = {};
  204. this.getSetting(this.key);
  205. }
  206. }
  207. };
  208. </script>
  209. <style>
  210. </style>