popup-advertisement.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template id="popup-advertisement">
  2. <div flex="main:around">
  3. <div class="general-modal-left" style="padding: 85px 35px; position: relative; background: rgba(0, 0, 0, 0.4);">
  4. <el-image style="width: 100%;height:100%;" :src="form.advertisingMap" fit="fit"></el-image>
  5. <span>关闭</span>
  6. </div>
  7. <div class="general-modal-right">
  8. <div flex="cross:center" style="margin-bottom: 20px;">
  9. <div class="label">是否开启</div>
  10. <el-switch v-model="form.value"></el-switch>
  11. </div>
  12. <div flex>
  13. <div class="label">广告图</div>
  14. <diy-img-setting :img-infos="imageUrl" def-img-count="1" :show-url="false" :suggest-site="2" suggest-size-text="建议图片宽度290,高度375。" :img-contain-style="{padding: 0}" :show-title="false" @change="addIconImg"></diy-img-setting>
  15. </div>
  16. <div flex style="margin-bottom: 20px;">
  17. <div class="label">设置链接</div>
  18. <com-pick-link @selected="selectedUrl" :default-tabs="[{name: 'mall'},{name: 'addons'}, {name: 'goods', children:['store_renov_goods']}]">
  19. <diy-url :text="form.selectUrl"></diy-url>
  20. </com-pick-link>
  21. </div>
  22. <div flex="cross:center">
  23. <div class="label">显示类型</div>
  24. <el-radio-group v-model="form.showType">
  25. <el-radio :label="1">仅首次</el-radio>
  26. <el-radio :label="2">多次</el-radio>
  27. </el-radio-group>
  28. </div>
  29. <div flex v-if="form.showType === 1">
  30. <div class="label"></div>
  31. <div class="desc">
  32. 进入商城只显示一次广告,再次进入商城不再显示,更换广告图后进入商城可再次显示
  33. </div>
  34. </div>
  35. <div flex v-else style="margin-top: 20px;">
  36. <div class="label">显示次数</div>
  37. <div class="desc">
  38. <el-input placeholder="请输入内容" v-model="form.count">
  39. <template slot="append">人/日</template>
  40. </el-input>
  41. <div style="margin-top: 10px;">
  42. 每次进入商城显示一次广告,每人每日最多显示1次,建议每人每日显示弹窗不超过3次
  43. </div>
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. </template>
  49. <script>
  50. Vue.component('popup-advertisement', {
  51. name: "popup-advertisement",
  52. template: '#popup-advertisement',
  53. props: {
  54. data: {
  55. type: Object,
  56. default () {
  57. return {}
  58. }
  59. }
  60. },
  61. data() {
  62. return {
  63. form: {
  64. value: false,
  65. selectUrl: '',
  66. linkItem: null,
  67. showType: 1,
  68. count: 1,
  69. advertisingMap: 'resources/img/decorate/default_img.png'
  70. },
  71. imageUrl: [],
  72. }
  73. },
  74. watch: {
  75. form: {
  76. handler(newVal) {
  77. // 直接监听
  78. this.$emit("change", Object.assign({}, newVal))
  79. },
  80. deep: true
  81. },
  82. data: {
  83. handler(newVal) {
  84. // 直接监听
  85. console.log(newVal, "=======> newVal");
  86. if (newVal) {
  87. this.form = newVal
  88. this.imageUrl = [{
  89. imgUrl: newVal.advertisingMap
  90. }]
  91. }
  92. },
  93. immediate: true
  94. },
  95. },
  96. methods: {
  97. // 图片
  98. addIconImg(arr) {
  99. if (arr[0]) {
  100. this.form.advertisingMap = arr[0].imgUrl || 'resources/img/decorate/default_img.png'
  101. this.$emit("change", Object.assign({}, this.form))
  102. }
  103. },
  104. selectedUrl(value) {
  105. var item = value[0]
  106. this.form.linkItem = item
  107. this.form.selectUrl = item.title
  108. }
  109. },
  110. });
  111. </script>
  112. <style>
  113. .general-modal-left {
  114. position: relative;
  115. padding: 85px 35px;
  116. width: 222px;
  117. height: 378px;
  118. border-radius: 4px;
  119. background: rgba(0, 0, 0, 0.4);
  120. }
  121. .general-modal-left span {
  122. position: absolute;
  123. right: 35px;
  124. top: 85px;
  125. color: #fff;
  126. width: 66px;
  127. height: 66px;
  128. line-height: 58px;
  129. text-align: center;
  130. font-size: 20px;
  131. transform: scale(.5);
  132. transform-origin: right top;
  133. padding-left: 12px;
  134. background: #000;
  135. border-radius: 0 8px 0 66px;
  136. }
  137. .general-modal-right {
  138. margin-left: 40px;
  139. width: 270px;
  140. }
  141. .label {
  142. min-width: 68px;
  143. text-align: right;
  144. vertical-align: middle;
  145. float: left;
  146. font-size: 12px;
  147. color: #666;
  148. padding: 10px 20px 10px 0;
  149. box-sizing: border-box;
  150. }
  151. .general-modal-right .diy-url {
  152. height: 32px;
  153. line-height: 1.5;
  154. padding: 4px 12px;
  155. }
  156. .general-modal-right .desc {
  157. color: #999;
  158. font-size: 12px;
  159. padding: 0;
  160. }
  161. .general-modal-right .el-input__inner {
  162. height: 32px;
  163. line-height: 32px;
  164. }
  165. </style>