jufubao-base 1.0.238-beta1 → 1.0.238-beta68

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.
@@ -1,5 +1,4 @@
1
1
  'use strict';
2
-
3
2
  import {mapActions} from "vuex";
4
3
 
5
4
  export default {
@@ -33,7 +32,7 @@ export default {
33
32
  //内部应用
34
33
  return true;
35
34
  });
36
- console.warn(`PostersList:${JSON.stringify(content.map(item=>`${item.app_type}:${item.content_name}:${item.redirect_data}`), null,2)}`)
35
+ console.warn(`filterPosterItem.posterMixins:${JSON.stringify(content.map(item=>`${item.app_type}:${item.content_name}:${item.redirect_data}`), null,2)}`)
37
36
  return content;
38
37
  },
39
38
 
@@ -141,6 +140,11 @@ export default {
141
140
  },
142
141
 
143
142
  handlePosterClick(item){
143
+ console.warn(`handlePosterClick.posterMixins`);
144
+
145
+ //预览模式
146
+ if( this.$configProject.isPreview) return;
147
+
144
148
  //未配置链接地址
145
149
  if(!item.redirect_data) {
146
150
  console.warn(`未配置链接地址: ${item.redirect_data}`);
@@ -0,0 +1,174 @@
1
+ 'use strict';
2
+
3
+
4
+ export default {
5
+ data() {
6
+ return {
7
+ //base
8
+ jfbListScrollElx: null, //计算滚动区域顶部元素top值(必须设置)建议使用ID选择器
9
+ jfbScrollList: null, //计算后的卡列表 (null|Array)
10
+ jfbScrollIndex:0,//记录当前数组的索引值
11
+ jfbScrollNextTop: 0, //计算元素初始化父节点元素距离顶部Top值
12
+
13
+ //list
14
+ jfbScrollRowShowNum: 1, //每行显示个数
15
+ jfbScrollItemPadding: 0, //行间距 rpx
16
+ jfbScrollItemHeight: 200, //块高度 rpx
17
+ jfbScrollLimit: 20, //每页个数
18
+ jfbScrollStart: 0, //可视区域的顶部边界值
19
+ jfbScrollEnd: 0, //可视区域的底部边界值
20
+ jfbShowPageStatus: false,//页面是否转为后台允许状态
21
+ jfbScrollFixed: 50, //调节阀值 rpx
22
+
23
+ //转换
24
+ jfbPxNum: 0, //px to rpx (1px * $pxNum)rpx
25
+ jfbRpxNum: 0, //rpx to px (1rpx * $rpxNum)px
26
+ maxAutoWindowWidth: 1280,
27
+
28
+ }
29
+ },
30
+
31
+ watch:{
32
+ jfbScrollStart() {
33
+ // console.log(this.jfbScrollStart, this.jfbScrollEnd);
34
+ // debugger
35
+ },
36
+ jfbScrollNextTop(val){
37
+ // console.log(val);
38
+ // debugger
39
+ }
40
+ },
41
+
42
+ created(){
43
+ this.jfbScrollEnd = uni.getSystemInfoSync().safeArea.height;
44
+ this.jfbPxNum = 750 / uni.getSystemInfoSync().windowWidth;
45
+ this.jfbRpxNum = uni.getSystemInfoSync().windowWidth / 750;
46
+ if(uni.getSystemInfoSync().windowWidth > 1280) {
47
+ this.jfbRpxNum = 375 / 750;
48
+ this.jfbPxNum = 750 / 375;
49
+ }
50
+ this.jfbShowPageStatus = true;
51
+ },
52
+
53
+ methods: {
54
+ checkListItemShow({height , top},index){
55
+
56
+ if(this.$configProject.isPreview) {
57
+ return this.jfbScrollLimit > index;
58
+ }
59
+ let boxTop = top + height + this.jfbScrollFixed * this.jfbRpxNum;
60
+ let boxBottom = top - (this.jfbScrollFixed * this.jfbRpxNum);
61
+ let {jfbScrollStart, jfbScrollEnd} = this;
62
+ return boxTop > jfbScrollStart && boxBottom < jfbScrollEnd;
63
+ },
64
+
65
+ getScrollContentTop(){
66
+ return new Promise((resolve, reject)=>{
67
+ this.$nextTick(()=>{
68
+ this.$xdUniHelper.getEleInfo(this.jfbListScrollElx, this, (data)=>{
69
+ this.jfbScrollNextTop = data.top;
70
+ console.warn('content-box:top='+this.jfbScrollNextTop)
71
+ resolve();
72
+ })
73
+ })
74
+ })
75
+ },
76
+
77
+ async onJfbLoad(options){
78
+ this.jfbListOptions = options;
79
+ if(this.jfbListScrollElx === null) throw new Error('滚动区域顶部元素,进行距离顶部设置');
80
+ else {
81
+
82
+ await this.getScrollContentTop();
83
+ if(typeof this['onJfbPackageLoad'] === 'function') {
84
+ this['onJfbPackageLoad'](options);
85
+ }
86
+ }
87
+ },
88
+
89
+ /**
90
+ * @description 设置属性 注意在created里面进行设置
91
+ * @param key
92
+ * @param value
93
+ */
94
+ setJfbScrollAttr(key, value){
95
+ let allow = [
96
+ 'jfbScrollRowShowNum',
97
+ 'jfbScrollItemPadding',
98
+ 'jfbScrollItemHeight',
99
+ 'maxAutoWindowWidth',
100
+ 'jfbListScrollElx',
101
+ 'jfbScrollLimit'
102
+ ];
103
+ if(allow.indexOf(key) === -1) console.warn(`键值:${key}不存在`);
104
+ else {
105
+ this[key]= value;
106
+ }
107
+ },
108
+
109
+ computeJfbScrollList(data = []){
110
+ return new Promise((resolve)=>{
111
+ const handle = ()=>{
112
+ if(this.jfbScrollNextTop === null) {
113
+ setTimeout(()=>{
114
+ handle();
115
+ }, 50)
116
+ return
117
+ }
118
+
119
+ //处理
120
+ let newData = this.$xdUniHelper.cloneDeep(data);
121
+ newData = newData.map(item=>{
122
+ let row = Math.floor(this.jfbScrollIndex/this.jfbScrollRowShowNum);
123
+ let height = this.jfbScrollItemHeight * this.jfbRpxNum;
124
+ let padding = this.jfbScrollItemPadding * this.jfbRpxNum;
125
+ item['height'] = height;
126
+ item['top'] = this.jfbScrollNextTop;
127
+ item['scrollIndex'] = this.jfbScrollIndex;
128
+
129
+ if(this.jfbScrollIndex%this.jfbScrollRowShowNum === (this.jfbScrollRowShowNum -1)) {
130
+ this.jfbScrollNextTop = this.jfbScrollNextTop + height + padding;
131
+ }
132
+ this.jfbScrollIndex++;
133
+ return item;
134
+ });
135
+ this.jfbScrollList = (this.jfbScrollList||[]).concat(newData);
136
+ resolve(this.jfbScrollList)
137
+ }
138
+ handle();
139
+ })
140
+ },
141
+
142
+ onJfbScroll(params){
143
+
144
+ if(this.jfbShowPageStatus) {
145
+ this.jfbScrollStart = params.e.scrollTop;
146
+ this.jfbScrollEnd = params.e.scrollTop + uni.getSystemInfoSync().safeArea.height
147
+ }
148
+ if(typeof this['onJfbPackageScroll'] === 'function') {
149
+ this['onJfbPackageScroll'](params);
150
+ }
151
+ },
152
+
153
+ onJfbHide(options){
154
+ this.jfbShowPageStatus = false;
155
+ if(typeof this['onJfbPackageHide'] === 'function') {
156
+ this['onJfbPackageHide'](options);
157
+ }
158
+ },
159
+
160
+ onJfbShow(options){
161
+ this.jfbShowPageStatus = true;
162
+ if(typeof this['onJfbPackageShow'] === 'function') {
163
+ this['onJfbPackageShow'](options);
164
+ }
165
+ },
166
+
167
+ clearDefault(){
168
+ this.jfbScrollList = null;
169
+ this.jfbScrollNextTop = 0;
170
+ this.jfbScrollIndex = 0
171
+ }
172
+
173
+ }
174
+ }