search-set.blade.php 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. @extends('layouts.base')
  2. @section('title', '基础设置')
  3. @section('content')
  4. <link rel="stylesheet" href="{{resource_get('plugins/pc-terminal/views/admin/index.css')}}">
  5. <style>
  6. .vue-main{background: #eff3f6;}
  7. /* 导航 */
  8. .el-radio-button .el-radio-button__inner,.el-radio-button:first-child .el-radio-button__inner {border-radius: 4px 4px 4px 4px;border-left: 0px;}
  9. .el-radio-button__inner{border:0;}
  10. .el-radio-button:last-child .el-radio-button__inner {border-radius: 4px 4px 4px 4px;}
  11. .el-radio__label{
  12. display: none;
  13. }
  14. /deep/ .el-radio__inner {
  15. width: 20px;
  16. height: 20px;
  17. background: transparent !important;
  18. box-sizing: border-box;
  19. border: 2px solid #4f9efd;
  20. }
  21. /deep/.el-radio__inner::after {
  22. background: #4f9efd;
  23. width: 10px;
  24. height: 10px;
  25. }
  26. /deep/.el-radio__label {
  27. font-size: 20px;
  28. color: #a0b2d3;
  29. font-weight: bolder;
  30. }
  31. /deep/.el-radio__input.is-checked + .el-radio__label {
  32. color: #4f9efd;
  33. }
  34. </style>
  35. <div class="all">
  36. <div id="app" v-cloak>
  37. <el-form ref="form" :model="form" label-width="15%">
  38. <div class="vue-head">
  39. <el-radio-group v-model="order_type">
  40. <el-radio-button label="1" @click.native="gotoOther(1)">基础设置</el-radio-button>
  41. <el-radio-button label="2" @click.native="gotoOther(2)">SEO设置</el-radio-button>
  42. <el-radio-button label="3" @click.native="gotoOther(3)">顶部导航</el-radio-button>
  43. <el-radio-button label="4" @click.native="gotoOther(4)">底部导航</el-radio-button>
  44. <el-radio-button label="5" @click.native="gotoOther(5)">登录页设置</el-radio-button>
  45. <el-radio-button label="6" @click.native="gotoOther(6)">聚合搜索</el-radio-button>
  46. </el-radio-group>
  47. </div>
  48. <div class="vue-head" style="margin-top:20px">
  49. <div class="vue-main-title">
  50. <div class="vue-main-title-left"></div>
  51. <div class="vue-main-title-content">聚合搜索</div>
  52. </div>
  53. <div class="vue-main-form">
  54. <el-row type="flex" :gutter="20" style="font-size: 14px;font-weight: bold">
  55. <el-col :span="4" :offset="2"><span>模块</span></el-col>
  56. <el-col :span="4"><span>自定义文案</span></el-col>
  57. <el-col :span="4" :offset="2"><span>默认搜索</span></el-col>
  58. </el-row>
  59. <div style="margin-top: 20px;">
  60. <div v-for="(item, index) in searchModule" class="checkbox-pane" style="display: inline">
  61. <el-row type="flex" :gutter="20" >
  62. <el-col :span="4" :offset="2"><span>[[item.name]]</span></el-col>
  63. <el-col :span="4"><el-input :placeholder="item.diy_text" v-model="item.diy_text" ></el-input></el-col>
  64. <el-col :span="4" :offset="2"><el-radio v-model="defaultModule" :label="item.key"></el-radio></el-col>
  65. </el-row>
  66. </div>
  67. </div>
  68. <el-form-item label="关闭原模块搜索" prop="searchModuleClose" style="margin-top: 20px;">
  69. <el-checkbox-group v-model="searchModuleClose" >
  70. <el-checkbox v-for="(item, index) in closeOption"
  71. :label="item.key" :value="item.value" name="type">[[item.name]]
  72. </el-checkbox>
  73. </el-checkbox-group>
  74. <div class="tip">勾选后,原模块中的独立搜索框将不再显示</div>
  75. </el-form-item>
  76. </div>
  77. </div>
  78. </el-form>
  79. <!-- 分页 -->
  80. <div class="vue-page">
  81. <div class="vue-center">
  82. <el-button type="primary" @click="submitForm('form')">提交</el-button>
  83. <el-button @click="goBack">返回</el-button>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. <script>
  89. var app = new Vue({
  90. el:"#app",
  91. delimiters: ['[[', ']]'],
  92. name: 'test',
  93. data() {
  94. let moduleSet = [];
  95. let moduleClose = [];
  96. let closeOption = [
  97. {
  98. "name": "知识库",
  99. "key":"knowledge",
  100. "value": false
  101. },
  102. {
  103. "name": "微社区",
  104. "key":"community",
  105. "value": false
  106. }
  107. ]
  108. let searchModule=[
  109. {"name":"商品","key":"goods","diy_text":"商品","is_default":true},
  110. {"name":"文章","key":"article","diy_text":"文章","is_default":false},
  111. {"name":"知识库","key":"knowledge","diy_text":"知识库","is_default":false},
  112. {"name":"微贴","key":"post","diy_text":"微贴","is_default":false},
  113. {"name":"短视频","key":"video","diy_text":"短视频","is_default":false},
  114. ]
  115. let form={}
  116. let searchModuleClose=[]
  117. let defaultModule='goods'
  118. return{
  119. searchModuleClose,
  120. form,
  121. order_type:'6',
  122. closeOption,
  123. searchModule,
  124. defaultModule
  125. }
  126. },
  127. created() {
  128. },
  129. mounted() {
  130. let moduleSet=JSON.parse('{!! $moduleSet?:"[]" !!}')
  131. let moduleClose=JSON.parse('{!! $moduleClose?:"[]" !!}')
  132. if(moduleSet.length){
  133. for (let cItem of moduleSet) {
  134. if ( cItem.is_default=="true") {
  135. this.defaultModule = cItem.key
  136. }
  137. }
  138. this.searchModule=moduleSet
  139. }
  140. if(moduleClose.length){
  141. for (let cItem of moduleClose) {
  142. if ( cItem.value=="true") {
  143. this.searchModuleClose.push(cItem.key)
  144. }
  145. }
  146. }
  147. },
  148. methods: {
  149. submitForm(formName) {
  150. for (let cItem of this.searchModule) {
  151. if (this.defaultModule == cItem.key) {
  152. cItem.is_default = "true"
  153. } else {
  154. cItem.is_default = "false"
  155. }
  156. }
  157. for (let cItem of this.closeOption) {
  158. if (this.searchModuleClose.indexOf(cItem.key)!=-1) {
  159. cItem.value = "true"
  160. } else {
  161. cItem.value = "false"
  162. }
  163. }
  164. this.$refs[formName].validate((valid) => {
  165. if (valid) {
  166. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  167. this.$http.post('{!! yzWebFullUrl('plugin.pc-terminal.admin.set.search-set') !!}',{formData:{moduleClose:this.closeOption,moduleSet:this.searchModule}}).then(response => {
  168. if (response.data.result) {
  169. this.$message({message: response.data.msg,type: 'success'});
  170. } else {
  171. this.$message({message: response.data.msg,type: 'error'});
  172. }
  173. loading.close();
  174. },response => {
  175. loading.close();
  176. });
  177. }
  178. else {
  179. console.log('error submit!!');
  180. return false;
  181. }
  182. });
  183. },
  184. goBack() {
  185. history.go(-1)
  186. },
  187. gotoOther(type) {
  188. let url = ""
  189. if(type==1) {
  190. url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.set.basic') !!}'
  191. }
  192. else if(type==2) {
  193. url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.set.seo') !!}'
  194. }
  195. else if(type==3) {
  196. url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.set.nav-top') !!}'
  197. }
  198. else if(type==4) {
  199. url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.set.nav-bottom') !!}'
  200. }
  201. else if(type==5) {
  202. url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.set.login-set') !!}'
  203. }
  204. else if(type==6) {
  205. //url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.set.search-set') !!}'
  206. }
  207. if(url) {
  208. window.location.href=url
  209. }
  210. },
  211. },
  212. })
  213. </script>
  214. @endsection