jufubao-base 1.0.197-beta2 → 1.0.197-beta4

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