appletslive.blade.php 45 KB

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