index.blade.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. @extends('layouts.base')
  2. @section('title', '自定义表单')
  3. @section('content')
  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:40px;
  25. position:relative;
  26. border-radius: 8px;
  27. min-height:100vh;
  28. background-color:#fff;
  29. }
  30. .con .setting .block{
  31. padding:10px;
  32. background-color:#fff;
  33. border-radius: 8px;
  34. margin-bottom:10px;
  35. }
  36. .con .setting .block .title{
  37. font-size:18px;
  38. margin-bottom:15px;
  39. display:flex;
  40. align-items:center;
  41. justify-content:space-between;
  42. }
  43. .confirm-btn{
  44. width: calc(100% - 266px);
  45. position:fixed;
  46. bottom:0;
  47. right:0;
  48. margin-right:10px;
  49. line-height:63px;
  50. background-color: #ffffff;
  51. box-shadow: 0px 8px 23px 1px
  52. rgba(51, 51, 51, 0.3);
  53. background-color:#fff;
  54. text-align:center;
  55. }
  56. .el-form-item__label{
  57. margin-right:30px;
  58. }
  59. .add{
  60. width: 100px;
  61. height: 36px;
  62. border-radius: 4px;
  63. border: solid 1px #29ba9c;
  64. color:#29ba9c;
  65. display:flex;
  66. align-items:center;
  67. justify-content:center;
  68. }
  69. .list-wrap{
  70. padding-left:10%;
  71. }
  72. .list{
  73. width: 911px;
  74. height: 159px;
  75. background-color: #f5f5f5;
  76. border-radius: 4px;
  77. margin-bottom:20px;
  78. box-sizing:border-box;
  79. padding:40px 0;
  80. position:relative;
  81. }
  82. .list .delete{
  83. width: 26px;
  84. height: 26px;
  85. background-color: #dee2ee;
  86. border-radius:50%;
  87. display:flex;
  88. align-items:center;
  89. justify-content:center;
  90. position:absolute;
  91. right:0;
  92. top:0;
  93. font-size:16px;
  94. }
  95. b{
  96. font-size:14px;
  97. }
  98. </style>
  99. <div id='re_content' >
  100. @include('layouts.newTabs')
  101. <div class="con" >
  102. <div class="setting">
  103. <el-form ref="form" :model="form" label-width="15%">
  104. <div class="block">
  105. <div class="title"><div style="display:flex;align-items:center;"><span style="width: 4px;height: 18px;background-color: #29ba9c;margin-right:15px;display:inline-block;"></span><b>基础设置</b></div></div>
  106. <el-form-item label="姓名">
  107. <div style="display: flex;align-items: center;">
  108. <el-switch
  109. v-model="base.name"
  110. active-value="1"
  111. inactive-value="0"
  112. >
  113. </el-switch>
  114. <div>
  115. <span style="margin: 0 30px 0 80px; font-size: 14px; color: #666;font-weight: 400;">姓名是否必填</span>
  116. <el-switch
  117. v-model="base.name_must"
  118. active-value="1"
  119. inactive-value="0"
  120. >
  121. </el-switch>
  122. </div>
  123. </div>
  124. </el-form-item>
  125. <el-form-item label="性别">
  126. <template>
  127. <el-switch
  128. v-model="base.sex"
  129. active-value="1"
  130. inactive-value="0"
  131. >
  132. </el-switch>
  133. </template>
  134. </el-form-item>
  135. <el-form-item label="详细地址">
  136. <template>
  137. <el-switch
  138. v-model="base.address"
  139. active-value="1"
  140. inactive-value="0"
  141. >
  142. </el-switch>
  143. </template>
  144. </el-form-item>
  145. <el-form-item label="生日">
  146. <template>
  147. <el-switch
  148. v-model="base.birthday"
  149. active-value="1"
  150. inactive-value="0"
  151. >
  152. </el-switch>
  153. </template>
  154. </el-form-item>
  155. <el-form-item label="修改昵称头像">
  156. <template>
  157. <el-switch
  158. v-model="base.change_info"
  159. active-value="1"
  160. inactive-value="0"
  161. >
  162. </el-switch>
  163. </template>
  164. <div>开启后,前端可修改会员头像昵称,若开启微信授权登录,修改后会被微信的头像昵称替换</div>
  165. </el-form-item>
  166. </div>
  167. <div style="background: #eff3f6;width:100%;height:15px;"></div>
  168. <div class="block">
  169. <div class="title"><div style="display:flex;align-items:center;"><span style="width: 4px;height: 18px;background-color: #29ba9c;margin-right:15px;display:inline-block;"></span><b>自定义</b><span></div><el-button type="primary" @click="addBlock">添加</el-button></div>
  170. <el-form-item label="自定义必填开启">
  171. <template>
  172. <el-switch
  173. v-model="base.form_open"
  174. active-value="1"
  175. inactive-value="0"
  176. >
  177. </el-switch>
  178. </template>
  179. <div>开启后,自定义字段必填</div>
  180. </el-form-item>
  181. <el-form-item label="前端禁止编辑">
  182. <template>
  183. <el-switch
  184. v-model="base.form_edit"
  185. active-value="1"
  186. inactive-value="0"
  187. >
  188. </el-switch>
  189. </template>
  190. <div>开启后,前端会员设置不可编辑</div>
  191. </el-form-item>
  192. <div class="list-wrap">
  193. <div class="list" v-for="(item,index) in form.sort">
  194. <div>
  195. <span style="display:inline-block;margin-right:30px;width:150px;text-align:right;">排序</span>
  196. <el-input v-model="form.sort[index]" name="form[sort][]" style="width:60%;"></el-input>
  197. </div>
  198. <div style="margin-top:20px;">
  199. <span style="display:inline-block;margin-right:30px;width:150px;text-align:right;">自定义字段名称</span>
  200. <el-input v-model="form.name[index]" name ="form[name][]" style="width:60%;"></el-input>
  201. </div>
  202. <a style="color:#666;"><div class="delete" @click="Delete(index)">x</div></a>
  203. </div>
  204. </div>
  205. </div>
  206. </el-form>
  207. </div>
  208. <div class="confirm-btn">
  209. <el-button type="primary" @click="submit">提交</el-button>
  210. </div>
  211. </div>
  212. </div>
  213. <script>
  214. var vm = new Vue({
  215. el: "#re_content",
  216. delimiters: ['[[', ']]'],
  217. data() {
  218. return {
  219. activeName: 'one',
  220. form:{
  221. sort:[],
  222. name:[]
  223. },
  224. base :{
  225. name:'0',
  226. sex:'0',
  227. address:'0',
  228. birthday:'0',
  229. name_must:'0',
  230. change_info:'0',
  231. }
  232. }
  233. },
  234. mounted () {
  235. this.getData();
  236. },
  237. methods: {
  238. Delete(i){
  239. this.form.sort.splice(i,1)
  240. this.form.name.splice(i,1)
  241. },
  242. addBlock(){
  243. this.form.sort.push("")
  244. this.form.name.push("")
  245. },
  246. getData(){
  247. this.$http.post('{!! yzWebFullUrl('setting.form.index') !!}').then(function (response){
  248. if (response.data.result) {
  249. if(response.data.data.set.form && response.data.data.set.form instanceof Array == true) {
  250. response.data.data.set.form.forEach((item,index) => {
  251. this.form.sort.push(item.sort)
  252. this.form.name.push(item.name)
  253. })
  254. }
  255. if(response.data.data.set.base){
  256. for(let i in response.data.data.set.base){
  257. this.base[i]=response.data.data.set.base[i]
  258. }
  259. }
  260. console.log(this.base)
  261. }else {
  262. this.$message({message: response.data.msg,type: 'error'});
  263. }
  264. },function (response) {
  265. this.$message({message: response.data.msg,type: 'error'});
  266. })
  267. },
  268. submit() {
  269. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  270. this.$http.post('{!! yzWebFullUrl('setting.form.index') !!}',{'form':this.form,'base':this.base}).then(function (response){
  271. if (response.data.result) {
  272. this.$message({message: response.data.msg,type: 'success'});
  273. loading.close();
  274. location.reload();
  275. }else {
  276. this.$message({message: response.data.msg,type: 'error'});
  277. }
  278. },function (response) {
  279. this.$message({message: response.data.msg,type: 'error'});
  280. })
  281. },
  282. },
  283. });
  284. </script>
  285. @endsection