category-info.blade.php 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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. 编辑分类广告
  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="PC广告图片" prop="pc_adv_img">
  28. <div class="upload-box" @click="openUpload('pc_adv_img')" v-if="!form.pc_adv_img_src">
  29. <i class="el-icon-plus" style="font-size:32px"></i>
  30. </div>
  31. <div @click="openUpload('pc_adv_img')" class="upload-boxed" v-if="form.pc_adv_img_src" style="height:82px">
  32. <img :src="form.pc_adv_img_src" alt="" style="width:150px;height:82px;border-radius: 5px;cursor: pointer;">
  33. <i class="el-icon-close" @click.stop="clearImg('pc_adv_img')" title="点击清除图片"></i>
  34. <div class="upload-boxed-text">点击重新上传</div>
  35. </div>
  36. <div class="tip">
  37. 建议尺寸: [[form.level==1?'260*470':'1200*400']]
  38. </div>
  39. </el-form-item>
  40. <el-form-item label="跳转链接" prop="pc_adv_url">
  41. <el-input v-model="form.pc_adv_url" style="width:70%;" placeholder=" 请填写指向的链接 (请以https://开头)"></el-input>
  42. <div class="tip">请以https://开头</div>
  43. </el-form-item>
  44. </div>
  45. </div>
  46. </el-form>
  47. <!-- 分页 -->
  48. <div class="vue-page">
  49. <div class="vue-center">
  50. <el-button type="primary" @click="submitForm('form')" :disabled="btnChangeEnable">提交</el-button>
  51. <el-button @click="goBack">返回</el-button>
  52. </div>
  53. </div>
  54. <upload-img :upload-show="uploadShow" :name="chooseImgName" @replace="changeProp" @sure="sureImg"></upload-img>
  55. <pop :show="show" @replace="changeLink" @add="parHref"></pop>
  56. <program :pro="pro" @replacepro="changeprogram" @addpro="parpro"></program>
  57. </div>
  58. </div>
  59. @include('public.admin.uploadImg')
  60. @include('public.admin.pop')
  61. @include('public.admin.program')
  62. <script>
  63. var app = new Vue({
  64. el:"#app",
  65. delimiters: ['[[', ']]'],
  66. name: 'test',
  67. data() {
  68. let category = {!!json_encode($category?:'{}') !!};
  69. return{
  70. show:false,//是否开启公众号弹窗
  71. pro:false ,//是否开启小程序弹窗
  72. chooseLink:'',
  73. chooseMiniLink:'',
  74. id:category?category.id:0,
  75. form:{
  76. level:category?category.level:"",
  77. pc_adv_img:category?category.pc_adv_img:"",
  78. pc_adv_img_src:category?category.pc_adv_img_src:"",
  79. pc_adv_url:category?category.pc_adv_url:""
  80. },
  81. btnChangeEnable:false,
  82. uploadShow:false,
  83. chooseImgName:'',
  84. submit_url:'',
  85. showVisible:false,
  86. loading: false,
  87. uploadImg1:'',
  88. rules:{
  89. },
  90. }
  91. },
  92. created() {
  93. },
  94. mounted() {
  95. },
  96. methods: {
  97. getParam(name) {
  98. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
  99. var r = window.location.search.substr(1).match(reg);
  100. if (r != null) return unescape(r[2]);
  101. return null;
  102. },
  103. goParent(level) {
  104. if(level==1) {
  105. window.location.href = `{!! yzWebFullUrl('plugin.pc-terminal.admin.set.basic') !!}`;
  106. }
  107. else if(level==2) {
  108. window.location.href = `{!! yzWebFullUrl('plugin.pc-terminal.admin.slide.slide-list') !!}`;
  109. }
  110. },
  111. submitForm(formName) {
  112. let that = this;
  113. this.btnChangeEnable = true;
  114. let json = {
  115. pc_adv_img:this.form.pc_adv_img,
  116. pc_adv_url:this.form.pc_adv_url,
  117. };
  118. this.$refs[formName].validate((valid) => {
  119. if (valid) {
  120. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  121. this.$http.post('{!! yzWebFullUrl('plugin.pc-terminal.admin.category.category-info') !!}',{id:this.id,category:json}).then(response => {
  122. if (response.data.result) {
  123. this.$message({type: 'success',message: '操作成功!'});
  124. // this.goBack();
  125. } else {
  126. this.$message({message: response.data.msg,type: 'error'});
  127. }
  128. loading.close();
  129. this.btnChangeEnable = false;
  130. },response => {
  131. loading.close();
  132. this.btnChangeEnable = false;
  133. });
  134. }
  135. else {
  136. console.log('error submit!!');
  137. this.btnChangeEnable = false;
  138. return false;
  139. }
  140. });
  141. },
  142. goBack() {
  143. history.go(-1)
  144. },
  145. openUpload(str) {
  146. this.chooseImgName = str;
  147. this.uploadShow = true;
  148. },
  149. changeProp(val) {
  150. if(val == true) {
  151. this.uploadShow = false;
  152. }
  153. else {
  154. this.uploadShow = true;
  155. }
  156. },
  157. sureImg(name,image,image_url) {
  158. this.form[name] = image;
  159. this.form[name+'_src'] = image_url;
  160. },
  161. clearImg(str) {
  162. this.form[str] = "";
  163. this.form[str+'_src'] = "";
  164. this.$forceUpdate();
  165. },
  166. //弹窗显示与隐藏的控制
  167. changeLink(item){
  168. this.show=item;
  169. },
  170. //当前链接的增加
  171. parHref(child,confirm){
  172. this.show=confirm;
  173. // this.form.link=child;
  174. this.form[this.chooseLink] = child;
  175. },
  176. changeprogram(item){
  177. this.pro=item;
  178. },
  179. parpro(child,confirm){
  180. this.pro=confirm;
  181. // this.form.prolink=child;
  182. this.form[this.chooseMiniLink] = child;
  183. },
  184. showLink(type,name) {
  185. if(type=="link") {
  186. this.chooseLink = name;
  187. this.show = true;
  188. }
  189. else {
  190. this.chooseMiniLink = name;
  191. this.pro = true;
  192. }
  193. },
  194. },
  195. })
  196. </script>
  197. @endsection