slide-edit.blade.php 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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. <link rel="stylesheet" href="{{static_url('css/public-number.css')}}">
  6. <style>
  7. th {border-bottom: 1px solid #EBEEF5 !important;}
  8. .dialog-cover{z-index:2001}
  9. .dialog-content{z-index:2002}
  10. </style>
  11. <div class="all">
  12. <div id="app" v-cloak>
  13. <div class="vue-crumbs">
  14. <a @click="goParent(1)">PC端</a>
  15. >
  16. <a @click="goParent(2)">广告管理</a>
  17. >
  18. <a @click="goParent(3)">幻灯片管理</a> > 编辑幻灯片
  19. </div>
  20. <el-form ref="form" :model="form" :rules="rules" label-width="15%">
  21. <div class="vue-main">
  22. <div class="vue-main-title">
  23. <div class="vue-main-title-left"></div>
  24. <div class="vue-main-title-content">编辑幻灯片</div>
  25. </div>
  26. <div class="vue-main-form">
  27. <el-form-item label="排序" prop="sort">
  28. <el-input v-model="form.sort" style="width:70%;"></el-input>
  29. </el-form-item>
  30. <el-form-item label="幻灯片名称" prop="title">
  31. <el-input v-model="form.title" style="width:70%;"></el-input>
  32. </el-form-item>
  33. <el-form-item label="幻灯片" prop="img">
  34. <div class="upload-box" @click="openUpload('img')" v-if="!form.img_src">
  35. <i class="el-icon-plus" style="font-size:32px"></i>
  36. </div>
  37. <div @click="openUpload('img')" class="upload-boxed" v-if="form.img_src" style="height:82px">
  38. <img :src="form.img_src" alt="" style="width:150px;height:82px;border-radius: 5px;cursor: pointer;">
  39. <i class="el-icon-close" @click.stop="clearImg('img')" title="点击清除图片"></i>
  40. <div class="upload-boxed-text">点击重新上传</div>
  41. </div>
  42. <div class="tip">
  43. 使用样式一,建议尺寸1200*400,使用样式二,建议尺寸1920*500
  44. </div>
  45. </el-form-item>
  46. <el-form-item label="跳转链接" prop="url">
  47. <el-input v-model="form.url" style="width:70%;" placeholder=" 请填写指向的链接 (请以https://开头)"></el-input>
  48. <div class="tip">请以https://开头</div>
  49. </el-form-item>
  50. <el-form-item label="是否显示" prop="is_show">
  51. <el-switch v-model="form.is_show" :active-value="1" :inactive-value="0"></el-switch>
  52. </el-form-item>
  53. </div>
  54. </div>
  55. </el-form>
  56. <!-- 分页 -->
  57. <div class="vue-page">
  58. <div class="vue-center">
  59. <el-button type="primary" @click="submitForm('form')" :disabled="btnChangeEnable">提交</el-button>
  60. <el-button @click="goBack">返回</el-button>
  61. </div>
  62. </div>
  63. <upload-img :upload-show="uploadShow" :name="chooseImgName" @replace="changeProp" @sure="sureImg"></upload-img>
  64. <pop :show="show" @replace="changeLink" @add="parHref"></pop>
  65. <program :pro="pro" @replacepro="changeprogram" @addpro="parpro"></program>
  66. </div>
  67. </div>
  68. @include('public.admin.uploadImg')
  69. @include('public.admin.pop')
  70. @include('public.admin.program')
  71. <script>
  72. var app = new Vue({
  73. el:"#app",
  74. delimiters: ['[[', ']]'],
  75. name: 'test',
  76. data() {
  77. let slide = {!!json_encode($slide?:'{}') !!};
  78. {{--let set = {!!json_encode($set?:'{}') !!};--}}
  79. return{
  80. show:false,//是否开启公众号弹窗
  81. pro:false ,//是否开启小程序弹窗
  82. chooseLink:'',
  83. chooseMiniLink:'',
  84. // slide_style:set&&set.slide_style?set.slide_style:0,
  85. id:slide?slide.id:0,
  86. form:{
  87. sort:slide?slide.sort:0,
  88. title:slide?slide.title:"",
  89. img:slide?slide.img:"",
  90. img_src:slide?slide.img_src:"",
  91. url:slide?slide.url:"",
  92. is_show:slide?slide.is_show:0,
  93. },
  94. btnChangeEnable:false,
  95. uploadShow:false,
  96. chooseImgName:'',
  97. submit_url:'',
  98. showVisible:false,
  99. loading: false,
  100. uploadImg1:'',
  101. rules:{
  102. sort:{ required: true, message: '请输入排序'},
  103. title:{ required: true, message: '请输入幻灯片标题'},
  104. img:{ required: true, message: '请选择幻灯片图片'},
  105. // url:{ required: true, message: '请选择幻灯片链接'},
  106. },
  107. }
  108. },
  109. created() {
  110. },
  111. mounted() {
  112. },
  113. methods: {
  114. getParam(name) {
  115. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
  116. var r = window.location.search.substr(1).match(reg);
  117. if (r != null) return unescape(r[2]);
  118. return null;
  119. },
  120. goParent(level) {
  121. if(level==1) {
  122. window.location.href = `{!! yzWebFullUrl('plugin.pc-terminal.admin.set.basic') !!}`;
  123. }
  124. else if(level==2) {
  125. window.location.href = `{!! yzWebFullUrl('plugin.pc-terminal.admin.slide.slide-list') !!}`;
  126. }
  127. else if(level==3) {
  128. window.location.href = `{!! yzWebFullUrl('plugin.pc-terminal.admin.slide.slide-list') !!}`;
  129. }
  130. },
  131. submitForm(formName) {
  132. this.btnChangeEnable = true;
  133. let that = this;
  134. let json = {
  135. sort:this.form.sort,
  136. title:this.form.title,
  137. img:this.form.img,
  138. url:this.form.url,
  139. is_show:this.form.is_show || 0,
  140. };
  141. this.$refs[formName].validate((valid) => {
  142. if (valid) {
  143. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  144. this.$http.post('{!! yzWebFullUrl('plugin.pc-terminal.admin.slide.slide-edit') !!}',{id:this.id,slide:json}).then(response => {
  145. if (response.data.result) {
  146. this.$message({type: 'success',message: '操作成功!'});
  147. // this.goBack();
  148. } else {
  149. this.$message({message: response.data.msg,type: 'error'});
  150. }
  151. loading.close();
  152. },response => {
  153. loading.close();
  154. });
  155. }
  156. else {
  157. console.log('error submit!!');
  158. return false;
  159. }
  160. });
  161. this.btnChangeEnable = false;
  162. },
  163. goBack() {
  164. history.go(-1)
  165. },
  166. openUpload(str) {
  167. this.chooseImgName = str;
  168. this.uploadShow = true;
  169. },
  170. changeProp(val) {
  171. if(val == true) {
  172. this.uploadShow = false;
  173. }
  174. else {
  175. this.uploadShow = true;
  176. }
  177. },
  178. sureImg(name,image,image_url) {
  179. this.form[name] = image;
  180. this.form[name+'_src'] = image_url;
  181. },
  182. clearImg(str) {
  183. this.form[str] = "";
  184. this.form[str+'_src'] = "";
  185. this.$forceUpdate();
  186. },
  187. //弹窗显示与隐藏的控制
  188. changeLink(item){
  189. this.show=item;
  190. },
  191. //当前链接的增加
  192. parHref(child,confirm){
  193. this.show=confirm;
  194. // this.form.link=child;
  195. this.form[this.chooseLink] = child;
  196. },
  197. changeprogram(item){
  198. this.pro=item;
  199. },
  200. parpro(child,confirm){
  201. this.pro=confirm;
  202. // this.form.prolink=child;
  203. this.form[this.chooseMiniLink] = child;
  204. },
  205. showLink(type,name) {
  206. if(type=="link") {
  207. this.chooseLink = name;
  208. this.show = true;
  209. }
  210. else {
  211. this.chooseMiniLink = name;
  212. this.pro = true;
  213. }
  214. },
  215. },
  216. })
  217. </script>
  218. @endsection