activity-posters.blade.php 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806
  1. @extends('layouts.base')
  2. @section('title', '基础设置')
  3. @section('content')
  4. <link rel="stylesheet" href="{{resource_get('plugins/new-poster/views/admin/index.css')}}">
  5. <link rel="stylesheet" href="{{resource_get('plugins/new-poster/views/admin/edit.css')}}">
  6. <link rel="stylesheet" href="{{static_url('css/public-number.css')}}">
  7. <style>
  8. /* 导航 */
  9. .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;}
  10. .el-radio-button__inner{border:0;}
  11. .el-radio-button:last-child .el-radio-button__inner {border-radius: 4px 4px 4px 4px;}
  12. .upload-boxed .el-icon-close {position: absolute;top: -5px;right: -5px;color: #fff;background: #333;border-radius: 50%;cursor: pointer;}
  13. .el-radio__inner { border: 1px solid #cfcfcf;}
  14. .edit-poster .el-form-item__label{width:20%!important}
  15. .edit-poster .el-form-item__content{margin-left:20%!important}
  16. </style>
  17. <div class="all">
  18. <div id="app" v-cloak>
  19. <el-form ref="form" :model="form" :rules="rules" label-width="15%">
  20. <div class="vue-head">
  21. <el-radio-group v-model="order_type">
  22. <el-radio-button label="1">海报设置</el-radio-button>
  23. </el-radio-group>
  24. </div>
  25. <div v-show="order_type==1">
  26. <div class="vue-head">
  27. <div class="vue-main-title">
  28. <div class="vue-main-title-left"></div>
  29. <div class="vue-main-title-content">基础设置</div>
  30. </div>
  31. <div class="vue-main-form">
  32. <el-form-item label="海报名称" prop="title">
  33. <el-input v-model="form.title" style="width:70%;" ref="title"></el-input>
  34. </el-form-item>
  35. <el-form-item label="是否启用" prop="status">
  36. <el-switch v-model="form.status" :active-value="1" :inactive-value="0"></el-switch>
  37. </el-form-item>
  38. </div>
  39. </div>
  40. <div class="vue-head" style="margin-top:20px">
  41. <div class="vue-main-title">
  42. <div class="vue-main-title-left"></div>
  43. <div class="vue-main-title-content">海报设计</div>
  44. </div>
  45. <div class="vue-main-form">
  46. <div style="width:85%;margin:auto;display:flex;margin-bottom:30px;">
  47. <div style="width: 320px;height: 504px;border: 1px solid #ccc;position: relative;" :style="{backgroundColor:(background_type==0?form.color:'')}">
  48. <img v-if="form.background_url&&background_type==1" :src="form.background_url" alt="" style="width:100%;height:100%;">
  49. <drag-resize
  50. v-for="(rect, index) in rects"
  51. :key="index"
  52. :w="rect.width"
  53. :h="rect.height"
  54. :x="rect.left"
  55. :y="rect.top"
  56. :axis="rect.axis"
  57. :is-active="rect.active"
  58. :minw="rect.minw"
  59. :minh="rect.minh"
  60. :is-draggable="rect.draggable"
  61. :is-resizable="rect.resizable"
  62. :parent-limitation="rect.parentLim"
  63. :aspect-ratio="rect.aspectRatio"
  64. :z="rect.zIndex"
  65. :content-class="rect.class"
  66. v-on:activated="activateEv(index)"
  67. v-on:deactivated="deactivateEv(index)"
  68. v-on:dragging="changePosition($event, index)"
  69. v-on:resizing="changeSize($event, index)"
  70. style="position: absolute;"
  71. >
  72. <!-- logo -->
  73. <img v-if="rect.type=='logo'" :src="rect.logo_type?rect.src_url:logo_url" alt="" style="width:100%;height:100%;">
  74. <!-- logo -->
  75. <!-- 头像 -->
  76. <img v-if="rect.type=='head'" :src="head_url" alt="" style="width:100%;height:100%;">
  77. <div v-if="rect.type=='nickname'"
  78. :style="{color:rect.color,fontSize:rect.size+'px'}"
  79. style="width:100%;height:100%;"
  80. >
  81. 昵称
  82. </div>
  83. <div v-if="rect.type=='invite'"
  84. :style="{color:rect.color,fontSize:rect.size+'px'}"
  85. style="width:100%;height:100%;"
  86. >
  87. A1H3U5GF
  88. </div>
  89. <div v-if="rect.type=='mid'"
  90. :style="{color:rect.color,fontSize:rect.size+'px'}"
  91. style="width:100%;height:100%;"
  92. >
  93. 8888
  94. </div>
  95. <!-- 活动二维码 -->
  96. <img v-if="rect.type=='active_qr_code'" :src="qr_url" alt="" style="width:100%;height:100%;">
  97. </drag-resize>
  98. </div>
  99. <div class="edit-poster" style="flex:1;margin-left:10%">
  100. <!-- <div>背景图片</div> -->
  101. <el-form-item label="背景" prop="background">
  102. <el-radio v-model="background_type" :label="0">颜色</el-radio>
  103. <el-radio v-model="background_type" :label="1">自定义图片</el-radio>
  104. </el-form-item>
  105. <el-form-item label="" prop="background" v-if="background_type==1">
  106. <div class="upload-box" @click="openUpload('background')" v-if="!form.background_url">
  107. <i class="el-icon-plus" style="font-size:32px"></i>
  108. </div>
  109. <div @click="openUpload('background')" class="upload-boxed" v-if="form.background_url" style="height:236.25px">
  110. <img :src="form.background_url" alt="" style="width:150px;height:236.25px;border-radius: 5px;cursor: pointer;">
  111. <i class="el-icon-close" @click.stop="clearImg('background')" title="点击清除图片"></i>
  112. <div class="upload-boxed-text">点击重新上传</div>
  113. </div>
  114. <div class="tip">建议背景图片尺寸: 640*1008</div>
  115. <div v-if="isDecorate" class="form-item_tips">建议尺寸: 640 * 640 ,或正方型图片 <span @click.stop="jumpUrl" style="color: #196dfa;font-weight: 600;margin-left: 15px;cursor:pointer;">图片智能在线设计</span><i class="el-icon-question" style="color:#196dfa;margin-left:2px;" @click="showIntroduce = true;"></i> </div>
  116. </el-form-item>
  117. <el-form-item label="" prop="" v-else>
  118. <el-color-picker v-model="form.color" style="display:inline-block"></el-color-picker>
  119. </el-form-item>
  120. <el-form-item label="海报元素" prop="" >
  121. <div style="width:500px;">
  122. <el-button size="small" @click="addEle('logo')">商城logo</el-button>
  123. <el-button size="small" @click="addEle('head')">头像</el-button>
  124. <el-button size="small" @click="addEle('nickname')">昵称</el-button>
  125. <el-button size="small" @click="addEle('invite')">邀请码</el-button>
  126. <el-button size="small" @click="addEle('mid')">会员ID</el-button><br/>
  127. <el-button size="small" @click="addEle('active_qr_code')">活动二维码</el-button>
  128. <el-button type="text" v-if="choosed_index!=-1" icon="iconfont icon-ht_operation_delete" @click="delEle" title="删除当前元素" style="color:#F56C6C"></el-button>
  129. </div>
  130. </el-form-item>
  131. <!-- logo设置项 -->
  132. <div v-if="choosed_obj.type=='logo'">
  133. <el-form-item label="商城logo" prop="background">
  134. <el-radio v-model="choosed_obj.logo_type" :label="0">默认</el-radio>
  135. <el-radio v-model="choosed_obj.logo_type" :label="1">自定义</el-radio>
  136. </el-form-item>
  137. <el-form-item label="图片设置" prop="" v-if="choosed_obj.logo_type==1">
  138. <div class="upload-box" @click="openUpload('src',2)" v-if="!choosed_obj.src_url">
  139. <i class="el-icon-plus" style="font-size:32px"></i>
  140. </div>
  141. <div @click="openUpload('src',2)" class="upload-boxed" v-if="choosed_obj.src_url" style="height:150px">
  142. <img :src="choosed_obj.src_url" alt="" style="width:150px;height:150px;border-radius: 5px;cursor: pointer;">
  143. <i class="el-icon-close" @click.stop="clearImg('src',2)" title="点击清除图片"></i>
  144. <div class="upload-boxed-text">点击重新上传</div>
  145. </div>
  146. </el-form-item>
  147. </div>
  148. <!-- 商品主图设置项 -->
  149. <!-- <div v-if="choosed_obj.type=='img'">
  150. <el-form-item label="商品主图圆角" prop="background">
  151. <el-slider v-model="choosed_obj.borderRadius" style="width:500px" show-input></el-slider>
  152. </el-form-item>
  153. </div> -->
  154. <!-- 商品名称设置项 -->
  155. <div v-if="choosed_obj.type=='title'">
  156. <el-form-item label="商品名称文字颜色" prop="banner1">
  157. <el-color-picker v-model="choosed_obj.color" style="display:inline-block"></el-color-picker>
  158. </el-form-item>
  159. <el-form-item label="商品名称文字大小" prop="banner1">
  160. <el-input v-model="choosed_obj.size" style="width:200px">
  161. <template slot="append">PX</template>
  162. </el-input>
  163. <!-- <el-button type="text" icon="iconfont icon-ht_textstyle_blod" @click="changeText('b')" title="加粗" :style="{color:choosed_obj.bold?'':'#000'}"></el-button> -->
  164. <!-- <el-button type="text" icon="iconfont icon-ht_textstyle_italic" @click="changeText('i')" title="斜体" :style="{color:choosed_obj.italic?'':'#000'}"></el-button> -->
  165. <el-button type="text" icon="iconfont icon-ht_textstyle_delete" @click="changeText('s')" title="中划线" :style="{color:choosed_obj.slide?'':'#000'}"></el-button>
  166. <!-- <el-button type="text" icon="iconfont icon-ht_textstyle_delete1" @click="changeText('u')" title="下划线" :style="{color:choosed_obj.under?'':'#000'}"></el-button> -->
  167. </el-form-item>
  168. </div>
  169. <!-- 图片设置项 -->
  170. <div v-if="choosed_obj.type=='other_img'">
  171. <el-form-item label="图片设置" prop="">
  172. <div class="upload-box" @click="openUpload('src',2)" v-if="!choosed_obj.src_url">
  173. <i class="el-icon-plus" style="font-size:32px"></i>
  174. </div>
  175. <div @click="openUpload('src',2)" class="upload-boxed" v-if="choosed_obj.src_url" style="height:150px">
  176. <img :src="choosed_obj.src_url" alt="" style="width:150px;height:150px;border-radius: 5px;cursor: pointer;">
  177. <i class="el-icon-close" @click.stop="clearImg('src',2)" title="点击清除图片"></i>
  178. <div class="upload-boxed-text">点击重新上传</div>
  179. </div>
  180. </el-form-item>
  181. </div>
  182. <!-- 会员价设置项 -->
  183. <div v-if="choosed_obj.type=='member_price'">
  184. <el-form-item label="会员价文字颜色" prop="banner1">
  185. <el-color-picker v-model="choosed_obj.color" style="display:inline-block"></el-color-picker>
  186. </el-form-item>
  187. <el-form-item label="会员价文字大小" prop="banner1">
  188. <el-input v-model="choosed_obj.size" style="width:200px">
  189. <template slot="append">PX</template>
  190. </el-input>
  191. <!-- <el-button type="text" icon="iconfont icon-ht_textstyle_blod" @click="changeText('b')" title="加粗" :style="{color:choosed_obj.bold?'':'#000'}"></el-button> -->
  192. <!-- <el-button type="text" icon="iconfont icon-ht_textstyle_italic" @click="changeText('i')" title="斜体" :style="{color:choosed_obj.italic?'':'#000'}"></el-button> -->
  193. <el-button type="text" icon="iconfont icon-ht_textstyle_delete" @click="changeText('s')" title="中划线" :style="{color:choosed_obj.slide?'':'#000'}"></el-button>
  194. <!-- <el-button type="text" icon="iconfont icon-ht_textstyle_delete1" @click="changeText('u')" title="下划线" :style="{color:choosed_obj.under?'':'#000'}"></el-button> -->
  195. </el-form-item>
  196. </div>
  197. <!-- 原价设置项 -->
  198. <div v-if="choosed_obj.type=='market_price'">
  199. <el-form-item label="原价文字颜色" prop="">
  200. <el-color-picker v-model="choosed_obj.color" style="display:inline-block"></el-color-picker>
  201. </el-form-item>
  202. <el-form-item label="原价文字大小" prop="">
  203. <el-input v-model="choosed_obj.size" style="width:200px">
  204. <template slot="append">PX</template>
  205. </el-input>
  206. <!-- <el-button type="text" icon="iconfont icon-ht_textstyle_blod" @click="changeText('b')" title="加粗" :style="{color:choosed_obj.bold?'':'#000'}"></el-button> -->
  207. <!-- <el-button type="text" icon="iconfont icon-ht_textstyle_italic" @click="changeText('i')" title="斜体" :style="{color:choosed_obj.italic?'':'#000'}"></el-button> -->
  208. <el-button type="text" icon="iconfont icon-ht_textstyle_delete" @click="changeText('s')" title="中划线" :style="{color:choosed_obj.slide?'':'#000'}"></el-button>
  209. <!-- <el-button type="text" icon="iconfont icon-ht_textstyle_delete1" @click="changeText('u')" title="下划线" :style="{color:choosed_obj.under?'':'#000'}"></el-button> -->
  210. </el-form-item>
  211. </div>
  212. <!-- 现价设置项 -->
  213. <div v-if="choosed_obj.type=='price'">
  214. <el-form-item label="现价文字颜色" prop="">
  215. <el-color-picker v-model="choosed_obj.color" style="display:inline-block"></el-color-picker>
  216. </el-form-item>
  217. <el-form-item label="现价文字大小" prop="">
  218. <el-input v-model="choosed_obj.size" style="width:200px">
  219. <template slot="append">PX</template>
  220. </el-input>
  221. <!-- <el-button type="text" icon="iconfont icon-ht_textstyle_blod" @click="changeText('b')" title="加粗" :style="{color:choosed_obj.bold?'':'#000'}"></el-button> -->
  222. <!-- <el-button type="text" icon="iconfont icon-ht_textstyle_italic" @click="changeText('i')" title="斜体" :style="{color:choosed_obj.italic?'':'#000'}"></el-button> -->
  223. <el-button type="text" icon="iconfont icon-ht_textstyle_delete" @click="changeText('s')" title="中划线" :style="{color:choosed_obj.slide?'':'#000'}"></el-button>
  224. <!-- <el-button type="text" icon="iconfont icon-ht_textstyle_delete1" @click="changeText('u')" title="下划线" :style="{color:choosed_obj.under?'':'#000'}"></el-button> -->
  225. </el-form-item>
  226. </div>
  227. <!-- 昵称、邀请码、会员ID设置项 -->
  228. <div v-if="choosed_obj.type=='nickname' || choosed_obj.type=='invite' || choosed_obj.type=='mid'">
  229. <el-form-item label="文字颜色" prop="banner1">
  230. <el-color-picker v-model="choosed_obj.color" style="display:inline-block"></el-color-picker>
  231. </el-form-item>
  232. <el-form-item label="文字大小" prop="banner1">
  233. <el-input v-model="choosed_obj.size" style="width:200px">
  234. <template slot="append">PX</template>
  235. </el-input>
  236. </el-form-item>
  237. </div>
  238. </div>
  239. </div>
  240. </div>
  241. </div>
  242. </div>
  243. </el-form>
  244. <!-- 分页 -->
  245. <div class="vue-page">
  246. <div class="vue-center">
  247. <el-button type="primary" @click="submitForm('form')">提交</el-button>
  248. <el-button @click="goBack">返回</el-button>
  249. </div>
  250. </div>
  251. <upload-img :upload-show="uploadShow" :name="chooseImgName" @replace="changeProp" @sure="sureImg"></upload-img>
  252. <pop :show="show" @replace="changeLink" @add="parHref"></pop>
  253. <program :pro="pro" @replacepro="changeprogram" @addpro="parpro"></program>
  254. <introduce v-model="showIntroduce" v-show="showIntroduce"></introduce>
  255. </div>
  256. </div>
  257. @include('public.admin.uploadImg')
  258. @include('public.admin.vueDragResize')
  259. @include('public.admin.pop')
  260. @include('public.admin.program')
  261. @include('public.admin.new-poster-introduce')
  262. <script>
  263. const CktUrl = "{!! $ckt_url !!}"; //* 创客贴url
  264. const IsDecorate = "{!! $is_decorate !!}";
  265. </script>
  266. <script>
  267. const qr_url = `{!! resource_get('plugins/new-poster/assets/img/qr.png') !!}`;
  268. const head_url = `{!! resource_get('plugins/new-poster/assets/img/head.jpg') !!}`;
  269. const thumb_url = `{!! resource_get('plugins/new-poster/assets/img/img.jpg') !!}`;
  270. const app_qr_url = `{!! resource_get('plugins/new-poster/assets/img/qr_app_share.jpg') !!}`;
  271. const qr_shop = `{!! resource_get('plugins/new-poster/assets/img/qr_shop.jpg') !!}`;
  272. const logo_url = `{!! resource_get('plugins/new-poster/assets/img/logo.png') !!}`;
  273. const goods_url = `{!! resource_get('plugins/new-poster/assets/img/goods.png') !!}`;
  274. let data = {!! json_encode($data)?:'[]' !!};
  275. let poster = {!! json_encode($poster)?:'{}' !!};
  276. let shop_credit1 = {!! json_encode($shop_credit1)?:'{}' !!};
  277. let id = 0;
  278. let supplement = {};
  279. let background_type = 1;
  280. if(data==null) {
  281. data = [];
  282. }
  283. if(poster==null) {
  284. poster = {};
  285. }
  286. else{
  287. supplement = poster.supplement;
  288. id = poster.id;
  289. background_type = poster.background?1:0;
  290. }
  291. if(shop_credit1==null) {
  292. shop_credit1 = "";
  293. }
  294. console.log(data);
  295. console.log(poster);
  296. console.log(shop_credit1);
  297. console.log(id);
  298. console.log(background_type);
  299. var app = new Vue({
  300. el:"#app",
  301. delimiters: ['[[', ']]'],
  302. name: 'test',
  303. data() {
  304. return{
  305. showIntroduce:false,
  306. id:id,
  307. poster_type:1,
  308. background_type:background_type,
  309. label_word:"",
  310. label_show:false,
  311. history_show:false,
  312. label_list:[],
  313. label_total:0,
  314. label_per_page:0,
  315. label_current_page:0,
  316. show:false,//是否开启公众号弹窗
  317. pro:false ,//是否开启小程序弹窗
  318. chooseLink:'',
  319. chooseMiniLink:'',
  320. link_type:1,
  321. coupon_word:"",
  322. coupon_show:false,
  323. coupon_list:[],
  324. coupon_total:0,
  325. coupon_per_page:0,
  326. coupon_current_page:0,
  327. coupon_type:0,
  328. rects:[],
  329. data:data,
  330. zIndex:0,//全局层次
  331. choosed_obj:{},
  332. choosed_index:-1,
  333. qr_url :qr_url,
  334. head_url :head_url,
  335. thumb_url:thumb_url,
  336. app_qr_url:app_qr_url,
  337. logo_url:logo_url,
  338. qr_shop:qr_shop,
  339. goods_url:goods_url,
  340. listWidth:"",
  341. listHeight:"",
  342. color1:'1',
  343. order_type:1,
  344. link_show:false,
  345. link_ref : "",
  346. link_type : "",
  347. link_form:{
  348. },
  349. form:{
  350. // poster
  351. title:poster.title || "",
  352. status:poster.status || 0,
  353. background:poster.background || "",
  354. background_url:poster.background_url || "",
  355. color:poster.color || "",
  356. },
  357. coupon_word1:"",
  358. coupon_word2:"",
  359. uploadShow:false,
  360. chooseImgName:'',
  361. img_type:"",
  362. submit_url:'',
  363. showVisible:false,
  364. loading: false,
  365. rules:{
  366. name:{ required: true, message: '请输入'}
  367. },
  368. isDecorate:IsDecorate,
  369. }
  370. },
  371. created() {
  372. },
  373. mounted() {
  374. if(this.id) {
  375. this.submit_url = '{!! yzWebFullUrl('plugin.new-poster.admin.poster.edit') !!}'
  376. }
  377. else {
  378. this.submit_url = '{!! yzWebFullUrl('plugin.new-poster.admin.poster.add') !!}'
  379. }
  380. this.poster_type = this.getParam('poster_type');
  381. console.log(this.poster_type)
  382. this.setPosterView(this.data);
  383. },
  384. methods: {
  385. setPosterView(data) {
  386. data.forEach((item,index) => {
  387. let width = parseInt(item.width);
  388. let height = parseInt(item.height);
  389. let top = parseInt(item.top);
  390. let left =parseInt(item.left);
  391. if(item.type=='logo') {
  392. this.rects.push(
  393. {zIndex:this.zIndex+1,type:item.type,src:item.src,src_url:item.src_url,logo_type:item.logo_type,width:width,height:width,left:left,top:top,axis:"both",active:false,minw:40,minh:40,draggable:true,resizable:true,parentLim:true,aspectRatio:true,class:""}
  394. )
  395. }
  396. else if(item.type=='head') {
  397. this.rects.push(
  398. {zIndex:this.zIndex+1,type:item.type,width:width,height:width,left:left,top:top,axis:"both",active:false,minw:40,minh:40,draggable:true,resizable:true,parentLim:true,aspectRatio:true,class:""}
  399. )
  400. }
  401. else if(item.type=='invite') {
  402. let size = parseInt(item.size);
  403. this.rects.push(
  404. {zIndex:this.zIndex+1,type:item.type,color:item.color,size:size,width:width,height:height,left:left,top:top,axis:"both",active:false,minw:100,minh:20,draggable:true,resizable:true,parentLim:false,aspectRatio:false,class:""}
  405. )
  406. }
  407. else if(item.type=='mid') {
  408. let size = Number(item.size.split('p')[0]);
  409. this.rects.push(
  410. {zIndex:this.zIndex+1,type:item.type,color:item.color,size:size,width:width,height:height,left:left,top:top,axis:"both",active:false,minw:40,minh:40,draggable:true,resizable:true,parentLim:true,aspectRatio:false,class:""}
  411. )
  412. }
  413. else if(item.type=="nickname") {
  414. let size = Number(item.size.split('p')[0]);
  415. this.rects.push(
  416. {zIndex:this.zIndex+1,type:item.type,color:item.color,size:size,width:width,height:height,left:left,top:top,axis:"both",active:false,minw:40,minh:40,draggable:true,resizable:true,parentLim:true,aspectRatio:false,class:""}
  417. )
  418. }
  419. else if(item.type=="active_qr_code"){
  420. this.rects.push(
  421. {zIndex:this.zIndex+1,type:item.type,width:width,height:height,left:left,top:top,axis:"both",active:false,minw:40,minh:40,draggable:true,resizable:true,parentLim:true,aspectRatio:true,class:""}
  422. )
  423. }
  424. this.zIndex++;
  425. })
  426. },
  427. submitForm(formName) {
  428. console.log(this.form)
  429. console.log(this.rects)
  430. let that = this;
  431. let json = {
  432. poster:{
  433. poster_type:this.poster_type,
  434. title:this.form.title,
  435. status:this.form.status,
  436. background:this.form.background,
  437. background_url:this.form.background_url,
  438. color:this.form.color,
  439. },
  440. poster_supplement:{
  441. },
  442. data:[],
  443. };
  444. // 背景类型
  445. if(this.background_type==1) {
  446. json.poster.color = "";
  447. }
  448. else {
  449. json.poster.background = "";
  450. json.poster.background_url = "";
  451. }
  452. this.rects.forEach((item,index) => {
  453. if(item.type=="logo") {
  454. json.data.push({src:item.src,src_url:item.src_url,logo_type:item.logo_type,width:item.width+'px',height:item.height+'px',top:item.top+'px',left:item.left+'px',type:item.type,})
  455. }
  456. else if(item.type=='nickname') {
  457. json.data.push({width:item.width+'px',height:item.height+'px',top:item.top+'px',left:item.left+'px',type:item.type,size:item.size+'px',color:item.color})
  458. }
  459. else if(item.type=='invite') {
  460. json.data.push({width:item.width+'px',height:item.height+'px',top:item.top+'px',left:item.left+'px',type:item.type,size:item.size+'px',color:item.color})
  461. }
  462. else if(item.type=='mid') {
  463. json.data.push({width:item.width+'px',height:item.height+'px',top:item.top+'px',left:item.left+'px',type:item.type,size:item.size+'px',color:item.color})
  464. }
  465. else if(item.type=='head') {
  466. json.data.push({width:item.width+'px',height:item.height+'px',top:item.top+'px',left:item.left+'px',type:item.type})
  467. }
  468. else if(item.type=="active_qr_code"){
  469. json.data.push({width:item.width+'px',height:item.height+'px',top:item.top+'px',left:item.left+'px',type:item.type})
  470. }
  471. });
  472. let json1 = {
  473. form_data : json,
  474. }
  475. if(this.id) {
  476. json1.id = this.id
  477. }
  478. this.$refs[formName].validate((valid) => {
  479. if (valid) {
  480. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  481. this.$http.post(this.submit_url, json1).then(response => {
  482. if (response.data.result) {
  483. this.$message({type: 'success',message: '操作成功!'});
  484. this.goBack();
  485. } else {
  486. this.$message({message: response.data.msg,type: 'error'});
  487. }
  488. loading.close();
  489. },response => {
  490. loading.close();
  491. });
  492. }
  493. else {
  494. console.log('error submit!!');
  495. return false;
  496. }
  497. });
  498. },
  499. goBack() {
  500. history.go(-1)
  501. },
  502. openUpload(str,img_type) {
  503. this.chooseImgName = str;
  504. this.uploadShow = true;
  505. this.img_type = img_type;
  506. },
  507. changeProp(val) {
  508. if(val == true) {
  509. this.uploadShow = false;
  510. }
  511. else {
  512. this.uploadShow = true;
  513. }
  514. },
  515. sureImg(name,image,image_url) {
  516. if(this.img_type) {
  517. this.rects[this.choosed_index][name] = image;
  518. this.rects[this.choosed_index][name+'_url'] = image_url;
  519. this.choosed_obj[name] = image;
  520. this.choosed_obj[name+'_url'] = image_url;
  521. this.$forceUpdate();
  522. }
  523. else {
  524. this.form[name] = image;
  525. this.form[name+'_url'] = image_url;
  526. }
  527. console.log(this.rects)
  528. },
  529. clearImg(str,type) {
  530. if(type) {
  531. this.rects[this.choosed_index][str] = "";
  532. this.rects[this.choosed_index][str+'_url'] = "";
  533. this.choosed_obj[str] = "";
  534. this.choosed_obj[str+'_url'] = "";
  535. }
  536. else {
  537. this.form[str] = "";
  538. this.form[str+'_url'] = "";
  539. }
  540. this.$forceUpdate();
  541. },
  542. openCoupon(type) {
  543. this.coupon_type = type;
  544. this.coupon_show = true;
  545. },
  546. searchCoupon() {
  547. this.$http.post('{!! yzWebFullUrl('plugin.new-poster.admin.poster.getCouponByWord') !!}',{coupon_kwd:this.coupon_word}).then(response => {
  548. if (response.data.result) {
  549. this.coupon_list = response.data.data.list.data;
  550. this.coupon_total = response.data.data.list.total;
  551. this.coupon_per_page = response.data.data.list.per_page;
  552. this.coupon_current_page = response.data.data.list.current_page;
  553. } else {
  554. this.$message({message: response.data.msg,type: 'error'});
  555. }
  556. },response => {
  557. });
  558. },
  559. chooseCoupon(row) {
  560. if(this.coupon_type==1) {
  561. this.form.recommender_coupon_id = row.id;
  562. this.form.recommender_coupon_name = row.name;
  563. this.coupon_word1 = `【ID:】`+this.form.recommender_coupon_id+``+this.form.recommender_coupon_name;
  564. }
  565. else if(this.coupon_type==2) {
  566. this.form.subscriber_coupon_id = row.id;
  567. this.form.subscriber_coupon_name = row.name;
  568. this.coupon_word2 = `【ID:】`+this.form.subscriber_coupon_id+``+this.form.subscriber_coupon_name;
  569. }
  570. this.coupon_show = false;
  571. console.log(this.form)
  572. },
  573. clearCoupon(type) {
  574. if(type==1) {
  575. this.form.recommender_coupon_id = "";
  576. this.form.recommender_coupon_name = "";
  577. this.coupon_word1 = "";
  578. }
  579. else if(type==2) {
  580. this.form.subscriber_coupon_id = "";
  581. this.form.subscriber_coupon_name = "";
  582. this.coupon_word2 = "";
  583. }
  584. },
  585. addEle(type) {
  586. let is_true = false;
  587. let choose_index = -1;
  588. this.rects.some((item,index) => {
  589. if(item.type == type) {
  590. is_true = true;
  591. choose_index = index
  592. return true
  593. }
  594. })
  595. if(is_true) {
  596. this.rects[choose_index].active = true;
  597. return false;
  598. }
  599. if(type=="logo") {
  600. this.rects.push(
  601. {zIndex:this.zIndex+1,type:type,src:"",src_url:"",logo_type:0,width:100,height:100,left:0,top:0,axis:"both",active:false,minw:40,minh:40,draggable:true,resizable:true,parentLim:true,aspectRatio:false,class:""}
  602. )
  603. }
  604. if(type=="nickname") {
  605. this.rects.push(
  606. {zIndex:this.zIndex+1,type:type,color:"#f00",size:20,width:130,height:30,left:0,top:0,axis:"both",active:false,minw:40,minh:40,draggable:true,resizable:true,parentLim:true,aspectRatio:false,class:""}
  607. )
  608. }
  609. if(type=="invite") {
  610. this.rects.push(
  611. {zIndex:this.zIndex+1,type:type,color:"#f00",size:20,width:110,height:30,left:0,top:0,axis:"both",active:false,minw:100,minh:22,draggable:true,resizable:true,parentLim:true,aspectRatio:false,class:""}
  612. )
  613. }
  614. if(type=="mid") {
  615. this.rects.push(
  616. {zIndex:this.zIndex+1,type:type,color:"#f00",size:20,width:54,height:30,left:0,top:0,axis:"both",active:false,minw:40,minh:40,draggable:true,resizable:true,parentLim:true,aspectRatio:false,class:""}
  617. )
  618. }
  619. if(type=="head") {
  620. this.rects.push(
  621. {zIndex:this.zIndex+1,type:type,width:100,height:100,left:0,top:0,axis:"both",active:false,minw:40,minh:40,draggable:true,resizable:true,parentLim:true,aspectRatio:true,class:""}
  622. )
  623. }
  624. if(type=="active_qr_code"){
  625. this.rects.push(
  626. {zIndex:this.zIndex+1,type:type,width:100,height:100,left:0,top:0,axis:"both",active:false,minw:40,minh:40,draggable:true,resizable:true,parentLim:true,aspectRatio:true,class:""}
  627. )
  628. }
  629. this.zIndex++;
  630. console.log(this.rects)
  631. },
  632. delEle() {
  633. console.log(this.rects);
  634. let list = JSON.parse(JSON.stringify(this.rects));
  635. list.splice(this.choosed_index,1);
  636. console.log(list);
  637. this.rects = [];
  638. // 样式处理
  639. setTimeout(() => {
  640. list.forEach((item,index) => {
  641. this.rects.push(item)
  642. })
  643. },10)
  644. this.choosed_obj = {};
  645. console.log(this.rects);
  646. this.choosed_index = -1;
  647. },
  648. activateEv(index) {
  649. console.log(index);
  650. if(this.choosed_index!=-1) {
  651. this.rects[this.choosed_index].active = false;
  652. }
  653. this.choosed_obj = this.rects[index];
  654. this.choosed_index = index;
  655. this.rects[index].active = true;
  656. },
  657. deactivateEv(index) {
  658. console.log(index)
  659. // this.rects[index].active = false;
  660. // this.choosed_index!=-1;
  661. },
  662. changePosition(newRect, index) {
  663. this.rects[index].top = newRect.top;
  664. this.rects[index].left = newRect.left;
  665. this.rects[index].width = newRect.width;
  666. this.rects[index].height = newRect.height;
  667. },
  668. changeSize(newRect, index) {
  669. this.rects[index].top = newRect.top;
  670. this.rects[index].left = newRect.left;
  671. this.rects[index].width = newRect.width;
  672. this.rects[index].height = newRect.height;
  673. },
  674. showLink(type,name,link_type) {
  675. if(type=="link") {
  676. this.chooseLink = name;
  677. this.show = true;
  678. }
  679. else {
  680. this.chooseMiniLink = name;
  681. this.pro = true;
  682. }
  683. this.link_type = link_type;
  684. },
  685. changeProp(val) {
  686. if(val == true) {
  687. this.uploadShow = false;
  688. }
  689. else {
  690. this.uploadShow = true;
  691. }
  692. },
  693. //弹窗显示与隐藏的控制
  694. changeLink(item){
  695. this.show=item;
  696. },
  697. //当前链接的增加
  698. parHref(child,confirm){
  699. this.show=confirm;
  700. // this.form.link=child;
  701. if(this.link_type!=5) {
  702. this.form[this.chooseLink] = child;
  703. }
  704. else {
  705. this.rects[this.choosed_index]['h5_link'] = child;
  706. this.$forceUpdate();
  707. }
  708. },
  709. changeprogram(item){
  710. this.pro=item;
  711. },
  712. parpro(child,confirm){
  713. this.pro=confirm;
  714. // this.form.prolink=child;
  715. if(this.link_type!=2) {
  716. this.form[this.chooseMiniLink] = child;
  717. }
  718. else {
  719. this.rects[this.choosed_index]['mini_link'] = child;
  720. this.$forceUpdate();
  721. }
  722. },
  723. changeText(type) {
  724. if(type=='b') {
  725. this.choosed_obj.bold = this.choosed_obj.bold==1?0:1;
  726. this.rects[this.choosed_index].bold = this.choosed_obj.bold;
  727. }
  728. if(type=='i') {
  729. this.choosed_obj.italic = this.choosed_obj.italic==1?0:1;
  730. this.rects[this.choosed_index].italic = this.choosed_obj.italic;
  731. }
  732. if(type=='s') {
  733. this.choosed_obj.slide = this.choosed_obj.slide==1?0:1;
  734. this.rects[this.choosed_index].slide = this.choosed_obj.slide;
  735. if(this.rects[this.choosed_index].slide) {
  736. this.rects[this.choosed_index].under = 0;
  737. }
  738. }
  739. if(type=='u') {
  740. this.choosed_obj.under = this.choosed_obj.under==1?0:1;
  741. this.rects[this.choosed_index].under = this.choosed_obj.under;
  742. if(this.rects[this.choosed_index].under) {
  743. this.rects[this.choosed_index].slide = 0;
  744. }
  745. }
  746. },
  747. getParam(name) {
  748. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
  749. var r = window.location.search.substr(1).match(reg);
  750. if (r != null) return unescape(r[2]);
  751. return null;
  752. },
  753. jumpUrl() {
  754. window.open(CktUrl);
  755. },
  756. },
  757. })
  758. </script>
  759. @endsection