chatgroup.blade.php 49 KB

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