nav-top.blade.php 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. @extends('layouts.base')
  2. @section('title', '顶部导航')
  3. @section('content')
  4. <link rel="stylesheet" href="{{resource_get('plugins/case-library/views/admin/index.css')}}">
  5. <style>
  6. /* 导航 */
  7. .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;}
  8. .el-radio-button__inner{border:0;}
  9. .el-radio-button:last-child .el-radio-button__inner {border-radius: 4px 4px 4px 4px;}
  10. </style>
  11. <div class="all">
  12. <div id="app" v-cloak>
  13. <el-form ref="form" :model="form" :rules="rules" label-width="15%">
  14. <div class="vue-head">
  15. <el-radio-group v-model="order_type">
  16. <el-radio-button label="1" @click.native="gotoOther(1)">基础设置</el-radio-button>
  17. <el-radio-button label="2" @click.native="gotoOther(2)">幻灯片</el-radio-button>
  18. <el-radio-button label="3" @click.native="gotoOther(3)">广告位</el-radio-button>
  19. <el-radio-button label="4" @click.native="gotoOther(4)">顶部导航</el-radio-button>
  20. <el-radio-button label="5" @click.native="gotoOther(5)">底部导航</el-radio-button>
  21. <el-radio-button label="6" @click.native="gotoOther(6)">管理员设置</el-radio-button>
  22. </el-radio-group>
  23. </div>
  24. <div class="vue-main">
  25. <div class="vue-main-title">
  26. <div class="vue-main-title-left"></div>
  27. <div class="vue-main-title-content" style="flex:0 0 80px">顶部导航</div>
  28. <div style="color:red">(只在PC版生效)</div>
  29. </div>
  30. <div class="vue-main-form">
  31. <el-form-item label="导航设置">
  32. <div v-for="(item, index) in form.nav_top" :key="index" style="margin-bottom:5px;">
  33. <span>名称</span>
  34. <el-input v-model="item.name" style="width:28%" placeholder="请输入名称"></el-input>&nbsp;&nbsp;&nbsp;&nbsp;
  35. <span>链接</span>
  36. <el-input v-model="item.url" style="width:28%" placeholder="请输入链接"></el-input>
  37. <el-button type="primary" icon="el-icon-plus" title="添加导航" style="margin-left: 0px;" @click="addNav(index)"></el-button>
  38. <el-button type="danger" icon="el-icon-close" title="删除导航" style="margin-left: 0px;" @click="delNav(index)"></el-button>
  39. <el-button icon="el-icon-upload2" title="向上排序" style="margin-left: 0px;" @click="topSort(index, item)"></el-button>
  40. <el-button icon="el-icon-download" title="向下排序" style="margin-left: 0px;" @click="bottomSort(index, item)"></el-button>
  41. </div>
  42. </el-form-item>
  43. </div>
  44. </div>
  45. </el-form>
  46. <!-- 分页 -->
  47. <div class="vue-page">
  48. <div class="vue-center">
  49. <el-button type="primary" @click="submitForm('form')">提交</el-button>
  50. <el-button @click="goBack">返回</el-button>
  51. </div>
  52. </div>
  53. <upload-img :upload-show="uploadShow" :name="chooseImgName" @replace="changeProp" @sure="sureImg"></upload-img>
  54. </div>
  55. </div>
  56. @include('public.admin.uploadImg')
  57. <script>
  58. var app = new Vue({
  59. el:"#app",
  60. delimiters: ['[[', ']]'],
  61. name: 'test',
  62. data() {
  63. let set = {!! json_encode($set)!!};
  64. let default_nav_top = {!! json_encode($default_nav_top)!!};
  65. return{
  66. order_type:'4',
  67. id:0,
  68. form:{
  69. nav_top:set&&set.nav_top?set.nav_top:default_nav_top
  70. },
  71. temp_list:[],
  72. temp:{
  73. store_pay_open:0,
  74. become_store_open:0,
  75. reject_store_open:0,
  76. store_pay_id:0,
  77. become_store_id:0,
  78. reject_store_id:0,
  79. },
  80. uploadShow:false,
  81. chooseImgName:'',
  82. submit_url:'',
  83. showVisible:false,
  84. loading: false,
  85. p:{
  86. province:'',
  87. city:'',
  88. district:'',
  89. street:'',
  90. },
  91. province_list:[],
  92. city_list:[],
  93. district_list:[],
  94. street_list:[],
  95. areaLoading:false,
  96. street:1,
  97. template_list:[],
  98. rules:{
  99. // name:{ required: true, message: '请输入品牌名称'}
  100. },
  101. }
  102. },
  103. created() {
  104. },
  105. mounted() {
  106. // this.getData();
  107. },
  108. methods: {
  109. // 添加导航
  110. addNav(index) {
  111. this.form.nav_top.splice(index + 1, 0, {});
  112. },
  113. // 删除导航
  114. delNav(index) {
  115. this.form.nav_top.splice(index, 1);
  116. },
  117. // 向上排序
  118. topSort(index, item) {
  119. if (index == 0) {
  120. return;
  121. }
  122. this.form.nav_top.splice(index, 1);
  123. this.form.nav_top.splice(index - 1, 0, item);
  124. },
  125. // 向下排序
  126. bottomSort(index, item) {
  127. if (index == this.form.nav_top.length) {
  128. return;
  129. }
  130. this.form.nav_top.splice(index, 1);
  131. this.form.nav_top.splice(index + 1, 0, item);
  132. },
  133. submitForm(formName) {
  134. console.log(this.form)
  135. let that = this;
  136. let json = {
  137. nav_top:this.form.nav_top,
  138. };
  139. this.$refs[formName].validate((valid) => {
  140. if (valid) {
  141. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  142. this.$http.post('{!! yzWebFullUrl('plugin.case-library.admin.set.nav-top') !!}',{set:json}).then(response => {
  143. if (response.data.result) {
  144. this.$message({type: 'success',message: '操作成功!'});
  145. } else {
  146. this.$message({message: response.data.msg,type: 'error'});
  147. }
  148. loading.close();
  149. },response => {
  150. loading.close();
  151. });
  152. }
  153. else {
  154. console.log('error submit!!');
  155. return false;
  156. }
  157. });
  158. },
  159. goBack() {
  160. history.go(-1)
  161. },
  162. gotoOther(type) {
  163. let url = ""
  164. if(type==1) {
  165. url = '{!! yzWebFullUrl('plugin.case-library.admin.set.basic') !!}'
  166. }
  167. else if(type==2) {
  168. url = '{!! yzWebFullUrl('plugin.case-library.admin.banner.banner-list') !!}'
  169. }
  170. else if(type==3) {
  171. url = '{!! yzWebFullUrl('plugin.case-library.admin.set.advert') !!}'
  172. }
  173. else if(type==4) {
  174. //url = '{!! yzWebFullUrl('plugin.case-library.admin.set.nav-top') !!}'
  175. }
  176. else if(type==5) {
  177. url = '{!! yzWebFullUrl('plugin.case-library.admin.set.nav-bottom') !!}'
  178. }
  179. else if(type==6) {
  180. url = '{!! yzWebFullUrl('plugin.case-library.admin.set.admin-view') !!}'
  181. }
  182. if(url) {
  183. window.location.href=url
  184. }
  185. },
  186. copyLink(type) {
  187. this.$refs[type].select();
  188. document.execCommand("Copy")
  189. this.$message.success("复制成功!");
  190. },
  191. openUpload(str) {
  192. this.chooseImgName = str;
  193. this.uploadShow = true;
  194. },
  195. changeProp(val) {
  196. if(val == true) {
  197. this.uploadShow = false;
  198. }
  199. else {
  200. this.uploadShow = true;
  201. }
  202. },
  203. sureImg(name,image,image_url) {
  204. this.form[name] = image;
  205. this.form[name+'_url'] = image_url;
  206. },
  207. clearImg(str) {
  208. this.form[str] = "";
  209. this.form[str+'_url'] = "";
  210. this.$forceUpdate();
  211. },
  212. },
  213. })
  214. </script>
  215. @endsection