jufubao-base 1.0.217 → 1.0.218-beta10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,284 @@
1
+ <template>
2
+ <view
3
+ class="jfb-base-notice-dialog"
4
+ @click="handleEditxSelect"
5
+ :class="{ editx: isEditx && active }"
6
+ >
7
+ <!--#ifdef H5-->
8
+ <view
9
+ class="jfb-base-notice-dialog__edit"
10
+ :class="{ editx: isEditx && active }"
11
+ v-if="isEditx && active"
12
+ >
13
+ <view class="jfb-base-notice-dialog__edit-icon" @click="delEdit"
14
+ >删除</view
15
+ >
16
+ </view>
17
+ <!-- #endif -->
18
+ <view class="jfb-base-notice-dialog__body">
19
+ <view v-if="isShow && contentList && contentList.length" class="jfb-base-notice-dialog__body_dialog">
20
+ <view
21
+ class="jfb-base-notice-dialog__body_dialog_mask"
22
+ @click.stop="handleMaskHide"
23
+ ></view>
24
+ <view class="jfb-base-notice-dialog__body_dialog_content">
25
+ <xd-font-icon
26
+ @click.stop="handleClose"
27
+ v-if="close_position === 'right'"
28
+ class="close-top"
29
+ icon="iconguanbi_xian"
30
+ color="#fff"
31
+ size="64"
32
+ ></xd-font-icon>
33
+ <image
34
+ @click="handleToLink"
35
+ mode="widthFix"
36
+ :src="currentImage"
37
+ ></image>
38
+ <xd-font-icon
39
+ @click.stop="handleClose"
40
+ v-if="close_position === 'bottom'"
41
+ class="close-bottom"
42
+ icon="iconguanbi_xian"
43
+ color="#fff"
44
+ size="64"
45
+ ></xd-font-icon>
46
+ </view>
47
+ </view>
48
+ <view
49
+ :style="{ background: backgroundColor, color: warningColor }"
50
+ class="jfb-base-notice-dialog__body-pop"
51
+ v-if="isPreview"
52
+ >弹框方便编辑(占位),在线上此模块不显</view
53
+ >
54
+ </view>
55
+ </view>
56
+ </template>
57
+
58
+ <script>
59
+ import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
60
+ import { jfbRootExec } from "@/utils/xd.event";
61
+ import JfbBaseNoticeDialogMixin from "./JfbBaseNoticeDialogMixin";
62
+ import { getContainerPropsValue } from "@/utils/xd.base";
63
+ import componentsMixins from "@/mixins/componentsMixins";
64
+ import extsMixins from "@/mixins/extsMixins";
65
+ import getServiceUrl from "@/common/getServiceUrl";
66
+ import storage from "@/common/storage";
67
+ const Color = require("color");
68
+ export default {
69
+ name: "JfbBaseNoticeDialog",
70
+ components: {
71
+ XdFontIcon,
72
+ },
73
+ mixins: [componentsMixins, extsMixins, JfbBaseNoticeDialogMixin],
74
+ data() {
75
+ return {
76
+ isShow: true,
77
+ backgroundColor: "",
78
+ isPreview: false, //是否预览
79
+ is_hide_dailog: "N",
80
+ time: 3, //小时
81
+ close_position: "",
82
+ type: "",
83
+ currentImage: "",
84
+ currentLinkUrl: "",
85
+ currentIndex: 0,
86
+ contentList: [],
87
+ number: ''
88
+ };
89
+ },
90
+ watch: {
91
+ container(value, oldValue) {
92
+ if (JSON.stringify(value) === JSON.stringify(oldValue)) return;
93
+ if (this.$configProject["isPreview"]) this.init(value);
94
+ },
95
+ is_hide_dailog(value) {
96
+ if (value === "N") {
97
+ storage.remove(this.containerId);
98
+ }
99
+ this.onJfbLoad();
100
+ },
101
+ },
102
+ created() {
103
+ this.isPreview = this.$configProject.isPreview;
104
+ this.backgroundColor = Color(this.warningColor).alpha(0.2).toString();
105
+ this.init(this.container);
106
+
107
+ //todo
108
+ },
109
+ methods: {
110
+ onJfbLoad(options) {
111
+ //预览模式
112
+ if (this.isPreview) {
113
+ if (this.is_hide_dailog === "N") {
114
+ this.getContent();
115
+ } else {
116
+ this.isShow = false;
117
+ }
118
+ return;
119
+ } else {
120
+ if (!storage.get(this.containerId)) this.getContent();
121
+ }
122
+ },
123
+ getContent() {
124
+ jfbRootExec("getListNoticeDialogContent", {
125
+ vm: this,
126
+ data: {
127
+ page_id: this.pageAttr["page_id"], //页面ID
128
+ container_id: this.containerId, //组件ID
129
+ page_size: this.number, //数量
130
+ },
131
+ })
132
+ .then((res) => {
133
+ console.log(res.list, "res.list");
134
+
135
+ //弹窗显示
136
+ if (res.list.length > 0) {
137
+ this.contentList = res.list.map((item) => {
138
+ return JSON.parse(item.content);
139
+ });
140
+ this.currentImage = getServiceUrl(
141
+ this.contentList[0].image_url,
142
+ "size3"
143
+ );
144
+ this.currentLinkUrl = this.getLinkUrl(
145
+ this.contentList[0].redirect_data
146
+ );
147
+ this.currentIndex = 0;
148
+
149
+ this.handlePop();
150
+ }
151
+ })
152
+ .catch((error) => {
153
+ console.error(error);
154
+ });
155
+ },
156
+ getLinkUrl(data) {
157
+ data = JSON.parse(data);
158
+ return `${data.page}?${data.redirect_params}`;
159
+ },
160
+ /**
161
+ * @description 监听事件变化
162
+ * @param container {object} 业务组件对象自己
163
+ */
164
+ init(container) {
165
+ this.time = Number(getContainerPropsValue(container, "content.time", 3));
166
+ this.is_hide_dailog = getContainerPropsValue(
167
+ container,
168
+ "content.is_hide_dailog",
169
+ "N"
170
+ );
171
+ this.close_position = getContainerPropsValue(
172
+ container,
173
+ "content.close_position",
174
+ "right"
175
+ );
176
+ this.type = getContainerPropsValue(container, "content.type", "pop");
177
+ this.number = getContainerPropsValue(container, "content.number", 1);
178
+ },
179
+ handlePop() {
180
+ console.warn(`this.time${this.time * 60 + "分钟"}`);
181
+ storage.set(this.containerId, 1, this.time);
182
+ this.isShow = true;
183
+ },
184
+ handleMaskHide() {
185
+ if (this.isPreview) return;
186
+ this.isShow = false;
187
+ },
188
+ handleClose() {
189
+ //切换下一张,没有下一张,关闭
190
+ if (this.currentIndex === this.contentList.length - 1) {
191
+ this.isShow = false;
192
+ return;
193
+ }
194
+ this.currentIndex = this.currentIndex + 1;
195
+ this.currentLinkUrl = this.getLinkUrl(
196
+ this.contentList[this.currentIndex].redirect_data
197
+ );
198
+ this.currentImage = getServiceUrl(
199
+ this.contentList[this.currentIndex].image_url,
200
+ "size3"
201
+ );
202
+ },
203
+ handleToLink() {
204
+ if (this.isPreview) return;
205
+ this.$xdUniHelper.navigateTo({
206
+ url: this.currentLinkUrl,
207
+ });
208
+ },
209
+ onJfbScroll(options) {
210
+ console.log("event.onJfbScroll", options);
211
+ },
212
+ onJfbReachBottom(options) {
213
+ console.log("event.onJfbReachBottom", options);
214
+ },
215
+ onJfbShow(options) {
216
+ console.log("event.onJfbShow", options);
217
+ },
218
+ onJfbHide(options) {
219
+ console.log("event.onJfbHide", options);
220
+ },
221
+ onJfbBack(options) {
222
+ console.log("event.onJfbBack", options);
223
+ },
224
+ onJfbUpdate(...data) {
225
+ console.log("event.onJfbUpdate", data);
226
+ },
227
+ onJfbCustomEvent(options) {
228
+ console.log("event.onJfbReachBottom", options);
229
+ },
230
+ },
231
+ };
232
+ </script>
233
+
234
+ <style scoped lang="less">
235
+ @import "./JfbBaseNoticeDialogLess.less";
236
+
237
+ .jfb-base-notice-dialog {
238
+ &__body {
239
+ &-pop {
240
+ min-height: 100rpx;
241
+ text-align: center;
242
+ vertical-align: middle;
243
+ color: #666;
244
+ font-size: unit(24, rpx);
245
+ line-height: 100rpx;
246
+ }
247
+ &_dialog {
248
+ position: fixed;
249
+ top: 0;
250
+ left: 0;
251
+ bottom: 0;
252
+ right: 0;
253
+ z-index: 3000;
254
+ &_mask {
255
+ position: absolute;
256
+ top: 0;
257
+ bottom: 0;
258
+ left: 0;
259
+ right: 0;
260
+ background: rgba(0, 0, 0, 0.6);
261
+ }
262
+ &_content {
263
+ position: absolute;
264
+ top: 50%;
265
+ left: 50%;
266
+ transform: translate(-50%, -50%);
267
+ display: flex;
268
+ flex-direction: column;
269
+ & > image {
270
+ width: 730rpx;
271
+ }
272
+ .close-top {
273
+ position: relative;
274
+ right: -40%;
275
+ margin-bottom: 20rpx;
276
+ }
277
+ .close-bottom {
278
+ margin-top: 68rpx;
279
+ }
280
+ }
281
+ }
282
+ }
283
+ }
284
+ </style>
@@ -0,0 +1,79 @@
1
+ /**
2
+ * @desc 获取绝对路径完整地址
3
+ * @param @path
4
+ **/
5
+ //例如:https://image.jufubao.cn/20220501010108/image/bg/default_gonghui_bg.png
6
+ @basePath: 'business/';
7
+ @doMain: '//sandbox-img.jufubao.cn/';
8
+
9
+ .getBusinessImageUrl(@path, @size: 'size8') {
10
+ @url: "@{doMain}@{basePath}@{path}?x-oss-process=style/@{size}";
11
+ background-image: url(@url);
12
+ }
13
+
14
+ //start
15
+ .jfb-base-notice-dialog {
16
+ box-sizing: border-box;
17
+
18
+ &__body{
19
+ position: relative;
20
+ overflow: hidden;
21
+ z-index: 2
22
+ }
23
+
24
+ &.editx,&.editx:hover {
25
+ position: relative;
26
+ min-height: unit(100, rpx);
27
+ z-index: 3;
28
+ &::after {
29
+ border: 2rpx dashed blue;
30
+ content: " ";
31
+ position: absolute;
32
+ top:0;
33
+ left:0;
34
+ bottom:0;
35
+ right:0;
36
+ z-index: 4;
37
+ cursor: pointer;
38
+ }
39
+
40
+ }
41
+
42
+
43
+ &__edit {
44
+ cursor: pointer;
45
+ position: absolute;
46
+ right: unit(0, rpx);
47
+ top: unit(-52, rpx);
48
+ height: unit(50, rpx);
49
+ line-height: unit(50, rpx);
50
+ display: flex;
51
+ justify-content: center;
52
+ align-items: center;
53
+ background: rgba(0, 0, 0, .6);
54
+ border-radius: unit(10, rpx);
55
+ box-shadow: 0 0 10px rbga(0, 0, 0, 0.3);
56
+ color: #fff;
57
+ font-size: unit(22, rpx);
58
+
59
+ &-icon{
60
+ padding: 0 unit(20, rpx);
61
+ }
62
+
63
+ &.editx {
64
+ box-sizing: border-box;
65
+
66
+ }
67
+ }
68
+ }
69
+ //end
70
+
71
+
72
+ /**notPreview**/
73
+ .jfb-base-notice-dialog {
74
+ //&:before {
75
+ //content: " ";
76
+ //display: table;
77
+ //}
78
+ }
79
+ /**endNotPreview**/
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+
4
+ //@AttrImport
5
+ import Attr from "./Attr";
6
+ //@EndAttrImport
7
+
8
+
9
+ export default {
10
+ data() {
11
+ return {
12
+ //#ifdef H5
13
+
14
+ //@AttrData
15
+ Attr:{}, //对外开发编辑属性
16
+ //@EndAttrData
17
+
18
+ // #endif
19
+ cssRoot: 'jfb-base-notice-dialog'
20
+ }
21
+ },
22
+ created() {
23
+
24
+ //@AttrDataCreated
25
+ this.Attr = this.$xdUniHelper.customClone(Attr);
26
+ //@EndAttrDataCreated
27
+
28
+
29
+ },
30
+ }
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+
5
+ }
@@ -336,6 +336,29 @@ export default {
336
336
  ],
337
337
  hidden: data.previewCurrent !== 'card'
338
338
  },
339
+ {
340
+ label: "无票券时是否展示购买新卡入口:",
341
+ ele: "xd-radio",
342
+ valueKey: "isShowBuy",
343
+ value: data.isShowBuy || "N",
344
+ list: [
345
+ { label: "展示", value: "Y" },
346
+ { label: "隐藏", value: "N" }
347
+ ],
348
+ groupKey: "content",
349
+ },
350
+ {
351
+ label: '购买新卡文案:',
352
+ ele: 'el-input',
353
+ type: 'text',
354
+ valueKey: 'buy_name',
355
+ groupKey:'content',
356
+ value: data.buy_name || '',
357
+ placeholder: '请输入购买新卡文案',
358
+ className: 'input80',
359
+ inline: false,
360
+ notice: '当未设置文案时,页面默认展示为"<span style="color:red">购买新卡</span>",建议不超过<span style="color:red">4</span>个汉字'
361
+ },
339
362
  {
340
363
  ele: "title",
341
364
  label: "我的优惠券内容配置",
@@ -1114,6 +1137,18 @@ export default {
1114
1137
  },
1115
1138
  inline: false,
1116
1139
  },
1140
+ {
1141
+ label: '购买新卡地址:',
1142
+ ele: 'xd-select-pages-path',
1143
+ valueKey: 'buy_new_url',
1144
+ groupKey:'advanced',
1145
+ placeholder: '请选择购买新卡地址',
1146
+ value: data.buy_new_url || null,
1147
+ setting: {
1148
+ router: XdBus.getParentApi('getPagesTree'),
1149
+ },
1150
+ inline: false,
1151
+ },
1117
1152
  ].filter(i=>i)
1118
1153
  },
1119
1154
  advanced: [],
@@ -104,7 +104,9 @@
104
104
  </view>
105
105
  <view v-else class="empty_data">
106
106
  <image :src="emptyBg"></image>
107
- 暂无票券
107
+ <view style="display:flex;align-items: center;justify-content: center;">
108
+ 暂无票券 <view v-if="isShowBuy==='Y'" class="buy_new" @click="toBuyNew" :style="{color: mainColor}"><view>{{buy_name}}</view> <xd-font-icon size="20" icon="iconxiangyou_xian"></xd-font-icon></view>
109
+ </view>
108
110
  </view>
109
111
  </view>
110
112
  </template>
@@ -245,6 +247,9 @@
245
247
  cardBtnMinWidth: 100,
246
248
  menuShowType: "text",
247
249
  cardFontColor: "",
250
+ buy_new_url: '',
251
+ isShowBuy: "",
252
+ buy_name: ""
248
253
  }
249
254
  },
250
255
  computed: {
@@ -587,6 +592,9 @@
587
592
  this.noticePadding = getContainerPropsValue(value, "content.noticePadding", {top: 20, left: 20, right: 20, bottom: 20});
588
593
  this.noticeFont = getContainerPropsValue(value, "content.noticeFont", {});
589
594
  this.noticeMoreFont = getContainerPropsValue(value, "content.noticeMoreFont", {});
595
+ this.isShowBuy = getContainerPropsValue(value, "content.isShowBuy", "N");
596
+ this.buy_name = getContainerPropsValue(value, "content.buy_name", "购买新卡");
597
+ this.buy_new_url = getContainerPropsValue(value,"content.buy_new_url",{value: ""}).value;
590
598
 
591
599
  console.log(this.cardShadow, 'cardShadow')
592
600
  if(this.bindCardTextStyle && !this.bindCardTextStyle.color){
@@ -716,6 +724,11 @@
716
724
  url: this.disabledPath
717
725
  })
718
726
  },
727
+ toBuyNew() {
728
+ this.$xdUniHelper.navigateTo({
729
+ url: `${this.buy_new_url}`,
730
+ });
731
+ },
719
732
  onJfbScroll(options) {
720
733
  // console.log('event.onJfbScroll', options)
721
734
  },
@@ -886,6 +899,13 @@
886
899
  flex-direction: column;
887
900
  align-items: center;
888
901
  justify-content: center;
902
+ .buy_new {
903
+ display: flex;
904
+ margin-left: 8rpx;
905
+ & > view:first-child {
906
+ margin-right: 8rpx;
907
+ }
908
+ }
889
909
  & > image {
890
910
  width: unit(460,rpx);
891
911
  height: unit(400,rpx);
@@ -44,6 +44,29 @@ export default {
44
44
  notice: '卡券自定义名称设置,默认值:<span style="color:red">卡券</span>,长度为:1-4字符',
45
45
  inline: false,
46
46
  },
47
+ {
48
+ label: "无票券时是否展示购买新卡入口:",
49
+ ele: "xd-radio",
50
+ valueKey: "isShowBuy",
51
+ value: data.isShowBuy || "N",
52
+ list: [
53
+ { label: "展示", value: "Y" },
54
+ { label: "隐藏", value: "N" }
55
+ ],
56
+ groupKey: "content",
57
+ },
58
+ {
59
+ label: '购买新卡文案:',
60
+ ele: 'el-input',
61
+ type: 'text',
62
+ valueKey: 'buy_name',
63
+ groupKey:'content',
64
+ value: data.buy_name || '',
65
+ placeholder: '请输入购买新卡文案',
66
+ className: 'input80',
67
+ inline: false,
68
+ notice: '当未设置文案时,页面默认展示为"<span style="color:red">购买新卡</span>",建议不超过<span style="color:red">4</span>个汉字'
69
+ },
47
70
 
48
71
  //style
49
72
  {
@@ -519,6 +542,18 @@ export default {
519
542
  router: XdBus.getParentApi('getPagesTree'),
520
543
  },
521
544
  },
545
+ {
546
+ label: '购买新卡地址:',
547
+ ele: 'xd-select-pages-path',
548
+ valueKey: 'buy_new_url',
549
+ groupKey:'advanced',
550
+ placeholder: '请选择购买新卡地址',
551
+ value: data.buy_new_url || null,
552
+ setting: {
553
+ router: XdBus.getParentApi('getPagesTree'),
554
+ },
555
+ inline: false,
556
+ },
522
557
  {
523
558
  label: '',
524
559
  ele: 'slot',
@@ -19,14 +19,26 @@
19
19
  <view :style="{borderRadius: bodyRadius + 'rpx', backgroundColor:bodyBackgroundColor, padding:outPadding}">
20
20
  <view class="my-card-add__btn" :style="[titleMarginComp]">
21
21
  <view :style="[titleStyleComp]">我的{{cardName}}</view>
22
- <view class="addBtn" :style="[addBtnStyleComp]" @click="handleToLink(add_url)">
23
- <text>添加{{cardName}}</text>
24
- <view v-if="isShowICONBtn === 'Y'">
25
- <xd-font-icon
26
- icon="iconxiangyou_xian"
27
- :color="addBtnStyleComp.color"
28
- :size="20"
29
- ></xd-font-icon>
22
+ <view style="display:flex">
23
+ <view v-if="isShowBuy==='Y'" class="addBtn" :style="[addBtnStyleComp]" @click="toBuyNew">
24
+ <text>{{buy_name}}</text>
25
+ <view v-if="isShowICONBtn === 'Y'">
26
+ <xd-font-icon
27
+ icon="iconxiangyou_xian"
28
+ :color="addBtnStyleComp.color"
29
+ :size="20"
30
+ ></xd-font-icon>
31
+ </view>
32
+ </view>
33
+ <view class="addBtn" :style="[addBtnStyleComp]" @click="handleToLink(add_url)">
34
+ <text>添加{{cardName}}</text>
35
+ <view v-if="isShowICONBtn === 'Y'">
36
+ <xd-font-icon
37
+ icon="iconxiangyou_xian"
38
+ :color="addBtnStyleComp.color"
39
+ :size="20"
40
+ ></xd-font-icon>
41
+ </view>
30
42
  </view>
31
43
  </view>
32
44
  </view>
@@ -188,7 +200,9 @@
188
200
  is_border: 'Y',
189
201
  is_border_w: 0,
190
202
  is_border_c: '',
191
-
203
+ buy_new_url: '',
204
+ isShowBuy: "",
205
+ buy_name: ""
192
206
  }
193
207
  },
194
208
  watch: {
@@ -211,6 +225,12 @@
211
225
  })
212
226
  },
213
227
 
228
+ toBuyNew() {
229
+ this.$xdUniHelper.navigateTo({
230
+ url: `${this.buy_new_url}`,
231
+ });
232
+ },
233
+
214
234
  /**
215
235
  * @description 监听事件变化
216
236
  * @param container {object} 业务组件对象自己
@@ -258,6 +278,10 @@
258
278
  this.add_url = getContainerPropsValue(container, 'content.add_url', {value: ''}).value;
259
279
  this.pwd_url = getContainerPropsValue(container, 'content.pwd_url', {value: ''}).value;
260
280
  this.card_url = getContainerPropsValue(container, 'content.card_url', {value: ''}).value;
281
+
282
+ this.isShowBuy = getContainerPropsValue(container, "content.isShowBuy", "N");
283
+ this.buy_name = getContainerPropsValue(container, "content.buy_name", "购买新卡");
284
+ this.buy_new_url = getContainerPropsValue(container,"content.buy_new_url",{value: ""}).value;
261
285
  },
262
286
  }
263
287
  }
@@ -273,6 +297,11 @@
273
297
  display: flex;
274
298
  justify-content: center;
275
299
  align-items: center;
300
+ width: unit(200, rpx);
301
+ height: unit(60, rpx);
302
+ line-height: unit(60, rpx);
303
+ text-align: center;
304
+ margin-left: 20rpx;
276
305
 
277
306
  & > view {
278
307
  margin-left: 10rpx;
@@ -287,13 +316,6 @@
287
316
  justify-content: space-between;
288
317
  align-items: center;
289
318
  font-size: unit(28, rpx);
290
-
291
- & > view:nth-child(2) {
292
- width: unit(200, rpx);
293
- height: unit(60, rpx);
294
- line-height: unit(60, rpx);
295
- text-align: center;
296
- }
297
319
  }
298
320
 
299
321
  &__link {