jufubao-base 1.0.66 → 1.0.67-beta201

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jufubao-base",
3
- "version": "1.0.66",
3
+ "version": "1.0.67-beta201",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件基础插件包",
6
6
  "main": "index.js",
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @description 卡券登陆
5
+ * @type {*[]}
6
+ */
7
+ module.exports = [
8
+ {
9
+ mapFnName: 'getCouponDialogList', //自定义方法名字(必选)
10
+ title: '获取活动弹框列表',
11
+ path: '/sms/v1/activity/list',
12
+ isRule: false,
13
+ params: {
14
+ namespace: ['业务线', 'String', '必填'],
15
+ },
16
+ isConsole: true,
17
+ disabled: true,
18
+ },
19
+ ];
@@ -0,0 +1,60 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @description 当表单组件中有联动操作时候,使用方法进行返回
5
+ */
6
+ export default {
7
+ style: [],
8
+ content:(data) => {
9
+ return [
10
+ {
11
+ label: '选取优惠券列表路径:', //label
12
+ ele: 'xd-select-pages-path', //package 名称
13
+ valueKey: 'list_url', //form[valueKey]
14
+ placeholder: '请选择优惠券列表路径',
15
+ value: data['list_url'] ||null,
16
+ setting: {
17
+ router: XdBus.getParentApi('getPagesTree'),
18
+ },
19
+ inline: false,
20
+ },
21
+ {
22
+ label: '活动提示方式:',
23
+ ele: 'xd-radio',
24
+ valueKey: 'type',
25
+ value: data['type']||1,
26
+ placeholder: '请选择活动提示方式',
27
+ multiple: false,
28
+ className: 'input80',
29
+ list: [
30
+ { label: '弹框', value: 1 },
31
+ { label: '切换', value: 2 },
32
+ ]
33
+ },
34
+ {
35
+ label: '弹窗间隔:',
36
+ ele: 'el-input',
37
+ type: 'text',
38
+ valueKey: 'time',
39
+ value: data.time || '',
40
+ placeholder: '请输入弹窗间隔,默认值:3小时',
41
+ className: 'input80',
42
+ unit: '小时'
43
+ },
44
+ {
45
+ label: '是否隐藏弹框(仅预览模式生效):',
46
+ ele: 'xd-radio',
47
+ valueKey: 'isHide',
48
+ value: data['isHide']||false,
49
+ placeholder: '请选择是否隐藏弹框',
50
+ multiple: false,
51
+ className: 'input80',
52
+ list: [
53
+ { label: '是', value: true },
54
+ { label: '否', value: false },
55
+ ]
56
+ },
57
+ ].filter(i=>i)
58
+ },
59
+ advanced: [],
60
+ };
@@ -0,0 +1,293 @@
1
+ <template>
2
+ <view
3
+ class="jfb-base-con-dialog"
4
+ @click="handleEditxSelect"
5
+ :class="{
6
+ editx: isEditx && active,
7
+ noBorder: noBorder,
8
+ }"
9
+ >
10
+ <!--#ifdef H5-->
11
+ <view
12
+ class="jfb-base-con-dialog__edit"
13
+ :class="{ editx: isEditx && active }"
14
+ v-if="isEditx && active && !noBorder"
15
+ >
16
+ <view class="jfb-base-con-dialog__edit-icon" @click="delEdit">删除</view>
17
+ </view>
18
+ <!-- #endif -->
19
+ <view class="jfb-base-con-dialog__body">
20
+ <view class="jfb-base-con-dialog__body-dialog" v-if="isShow">
21
+ <view class="jfb-base-con-dialog__body-dialog-mask"></view>
22
+ <view class="jfb-base-con-dialog__body-dialog-content">
23
+ <view class="jfb-base-con-dialog__body-dialog-content-num">
24
+ <text>{{ currentIndex + 1 }}/{{ list.length }}</text>
25
+ </view>
26
+ <view style="display: flex; align-items: center">
27
+ <view
28
+ @click="handleChange('left')"
29
+ v-if="this.type === 2 && this.currentIndex !== 0"
30
+ class="jfb-base-con-dialog__body-dialog-content-left"
31
+ >
32
+ <xd-font-icon icon="iconxiangzuo_xian"></xd-font-icon>
33
+ </view>
34
+ <view class="jfb-base-con-dialog__body-dialog-content-image">
35
+ <image :src="currentImage"></image>
36
+ <image @click="handleToList" :src="currentBtnImage"></image>
37
+ </view>
38
+ <view
39
+ v-if="this.type === 2 && this.currentIndex !== list.length - 1"
40
+ @click="handleChange('right')"
41
+ class="jfb-base-con-dialog__body-dialog-content-right"
42
+ >
43
+ <xd-font-icon icon="iconxiangyou_xian"></xd-font-icon>
44
+ </view>
45
+ </view>
46
+ <xd-font-icon
47
+ @click="handleClose"
48
+ class="jfb-base-con-dialog__body-dialog-content-close"
49
+ icon="iconguanbi_xian"
50
+ color="#fff"
51
+ size="64"
52
+ ></xd-font-icon>
53
+ </view>
54
+ </view>
55
+ <view
56
+ :style="{ background: backgroundColor, color: warningColor }"
57
+ class="jfb-base-con-dialog__body-pop"
58
+ v-if="isPreview"
59
+ >弹框方便编辑(占位),在线上此模块不显</view
60
+ >
61
+ </view>
62
+ </view>
63
+ </template>
64
+
65
+ <script>
66
+ import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
67
+ import { jfbRootExec, JfbEvent } from "@/utils/xd.event";
68
+ import JfbBaseConDialogMixin from "./JfbBaseConDialogMixin";
69
+ import componentsMixins from "@/mixins/componentsMixins";
70
+ import extsMixins from "@/mixins/extsMixins";
71
+ import { getContainerPropsValue } from "@/utils/xd.base";
72
+ import getServiceUrl from "@/common/getServiceUrl";
73
+ import colorCardMixins from "@/mixins/colorCardMixins";
74
+ const Color = require("color");
75
+ import { mapState } from "vuex";
76
+ import storage from "@/common/storage";
77
+
78
+ export default {
79
+ name: "JfbBaseConDialog",
80
+ components: {
81
+ XdFontIcon,
82
+ },
83
+ mixins: [componentsMixins, extsMixins, JfbBaseConDialogMixin],
84
+ data() {
85
+ return {
86
+ list_url: "",
87
+ list: [],
88
+ currentImage: "",
89
+ currentBtnImage: "",
90
+ currentIndex: 0,
91
+ isShow: false,
92
+ type: "",
93
+ isPreview: false, //是否预览
94
+ activity_id: "",
95
+ backgroundColor: "",
96
+ };
97
+ },
98
+ computed: {
99
+ ...mapState(["pageNamespace"]),
100
+ },
101
+ watch: {
102
+ container(value) {
103
+ console.log(value, "aakakakkaka");
104
+ this.init(value);
105
+ },
106
+ },
107
+ created() {
108
+ this.isPreview = this.$configProject.isPreview;
109
+ this.backgroundColor = Color(this.warningColor).alpha(0.2).toString();
110
+ this.init(this.container);
111
+ },
112
+ methods: {
113
+ init(value) {
114
+ this.list_url = getContainerPropsValue(value, "content.list_url", {
115
+ value: "",
116
+ }).value;
117
+ this.type = getContainerPropsValue(value, "content.type", 1);
118
+ this.isHide = getContainerPropsValue(value, "content.isHide", false);
119
+ this.time = Number(getContainerPropsValue(value, "content.time", 3));
120
+ if (this.isPreview) {
121
+ this.isShow = !this.isHide;
122
+ }
123
+ },
124
+ getDialogList() {
125
+ jfbRootExec("getCouponDialogList", {
126
+ vm: this,
127
+ data: {
128
+ namespace: this.pageNamespace,
129
+ },
130
+ })
131
+ .then((res) => {
132
+ console.log(res, "resresres");
133
+ this.list = res.list;
134
+ this.currentImage = getServiceUrl(
135
+ this.list[this.currentIndex].app_activity_url
136
+ );
137
+ this.currentBtnImage = getServiceUrl(
138
+ this.list[this.currentIndex].app_activity_button
139
+ );
140
+ this.activity_id = this.list[this.currentIndex].activity_id;
141
+ this.handlePop();
142
+ })
143
+ .catch((err) => {
144
+ console.log(err, "err");
145
+ });
146
+ },
147
+ handlePop() {
148
+ console.log("this.time", this.time * 60 + "分钟");
149
+ storage.set(this.containerId, 1, this.time);
150
+ this.isShow = true;
151
+ },
152
+ onJfbLoad(options) {
153
+ console.log(11111);
154
+ try {
155
+ if (!storage.get(this.containerId)) this.getDialogList();
156
+ } catch (error) {
157
+ console.log(error, "errorerror");
158
+ }
159
+ },
160
+ onJfbUpdate(data) {
161
+ storage.remove(this.containerId);
162
+ this.getDialogList();
163
+ },
164
+ handleToList() {
165
+ this.$xdUniHelper.navigateTo({
166
+ url: `${this.list_url}?activity_id=${this.activity_id}&distribution_method=homed`,
167
+ });
168
+ },
169
+ handleClose() {
170
+ //切换下一张,没有下一张,关闭
171
+ if (this.currentIndex == this.list.length - 1 || this.type == 2) {
172
+ this.isShow = false;
173
+ return;
174
+ }
175
+ this.currentIndex = this.currentIndex + 1;
176
+ this.currentImage = getServiceUrl(
177
+ this.list[this.currentIndex].app_activity_url
178
+ );
179
+ this.currentBtnImage = getServiceUrl(
180
+ this.list[this.currentIndex].app_activity_button
181
+ );
182
+ this.activity_id = this.list[this.currentIndex].activity_id;
183
+ },
184
+ handleChange(type) {
185
+ this.currentIndex =
186
+ type === "left" ? this.currentIndex - 1 : this.currentIndex + 1;
187
+ //不小于0,不大于数组长度
188
+ this.currentIndex = Math.max(
189
+ 0,
190
+ Math.min(this.currentIndex, this.list.length - 1)
191
+ );
192
+ this.currentImage = getServiceUrl(
193
+ this.list[this.currentIndex].app_activity_url
194
+ );
195
+ this.currentBtnImage = getServiceUrl(
196
+ this.list[this.currentIndex].app_activity_button
197
+ );
198
+ this.activity_id = this.list[this.currentIndex].activity_id;
199
+ },
200
+ },
201
+ };
202
+ </script>
203
+
204
+ <style scoped lang="less">
205
+ @import "./JfbBaseConDialogLess.less";
206
+
207
+ .jfb-base-con-dialog {
208
+ &__body {
209
+ &-pop {
210
+ min-height: 100rpx;
211
+ text-align: center;
212
+ vertical-align: middle;
213
+ color: #666;
214
+ font-size: unit(24, rpx);
215
+ line-height: 100rpx;
216
+ }
217
+ &-dialog {
218
+ position: fixed;
219
+ top: 0;
220
+ bottom: 0;
221
+ left: 0;
222
+ right: 0;
223
+ z-index: 3000;
224
+
225
+ &-mask {
226
+ position: absolute;
227
+ top: 0;
228
+ bottom: 0;
229
+ left: 0;
230
+ right: 0;
231
+ background: rgba(0, 0, 0, 0.5);
232
+ }
233
+
234
+ &-content {
235
+ max-height: unit(1000, rpx);
236
+ overflow-y: auto;
237
+ overflow-x: hidden;
238
+ position: absolute;
239
+ top: 50%;
240
+ left: 50%;
241
+ transform: translate(-50%, -50%);
242
+ display: flex;
243
+ flex-direction: column;
244
+ &-num {
245
+ margin: 0 auto;
246
+ background: rgba(255, 255, 255, 0.5);
247
+ border-radius: unit(40, rpx);
248
+ padding: unit(8, rpx) unit(24, rpx);
249
+ color: #fff;
250
+ font-size: unit(40, rpx);
251
+ }
252
+ &-close {
253
+ margin: 0 auto;
254
+ }
255
+ &-left {
256
+ background: rgba(255, 255, 255, 0.1);
257
+ padding: unit(40, rpx) unit(10, rpx);
258
+ color: #fff;
259
+ border-radius: unit(40, rpx);
260
+ }
261
+ &-right {
262
+ background: rgba(255, 255, 255, 0.1);
263
+ padding: unit(40, rpx) unit(10, rpx);
264
+ color: #fff;
265
+ border-radius: unit(40, rpx);
266
+ }
267
+ &-image {
268
+ min-width: unit(600, rpx);
269
+ min-height: unit(800, rpx);
270
+ height: unit(800, rpx);
271
+ display: flex;
272
+ align-items: center;
273
+ flex-direction: column;
274
+ margin: 20rpx;
275
+ position: relative;
276
+
277
+ & > image:first-child {
278
+ width: 100%;
279
+ height: 100%;
280
+ }
281
+
282
+ & > image:nth-child(2) {
283
+ width: unit(448, rpx);
284
+ height: unit(70, rpx);
285
+ position: absolute;
286
+ bottom: unit(100, rpx);
287
+ }
288
+ }
289
+ }
290
+ }
291
+ }
292
+ }
293
+ </style>
@@ -0,0 +1,80 @@
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-con-dialog {
16
+ border: 1px dashed rgba(0, 0, 0, 0);
17
+ box-sizing: border-box;
18
+ min-height: unit(50, rpx);
19
+
20
+ &__body{
21
+ position: relative;
22
+ overflow: hidden;
23
+ z-index: 2
24
+ }
25
+
26
+ &.editx {
27
+ position: relative;
28
+ border: 1px dashed blue;
29
+ box-sizing: border-box;
30
+ z-index: 3
31
+
32
+ }
33
+
34
+ &:hover {
35
+ border: 1px dashed blue;
36
+ }
37
+
38
+ &.noBorder {
39
+ border-color: rgba(0,0,0,0);
40
+ border-width: 0;
41
+ }
42
+
43
+
44
+ &__edit {
45
+ cursor: pointer;
46
+ position: absolute;
47
+ right: unit(0, rpx);
48
+ top: unit(-52, rpx);
49
+ height: unit(50, rpx);
50
+ line-height: unit(50, rpx);
51
+ display: flex;
52
+ justify-content: center;
53
+ align-items: center;
54
+ background: rgba(0, 0, 0, .6);
55
+ border-radius: unit(10, rpx);
56
+ box-shadow: 0 0 10px rbga(0, 0, 0, 0.3);
57
+ color: #fff;
58
+ font-size: unit(22, rpx);
59
+
60
+ &-icon{
61
+ padding: 0 unit(20, rpx);
62
+ }
63
+
64
+ &.editx {
65
+ box-sizing: border-box;
66
+
67
+ }
68
+ }
69
+ }
70
+ //end
71
+
72
+
73
+ /**notPreview**/
74
+ .jfb-base-con-dialog {
75
+ &:before {
76
+ content: " ";
77
+ display: table;
78
+ }
79
+ }
80
+ /**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-con-dialog'
20
+ }
21
+ },
22
+ created() {
23
+
24
+ //@AttrDataCreated
25
+ this.Attr = this.$xdUniHelper.customClone(Attr);
26
+ //@EndAttrDataCreated
27
+
28
+
29
+ },
30
+ }
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ getCouponDialogList: {
5
+ "list": [
6
+ {
7
+ "app_key": "sms-coupon",
8
+ "app_activity_url": "//sandbox-img.jufubao.cn/uploads/20231123/b68d9ff61ffe6cada499d8ad809aaa8d.jpg",
9
+ "app_activity_button": "//sandbox-img.jufubao.cn/uploads/20231123/d9730115b5e1e8047b2b36e69655e745.jpg",
10
+ "background": "background1.png",
11
+ "activity_id": 35,
12
+ },
13
+ {
14
+ "app_key": "sms-coupon",
15
+ "app_activity_url": "//sandbox-img.jufubao.cn/uploads/20231123/b68d9ff61ffe6cada499d8ad809aaa8d.jpg",
16
+ "app_activity_button": "//sandbox-img.jufubao.cn/uploads/20231123/d9730115b5e1e8047b2b36e69655e745.jpg",
17
+ "background": "background1.png",
18
+ "activity_id": 35,
19
+ },
20
+ {
21
+ "app_key": "sms-coupon",
22
+ "app_activity_url": "//sandbox-img.jufubao.cn/uploads/20231123/b68d9ff61ffe6cada499d8ad809aaa8d.jpg",
23
+ "app_activity_button": "//sandbox-img.jufubao.cn/uploads/20231123/d9730115b5e1e8047b2b36e69655e745.jpg",
24
+ "background": "background1.png",
25
+ "activity_id": 35,
26
+ }
27
+ ],
28
+ "request_id": "4b9803ed0ecdc0f6"
29
+ }
30
+ }
@@ -0,0 +1,58 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @description 卡券登陆
5
+ * @type {*[]}
6
+ */
7
+ module.exports = [
8
+ {
9
+ mapFnName: 'getListBaseNewsContentCoupon', //自定义方法名字(必选)
10
+ title: '获取内容',
11
+ path: '/cms/v1/news-content',
12
+ isRule: false,
13
+ params: {
14
+ scene: ['使用场景', 'String', '选填'],
15
+ container_id: ['插件ID', 'String', '必填'],
16
+ page_id: ['页面ID', 'String', '必填'],
17
+ page_size: ['记录条数', 'Number', '必填', 1],
18
+ code: ['业务线id', 'String', '选填'],
19
+ },
20
+ isConsole: true,
21
+ disabled: true,
22
+ },
23
+ {
24
+ mapFnName: 'getCouponList', //自定义方法名字(必选)
25
+ title: '获取优惠券列表',
26
+ path: '/sms-coupon/v1/activity-prizes-user/list',
27
+ isRule: false,
28
+ params: {
29
+ distribution_method: ['发放方式 entry=主动发放, homed=首页发放,paid=消费后发放,card_binded=绑定卡后发放', 'String', '选填'],
30
+ namespace: ['业务线', 'String', '必填'],
31
+ },
32
+ isConsole: true,
33
+ disabled: true,
34
+ },
35
+ {
36
+ mapFnName: 'getAllCoupon', //自定义方法名字(必选)
37
+ title: '领取优惠券',
38
+ path: '/sms-coupon/v1/activity-prizes-user/set',
39
+ isRule: false,
40
+ params: {
41
+ distribution_method: ['发放方式 entry=主动发放, homed=首页发放,paid=消费后发放,card_binded=绑定卡后发放', 'String', '选填'],
42
+ namespace: ['业务线', 'String', '必填'],
43
+ },
44
+ isConsole: true,
45
+ disabled: true,
46
+ },
47
+ {
48
+ mapFnName: 'getCouponResult', //自定义方法名字(必选)
49
+ title: '轮询查询活动结果',
50
+ path: '/sms-coupon/v1/activity-prizes-user/get',
51
+ isRule: false,
52
+ params: {
53
+ tmp_order_number: ['tmp_order_number', 'String', '选填'],
54
+ },
55
+ isConsole: true,
56
+ disabled: true,
57
+ },
58
+ ];
@@ -0,0 +1,224 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @description 当表单组件中有联动操作时候,使用方法进行返回
5
+ */
6
+ export default {
7
+ style: [],
8
+ content: [
9
+ {
10
+ label: '领券规则:',
11
+ ele: 'xd-site-news',
12
+ valueKey: 'notice',
13
+ value: null,
14
+ className: 'input70',
15
+ setting: {
16
+ config: {
17
+ sort: true,
18
+ maxlen: 100,
19
+ action: 'aliyun',
20
+ size: 5,
21
+ tipsformet: '上传文件格式:@imageType@,不超过@size@MB.',
22
+ uploadType: 'aliyun',
23
+ type: ['jpg', 'png', 'jpeg']
24
+ },
25
+ },
26
+ handleCustom({action, data}) {
27
+ if (data && data.params) {
28
+ //当一个插件中出现使用内容分类时候需要设置code值,在页面引用时候容器id + code进行拼接
29
+ //data.params = Object.assign({}, data.params, {code: 'g_test_id'});
30
+ }
31
+
32
+ //获取返回参数(场景类型名称为必填)
33
+ let loading = XdBus.getParentApi('loading')({});
34
+
35
+ //获取显示内容
36
+ if (action === 'screen') {
37
+ XdBus.getParentApi('getOptionsSettingList')({setting_id: 'edtix_bucket_content_tip'})
38
+ .then(res => {
39
+ loading.close();
40
+ data.cb(res['list'])
41
+ })
42
+ .catch(error => {
43
+ console.error(error);
44
+ loading.close();
45
+ });
46
+
47
+ }
48
+
49
+ //获取返回参数(广告位高度必选项)
50
+ if (action === 'getNewsInfo') {
51
+ XdBus.getParentApi('cmsGetPublishEditxContent')(data.params)
52
+ .then(res => {
53
+ loading.close()
54
+ data.cb({list: res.list, selectId: res.selected})
55
+ })
56
+ .catch(error => {
57
+ loading.close()
58
+ console.error(error);
59
+ });
60
+ }
61
+
62
+ //获取产品业务线列表
63
+ if (action === 'namespace') {
64
+ XdBus.getParentApi('getOptionsNamespaces')({})
65
+ .then(res => {
66
+ loading.close()
67
+ data.cb(res['list'])
68
+ })
69
+ .catch(error => {
70
+ loading.close()
71
+ console.error(error);
72
+ });
73
+ }
74
+
75
+ //使用内容分类
76
+ if (action === 'cmsPublishEditxContent') {
77
+ XdBus.getParentApi('cmsPublishEditxContent')(data.params)
78
+ .then(res => {
79
+ console.log('cmsPublishEditxContent', res)
80
+ loading.close();
81
+ data.cb(res)
82
+ })
83
+ .catch(error => {
84
+ loading.close();
85
+ console.error(error);
86
+ });
87
+ }
88
+
89
+ //位置列表
90
+ if (action === 'getListPostion') {
91
+ XdBus.getParentApi('getListNewsPosition')(data.params)
92
+ .then(res => {
93
+ loading.close();
94
+ data.cb(res)
95
+ })
96
+ .catch(error => {
97
+ loading.close();
98
+ console.error(error);
99
+ });
100
+ }
101
+
102
+ //位置创建
103
+ if (action === 'addPostion') {
104
+ XdBus.getParentApi('addNewsPosition')(data.params)
105
+ .then(res => {
106
+ loading.close();
107
+ data.cb(true)
108
+ })
109
+ .catch(error => {
110
+ console.error(error);
111
+ loading.close();
112
+ data.cb(false)
113
+ });
114
+ }
115
+
116
+ //位置编辑
117
+ if (action === 'editPostion') {
118
+ XdBus.getParentApi('updateNewsPosition')(data.params)
119
+ .then(res => {
120
+ loading.close();
121
+ data.cb(true)
122
+ })
123
+ .catch(error => {
124
+ console.error(error);
125
+ loading.close();
126
+ data.cb(false)
127
+ });
128
+ }
129
+
130
+ //位置删除
131
+ if (action === 'deleltePostion') {
132
+ XdBus.getParentApi('deleteNewsPosition')(data.params)
133
+ .then(res => {
134
+ loading.close();
135
+ data.cb(true)
136
+ })
137
+ .catch(error => {
138
+ console.error(error);
139
+ loading.close();
140
+ data.cb(false)
141
+ });
142
+ }
143
+
144
+ //获取广告位内容列表
145
+ if (action === 'getListContent') {
146
+ XdBus.getParentApi('getListNewsContent')(data.params)
147
+ .then(res => {
148
+ loading.close();
149
+ data.cb(res)
150
+ })
151
+ .catch(error => {
152
+ loading.close();
153
+ console.error(error);
154
+ });
155
+ }
156
+
157
+ //广告内容创建
158
+ if (action === 'addContent') {
159
+ XdBus.getParentApi('addNewsContent')(data.params)
160
+ .then(res => {
161
+ loading.close();
162
+ data.cb(true)
163
+ })
164
+ .catch(error => {
165
+ console.error(error);
166
+ loading.close();
167
+ data.cb(false)
168
+ });
169
+ }
170
+
171
+ //广告内容编辑
172
+ if (action === 'editContent') {
173
+ XdBus.getParentApi('updateNewsContent')(data.params)
174
+ .then(res => {
175
+ loading.close();
176
+ data.cb(true)
177
+ })
178
+ .catch(error => {
179
+ console.error(error);
180
+ loading.close();
181
+ data.cb(false)
182
+ });
183
+ }
184
+
185
+ //广告内容删除
186
+ if (action === 'deleteContent') {
187
+ XdBus.getParentApi('deleteNewsContent')(data.params)
188
+ .then(res => {
189
+ loading.close();
190
+ data.cb(true)
191
+ })
192
+ .catch(error => {
193
+ console.error(error);
194
+ loading.close();
195
+ data.cb(false)
196
+ });
197
+ }
198
+
199
+ //内容发布
200
+ if (action === 'publish') {
201
+ console.log('publish', data.params)
202
+ XdBus.getParentApi('cmsPublishContent')(data.params)
203
+ .then(res => {
204
+ loading.close();
205
+ data.cb(res)
206
+ })
207
+ .catch(error => {
208
+ loading.close();
209
+ console.error(error);
210
+ });
211
+ }
212
+
213
+ //通知页面进行刷新
214
+ if (action === 'update') {
215
+ XdBus.getParentApi('getXdBusUpdateView')('onUpdateView', {});
216
+ loading.close()
217
+ }
218
+ },
219
+ inline: false,
220
+ notice: '请配置温馨提示内容,未配置的情况将不显示此模块',
221
+ },
222
+ ],
223
+ advanced: [],
224
+ };
@@ -0,0 +1,415 @@
1
+ <template>
2
+ <view
3
+ class="jfb-base-con-list"
4
+ @click="handleEditxSelect"
5
+ :class="{
6
+ editx: isEditx && active,
7
+ noBorder: noBorder,
8
+ }"
9
+ >
10
+ <!--#ifdef H5-->
11
+ <view
12
+ class="jfb-base-con-list__edit"
13
+ :class="{ editx: isEditx && active }"
14
+ v-if="isEditx && active && !noBorder"
15
+ >
16
+ <view class="jfb-base-con-list__edit-icon" @click="delEdit">删除</view>
17
+ </view>
18
+ <!-- #endif -->
19
+ <view class="jfb-base-con-list__body">
20
+ <view class="jfb-base-con-list__body-header">
21
+ <image :src="background"></image>
22
+ </view>
23
+ <view class="jfb-base-con-list__body-content">
24
+ <view class="jfb-base-con-list__body-content-header">
25
+ <view class="jfb-base-con-list__body-content-header-left">
26
+ <view :style="{ backgroundColor: mainColor }"></view>
27
+ <view>赠送优惠券</view>
28
+ </view>
29
+ <view
30
+ :style="{ color: mainColor, background: contentBackground }"
31
+ class="jfb-base-con-list__body-content-header-right"
32
+ @click="showRule = true"
33
+ >
34
+ <text>领券规则</text>
35
+ <xd-font-icon size="20" icon="iconxiangyou_xian"></xd-font-icon>
36
+ </view>
37
+ </view>
38
+ <view class="jfb-base-con-list__body-content-list">
39
+ <view
40
+ v-for="(item, index) in couponList"
41
+ :key="index"
42
+ class="jfb-base-con-list__body-content-list-item"
43
+ :style="{ background: contentBackground }"
44
+ >
45
+ <view class="jfb-base-con-list__body-content-list-item-left">
46
+ <view
47
+ :style="couponBackground"
48
+ class="jfb-base-con-list__body-content-list-item-left-info"
49
+ >
50
+ <view :style="{ color: mainColor }">满减券</view>
51
+ <view>{{ item.prize_name }}</view>
52
+ </view>
53
+ <view class="jfb-base-con-list__body-content-list-item-left-num">
54
+ <view>{{ item.prize_name }}</view>
55
+ <view :style="{ color: mainColor,display:'flex',alignItems:'center' }">
56
+ <xd-font-icon style="margin-right:10rpx" size="24" icon="icondanchuangguanbi_xian"></xd-font-icon>
57
+ {{ item.prize_num }}
58
+ </view>
59
+ </view>
60
+ </view>
61
+ <view class="jfb-base-con-list__body-content-list-item-right">
62
+ <xd-font-icon
63
+ size="100"
64
+ :style="{ color: disabled ? '#D6D6D6' : mainColor }"
65
+ :icon="disabled ? 'iconyilingqu' : 'icondailingqu'"
66
+ ></xd-font-icon>
67
+ </view>
68
+ </view>
69
+ </view>
70
+ </view>
71
+ <view style="height: 120rpx"></view>
72
+ <view class="bottom_btn" :style="prod_bottom">
73
+ <xd-button
74
+ :disabled="disabled"
75
+ @click="getCoupont"
76
+ type="primary"
77
+ :style="btn"
78
+ width="60%"
79
+ >{{ disabled ? "已领取" : "一键领取" }}</xd-button
80
+ >
81
+ </view>
82
+ <xd-dailog
83
+ :cancel="false"
84
+ :confirm="false"
85
+ title="活动规则说明"
86
+ :show.sync="showRule"
87
+ >
88
+ <xd-content-xss :html="notice"></xd-content-xss>
89
+ </xd-dailog>
90
+ </view>
91
+ </view>
92
+ </template>
93
+
94
+ <script>
95
+ import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
96
+ import XdButton from "@/components/XdButton/XdButton";
97
+ import { jfbRootExec } from "@/utils/xd.event";
98
+ import JfbBaseConListMixin from "./JfbBaseConListMixin";
99
+ import componentsMixins from "@/mixins/componentsMixins";
100
+ import extsMixins from "@/mixins/extsMixins";
101
+ import { getContainerPropsValue } from "@/utils/xd.base";
102
+ import XdDailog from "@/components/XdDailog/XdDailog";
103
+ import XdContentXss from "@/components/XdContentXss/XdContentXss";
104
+ import getServiceUrl from "@/common/getServiceUrl";
105
+ import colorCardMixins from "@/mixins/colorCardMixins";
106
+ import { mapState } from "vuex";
107
+ const Color = require("color");
108
+
109
+ export default {
110
+ name: "JfbBaseConList",
111
+ components: {
112
+ XdFontIcon,
113
+ XdButton,
114
+ XdDailog,
115
+ XdContentXss,
116
+ },
117
+ mixins: [componentsMixins, extsMixins, JfbBaseConListMixin],
118
+ data() {
119
+ return {
120
+ contentBackground: "",
121
+ couponList: [],
122
+ disabled: false,
123
+ notice: "",
124
+ showRule: false,
125
+ btn: "",
126
+ activity_id: "",
127
+ background: "",
128
+ app_coupon_url: "",
129
+ method: "entry",
130
+ maxTime: 5, //最长轮询2的N次方(秒)
131
+ date: 2, //时间底数
132
+ time: 1, //时间幂指数
133
+ timeer: null,
134
+ order_num: null,
135
+ };
136
+ },
137
+ computed: {
138
+ prod_bottom() {
139
+ return this.fixedStyle({ height: 0, zIndex: 111 });
140
+ },
141
+ couponBackground() {
142
+ return {
143
+ background: `url(${this.app_coupon_url})`,
144
+ backgroundSize: "100% 100%",
145
+ backgroundRepeat: "no-repeat",
146
+ };
147
+ },
148
+ ...mapState(["pageBusinessCode"]),
149
+ },
150
+ watch: {
151
+ container(value) {
152
+ this.init(value);
153
+ },
154
+ },
155
+ created() {
156
+ this.init(this.container);
157
+ },
158
+ destroyed() {
159
+ if (this.timeer) {
160
+ clearTimeout(this.timeer);
161
+ }
162
+ },
163
+ methods: {
164
+ init(value) {
165
+ this.contentBackground = Color(this.mainColor).alpha(0.2).toString();
166
+ },
167
+ getList() {
168
+ jfbRootExec("getCouponList", {
169
+ vm: this,
170
+ data: {
171
+ distribution_method: this.method,
172
+ namespace: this.pageBusinessCode,
173
+ activity_id: this.activity_id,
174
+ },
175
+ })
176
+ .then((res) => {
177
+ this.background = getServiceUrl(res.background);
178
+ this.app_coupon_url = getServiceUrl(res.app_coupon_url);
179
+ this.btn = res.app_activity_button
180
+ ? {
181
+ background: `url(${getServiceUrl(res.app_activity_button)})`,
182
+ backgroundSize: "100% 100%",
183
+ backgroundRepeat: "no-repeat",
184
+ }
185
+ : { background: this.mainColor };
186
+ this.couponList = res.list;
187
+ })
188
+ .catch((err) => {
189
+ console.log(err, "err");
190
+ });
191
+ },
192
+ getCoupont() {
193
+ this.$xdShowLoading({});
194
+ jfbRootExec("getAllCoupon", {
195
+ vm: this,
196
+ data: {
197
+ distribution_method: this.method,
198
+ namespace: this.pageBusinessCode,
199
+ activity_id: this.activity_id,
200
+ },
201
+ })
202
+ .then((res) => {
203
+ this.order_num = res.tmp_order_number;
204
+ this.getResult();
205
+ })
206
+ .catch((err) => {
207
+ console.log(err, "err");
208
+ });
209
+ },
210
+ getResult() {
211
+ jfbRootExec("getCouponResult", {
212
+ vm: this,
213
+ data: {
214
+ tmp_order_number: this.order_num,
215
+ },
216
+ })
217
+ .then((res) => {
218
+ if (res.status_type === "success") {
219
+ this.$xdHideLoading();
220
+ this.$xdAlert({
221
+ content: "领取成功",
222
+ zIndex: 3200,
223
+ time: 2000,
224
+ isClose: false,
225
+ });
226
+ this.disabled = true;
227
+ if (this.timeer) {
228
+ clearTimeout(this.timeer);
229
+ }
230
+ return;
231
+ }
232
+ if (res.status_type === "error") {
233
+ this.$xdHideLoading();
234
+ this.$xdAlert({
235
+ content: "领取失败",
236
+ zIndex: 3200,
237
+ time: 2000,
238
+ isClose: false,
239
+ });
240
+ this.disabled = false;
241
+ if (this.timeer) {
242
+ clearTimeout(this.timeer);
243
+ }
244
+ return;
245
+ }
246
+ this.time++;
247
+ this.timeer = setTimeout(() => {
248
+ this.getResult();
249
+ if (this.time > 5)
250
+ this.$xdLog.setARMSInfo(
251
+ { message: "领取中" },
252
+ `pay_${res.status_type}`
253
+ );
254
+ }, Math.pow(this.date, this.time > this.maxTime ? this.maxTime : this.time) * 1000);
255
+ })
256
+ .catch((err) => {
257
+ this.$xdHideLoading();
258
+ console.log(err, "err");
259
+ });
260
+ },
261
+ getContent() {
262
+ jfbRootExec("getListBaseNewsContentCoupon", {
263
+ vm: this,
264
+ data: {
265
+ page_id: this.pageAttr["page_id"], //页面ID
266
+ container_id: this.containerId, //组件ID
267
+ limit: 1,
268
+ },
269
+ })
270
+ .then((res) => {
271
+ console.log(res, "ajajajajaj");
272
+ if (res.list.length > 0) {
273
+ this.notice = res.list[0].content;
274
+ }
275
+ })
276
+ .catch((error) => {
277
+ console.error(error);
278
+ });
279
+ },
280
+ onJfbLoad(options) {
281
+ console.log(this.pageBusinessCode, "pageNamespace");
282
+ this.activity_id = options.activity_id;
283
+ this.method = options.distribution_method
284
+ ? options.distribution_method
285
+ : "entry";
286
+ this.getContent();
287
+ this.getList();
288
+ },
289
+
290
+ onJfbShow() {
291
+ if (this.timeer) {
292
+ clearTimeout(this.timeer);
293
+ }
294
+ this.time = 0;
295
+ if (this.order_num) this.getResult();
296
+ },
297
+
298
+ onJfbUnload() {
299
+ if (this.timeer) {
300
+ clearTimeout(this.timeer);
301
+ }
302
+ },
303
+
304
+ onJfbBack(options) {
305
+ if (this.timeer) {
306
+ clearTimeout(this.timeer);
307
+ }
308
+ if (this.$configProject.isPreview) return;
309
+ this.$xdUniHelper.navigateBack();
310
+ },
311
+ },
312
+ };
313
+ </script>
314
+
315
+ <style scoped lang="less">
316
+ @import "./JfbBaseConListLess.less";
317
+
318
+ .jfb-base-con-list {
319
+ &__body {
320
+ position: relative;
321
+ &-header {
322
+ height: unit(600, rpx);
323
+ & > image {
324
+ width: 100%;
325
+ height: 100%;
326
+ }
327
+ }
328
+ &-content {
329
+ border-radius: unit(20, rpx);
330
+ background: #fff;
331
+ padding: unit(40, rpx);
332
+ position: absolute;
333
+ top: unit(164, rpx);
334
+ left: 50%;
335
+ transform: translateX(-50%);
336
+ width: unit(600, rpx);
337
+
338
+ &-header {
339
+ display: flex;
340
+ justify-content: space-between;
341
+ align-items: center;
342
+
343
+ &-left {
344
+ display: flex;
345
+ align-items: center;
346
+ font-size: unit(32, rpx);
347
+ & > view:first-child {
348
+ width: unit(8, rpx);
349
+ height: unit(36, rpx);
350
+ border-radius: unit(4, rpx);
351
+ margin-right: unit(20, rpx);
352
+ }
353
+ }
354
+
355
+ &-right {
356
+ display: flex;
357
+ font-size: unit(24, rpx);
358
+ padding: unit(8, rpx) unit(16, rpx);
359
+ border-radius: unit(24, rpx);
360
+ }
361
+ }
362
+
363
+ &-list {
364
+ margin-top: unit(20, rpx);
365
+
366
+ &-item {
367
+ margin-top: unit(20, rpx);
368
+ display: flex;
369
+ justify-content: space-between;
370
+ align-items: center;
371
+ padding: unit(20, rpx) unit(30, rpx);
372
+ border-radius: unit(12, rpx);
373
+ &-left {
374
+ display: flex;
375
+
376
+ &-info {
377
+ padding: unit(20, rpx) unit(36, rpx);
378
+ & > view:first-child {
379
+ font-size: unit(44, rpx);
380
+ font-weight: 500;
381
+ margin-bottom: unit(36, rpx);
382
+ }
383
+ & > view:nth-child(2) {
384
+ font-size: unit(28, rpx);
385
+ color: #fff;
386
+ }
387
+ }
388
+
389
+ &-num {
390
+ margin-left: unit(24, rpx);
391
+ margin-top: unit(10, rpx);
392
+ & > view:first-child {
393
+ font-size: unit(40, rpx);
394
+ margin-bottom: unit(16, rpx);
395
+ }
396
+ & > view:nth-child(2) {
397
+ font-size: unit(28, rpx);
398
+ }
399
+ }
400
+ }
401
+ }
402
+ }
403
+ }
404
+ .bottom_btn {
405
+ position: fixed;
406
+ width: 100%;
407
+ display: flex;
408
+ justify-content: center;
409
+ align-items: center;
410
+ height: unit(120, rpx);
411
+ background: #ffffff;
412
+ }
413
+ }
414
+ }
415
+ </style>
@@ -0,0 +1,80 @@
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-con-list {
16
+ border: 1px dashed rgba(0, 0, 0, 0);
17
+ box-sizing: border-box;
18
+ min-height: unit(50, rpx);
19
+
20
+ &__body{
21
+ position: relative;
22
+ overflow: hidden;
23
+ z-index: 2
24
+ }
25
+
26
+ &.editx {
27
+ position: relative;
28
+ border: 1px dashed blue;
29
+ box-sizing: border-box;
30
+ z-index: 3
31
+
32
+ }
33
+
34
+ &:hover {
35
+ border: 1px dashed blue;
36
+ }
37
+
38
+ &.noBorder {
39
+ border-color: rgba(0,0,0,0);
40
+ border-width: 0;
41
+ }
42
+
43
+
44
+ &__edit {
45
+ cursor: pointer;
46
+ position: absolute;
47
+ right: unit(0, rpx);
48
+ top: unit(-52, rpx);
49
+ height: unit(50, rpx);
50
+ line-height: unit(50, rpx);
51
+ display: flex;
52
+ justify-content: center;
53
+ align-items: center;
54
+ background: rgba(0, 0, 0, .6);
55
+ border-radius: unit(10, rpx);
56
+ box-shadow: 0 0 10px rbga(0, 0, 0, 0.3);
57
+ color: #fff;
58
+ font-size: unit(22, rpx);
59
+
60
+ &-icon{
61
+ padding: 0 unit(20, rpx);
62
+ }
63
+
64
+ &.editx {
65
+ box-sizing: border-box;
66
+
67
+ }
68
+ }
69
+ }
70
+ //end
71
+
72
+
73
+ /**notPreview**/
74
+ .jfb-base-con-list {
75
+ &:before {
76
+ content: " ";
77
+ display: table;
78
+ }
79
+ }
80
+ /**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-con-list'
20
+ }
21
+ },
22
+ created() {
23
+
24
+ //@AttrDataCreated
25
+ this.Attr = this.$xdUniHelper.customClone(Attr);
26
+ //@EndAttrDataCreated
27
+
28
+
29
+ },
30
+ }
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ getCouponList: {
5
+ "list": [
6
+ {
7
+ "prize_id": 25,
8
+ "prize_name": "满100减1",
9
+ "prize_num": 23
10
+ }
11
+ ],
12
+ "background": "//sandbox-img.jufubao.cn/uploads/20231123/4767f11be07185af4d31c657812dd96f.jpg",
13
+ "app_coupon_url": "//sandbox-img.jufubao.cn/uploads/20231123/9709c60e75753585d7bab94699ce1d96.jpg",
14
+ "request_id": "60417690eab2c156"
15
+ },
16
+ getAllCoupon: {
17
+ "request_id": "5987aa28c709d4ef"
18
+ }
19
+ }
@@ -400,6 +400,11 @@ export default {
400
400
  this.isPreview = this.$configProject.isPreview;
401
401
  this.init(this.container);
402
402
  },
403
+ destroyed() {
404
+ if (this.timeer) {
405
+ clearTimeout(this.timeer);
406
+ }
407
+ },
403
408
  methods: {
404
409
 
405
410
  onJfbLoad(options) {
@@ -639,12 +644,6 @@ export default {
639
644
  }
640
645
  },
641
646
 
642
- destroyed() {
643
- if (this.timeer) {
644
- clearTimeout(this.timeer);
645
- }
646
- },
647
-
648
647
  /**
649
648
  * @description 页面返回按钮
650
649
  * @param options