jufubao-base 1.0.66 → 1.0.67-beta200

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-beta200",
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,47 @@
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
+ ].filter(i=>i)
45
+ },
46
+ advanced: [],
47
+ };
@@ -0,0 +1,290 @@
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
+ <xd-font-icon
27
+ @click="handleClose"
28
+ class="jfb-base-con-dialog__body-dialog-content-close"
29
+ icon="iconguanbi_xian"
30
+ color="#fff"
31
+ size="64"
32
+ ></xd-font-icon>
33
+ <view
34
+ @click="handleChange('left')"
35
+ v-if="this.type === 2 && this.currentIndex !== 0"
36
+ class="jfb-base-con-dialog__body-dialog-content-left"
37
+ >
38
+ <xd-font-icon icon="iconxiangzuo_xian"></xd-font-icon>
39
+ </view>
40
+ <view
41
+ v-if="this.type === 2 && this.currentIndex !== list.length - 1"
42
+ @click="handleChange('right')"
43
+ class="jfb-base-con-dialog__body-dialog-content-right"
44
+ >
45
+ <xd-font-icon icon="iconxiangyou_xian"></xd-font-icon>
46
+ </view>
47
+ <view class="jfb-base-con-dialog__body-dialog-content-image">
48
+ <image :src="currentImage"></image>
49
+ <image @click="handleToList" :src="currentBtnImage"></image>
50
+ </view>
51
+ </view>
52
+ </view>
53
+ </view>
54
+ </view>
55
+ </template>
56
+
57
+ <script>
58
+ import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
59
+ import XdButton from "@/components/XdButton/XdButton";
60
+ import { jfbRootExec, JfbEvent } from "@/utils/xd.event";
61
+ import JfbBaseConDialogMixin from "./JfbBaseConDialogMixin";
62
+ import componentsMixins from "@/mixins/componentsMixins";
63
+ import extsMixins from "@/mixins/extsMixins";
64
+ import { getContainerPropsValue } from "@/utils/xd.base";
65
+ import getServiceUrl from "@/common/getServiceUrl";
66
+ import XdDailog from "@/components/XdDailog/XdDailog";
67
+ import XdContentXss from "@/components/XdContentXss/XdContentXss";
68
+ import colorCardMixins from "@/mixins/colorCardMixins";
69
+ const Color = require("color");
70
+ import { mapState } from "vuex";
71
+ import storage from "@/common/storage";
72
+
73
+ export default {
74
+ name: "JfbBaseConDialog",
75
+ components: {
76
+ XdFontIcon,
77
+ XdButton,
78
+ XdDailog,
79
+ XdContentXss,
80
+ },
81
+ mixins: [componentsMixins, extsMixins, JfbBaseConDialogMixin],
82
+ data() {
83
+ return {
84
+ list_url: "",
85
+ list: [],
86
+ currentImage: "",
87
+ currentBtnImage: "",
88
+ currentIndex: 0,
89
+ isShow: false,
90
+ type: "",
91
+ isPreview: false, //是否预览
92
+ activity_id: "",
93
+ };
94
+ },
95
+ computed: {
96
+ ...mapState(["xnamespace"]),
97
+ },
98
+ watch: {
99
+ container(value) {
100
+ console.log(value, "aakakakkaka");
101
+ this.init(value);
102
+ },
103
+ },
104
+ created() {
105
+ this.isPreview = this.$configProject.isPreview;
106
+ if (this.isPreview) {
107
+ this.isShow = true;
108
+ return;
109
+ }
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.time = Number(getContainerPropsValue(value, "content.time", 3));
119
+ },
120
+ getDialogList() {
121
+ jfbRootExec("getCouponDialogList", {
122
+ vm: this,
123
+ data: {
124
+ namespace: this.xnamespace,
125
+ },
126
+ })
127
+ .then((res) => {
128
+ console.log(res, "resresres");
129
+ this.list = res.list;
130
+ this.currentImage = getServiceUrl(
131
+ this.list[this.currentIndex].app_activity_url
132
+ );
133
+ this.currentBtnImage = getServiceUrl(
134
+ this.list[this.currentIndex].app_activity_button
135
+ );
136
+ this.activity_id = this.list[this.currentIndex].activity_id;
137
+ this.handlePop();
138
+ })
139
+ .catch((err) => {
140
+ console.log(err, "err");
141
+ });
142
+ },
143
+ handlePop() {
144
+ console.log("this.time", this.time * 60 + "分钟");
145
+ storage.set(this.containerId, 1, this.time);
146
+ this.isShow = true;
147
+ },
148
+ onJfbLoad(options) {
149
+ console.log(11111);
150
+ try {
151
+ this.setNameSpace(options);
152
+ if (!storage.get(this.containerId)) this.getDialogList();
153
+ } catch (error) {
154
+ console.log(error, "errorerror");
155
+ }
156
+ },
157
+ onJfbUpdate(data) {
158
+ storage.remove(this.containerId);
159
+ this.getDialogList();
160
+ },
161
+ handleToList() {
162
+ this.$xdUniHelper.navigateTo({
163
+ url: `${this.list_url}?activity_id=${this.activity_id}`,
164
+ });
165
+ },
166
+ handleClose() {
167
+ //切换下一张,没有下一张,关闭
168
+ if (this.currentIndex == this.list.length - 1 || this.type == 2) {
169
+ this.isShow = false;
170
+ return;
171
+ }
172
+ this.currentIndex = this.currentIndex + 1;
173
+ this.currentImage = getServiceUrl(
174
+ this.list[this.currentIndex].app_activity_url
175
+ );
176
+ this.currentBtnImage = getServiceUrl(
177
+ this.list[this.currentIndex].app_activity_button
178
+ );
179
+ this.activity_id = this.list[this.currentIndex].activity_id;
180
+ },
181
+ handleChange(type) {
182
+ this.currentIndex =
183
+ type === "left" ? this.currentIndex - 1 : this.currentIndex + 1;
184
+ //不小于0,不大于数组长度
185
+ this.currentIndex = Math.max(
186
+ 0,
187
+ Math.min(this.currentIndex, this.list.length - 1)
188
+ );
189
+ this.currentImage = getServiceUrl(
190
+ this.list[this.currentIndex].app_activity_url
191
+ );
192
+ this.currentBtnImage = getServiceUrl(
193
+ this.list[this.currentIndex].app_activity_button
194
+ );
195
+ this.activity_id = this.list[this.currentIndex].activity_id;
196
+ },
197
+ },
198
+ };
199
+ </script>
200
+
201
+ <style scoped lang="less">
202
+ @import "./JfbBaseConDialogLess.less";
203
+
204
+ .jfb-base-con-dialog {
205
+ &__body {
206
+ &-dialog {
207
+ position: fixed;
208
+ top: 0;
209
+ bottom: 0;
210
+ left: 0;
211
+ right: 0;
212
+ z-index: 2000;
213
+
214
+ &-mask {
215
+ position: absolute;
216
+ top: 0;
217
+ bottom: 0;
218
+ left: 0;
219
+ right: 0;
220
+ background: rgba(0, 0, 0, 0.5);
221
+ }
222
+
223
+ &-content {
224
+ &-num {
225
+ position: absolute;
226
+ top: 16%;
227
+ right: 50%;
228
+ z-index: 3000;
229
+ transform: translateX(50%);
230
+ background: rgba(255, 255, 255, 0.5);
231
+ border-radius: unit(40, rpx);
232
+ padding: unit(8, rpx) unit(24, rpx);
233
+ color: #fff;
234
+ font-size: unit(40, rpx);
235
+ }
236
+ &-close {
237
+ position: absolute;
238
+ bottom: 12%;
239
+ right: 50%;
240
+ z-index: 3000;
241
+ transform: translateX(50%);
242
+ }
243
+ &-left {
244
+ position: absolute;
245
+ top: 50%;
246
+ left: 1%;
247
+ z-index: 3000;
248
+ background: rgba(255, 255, 255, 0.1);
249
+ padding: unit(40, rpx) unit(10, rpx);
250
+ color: #fff;
251
+ border-radius: unit(40, rpx);
252
+ }
253
+ &-right {
254
+ position: absolute;
255
+ top: 50%;
256
+ right: 1%;
257
+ z-index: 3000;
258
+ background: rgba(255, 255, 255, 0.1);
259
+ padding: unit(40, rpx) unit(10, rpx);
260
+ color: #fff;
261
+ border-radius: unit(40, rpx);
262
+ }
263
+ &-image {
264
+ position: absolute;
265
+ top: 50%;
266
+ left: 50%;
267
+ transform: translate(-50%, -50%);
268
+ width: unit(600, rpx);
269
+ height: unit(800, rpx);
270
+ display: flex;
271
+ align-items: center;
272
+ flex-direction: column;
273
+
274
+ & > image:first-child {
275
+ width: 100%;
276
+ height: 100%;
277
+ }
278
+
279
+ & > image:nth-child(2) {
280
+ width: unit(448, rpx);
281
+ height: unit(70, rpx);
282
+ position: absolute;
283
+ bottom: unit(110, rpx);
284
+ }
285
+ }
286
+ }
287
+ }
288
+ }
289
+ }
290
+ </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,47 @@
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
+ ];
@@ -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,319 @@
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
22
+ :src="background"
23
+ ></image>
24
+ </view>
25
+ <view class="jfb-base-con-list__body-content">
26
+ <view class="jfb-base-con-list__body-content-header">
27
+ <view class="jfb-base-con-list__body-content-header-left">
28
+ <view :style="{ backgroundColor: mainColor }"></view>
29
+ <view>赠送优惠券</view>
30
+ </view>
31
+ <view
32
+ :style="{ color: mainColor, background: contentBackground }"
33
+ class="jfb-base-con-list__body-content-header-right"
34
+ @click="showRule = true"
35
+ >
36
+ <text>领券规则</text>
37
+ <xd-font-icon size="20" icon="iconxiangyou_xian"></xd-font-icon>
38
+ </view>
39
+ </view>
40
+ <view class="jfb-base-con-list__body-content-list">
41
+ <view
42
+ v-for="(item, index) in couponList"
43
+ :key="index"
44
+ class="jfb-base-con-list__body-content-list-item"
45
+ :style="{ background: contentBackground }"
46
+ >
47
+ <view class="jfb-base-con-list__body-content-list-item-left">
48
+ <view
49
+ style="
50
+ background: url('https://i.niupic.com/images/2023/11/22/d1bV.webp');
51
+ background-size: 100% 100%;
52
+ background-repeat: no-repeat;
53
+ "
54
+ class="jfb-base-con-list__body-content-list-item-left-info"
55
+ >
56
+ <view :style="{ color: mainColor }">满减券</view>
57
+ <view>{{item.prize_name}}</view>
58
+ </view>
59
+ <view class="jfb-base-con-list__body-content-list-item-left-num">
60
+ <view>{{item.prize_name}}</view>
61
+ <view :style="{ color: mainColor }">X{{item.prize_num}}</view>
62
+ </view>
63
+ </view>
64
+ <view class="jfb-base-con-list__body-content-list-item-right">
65
+ <xd-font-icon
66
+ :style="{ color: disabled ? '#D6D6D6' : mainColor }"
67
+ icon="iconerweima"
68
+ ></xd-font-icon>
69
+ </view>
70
+ </view>
71
+ </view>
72
+ </view>
73
+ <view style="height: 120rpx"></view>
74
+ <view class="bottom_btn" :style="prod_bottom">
75
+ <xd-button
76
+ @click="getCoupont"
77
+ :style="{ backgroundColor: btnBackground }"
78
+ width="60%"
79
+ :type="disabled ? 'info' : 'primary'"
80
+ >一键领取</xd-button
81
+ >
82
+ </view>
83
+ <xd-dailog
84
+ :cancel="false"
85
+ :confirm="false"
86
+ title="活动规则说明"
87
+ :show.sync="showRule"
88
+ >
89
+ <xd-content-xss :html="notice"></xd-content-xss>
90
+ </xd-dailog>
91
+ </view>
92
+ </view>
93
+ </template>
94
+
95
+ <script>
96
+ import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
97
+ import XdButton from "@/components/XdButton/XdButton";
98
+ import { jfbRootExec } from "@/utils/xd.event";
99
+ import JfbBaseConListMixin from "./JfbBaseConListMixin";
100
+ import componentsMixins from "@/mixins/componentsMixins";
101
+ import extsMixins from "@/mixins/extsMixins";
102
+ import { getContainerPropsValue } from "@/utils/xd.base";
103
+ import XdDailog from "@/components/XdDailog/XdDailog";
104
+ import XdContentXss from "@/components/XdContentXss/XdContentXss";
105
+ import getServiceUrl from '@/common/getServiceUrl'
106
+ import colorCardMixins from "@/mixins/colorCardMixins";
107
+ import { mapState } from "vuex";
108
+ const Color = require("color");
109
+
110
+ export default {
111
+ name: "JfbBaseConList",
112
+ components: {
113
+ XdFontIcon,
114
+ XdButton,
115
+ XdDailog,
116
+ XdContentXss,
117
+ },
118
+ mixins: [componentsMixins, extsMixins, JfbBaseConListMixin],
119
+ data() {
120
+ return {
121
+ contentBackground: "",
122
+ couponList: [],
123
+ disabled: false,
124
+ notice: "",
125
+ showRule: false,
126
+ btn: "",
127
+ activity_id: '',
128
+ background: ''
129
+ };
130
+ },
131
+ computed: {
132
+ prod_bottom() {
133
+ return this.fixedStyle({ height: 0, zIndex: 111 });
134
+ },
135
+ btnBackground() {
136
+ if (this.disabled) return;
137
+ return this.btn ? this.btn : this.mainColor;
138
+ },
139
+ ...mapState(["xnamespace"]),
140
+ },
141
+ watch: {
142
+ container(value) {
143
+ this.init(value);
144
+ },
145
+ },
146
+ created() {
147
+ this.init(this.container);
148
+ },
149
+ methods: {
150
+ init(value) {
151
+ this.contentBackground = Color(this.mainColor).alpha(0.2).toString();
152
+ },
153
+ getList() {
154
+ jfbRootExec("getCouponList", {
155
+ vm: this,
156
+ data: {
157
+ distribution_method: "entry",
158
+ namespace: this.xnamespace,
159
+ activity_id: this.activity_id
160
+ },
161
+ }).then(res=>{
162
+ this.background = getServiceUrl(res.background)
163
+ this.couponList = res.list
164
+ }).catch(err=>{
165
+ console.log(err,'err');
166
+ })
167
+ },
168
+ getCoupont() {
169
+ jfbRootExec("getAllCoupon", {
170
+ vm: this,
171
+ data: {
172
+ distribution_method: "entry",
173
+ namespace: this.xnamespace,
174
+ activity_id: this.activity_id
175
+ },
176
+ }).then(res=>{
177
+ this.$xdAlert({
178
+ content: "领取成功",
179
+ zIndex: 3200,
180
+ time: 2000,
181
+ isClose: false,
182
+ });
183
+ this.disabled=true
184
+ }).catch(err=>{
185
+ console.log(err,'err');
186
+ })
187
+ },
188
+ getContent() {
189
+ jfbRootExec("getListBaseNewsContentCoupon", {
190
+ vm: this,
191
+ data: {
192
+ page_id: this.pageAttr["page_id"], //页面ID
193
+ container_id: this.containerId, //组件ID
194
+ limit: 1,
195
+ },
196
+ })
197
+ .then((res) => {
198
+ console.log(res, "ajajajajaj");
199
+ if (res.list.length > 0) {
200
+ this.notice = res.list[0].content;
201
+ }
202
+ })
203
+ .catch((error) => {
204
+ console.error(error);
205
+ });
206
+ },
207
+ onJfbLoad(options) {
208
+ this.activity_id = options.activity_id
209
+ this.setNameSpace(options);
210
+ this.getContent();
211
+ this.getList();
212
+ },
213
+
214
+ onJfbCustomEvent(data) {
215
+ console.log("onJfbCustomEvent", data);
216
+ },
217
+ },
218
+ };
219
+ </script>
220
+
221
+ <style scoped lang="less">
222
+ @import "./JfbBaseConListLess.less";
223
+
224
+ .jfb-base-con-list {
225
+ &__body {
226
+ position: relative;
227
+ &-header {
228
+ width: 100%;
229
+ height: unit(600, rpx);
230
+ & > image {
231
+ width: 100%;
232
+ height: 100%;
233
+ }
234
+ }
235
+ &-content {
236
+ border-radius: unit(20, rpx);
237
+ background: #fff;
238
+ padding: unit(40, rpx);
239
+ position: relative;
240
+ top: unit(-340, rpx);
241
+ margin: 0 unit(20, rpx);
242
+
243
+ &-header {
244
+ display: flex;
245
+ justify-content: space-between;
246
+ align-items: center;
247
+
248
+ &-left {
249
+ display: flex;
250
+ align-items: center;
251
+ font-size: unit(32, rpx);
252
+ & > view:first-child {
253
+ width: unit(8, rpx);
254
+ height: unit(36, rpx);
255
+ border-radius: unit(4, rpx);
256
+ margin-right: unit(20, rpx);
257
+ }
258
+ }
259
+
260
+ &-right {
261
+ display: flex;
262
+ font-size: unit(24, rpx);
263
+ padding: unit(8, rpx) unit(16, rpx);
264
+ border-radius: unit(24, rpx);
265
+ }
266
+ }
267
+
268
+ &-list {
269
+ margin-top: unit(20, rpx);
270
+ &-item {
271
+ margin-top: unit(20, rpx);
272
+ display: flex;
273
+ justify-content: space-between;
274
+ align-items: center;
275
+ padding: unit(20, rpx) unit(30, rpx);
276
+ border-radius: unit(12, rpx);
277
+ &-left {
278
+ display: flex;
279
+
280
+ &-info {
281
+ padding: unit(20, rpx) unit(36, rpx);
282
+ & > view:first-child {
283
+ font-size: unit(44, rpx);
284
+ font-weight: 500;
285
+ margin-bottom: unit(36, rpx);
286
+ }
287
+ & > view:nth-child(2) {
288
+ font-size: unit(28, rpx);
289
+ color: #fff;
290
+ }
291
+ }
292
+
293
+ &-num {
294
+ margin-left: unit(24, rpx);
295
+ margin-top: unit(10, rpx);
296
+ & > view:first-child {
297
+ font-size: unit(40, rpx);
298
+ margin-bottom: unit(16, rpx);
299
+ }
300
+ & > view:nth-child(2) {
301
+ font-size: unit(28, rpx);
302
+ }
303
+ }
304
+ }
305
+ }
306
+ }
307
+ }
308
+ .bottom_btn {
309
+ position: fixed;
310
+ width: 100%;
311
+ display: flex;
312
+ justify-content: center;
313
+ align-items: center;
314
+ height: unit(120, rpx);
315
+ background: #ffffff;
316
+ }
317
+ }
318
+ }
319
+ </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
+ }