jufubao-base 1.0.197-beta3 → 1.0.197-beta5

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,453 @@
1
+ <template>
2
+ <view
3
+ class="jfb-base-header-elephant"
4
+ @click="handleEditxSelect"
5
+ :class="{ editx : isEditx && active }"
6
+ >
7
+ <!--#ifdef H5-->
8
+ <view
9
+ class="jfb-base-header-elephant__edit"
10
+ :class="{ editx : isEditx && active }"
11
+ v-if="isEditx && active"
12
+ >
13
+ <view class="jfb-base-header-elephant__edit-icon" @click="delEdit">删除</view>
14
+ </view>
15
+ <!-- #endif -->
16
+ <view class="jfb-base-header-elephant__body">
17
+ <view class="box_wrap">
18
+ <view class="box_cont" :style="[boxContStyle]">
19
+ <view class="box_l">
20
+ <view class="box_logo">
21
+ <image v-if="showLogoType==='self' && selfLogo" :src="selfLogo" mode="heightFix" />
22
+ <image v-if="showLogoType==='default'" :src="site_logo" mode="heightFix" />
23
+ </view>
24
+ <view v-if="showSiteName==='Y'"
25
+ class="box_site_name"
26
+ :style="[siteNameFont]"
27
+ >{{ site_name }}</view>
28
+ </view>
29
+ <view v-if="showCategory === 'Y'" class="box_r" @click="isExtendCate=!isExtendCate">
30
+ <xd-font-icon :icon=" categoryIcon || 'iconfenlei1'" :color="siteNameFont.color"></xd-font-icon>
31
+ </view>
32
+ </view>
33
+ <view v-if="isExtendCate && showCategory==='Y'" class="cate_pop" :style="[catePopBoxStyle]">
34
+ <view class="cate_list" :style="[cateListBoxStyle]">
35
+ <view class="cate_item"
36
+ v-for="(item, i) in cateList" :key="i"
37
+ :style="[cateItemBoxStyle]"
38
+ @click="handleClick(item)"
39
+ >
40
+ <view class="cate_img" :style=[cateIconStyle]>
41
+ <image :src="item.image_url" mode="aspectFill" />
42
+ </view>
43
+ <view class="cate_name">{{item.content_name}}</view>
44
+ </view>
45
+ </view>
46
+ </view>
47
+
48
+ </view>
49
+ <view v-if="isExtendCate && showCategory==='Y'" class="_modal"></view>
50
+ </view>
51
+ </view>
52
+ </template>
53
+
54
+ <script>
55
+ import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
56
+ import { jfbRootExec } from "@/utils/xd.event";
57
+ import JfbBaseHeaderElephantMixin from "./JfbBaseHeaderElephantMixin";
58
+ import { getContainerPropsValue } from "@/utils/xd.base";
59
+ import componentsMixins from "@/mixins/componentsMixins";
60
+ import extsMixins from "@/mixins/extsMixins";
61
+ import getServiceUrl from '@/common/getServiceUrl'
62
+ export default {
63
+ name: "JfbBaseHeaderElephant",
64
+ components: {
65
+ XdFontIcon
66
+ },
67
+ mixins: [
68
+ componentsMixins, extsMixins, JfbBaseHeaderElephantMixin
69
+ ],
70
+ data() {
71
+ return {
72
+ useNumber: 24,
73
+ cateList: [],
74
+ site_logo: "",
75
+ site_name: "",
76
+ isPreview: false,
77
+ isExtendCate: false,
78
+ //todo
79
+
80
+ showLogoType: "default",
81
+ selfLogo: "",
82
+ showSiteName: "",
83
+ showCategory: "",
84
+ categoryIcon: "",
85
+ bgColor: "",
86
+ siteNameFont: {},
87
+ navColumn: "",
88
+ navRow: "",
89
+ navPadding: "",
90
+ iconWidth: "",
91
+ iconHeight: "",
92
+ navBgColor: "",
93
+ navFontColor: "",
94
+ navColumnGap: "",
95
+ navRowGap: "",
96
+ navExpand: "",
97
+ iconMargin: "",
98
+ navRadius: "",
99
+ navShadow: "",
100
+ }
101
+ },
102
+ computed: {
103
+ boxContStyle(){
104
+ return {
105
+ backgroundColor: this.bgColor,
106
+ }
107
+ },
108
+ cateListBoxStyle(){
109
+ let padding = `${this.checkValue(this.navPadding.top, 20)}rpx`;
110
+ padding = `${padding} ${this.checkValue(this.navPadding.right, 20)}rpx`;
111
+ padding = `${padding} ${this.checkValue(this.navPadding.bottom, 20)}rpx`;
112
+ padding = `${padding} ${this.checkValue(this.navPadding.left, 20)}rpx`;
113
+ return {
114
+ gridTemplateColumns: `repeat(${this.navColumn}, 1fr)`,
115
+ columnGap: `${this.navColumnGap}rpx`,
116
+ rowGap: `${this.navRowGap}rpx`,
117
+ padding: padding
118
+ }
119
+ },
120
+ cateItemBoxStyle(){
121
+ return {
122
+ backgroundColor: this.navBgColor,
123
+ color: this.navFontColor
124
+ }
125
+ },
126
+ cateIconStyle(){
127
+ let margin = `${this.checkValue(this.iconMargin.top, 0)}rpx`;
128
+ margin = `${margin} ${this.checkValue(this.iconMargin.right, 0)}rpx`;
129
+ margin = `${margin} ${this.checkValue(this.iconMargin.bottom, 0)}rpx`;
130
+ margin = `${margin} ${this.checkValue(this.iconMargin.left, 0)}rpx`;
131
+ return {
132
+ width: `${this.checkValue(this.iconWidth, 100)}rpx`,
133
+ height: `${this.checkValue(this.iconHeight, 100)}rpx`,
134
+ margin: margin,
135
+ borderRadius: this.navRadius + 'rpx',
136
+ boxShadow: this.navShadow
137
+ }
138
+ },
139
+ catePopBoxStyle(){
140
+ let position = 'absolute';
141
+ if(this.isPreview) position = 'relative';
142
+ return {
143
+ position: position,
144
+ }
145
+ }
146
+ },
147
+ watch: {
148
+ container(value, oldValue) {
149
+ if (JSON.stringify(value) === JSON.stringify(oldValue)) return;
150
+ if (this.$configProject['isPreview']) this.init(value)
151
+ },
152
+ },
153
+ created() {
154
+ this.init(this.container);
155
+ this.site_logo = getServiceUrl(this.projectAttr["site_logo"], "size3");
156
+ this.site_name = this.projectAttr["site_name"];
157
+ this.isPreview = this.$configProject['isPreview'];
158
+ //todo
159
+ },
160
+ methods: {
161
+ onJfbLoad(options) {
162
+
163
+ jfbRootExec('getListPosterContent', {
164
+ vm: this,
165
+ data: {
166
+ page_id: this.pageAttr['page_id'], //页面ID
167
+ container_id: this.containerId, //组件ID
168
+ page_size: this.useNumber //可以不传
169
+ },
170
+ }).then(res => {
171
+
172
+ if(res.list.length === 0 && this.isPreview) {
173
+ res.list = this.getTestData();
174
+ }
175
+ this.handleOne(res.list);
176
+ })
177
+ },
178
+ /**
179
+ * @description 监听事件变化
180
+ * @param container {object} 业务组件对象自己
181
+ */
182
+ init(container) {
183
+ this.showLogoType = getContainerPropsValue(container, 'content.showLogoType', 'default');
184
+ this.selfLogo = getServiceUrl(getContainerPropsValue(container, 'content.selfLogo', {url: ""}).url);
185
+ this.showSiteName = getContainerPropsValue(container, 'content.showSiteName', 'Y');
186
+ this.showCategory = getContainerPropsValue(container, 'content.showCategory', 'Y');
187
+ this.categoryIcon = getContainerPropsValue(container, 'content.categoryIcon', '');
188
+ this.bgColor = getContainerPropsValue(container, 'content.bgColor', '');
189
+ this.siteNameFont = getContainerPropsValue(container, 'content.siteNameFont', {});
190
+ this.navColumn = getContainerPropsValue(container, 'content.navColumn', 4);
191
+ this.navPadding = getContainerPropsValue(container, 'content.navPadding', {});
192
+ this.navRow = getContainerPropsValue(container, 'content.navRow', 2);
193
+ this.iconWidth = getContainerPropsValue(container, 'content.iconWidth', 100);
194
+ this.iconHeight = getContainerPropsValue(container, 'content.iconHeight', 100);
195
+ this.navBgColor = getContainerPropsValue(container, 'content.navBgColor', '');
196
+ this.navFontColor = getContainerPropsValue(container, 'content.navFontColor', '');
197
+ this.navColumnGap = getContainerPropsValue(container, 'content.navColumnGap', 10);
198
+ this.navRowGap = getContainerPropsValue(container, 'content.navRowGap', 10);
199
+ this.navExpand = getContainerPropsValue(container, 'content.navExpand', '');
200
+ this.iconMargin = getContainerPropsValue(container, 'content.iconMargin', {});
201
+ this.navRadius = getContainerPropsValue(container, 'content.navRadius', 0);
202
+ let navShadow = getContainerPropsValue(container, 'content.navShadow', '');
203
+ if(navShadow.type === "Y" && navShadow.value){
204
+ this.navShadow = `0 0 ${navShadow.value.width}rpx ${navShadow.value.color}`;
205
+ }else{
206
+ this.navShadow = 'none';
207
+ }
208
+ console.log("navShadow", this.navShadow);
209
+
210
+ this.useNumber = this.navRow * this.navColumn;
211
+ if(this.isPreview){
212
+ this.handleOne(this.getTestData());
213
+ this.isExtendCate = this.navExpand === 'Y' ? true : false;
214
+ if(this.isExtendCate){
215
+ document.querySelector('.xd-Layout__top').style.zIndex = 149099;
216
+ }else{
217
+ document.querySelector('.xd-Layout__top').style.zIndex = 1490;
218
+ }
219
+ }
220
+ },
221
+ handleClick(item) {
222
+ if(!item.redirect_data) {
223
+ console.warn(`未配置链接地址: ${item.redirect_data}`);
224
+ console.error(`未配置链接地址: ${item.redirect_data}`);
225
+ return
226
+ }
227
+
228
+ //内部链接跳转地址
229
+ if (item.redirect_type === 'INN') {
230
+ try {
231
+ let url = JSON.parse(item.redirect_data);
232
+ let params = '';
233
+ if(url.page) {
234
+ if (item['redirect_params']) params = `?${item['redirect_params']}`;
235
+ this.$xdUniHelper.navigateTo({url: url.page + params})
236
+ }
237
+ else {
238
+ console.error(`应用链接配置错误: ${url.page}`)
239
+ }
240
+ } catch (e) {
241
+ console.error(`应用链接配置错误: ${item.redirect_data}`)
242
+ }
243
+ }
244
+
245
+ //外部链接
246
+ if (item.redirect_type === 'URL') {
247
+ let reg = /^(http:\/\/|https:\/\/|\/\/)+.+$/;
248
+ let spReg = /(-apiuri\/v)/;
249
+ //#ifdef MP-WEIXIN
250
+ try {
251
+ let url = JSON.parse(item.redirect_data);
252
+ if (reg.test(url.url) || spReg.test(url.url)) {
253
+ console.warn(`广告跳转外站: ${url.url}`)
254
+ this.$xdUniHelper.navigateTo(url);
255
+ } else {
256
+ console.error(`广告跳转外站配置错误: ${url.url}`)
257
+ }
258
+ } catch (e) {
259
+ console.error(`广告跳转外站配置错误: ${item.redirect_data}`)
260
+ }
261
+ //#endif
262
+ //#ifdef H5
263
+ try {
264
+ let url = JSON.parse(item.redirect_data);
265
+ console.warn(`广告跳转外站: ${url.url}`);
266
+ this.$xdUniHelper.redirectTo(url, false)
267
+ } catch (e) {
268
+ console.error(`广告跳转外站配置错误: ${item.redirect_data}`)
269
+ }
270
+ //#endif
271
+
272
+ }
273
+
274
+ //无跳转地址
275
+ if(item.redirect_type === 'EMP') {
276
+ console.warn(`无跳转地址`);
277
+ }
278
+ },
279
+ handleImage(list){
280
+ list = this.filterItem(list);
281
+
282
+ return list.map((item,index) => {
283
+ return {
284
+ ...item,
285
+ image_background_url: item.image_background_url?getServiceUrl(item.image_background_url):'',
286
+ image_url: item.image_url?getServiceUrl(item.image_url):''
287
+ }
288
+ })
289
+ },
290
+ handleOne(list){
291
+ this.cateList = this.handleImage(list);
292
+
293
+ //轮播图记录为0条处理
294
+ if( this.cateList.length === 0) return
295
+ let current = this.current || 0;
296
+ this.currentImage = this.cateList[current]['image_background_url']
297
+ },
298
+ getTestData(){
299
+ let temp = [];
300
+ for (let i = 0; i< this.useNumber; i++) {
301
+ let item = this.$xdUniHelper.cloneDeep(this['posterTest']);
302
+ item.content_id = i;
303
+ item.content_name = item.content_name + i;
304
+ item.image_url = `//dummyimage.com/${this.iconWidth}x${this.iconHeight}`;
305
+ temp.push(item)
306
+ }
307
+ return temp
308
+ },
309
+ /**
310
+ * @description 过滤不可以用
311
+ * 当前项目未H5时,过滤所有小程序应用
312
+ * 当前项目未小程序时,过滤所有非当前小程序应用
313
+ * 站外地址直接返回
314
+ * 站内地址未选值直接返回
315
+ * 预览模式全过
316
+ */
317
+ filterItem(list){
318
+ let content = list.filter(item=>{
319
+ //预览模式
320
+ if( this.$configProject.isPreview) return true;
321
+
322
+ //非内部应用
323
+ if(item.redirect_type !== 'INN') return true
324
+
325
+ //没有配置链接
326
+ if(!item.redirect_data) return true;
327
+
328
+ //内部应用
329
+ else {
330
+ let redirect_data;
331
+ try {
332
+ redirect_data = JSON.parse(item.redirect_data);
333
+ if(!item['app_type']) item['app_type']= 'h5';
334
+
335
+ //#ifdef H5
336
+ return item['app_type'] !== 'wxmp';
337
+ //#endif
338
+
339
+ //#ifdef MP-WEIXIN
340
+ let actDir = this.$parent.projectAttr.deploy_dir;
341
+ let dir = this.getPathDir(redirect_data.page);
342
+ if(item['app_type'] === 'wxmp'){
343
+ return actDir === dir;
344
+ }
345
+ else if(item['app_type'] === 'h5') return true;
346
+ else return true
347
+ //#endif
348
+ }
349
+ catch (e) {
350
+ return true
351
+ }
352
+ }
353
+ });
354
+ console.warn(`PostersList:${JSON.stringify(content.map(item=>`${item.app_type}:${item.content_name}:${item.redirect_data}`), null,2)}`)
355
+ return content;
356
+
357
+ },
358
+ onJfbScroll(options) {
359
+ // console.log('event.onJfbScroll', options)
360
+ },
361
+ onJfbReachBottom(options) {
362
+ console.log('event.onJfbReachBottom', options)
363
+ },
364
+ onJfbShow(options) {
365
+ console.log('event.onJfbShow', options)
366
+ this.onJfbLoad(options);
367
+ },
368
+ onJfbHide(options) {
369
+ console.log('event.onJfbHide', options)
370
+ },
371
+ onJfbBack(options) {
372
+ console.log('event.onJfbBack', options)
373
+ },
374
+ onJfbUpdate(...data) {
375
+ console.log('event.onJfbUpdate', data)
376
+ },
377
+ onJfbCustomEvent(options) {
378
+ console.log('event.onJfbReachBottom', options)
379
+ },
380
+ }
381
+ }
382
+
383
+ </script>
384
+
385
+ <style scoped lang="less">
386
+ @import "./JfbBaseHeaderElephantLess.less";
387
+
388
+ .jfb-base-header-elephant {
389
+ &__body{
390
+ ._modal{
391
+ position: fixed;
392
+ top: 0;
393
+ left: 0;
394
+ width: 100vh;
395
+ height: 100vh;
396
+ background: rgba(0, 0, 0, .5);
397
+ z-index: 999;
398
+ }
399
+ .box_wrap{
400
+ position: relative;
401
+ z-index: 1000;
402
+ .cate_pop{
403
+ top: 100%;
404
+ left: 0;
405
+ width: 100%;
406
+ z-index: 11;
407
+ background: #FFFFFF;
408
+ }
409
+ }
410
+ .box_cont{
411
+ display: flex;
412
+ align-items: center;
413
+ justify-content: space-between;
414
+ padding: 20rpx;
415
+ .box_l{
416
+ display: flex;
417
+ align-items: center;
418
+ }
419
+ .box_logo{
420
+ //width: 72rpx;
421
+ height: 72rpx;
422
+ image{
423
+ // width: 100%;
424
+ height: 100%;
425
+ }
426
+ }
427
+ .box_site_name{
428
+ margin-left: 20rpx;
429
+ }
430
+ }
431
+ .cate_list{
432
+ display: grid;
433
+ justify-items: center;
434
+ .cate_item{
435
+ width: 100%;
436
+ display: flex;
437
+ flex-direction: column;
438
+ align-items: center;
439
+ justify-content: center;
440
+ .cate_img{
441
+ width: 100rpx;
442
+ height: 100rpx;
443
+ overflow: hidden;
444
+ image{
445
+ width: 100%;
446
+ height: 100%;
447
+ }
448
+ }
449
+ }
450
+ }
451
+ }
452
+ }
453
+ </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-header-elephant {
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-header-elephant {
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-header-elephant'
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
+ aa: {}
5
+ }
@@ -275,6 +275,32 @@ export default {
275
275
  { label: '否', value: 'N' },
276
276
  ]
277
277
  },
278
+ {
279
+ label: "按钮长度:",
280
+ ele: "el-input",
281
+ valueKey: "btnConfirmWidth",
282
+ value: data['btnConfirmWidth'] || '',
283
+ placeholder: '请输入按钮长度',
284
+ className: 'input60',
285
+ groupKey: "content",
286
+ },
287
+ {
288
+ label: "按钮背景颜色:",
289
+ ele: "xd-color",
290
+ valueKey: "btnConfirmBgColor",
291
+ groupKey:'content',
292
+ value: data['btnConfirmBgColor'] || '',
293
+ placeholder: '请选择按钮背景颜色',
294
+ groupKey: "content",
295
+ },
296
+ {
297
+ label: "按钮文字颜色:",
298
+ ele: "xd-color",
299
+ valueKey: "btnConfirmTextColor",
300
+ groupKey:'content',
301
+ value: data['btnConfirmTextColor'] || '',
302
+ placeholder: '请选择按钮文字颜色',
303
+ },
278
304
  {
279
305
  ele: 'title',
280
306
  label: '静态显示',
@@ -220,7 +220,11 @@
220
220
  backgroundColor: '',
221
221
  is_hide_dailog:'N',
222
222
 
223
- isMp:false
223
+ isMp:false,
224
+
225
+ btnConfirmWidth: "",
226
+ btnConfirmBgColor: "",
227
+ btnConfirmTextColor: "",
224
228
  }
225
229
  },
226
230
  watch: {
@@ -330,11 +334,16 @@
330
334
  this.scrollMargin = getContainerPropsValue(container, 'content.scrollMargin', {});
331
335
  this.radius = getContainerPropsValue(container, 'content.radius', 0);
332
336
  this.fontSize = Number(getContainerPropsValue(container, 'content.fontSize', '20'));
337
+ this.btnConfirmWidth = getContainerPropsValue(container, 'content.btnConfirmWidth', '');
338
+ this.btnConfirmBgColor = getContainerPropsValue(container, 'content.btnConfirmBgColor', '');
339
+ this.btnConfirmTextColor = getContainerPropsValue(container, 'content.btnConfirmTextColor', '');
333
340
  if (this.fontSize === 20) this.titleFontSize = 28;
334
341
  if (this.fontSize === 26) this.titleFontSize = 36;
335
342
  if (this.fontSize === 36) this.titleFontSize = 44;
336
343
  this.isTitle = getContainerPropsValue(container, 'content.isTitle', false);
337
344
 
345
+ console.log("this.btnConfirmTextColor", this.btnConfirmTextColor);
346
+
338
347
  if(this.style === '2') {
339
348
  this.num = getContainerPropsValue(container, 'content.num', 1);
340
349
  //#ifdef H5
@@ -358,6 +367,9 @@
358
367
  isHtml: true,
359
368
  zIndex: 2000,
360
369
  cancel: false,
370
+ btnConfirmWidth: this.btnConfirmWidth,
371
+ btnConfirmBgColor: this.btnConfirmBgColor,
372
+ btnConfirmTextColor: this.btnConfirmTextColor,
361
373
  });
362
374
  },
363
375
 
@@ -209,7 +209,7 @@
209
209
  class="jfb-base-order-detail__body-delivery-bottom"
210
210
  v-if="item.info && item.info.length > 0"
211
211
  >
212
- <view class="jfb-base-order-detail__body-delivery-bottom-title">{{item.service_name}}</view>
212
+ <view class="jfb-base-order-detail__body-delivery-bottom-title">配送信息</view>
213
213
  <view
214
214
  v-for="(Ditem, Dindex) in item.info"
215
215
  :key="Dindex"