poster.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <!-- 加载字体库 -->
  2. <el-card shadow='never' style="background: transparent;padding:0;border:0">
  3. <div style="min-width: 1200px;">
  4. <div class="main_box flex">
  5. <div class="main_img_box">
  6. <img class="main_img" src="resources/img/mall/decorate/duihuakuangSmall.png" alt="">
  7. <div class="main_content">
  8. <img class="main_content_img" :src="ruleForm.basic.poster.bg_pic.url" v-if='ruleForm.basic.poster.bg_pic.url' alt="">
  9. <div v-else class="default_tips">暂时未设置海报背景</div>
  10. <!-- 自定义海报内容插件 -->
  11. <img class="diy_avatar" src="resources/img/mall/decorate/code.jpg" v-if='selectBool(3)' :style="{width:ruleForm.basic.poster.qr_code.size+'px',top:ruleForm.basic.poster.qr_code.top+'px',left:ruleForm.basic.poster.qr_code.left+'px'}">
  12. </div>
  13. </div>
  14. <div class="edit_box">
  15. <com-attachment v-model="ruleForm.basic.poster.bg_pic.url" :multiple="false" :max="1">
  16. <el-tooltip class="item" effect="dark" content="建议尺寸:750 * 1334" placement="top">
  17. <el-button size="mini">更换海报背景</el-button>
  18. </el-tooltip>
  19. </com-attachment>
  20. <div class="btn_list_box flex">
  21. <div class="btn_list" @click.stop='selectItem(3)' class="{btn_active:select_index == 3}">
  22. <i class="iconfont icon-a-31erweima btn_icon" :class="{btn_icon_close_active:select_index == 3}"></i>
  23. <i class="el-icon-close btn_icon_close" @click.stop='deleteSelect(3)' v-if='selectBool(3)' :class="{btn_icon_close_active:select_index == 3}"></i>
  24. </div>
  25. </div>
  26. <div class="set_box">
  27. <!-- 二维码设置 -->
  28. <div class="set_avatar" v-if="select_index == 3">
  29. <div class="set_title">二维码设置</div>
  30. <div style="padding-left: 16px;width:500px">
  31. <!-- <div class="flex flex-y-center" style="margin-bottom: 4px;">-->
  32. <!-- <span class="slider_title">样式</span>-->
  33. <!-- <el-radio v-model="sendData.share.qr_code.type" :label="1">圆形</el-radio>-->
  34. <!-- <el-radio v-model="sendData.share.qr_code.type" :label="2">方形</el-radio>-->
  35. <!-- </div>-->
  36. <div class="flex flex-y-center">
  37. <span class="slider_title">大小</span>
  38. <el-slider v-model="ruleForm.basic.poster.qr_code.size" @input="attarController($event,'codeSize')" :min="80" :max='400' style="flex: 1;" show-input :show-input-controls='false'></el-slider>
  39. </div>
  40. <div class="flex flex-y-center">
  41. <span class="slider_title">上间距</span>
  42. <el-slider v-model="ruleForm.basic.poster.qr_code.top" :max="avatar_max_top" style="flex: 1;" show-input :show-input-controls='false'></el-slider>
  43. </div>
  44. <div class="flex flex-y-center">
  45. <span class="slider_title">左间距</span>
  46. <el-slider v-model="ruleForm.basic.poster.qr_code.left" :max='avatar_max_left' style="flex: 1;" show-input :show-input-controls='false'></el-slider>
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. </el-card>
  55. <!-- <script>
  56. new Vue({
  57. el: '#app',
  58. data() {
  59. return {
  60. activeIndex: '1',
  61. activeName: '1',
  62. select_index: 0,
  63. select_arr: [], //选择了那些属性
  64. addImgLoad: false, //是否在上传图片
  65. options: [],
  66. color1: '#000000',
  67. posterLoading: false,
  68. sendData: {
  69. share: {
  70. bg_pic: {
  71. url: '',
  72. is_show: 0
  73. },
  74. qr_code: {
  75. is_show: 0,
  76. size: 80,
  77. top: 0,
  78. left: 0,
  79. type: 1,
  80. file_type: 'image',
  81. },
  82. },
  83. },
  84. params: {},
  85. fields: {
  86. upload_type: 'images'
  87. },
  88. avatar_max_top: 1285,
  89. avatar_max_left: 610,
  90. id: '',
  91. }
  92. },
  93. methods: {
  94. getPosterDetail() {
  95. this.posterLoading = true;
  96. this.$request({
  97. params: {
  98. r: 'mall/poster/edit',
  99. id: this.id
  100. },
  101. method: 'get',
  102. }).then(e => {
  103. this.posterLoading = false;
  104. if (e.data.code == 0) {
  105. this.sendData.name = e.data.data.name;
  106. this.sendData.key_word = e.data.data.key_word;
  107. this.sendData.share.bg_pic = e.data.data.poster_content.bg_pic;
  108. this.sendData.share.frame = e.data.data.poster_content.frame;
  109. this.sendData.share.qr_code = e.data.data.poster_content.qr_code;
  110. if (e.data.data.poster_content.name) {
  111. this.sendData.share.name = e.data.data.poster_content.name;
  112. e.data.data.poster_content.name.font = e.data.data.poster_content.name.font * 1;
  113. if (this.sendData.share.name.is_show == 1) {
  114. this.select_arr.push(2);
  115. }
  116. }
  117. if (e.data.data.poster_content.memberid) {
  118. this.sendData.share.memberid = e.data.data.poster_content.memberid;
  119. e.data.data.poster_content.memberid.font = e.data.data.poster_content.memberid.font * 1;
  120. if (this.sendData.share.memberid.is_show == 1) {
  121. this.select_arr.push(4);
  122. }
  123. }
  124. if (e.data.data.poster_content.head) {
  125. this.sendData.share.head = e.data.data.poster_content.head;
  126. if (this.sendData.share.head.is_show == 1) {
  127. this.select_arr.push(1);
  128. }
  129. }
  130. if (this.sendData.share.qr_code.is_show == 1) {
  131. this.select_arr.push(3);
  132. }
  133. } else {
  134. this.$message.error(e.data.msg);
  135. }
  136. });
  137. },
  138. savePoster() {
  139. // if (this.sendData.share.bg_pic.url == '') {
  140. // this.$message.error('请添加海报背景');
  141. // return;
  142. // }
  143. // if (this.sendData.share.bg_pic.url) {
  144. // this.sendData.share.bg_pic.is_show = 1;
  145. // } else {
  146. // this.sendData.share.bg_pic.is_show = 0;
  147. // }
  148. // this.select_arr.forEach((item, index) => {
  149. // if (item == 1) {
  150. // this.sendData.share.head.is_show = 1;
  151. // } else if (item == 2) {
  152. // this.sendData.share.name.is_show = 1;
  153. // } else if (item == 3) {
  154. // this.sendData.share.qr_code.is_show = 1;
  155. // } else if (item == 4) {
  156. // this.sendData.share.memberid.is_show = 1;
  157. // }
  158. // })
  159. // if (!this.sendData.share.qr_code.is_show) {
  160. // this.$message.error('请添加二维码');
  161. // return;
  162. // }
  163. // 计算百分比
  164. // let share = this.sendData.share;
  165. // for (let key in share) {
  166. // if (key == 'bg_pic') {
  167. // let img = document.getElementsByClassName("main_content_img");
  168. // this.sendData.share[key].width = img[0].width;
  169. // this.sendData.share[key].height = img[0].height;
  170. // } else {
  171. // this.sendData.share[key].top_ratio = Math.floor(share[key].top / share[key].max_top * 100) / 100;
  172. // this.sendData.share[key].left_ratio = Math.floor(share[key].left / share[key].max_left * 100) / 100;
  173. // }
  174. // }
  175. // this.sendData.share.frame = {
  176. // width: 750,
  177. // height: 1334
  178. // };
  179. var obj = {
  180. poster_content: {
  181. share: ''
  182. },
  183. name: '',
  184. key_word: '',
  185. id: this.id
  186. };
  187. obj.poster_content.share = this.sendData.share;
  188. obj.name = this.sendData.name;
  189. obj.key_word = this.sendData.key_word;
  190. obj.share_url = this.sendData.share.bg_pic.url;
  191. this.posterLoading = true;
  192. this.select_arr.forEach((item, index) => {
  193. if (this.select_arr.indexOf(1) == -1) {
  194. delete obj.poster_content.share.head
  195. }
  196. if (this.select_arr.indexOf(2) == -1) {
  197. delete obj.poster_content.share.name
  198. }
  199. })
  200. this.$request({
  201. params: {
  202. r: 'mall/poster/edit',
  203. },
  204. method: 'post',
  205. data: obj
  206. }).then(e => {
  207. this.posterLoading = false;
  208. if (e.data.code == 0) {
  209. this.$message({
  210. message: '保存成功!',
  211. type: 'success'
  212. });
  213. setTimeout(() => {
  214. this.$navigate({
  215. r: 'mall/poster/index'
  216. })
  217. }, 1000)
  218. } else {
  219. this.$message.error(e.data.msg);
  220. }
  221. });
  222. },
  223. }
  224. })
  225. </script> -->