jufubao-base 1.0.169-beta1 → 1.0.169-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.
Files changed (40) hide show
  1. package/package.json +1 -1
  2. package/src/components/JfbBaseHeader/JfbBaseHeader.vue +2 -2
  3. package/src/components/JfbBaseLogin/Attr.js +54 -16
  4. package/src/components/JfbBaseMapSearch/MapSearchMp.vue +1 -1
  5. package/src/components/JfbBaseOrderDetail/Api.js +12 -7
  6. package/src/components/JfbBaseOrderDetail/Attr.js +28 -14
  7. package/src/components/JfbBaseOrderDetail/JfbBaseOrderDetail.vue +68 -18
  8. package/src/components/JfbBaseOrderDetail/Mock.js +3 -1
  9. package/src/components/JfbBaseTfkCardBind/Api.js +49 -30
  10. package/src/components/JfbBaseTfkCardBind/Attr.js +61 -10
  11. package/src/components/JfbBaseTfkCardBind/JfbBaseTfkCardBind.vue +169 -9
  12. package/src/components/JfbBaseTfkCardBind/Mock.js +19 -9
  13. package/src/components/JfbBaseTfkCardDetail/Api.js +26 -0
  14. package/src/components/JfbBaseTfkCardDetail/Attr.js +336 -9
  15. package/src/components/JfbBaseTfkCardDetail/JfbBaseTfkCardDetail.vue +241 -36
  16. package/src/components/JfbBaseTfkCardDetail/Mock.js +2 -2
  17. package/src/components/JfbBaseTfkCardLogin/Attr.js +301 -5
  18. package/src/components/JfbBaseTfkCardLogin/JfbBaseTfkCardLogin.vue +317 -158
  19. package/src/components/JfbBaseTfkCardLogin/Mock.js +2 -46
  20. package/src/components/JfbBaseTfkCardLogin/XdCouponItem.vue +271 -0
  21. package/src/components/JfbBaseTfkSearch/AllList.vue +232 -0
  22. package/src/components/JfbBaseTfkSearch/Api.js +11 -42
  23. package/src/components/JfbBaseTfkSearch/Attr.js +225 -33
  24. package/src/components/JfbBaseTfkSearch/ContentCinema.vue +157 -0
  25. package/src/components/JfbBaseTfkSearch/ContentFilm.vue +180 -0
  26. package/src/components/JfbBaseTfkSearch/ContentProduct.vue +308 -0
  27. package/src/components/JfbBaseTfkSearch/ContentShop.vue +184 -0
  28. package/src/components/JfbBaseTfkSearch/CusAttr.js +213 -0
  29. package/src/components/JfbBaseTfkSearch/CustomList.vue +402 -0
  30. package/src/components/JfbBaseTfkSearch/JfbBaseTfkSearch.vue +230 -26
  31. package/src/components/JfbBaseTfkSearch/Mock.js +90 -11
  32. package/src/components/JfbBaseTfkSearch/SkeletonCinema.vue +45 -0
  33. package/src/components/JfbBaseTfkSearch/SkeletonFilm.vue +109 -0
  34. package/src/components/JfbBaseTfkSearch/SkeletonProduct.vue +246 -0
  35. package/src/components/JfbBaseTfkSearch/SkeletonShop.vue +81 -0
  36. package/src/components/JfbBaseTfkSearch/handleKeyword.js +24 -0
  37. package/src/components/JfbBaseTfkSearch/listMixins.js +153 -0
  38. package/src/components/JfbBaseTfkSearch/search.js +293 -0
  39. package/src/mixins/colorCardMixins.js +71 -9
  40. package/src/mixins/componentsMixins.js +346 -23
@@ -1,6 +1,10 @@
1
1
  'use strict';
2
2
 
3
- import {getContainerFnPropsValue, getContainerPropsValue} from "@/utils/xd.base";
3
+ import {getContainerFnPropsValue, getContainerPropsValue,isWechat} from "@/utils/xd.base";
4
+ import {Base64} from 'js-base64';
5
+ import {mapActions,mapState, mapMutations} from "vuex";
6
+ import helper from "@/utils/helper";
7
+ import store from "@/store/index";
4
8
 
5
9
  export default {
6
10
  props: {
@@ -109,11 +113,55 @@ export default {
109
113
  subMainColor: '',
110
114
  infoColor: '',
111
115
  defaultColor: '',
112
- dangerColor: ''
116
+ dangerColor: '',
117
+ mainGradient: '',
118
+ subGradient: '',
119
+
120
+ //test
121
+ posterTest:{
122
+ "content_id": "KpBbUKdj4aBejwe7Fh1ki",
123
+ "position_id": "QCk3PmoyQmOWRP1SxnYR3",
124
+ "partner_id": 0,
125
+ "site_id": "",
126
+ "content_name": "测试.",
127
+ "image_url": "//dummyimage.com/200x200",
128
+ "redirect_type": "EMP",
129
+ "redirect_type_name": "无链接",
130
+ "redirect_data": "",
131
+ "sort": "",
132
+ "status": "",
133
+ "start_time": "",
134
+ "end_time": "",
135
+ "op_user_id": "",
136
+ "created_time": 0,
137
+ "updated_time": 0
138
+ }
139
+ }
140
+ },
141
+
142
+ destroyed() {
143
+ console.warn('componentsMixins.destroyed.my(timeer|timer)');
144
+ if (this.timeer && typeof this.timeer === "number") {
145
+ clearTimeout(this.timeer);
146
+ console.warn('componentsMixins.destroyed.my.timeer');
147
+ }
148
+ if (this.timer && typeof this.timer === "number") {
149
+ clearTimeout(this.timer);
150
+ console.warn('componentsMixins.destroyed.my.timer');
113
151
  }
152
+
153
+ //卸载页面
154
+ if(typeof this.onJfbUnload === "function") {
155
+ console.warn('componentsMixins.destroyed.exec.onJfbUnload');
156
+ this.onJfbUnload()
157
+ }
158
+
114
159
  },
160
+
115
161
  created(){
116
- console.warn(`init.components._uid:${this._uid},vnode.name=${this.$vnode.tag}`);
162
+ let tag = '';
163
+ if (this.$vnode && this.$vnode.tag) tag = this.$vnode.tag;
164
+ this.$xdLog.setProject('App.components.start', `App.components.vnode.name.${tag}`);
117
165
 
118
166
  //设置插件cid
119
167
  if (this.cid) {
@@ -122,9 +170,14 @@ export default {
122
170
  this.containerId = this.$xdUniHelper.randomChar(20);
123
171
  }
124
172
 
173
+ //保存到vuex
174
+ console.log('setStyleCommon',this)
175
+ this.setStyleCommon(this.styles);
176
+
125
177
  //初始化风格
126
178
  this.initThemesToData();
127
179
 
180
+
128
181
  //#ifdef H5
129
182
  //监听用户点击状态显示虚框
130
183
  XdBus.addEvent('select', ({containerId}) => {
@@ -152,35 +205,120 @@ export default {
152
205
 
153
206
  //#ifdef H5
154
207
  mounted() {
155
- if (this.$configProject.isPreview) {
156
- let that = this;
157
- function handle() {
158
- let className = `${that.cssRoot}__body-mask`;
159
- if (document.getElementsByClassName(className).length === 0) {
160
- let elx = document.getElementsByClassName(`${that.cssRoot}__body`);
208
+ let that = this;
209
+ this.autoHideMask();
210
+ if (this.$configProject.isPreview && this.selfMask !== true ) {
211
+ this.$nextTick(()=>{
212
+ function handle() {
213
+ let elx = that.$el.getElementsByClassName(`${that.cssRoot}__body`);
161
214
  if (elx.length === 0) {
162
215
  setTimeout(() => {
163
216
  handle()
164
- }, 100)
217
+ }, 50)
165
218
  } else {
166
- const mask = document.createElement("div");
167
- mask.className = 'jfb-mask';
168
- mask.style.position = 'absolute';
169
- mask.style.left = '0px';
170
- mask.style.right = '0px';
171
- mask.style.top = '0px';
172
- mask.style.bottom = '0px';
173
- mask.style.zIndex = 9999;
174
- elx.item(0).appendChild(mask);
219
+ let len = elx.length;
220
+ for (let i = 0; i < len; i++) {
221
+ if (!elx.item(i).classList.contains('isGPreview')) {
222
+ elx.item(i).classList.add("isGPreview");
223
+ }
224
+ }
175
225
  }
176
226
  }
177
- }
178
- handle()
227
+ handle();
228
+ });
229
+ }
230
+
231
+ //模式不显示虚线
232
+ if(this.$configProject.type === 'test'
233
+ && this.$configProject.NODE_ENV === 'development'
234
+ && this.$configProject.viewType === 'pack'
235
+ ){
236
+ this.isEditx = false;
179
237
  }
238
+
180
239
  },
181
240
  // #endif
182
241
 
242
+ computed:{
243
+ ...mapState({
244
+ pageNamespace: state=> state.pageBusinessCode,
245
+ })
246
+ },
247
+
248
+ watch:{
249
+ active(val){
250
+ if(this.$configProject.isPreview && val) this.autoHideMask();
251
+ },
252
+ },
253
+
183
254
  methods:{
255
+ ...mapActions(['setXNamespace','setStyleCommon']),
256
+ ...mapMutations(['setCurrentStyle']),
257
+
258
+ /**
259
+ * @description 自动生成调试模式
260
+ */
261
+ autoHideMask(){
262
+ if(this.$configProject.isPreview && this.hideMask === true){
263
+ this.$nextTick(()=>{
264
+ let className = this.$el.classList;
265
+ if(!className.contains('gHideMask')) {
266
+ className.add("gHideMask")
267
+ }
268
+ })
269
+ }
270
+ },
271
+
272
+ /**
273
+ * @description 检查是否同域名
274
+ * @param url
275
+ * @param dir {String} 部署目录
276
+ * @returns {*}
277
+ */
278
+ //#ifdef H5
279
+ getSameSiteAndDomain(url, dir) {
280
+ let regDir = new RegExp(`^/${dir}/\.*$`);
281
+ let host = window.location.host;
282
+ let pages = this.$xdUniHelper.parseURL(url);
283
+
284
+ //域名相同并且部署目录相同
285
+ if (host === pages.host && regDir.test(pages.path)) {
286
+ return pages.relative;
287
+ }
288
+ return url;
289
+ },
290
+ // #endif
291
+
292
+ setNameSpace(options){
293
+ this.xnamespace = this.xnamespace || this.pageNamespace;
294
+ if(!this.xnamespace && !this.$configProject.isPreview){
295
+ this.$xdAlert({content: '未设置业务编码',type:'error'});
296
+ throw new Error('请配置业务编码')
297
+ }
298
+ this.setXNamespace(this.xnamespace)
299
+ },
300
+
301
+ /**
302
+ * @description 自动计算列数的宽和间距 (父节点需要设置110%)不兼容微信小程序(废弃)
303
+ * @param index {number} 当前索引值
304
+ * @param cell {number} 当前索引值
305
+ * @param jfbSpacing {number}
306
+ * @returns {{marginRight: string, overflow: string, width: string, marginTop: string}}
307
+ */
308
+ itemStyle(index, cell, jfbSpacing ) {
309
+ if(this.$xdUniHelper.checkVarType(jfbSpacing) === 'string') jfbSpacing = Number(jfbSpacing);
310
+ let maxW = 100 / cell;
311
+ let padding = Math.floor(this.$rpxNum * jfbSpacing + this.$rpxNum * (jfbSpacing / cell))
312
+ return {
313
+ marginTop: jfbSpacing + 'rpx',
314
+ marginRight: (index + 1) % cell === 0 ? '0' : jfbSpacing + 'rpx',
315
+ width: `calc(${maxW}vw - ${padding}px)`,
316
+ overflow: 'hidden'
317
+ };
318
+ },
319
+
320
+
321
+
184
322
  /**
185
323
  * @description 获取吸顶样式
186
324
  * @param options {Object} 样式参数
@@ -192,15 +330,23 @@ export default {
192
330
  * @param options.height 距离底部距离(paddingBottom和height选其一即可)
193
331
  * @param options.zIndex
194
332
  * @param type {String} 吸顶类型 其值:bottom/top
333
+ * @param fixed {Boolean} 是否吸顶或者占位
195
334
  * @return {String}
196
335
  */
197
- fixedStyle(options = {}, type = 'bottom') {
336
+ fixedStyle(options = {}, type = 'bottom', fixed = true) {
198
337
  let paddingBottom = options.paddingBottom || options.height || 0;
199
338
  if (options.paddingBottom) delete options.paddingBottom;
200
339
  if (options.height) delete options.height;
201
340
  let obj = Object.assign({}, {
202
341
  top: 0, left: 0, right: 0, bottom: 0, zIndex: 100,
203
342
  }, options);
343
+ if (!fixed) {
344
+ let padding = (this.layoutInfo.bottomHeight + this.layoutInfo.footerHeight + paddingBottom) * this.$rpxNum;
345
+ let sy = `padding-bottom:calc(${padding}px + constant(safe-area-inset-bottom));`;
346
+ sy = `${style}; padding-bottom:calc(${padding}px + env(safe-area-inset-bottom));`;
347
+ return sy;
348
+ }
349
+
204
350
  let style = 'position: fixed';
205
351
  style = `${style};left:${obj.left}rpx`;
206
352
  style = `${style};right:${obj.right}rpx`;
@@ -217,6 +363,7 @@ export default {
217
363
  return style;
218
364
  },
219
365
 
366
+
220
367
  /**
221
368
  * 检查插件是否加载成功
222
369
  */
@@ -226,10 +373,15 @@ export default {
226
373
  * @description 业务组件风格map到data中
227
374
  */
228
375
  initThemesToData() {
376
+ let current = {};
229
377
  Object.keys(this.styles).map(key => {
230
378
  let k = key.replace('$', '');
231
- if (this[k] !== undefined) this[k] = this.styles[key];
379
+ if (this[k] !== undefined){
380
+ this[k] = this.styles[key];
381
+ current[k] = this.styles[key];
382
+ }
232
383
  });
384
+ this.setCurrentStyle(helper.cloneDeep(current))
233
385
  },
234
386
 
235
387
  /**
@@ -245,6 +397,7 @@ export default {
245
397
  * @description 点击删除操作按钮
246
398
  */
247
399
  delEdit() {
400
+ if(this.isReferenceTemplate) return;
248
401
  XdBus.send('onDelPackage', {
249
402
  containerId: this.containerId,
250
403
  componentAtrr: this.componentAtrr,
@@ -300,6 +453,176 @@ export default {
300
453
  })
301
454
  //#endif
302
455
  },
456
+
457
+ checkValue(value, dValue = 0){
458
+ if(value === undefined || value === '' || value === null) return dValue;
459
+ return Number(value || 0);
460
+ },
461
+
462
+ getXdShadow(defaultObj, newObj){
463
+ if(newObj.type === 'N' || this.$xdUniHelper.isEmpty(newObj)) return `0 0 0 rgba(0,0,0,0)`;
464
+ let width = defaultObj.width;
465
+ let color = defaultObj.color;
466
+ if(newObj.value !== null) {
467
+ if(newObj.value.width) width = newObj.value.width;
468
+ if(newObj.value.color) color = newObj.value.color
469
+ }
470
+ return `0 0 ${width}rpx ${color}`;
471
+ },
472
+
473
+ getXdBorder(defaultObj, newObj){
474
+ if(newObj.type === 'N' || this.$xdUniHelper.isEmpty(newObj)) return `0`
475
+ let width = defaultObj.width;
476
+ let color = defaultObj.color;
477
+ if(newObj.value !== null) {
478
+ if(newObj.value.width) width = newObj.value.width
479
+ if(newObj.value.color) color = newObj.value.color
480
+ }
481
+ return `${width}rpx solid ${color}`;
482
+ },
483
+
484
+ getUrlCallback(path){
485
+ if(this.inCallbackUrlOrg) {
486
+ if(path.indexOf('?') === -1) path = `${path}?inCallback=${this.inCallbackUrlOrg}`;
487
+ else path = `${path}&inCallback=${this.inCallbackUrlOrg}`;
488
+ }
489
+ return path
490
+ },
491
+
492
+ baiduTogcj(bd_lng, bd_lat) {//坐标第转换
493
+ const x_PI = 3.14159265358979324 * 3000.0 / 180.0;
494
+ const x = bd_lng - 0.0065;
495
+ const y = bd_lat - 0.006;
496
+ const z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_PI);
497
+ const theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_PI);
498
+ const gg_lng = z * Math.cos(theta);
499
+ const gg_lat = z * Math.sin(theta);
500
+ return [gg_lng, gg_lat]
501
+ },
502
+
503
+
504
+ //#ifdef H5
505
+ webChatEnvOpenLocation({latitude,longitude,name, address}, cb){
506
+ store.dispatch('getH5WxAuthorize',{jsApiList: ['openLocation', 'getLocation']})
507
+ .then(({jwxSDK})=>{
508
+ let zb = this.baiduTogcj(latitude, longitude)
509
+ jwxSDK.openLocation({
510
+ latitude: zb[0],
511
+ longitude:zb[1],
512
+ name: name || '我的位置',
513
+ address: address||'',
514
+ scale: 15,
515
+ infoUrl: ''
516
+ });
517
+ })
518
+ .catch(err=>{
519
+ console.error(err)
520
+ this.$xdAlert({
521
+ content:'暂时不支持唤起APP导航功能',
522
+ time:5000,
523
+ })
524
+ })
525
+ },
526
+ //#endif
527
+
528
+ handleOpenLocation({latitude,longitude, name, address}, cb){
529
+ //latitude = latitude||39.961521814959795;
530
+ //longitude = longitude || 116.84499635227222
531
+
532
+ if(typeof latitude === 'string') latitude = Number(latitude);
533
+ if(typeof longitude === 'string') longitude = Number(longitude);
534
+
535
+ //#ifdef MP-WEIXIN
536
+ let zb = this.baiduTogcj(latitude, longitude);
537
+ uni.openLocation({
538
+ latitude: zb[0],
539
+ longitude: zb[1],
540
+ name: name || '我的位置',
541
+ scale: 15,
542
+ address: address ||'',
543
+ success: function () {
544
+ if(typeof cb === 'function') {
545
+ cb();
546
+ }
547
+ console.log('success');
548
+ }
549
+ });
550
+ //#endif
551
+ //#ifdef H5
552
+ if(isWechat()) this.webChatEnvOpenLocation({latitude,longitude, name, address}, cb);
553
+ else {
554
+ let params = '';
555
+ params = `${params}&location=${latitude},${longitude}`;
556
+ params = `${params}&title=${encodeURIComponent(name)}`;
557
+ params = `${params}&content=${encodeURIComponent(address)}&output=html&zoom=15`;
558
+ window.location.href = `http://api.map.baidu.com/marker?${params}`;
559
+ }
560
+ //#endif
561
+ },
562
+
563
+ getUrlHasSpStr(pathDir){
564
+ if(pathDir.indexOf('@site_domain@/') === 0) {
565
+ return pathDir.replace('@site_domain@/','').split('/')[0]
566
+ }
567
+ return ''
568
+ },
569
+
570
+ /**
571
+ * @description 过滤不可以用
572
+ * 当前项目未H5时,过滤所有小程序应用
573
+ * 当前项目未小程序时,过滤所有非当前小程序应用
574
+ * 站外地址直接返回
575
+ * 站内地址未选值直接返回
576
+ * 预览模式全过
577
+ * @param url {object}
578
+ */
579
+ checkUrlIsValid(url){
580
+ if(!url) return null;
581
+ try {
582
+
583
+ }catch (e){
584
+ return null;
585
+ }
586
+ // let content = list.filter(item=>{
587
+ // //预览模式
588
+ // if(this.$configProject.isPreview) return true;
589
+ //
590
+ // //非内部应用
591
+ // if(item.redirect_type !== 'INN') return true
592
+ //
593
+ // //没有配置链接
594
+ // if(!item.redirect_data) return true;
595
+ //
596
+ // //内部应用
597
+ // else {
598
+ // let redirect_data;
599
+ // try {
600
+ // redirect_data = JSON.parse(item.redirect_data);
601
+ // if(!item['app_type']) item['app_type']= 'h5';
602
+ //
603
+ // //#ifdef H5
604
+ // return item['app_type'] !== 'wxmp';
605
+ // //#endif
606
+ //
607
+ // //#ifdef MP-WEIXIN
608
+ // let actDir = this.$parent.projectAttr.deploy_dir;
609
+ // let dir = this.getPathDir(redirect_data.page);
610
+ // if(item['app_type'] === 'wxmp'){
611
+ // return actDir === dir;
612
+ // }
613
+ // else if(item['app_type'] === 'h5') return true;
614
+ // else return true
615
+ // //#endif
616
+ // }
617
+ // catch (e) {
618
+ // return true
619
+ // }
620
+ // }
621
+ // });
622
+ // console.warn(`PostersList:${JSON.stringify(content.map(item=>`${item.app_type}:${item.content_name}:${item.redirect_data}`), null,2)}`)
623
+ // return content;
624
+
625
+ },
303
626
  }
304
627
  }
305
628