jufubao-base 1.0.289-beta1 → 1.0.289-beta11

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.289-beta1",
3
+ "version": "1.0.289-beta11",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件基础插件包",
6
6
  "main": "index.js",
@@ -36,7 +36,7 @@
36
36
 
37
37
  <script>
38
38
  import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
39
- import XdFooterBar from "@/components/XdFooterBar/XdFooterBar";
39
+ import XdFooterBar from "./XdFooterBar";
40
40
  import { jfbRootExec, jfbRootFnExec } from "@/utils/xd.event";
41
41
  import JfbBaseFooterMixin from "./JfbBaseFooterMixin";
42
42
  import componentsMixins from "@/mixins/componentsMixins";
@@ -112,12 +112,13 @@
112
112
  }
113
113
  //#endif
114
114
 
115
- this.height = 96//Number(getComponentAttr(this.componentAttr, 'height'));
115
+ this.height = Number(getComponentAttr(this.componentAttr, 'height'));
116
116
 
117
117
  this.init(this.container);
118
118
 
119
119
  //监听重试消息数量
120
120
  this.$xdRoot.$on('restFooterNumber', this.handle)
121
+
121
122
  },
122
123
  methods: {
123
124
  handle(){
@@ -0,0 +1,324 @@
1
+ <template>
2
+ <view class="xd-footer-bar" :style="[boxStyleComp]">
3
+ <view class="xd-footer-bar__border">
4
+ <view
5
+ v-for="(item,index) in dataList"
6
+ :key="item.key"
7
+ class="xd-footer-bar__item"
8
+ >
9
+ <view
10
+ class="xd-footer-bar__item-badge"
11
+ v-if="item.num"
12
+ :style="[numStyleComp,{padding: item.num === '99+' ? '0 8rpx': '0'}]"
13
+ >{{item.num}}</view>
14
+ <navigator
15
+ class="xd-footer-bar__item-link"
16
+ open-type="redirect"
17
+ :url="view ? '': (item.path + '?' + params)"
18
+ >
19
+ <view class="xd-footer-bar__icon" :class="{noName:!item.name,isCenter:index === isCenterIndex}">
20
+ <view v-if="item.image" class="image">
21
+ <image :src="(activeUrl === getPath(item.path))?item['actImage']:item.image" />
22
+ </view>
23
+ <xd-font-icon
24
+ v-else-if="item.icon"
25
+ :size="(item.size ? item.size * 2 : 36) * nameSizeComp"
26
+ :icon="item.icon"
27
+ :style="{color: (activeUrl === getPath(item.path)) ? iconActColor : iconColor}"
28
+ ></xd-font-icon>
29
+ </view>
30
+ <view v-if="index !== isCenterIndex && item.name" class="xd-footer-bar__text" :style="{color: (activeUrl === getPath(item.path))? nameActColor : nameColor}">{{item.name}}</view>
31
+ </navigator>
32
+ </view>
33
+ </view>
34
+ </view>
35
+ </template>
36
+
37
+ <script>
38
+ import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
39
+ import {
40
+ getPlatformParamsValue,
41
+ getPlatformParamsForGroup
42
+ } from "@/project";
43
+ import storage from "@/common/storage";
44
+ import {
45
+ getParentsStyle,
46
+ } from '@/utils/xd.base';
47
+
48
+ /**
49
+ * XdFooterBar 全局Ui
50
+ * @description 底部功能
51
+ * @tutorial
52
+ * @property {Number} zIndex 层级数字 (可选)
53
+ * @property {Number} height tabBar高度(可选)
54
+ * @property {Boolean} view view显示模式(可选)
55
+ * @property {Object} styles 模版风格(可选)
56
+ * @property {Object} tabbar
57
+ * tabBar.selectedColor {String} tabBar当前选中文字颜色
58
+ * tabBar.bgColor {String} tabBar背景颜色值
59
+ * tabBar.list {Array} tabBar列表
60
+ * tabBar.list.name {String} tabBar文案(4个汉字)
61
+ * tabBar.list.path {String} 链接路径
62
+ * tabBar.list.icon {String} iconfont图标
63
+ */
64
+
65
+ export default {
66
+ name: "XdFooterBar",
67
+ components: {
68
+ XdFontIcon
69
+ },
70
+ props: {
71
+ styles:{
72
+ type: Object,
73
+ default(){
74
+ return {}
75
+ },
76
+ },
77
+ view: {
78
+ type:Boolean,
79
+ default: false,
80
+ },
81
+ zIndex: {
82
+ type: Number,
83
+ default: 1500 //rpx
84
+ },
85
+ tabBar: {
86
+ type: Object,
87
+ required: true
88
+ },
89
+ height: {
90
+ type: Number,
91
+ default: 100 //rpx
92
+ },
93
+ baseUrl: {
94
+ type: String,
95
+ required: true
96
+ }
97
+ },
98
+
99
+ watch:{
100
+ tabBar(){
101
+ this.init();
102
+ }
103
+ },
104
+
105
+ computed:{
106
+ boxStyleComp(){
107
+ return {
108
+ zIndex: this.zIndex,
109
+ height: this.height + 'rpx',
110
+ "--center-border": `${this.centerBorderWidth * this.$rpxNum}px solid ${this.centerBorderColor}`,
111
+ "--center-background-color": this.centerBorderColor
112
+ }
113
+ },
114
+ numStyleComp(){
115
+ return {
116
+ backgroundColor: 'red',
117
+ }
118
+ },
119
+ nameSizeComp(){
120
+ if(this.hasName === false) return 80/52;
121
+ return 1
122
+ },
123
+ },
124
+
125
+ data(){
126
+ return {
127
+ dataList: [],
128
+ activeUrl: null, //当前路径
129
+ params: null, //系统透传参数
130
+ hasName:true,//展示文字
131
+
132
+ //文字样式
133
+ nameColor: '#333',
134
+ nameActColor: 'red',
135
+
136
+ //图标样式
137
+ iconColor: '#333',
138
+ iconActColor: 'red',
139
+
140
+ styleMainColor: null, //插件主题风格样式
141
+
142
+ //中间效果
143
+ isCenterIndex:-1,
144
+ centerBorderColor:'#333',
145
+ centerBorderWidth: 12
146
+
147
+ }
148
+ },
149
+
150
+ async created() {
151
+ this.styleMainColor = await getParentsStyle(this.$parent, '$mainColor');
152
+
153
+ //设置活动参数
154
+ let params = [];
155
+ let xParamsKey = getPlatformParamsForGroup([]);
156
+ xParamsKey.map(key=>{
157
+ let {paramKey, storageKey} = getPlatformParamsValue(key);
158
+ let value = storage.get(storageKey);
159
+ if(value) params.push(`${paramKey}=${value}`);
160
+ })
161
+ this.params = params.join("&");
162
+
163
+ this.init();
164
+ },
165
+
166
+ mounted() {
167
+ this.$nextTick(() => {
168
+ this.getActive()
169
+ })
170
+ },
171
+
172
+ methods:{
173
+
174
+ getPath(path){
175
+ if(this.baseUrl) path = require('path').normalize(`/${this.baseUrl}/${path}`);
176
+ return path;
177
+ },
178
+
179
+ getActive(){
180
+ let routes = this.$xdUniHelper.getCurrentPages(this.tabBar.home);
181
+ this.activeUrl = routes['path'];
182
+ },
183
+
184
+
185
+ /**
186
+ * @description 初始化数据
187
+ */
188
+ init(){
189
+ this.nameActColor = this.tabBar['selectedColor'] || this.styleMainColor || 'red';
190
+ this.nameColor = this.tabBar['color'] || '#333';
191
+ this.iconActColor = this.tabBar['selectedIconColor'] || this.styleMainColor || 'red';
192
+ this.iconColor = this.tabBar['iconColor'] || '#333';
193
+ this.hasName = this.tabBar['hasName'];
194
+ this.dataList = this.tabBar.list.map(item=>{
195
+ return {
196
+ key : this.$xdUniHelper.randomChar(20),
197
+ ...item
198
+ }
199
+ });
200
+ this.centerBorderWidth = this.tabBar['borderWidth'] || 12;
201
+ this.centerBorderColor = this.tabBar['borderColor'] || this.tabBar['bgColor'] || '#fff';
202
+
203
+ if(this.tabBar['tpl'] === 'itemCenterBig') {
204
+ if( this.dataList .length === 1) this.isCenterIndex = 0;
205
+ if( this.dataList .length === 3) this.isCenterIndex = 1;
206
+ if( this.dataList .length === 5) this.isCenterIndex = 2;
207
+ }
208
+ else {
209
+ this.isCenterIndex = -1
210
+ }
211
+ },
212
+ }
213
+ }
214
+ </script>
215
+
216
+ <style scoped lang="less">
217
+ .xd-footer-bar {
218
+ height: 100%;
219
+ width: 100%;
220
+
221
+ &__icon {
222
+ width: 52rpx;
223
+ height: 52rpx;
224
+ display: flex;
225
+ justify-content: center;
226
+ align-items: center;
227
+
228
+ &.noName {
229
+ width: 80rpx;
230
+ height: 80rpx;
231
+ }
232
+ }
233
+
234
+ &__text {
235
+ line-height:1.2rem;
236
+ }
237
+
238
+ &__border {
239
+ border-top: 1px solid #eee;
240
+ display: flex;
241
+ flex-wrap: nowrap;
242
+ justify-content: center;
243
+ align-items: center;
244
+ height: 100%;
245
+ box-sizing: border-box;
246
+ }
247
+
248
+ &__item {
249
+ height: 100%;
250
+ flex: 1;
251
+ font-size: @xd-font-size-sm;
252
+ text-align: center;
253
+ display: flex;
254
+ flex-wrap: nowrap;
255
+ justify-content: center;
256
+ align-items: center;
257
+ position: relative;
258
+
259
+ &-link {
260
+ height: 100%;
261
+ width: 100%;
262
+ display: flex;
263
+ justify-content: center;
264
+ flex-direction: column;
265
+ align-items: center;
266
+ position: relative;
267
+
268
+ & .isCenter {
269
+ width: 120rpx;
270
+ height: 120rpx;
271
+ position: absolute;
272
+ background-color: var(--center-background-color);
273
+ border-radius: 50%;
274
+ box-sizing: border-box;
275
+ left:50%;
276
+ margin-left: -60rpx;
277
+ bottom: 0;
278
+ border: var(--center-border);
279
+ }
280
+ }
281
+
282
+ & > view:nth-child(2) {
283
+ flex: 1;
284
+ display: flex;
285
+ justify-content: center;
286
+ align-items: center;
287
+ flex-direction: column;
288
+ }
289
+
290
+ &-badge {
291
+ position: absolute;
292
+ top: unit(0, rpx);
293
+ left: 50%;
294
+ color: #fff;
295
+ transform: translateX(unit(10,rpx));
296
+ min-width: unit(32, rpx);
297
+ height: unit(32, rpx);
298
+ line-height: unit(32, rpx);
299
+ border-radius: unit(16, rpx);
300
+ font-size: unit(18, rpx);
301
+ z-index: 20;
302
+ }
303
+ }
304
+
305
+
306
+ &__image {
307
+ display: flex;
308
+ flex-wrap: nowrap;
309
+ justify-content: center;
310
+ align-items: center;
311
+ }
312
+
313
+ .image {
314
+ width: 100%;
315
+ height: 100%;
316
+
317
+ & > image {
318
+ max-width: 100%;
319
+ max-height: 100%;
320
+ }
321
+ }
322
+
323
+ }
324
+ </style>
@@ -364,7 +364,21 @@ export default function (data, gValue, gColor, oldData){
364
364
  let setTpl = dataVal({data, key:'footerTpl', dValue:'normal', gValue});
365
365
  if(setTpl === 'normal') {
366
366
  if(value && value.length === 0) callback('请设置菜单');
367
- else callback();
367
+ else {
368
+ let errorStr = '';
369
+ if(value && value.length > 0) {
370
+ let len = value.length;
371
+ for(let i = 0; i < len; i++) {
372
+ if(value[i].name.length > 5) {
373
+ errorStr = `菜单${i}最大长度不能超过5个汉字`;
374
+ break
375
+ }
376
+ }
377
+ }
378
+ if(errorStr) {
379
+ callback(errorStr)
380
+ }else callback();
381
+ }
368
382
  }
369
383
  else callback()
370
384
  },
@@ -385,6 +399,7 @@ export default function (data, gValue, gColor, oldData){
385
399
  icons:ICONS,
386
400
  mode: 'new',
387
401
  tplMode: footerTpl,
402
+
388
403
  showField: {
389
404
  path: true,
390
405
  icon: true,
@@ -409,7 +424,21 @@ export default function (data, gValue, gColor, oldData){
409
424
  let setTpl = dataVal({data, key:'footerTpl', dValue:'normal', gValue});
410
425
  if(setTpl === 'itemCenterBig') {
411
426
  if(value && value.length === 0) callback('请设置菜单');
412
- else callback();
427
+ else {
428
+ let errorStr = '';
429
+ if(value && value.length > 0) {
430
+ let len = value.length;
431
+ for(let i = 0; i < len; i++) {
432
+ if(value[i].name.length > 5) {
433
+ errorStr = `菜单${i}最大长度不能超过5个汉字`;
434
+ break
435
+ }
436
+ }
437
+ }
438
+ if(errorStr) {
439
+ callback(errorStr)
440
+ }else callback();
441
+ }
413
442
  }
414
443
  else callback()
415
444
  },
@@ -40,7 +40,7 @@
40
40
  <xd-font-icon size="24" icon="iconxia_down" color="#333"></xd-font-icon>
41
41
  </view>
42
42
  <view @click="handleGetFilterItem({value:'sort'})" v-if="showSort" class="menu_filter_item" >
43
- <view>{{sortData.label || '排序'}}</view>
43
+ <view>{{sortData.label || '综合'}}</view>
44
44
  <xd-font-icon size="24" icon="iconxia_down" color="#333"></xd-font-icon>
45
45
  </view>
46
46
  <view class="menu_filter_item" @click="handleGetFilterItem(item)" v-for="(item,index) in filterTab" :key="index">
@@ -68,6 +68,7 @@
68
68
  ></xd-query-sort>
69
69
  </view>
70
70
  </view>
71
+ <view v-show="curQueryTab" class="modal"></view>
71
72
 
72
73
  <view v-if="!isPreview" :style="{height: menuHeight}"></view>
73
74
  <view class="tfk-search" :style="{padding: outSpacing + 'rpx'}">
@@ -173,7 +174,7 @@
173
174
  filterTabIcon: [
174
175
  { value: 'area', label: '区域',icon: 'icondizhitubiao', size: 24 },
175
176
  { value: 'brand', label: '品牌',icon: 'iconxia_down', size: 18 },
176
- { value: 'shop', label: '门店分类',icon: 'iconxia_down', size: 18 },
177
+ { value: 'shop_category', label: '门店分类',icon: 'iconxia_down', size: 18 },
177
178
  { value: 'filter', label: '筛选', icon: 'iconshaixuanbiaoji_mian', size: 24 },
178
179
  { value: 'comprehensive', label: '综合', icon: 'iconxia_down', size: 18 },
179
180
  { value: 'sort', label: '排序', icon: 'iconxia_down', size: 18 },
@@ -193,7 +194,7 @@
193
194
  showSort:false,
194
195
  brands: [],
195
196
  namespace: '',
196
- sortList: []
197
+ sortList: [],
197
198
  }
198
199
  },
199
200
  computed: {
@@ -287,6 +288,9 @@
287
288
  allModuleItemContRadius: this.allModuleItemContRadius,
288
289
  allModuleItemContBgColor: this.allModuleItemContBgColor
289
290
  }
291
+ },
292
+ showQueryModal() {
293
+ return this.curQueryTab?true:false
290
294
  }
291
295
  },
292
296
  watch: {
@@ -409,12 +413,13 @@
409
413
  this.filterType = item.type
410
414
  this.curQueryTab = '';
411
415
  this.searchFilterParams = {};
416
+ this.selectFilterParams = {};
412
417
  this.sortData = {};
413
418
  this.sort = '';
414
419
  if (item.filter_item && item.filter_item.tab_filter) {
415
420
  // 综合和排序的显示状态,当选中综合或排序时,下拉菜单取本地数据
416
- this.showComprehensive = item.filter_item.tab_filter.find(item => item.value === 'comprehensive')
417
- this.showSort = item.filter_item.tab_filter.find(item => item.value === 'sort')
421
+ this.showComprehensive = item.filter_item.tab_filter.find(item => item.value === 'comprehensive')?true:false;
422
+ this.showSort = item.filter_item.tab_filter.find(item => item.value === 'sort')?true:false;
418
423
  let filter_item = item.filter_item.tab_filter.filter(item => {
419
424
  return (item.value !== 'comprehensive'&&item.value !== 'sort')
420
425
  })
@@ -454,8 +459,9 @@
454
459
  this.curQueryTab = item.value;
455
460
  }
456
461
  if (this.curQueryTab === 'sort') {
462
+ this.sort = 'default'
457
463
  this.sortList = [{
458
- label: "排序",
464
+ label: "综合",
459
465
  key: "default",
460
466
  value: "default"
461
467
  }]
@@ -491,6 +497,7 @@
491
497
  };
492
498
 
493
499
  if (sortMap[item.value]) {
500
+ this.curQueryTab = '';
494
501
  this.sort = sortMap[item.value];
495
502
  this.refresh = new Date().getTime();
496
503
  return;
@@ -507,32 +514,24 @@
507
514
  },
508
515
  handleQueryFilter({ items, ids, labels }) {
509
516
  const maps = {
510
- 'brand': 'brands',
517
+ 'brand': 'brand_ids',
511
518
  'area': 'area_codes',
512
519
  'delivery_method': 'delivery_methods',
513
520
  'shop_category': 'category_ids',
514
- 'business_line': 'business_lines'
521
+ 'business_line': 'namespaces'
515
522
  };
516
523
  Object.keys(items).map(key => {
517
524
  let keys = Object.keys(maps);
518
525
  if (keys.indexOf(key) > -1) {
519
526
  this.searchFilterParams[maps[key]] = ids[key]
527
+ if (this.$xdUniHelper.checkVarType(ids[key]) === 'array') {
528
+ if (ids[key].length === 0) {
529
+ this.searchFilterParams[maps[key]] = ''
530
+ } else {
531
+ this.searchFilterParams[maps[key]] = ids[key].join(',')
532
+ }
533
+ }
520
534
  }
521
- // if (key === 'brand') {
522
- // this.searchFilterParams.brands = ids[key]
523
- // }
524
- // if (key === 'area') {
525
- // this.searchFilterParams.area_codes = ids[key]
526
- // }
527
- // if (key === 'delivery_method') {
528
- // this.searchFilterParams.delivery_methods = ids[key]
529
- // }
530
- // if (key === 'shop_category') {
531
- // this.searchFilterParams.category_ids = ids[key]
532
- // }
533
- // if (key === 'business_line') {
534
- // this.searchFilterParams.business_lines = ids[key]
535
- // }
536
535
  this.selectFilterParams[key] = ids[key]
537
536
  })
538
537
  this.curQueryTab = '';
@@ -622,4 +621,13 @@
622
621
  }
623
622
  }
624
623
  }
624
+ .modal{
625
+ position: fixed;
626
+ width: 100%;
627
+ height: 100%;
628
+ left: 0;
629
+ top: 0;
630
+ background: rgba(0, 0, 0, .4);
631
+ z-index: 102;
632
+ }
625
633
  </style>
@@ -216,16 +216,9 @@ export default {
216
216
  setChooseTag(tab, item){
217
217
  //单选
218
218
  if(!tab.multiple) {
219
- //取消
220
- if(this.selectedIds[tab.value] && this.selectedIds[tab.value].includes(item.value)) {
221
- this.setSelectData(tab.value, '', '', '')
222
- }
223
- //新增
224
- else {
225
- this.setSelectData(tab.value, item.value, item, item.label);
226
- //单选直接触发返回数据
227
- if(this.isShowBtn === false) this.onConfirm();
228
- }
219
+ this.setSelectData(tab.value, item.value, item, item.label);
220
+ //单选直接触发返回数据
221
+ if(this.isShowBtn === false) this.onConfirm();
229
222
  }
230
223
  //多选
231
224
  else {
@@ -316,7 +309,7 @@ export default {
316
309
  flex-wrap: wrap;
317
310
  justify-content: flex-start;
318
311
  align-items: center;
319
- max-height: 50vh;
312
+ // max-height: 50vh;
320
313
 
321
314
  & > ._tag{
322
315
  text-align: center;
@@ -51,18 +51,20 @@ export default {
51
51
  brandColor,imgRradius,contMargin,contRradius,contShadow,contBorder,contBgColor,contObjBorder,contBorderWidth}
52
52
  },
53
53
 
54
- filtersResData(res){
55
- let list = res.list.filter(item=>{
54
+ filtersResData(res) {
55
+ let list = res.list.filter(item => {
56
56
  return item.items.length > 0
57
57
  });
58
- if(res.list.length === list.length) return res;
59
- let tabs = list.map(item=>{
58
+ if (res.list.length === list.length) { return res; }
59
+ let tabs = list.map(item => {
60
+ let filter_item = res.tabs.find(Titem => Titem.value === item.tab)['filter_item']
60
61
  return {
61
62
  label: item.name,
62
- value: item.tab
63
+ value: item.tab,
64
+ filter_item
63
65
  }
64
66
  });
65
- return {...res, list, tabs}
67
+ return { ...res, list, tabs }
66
68
  },
67
69
 
68
70