jufubao-base 1.0.169-beta15 → 1.0.169-beta17

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.169-beta15",
3
+ "version": "1.0.169-beta17",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件基础插件包",
6
6
  "main": "index.js",
@@ -4,70 +4,69 @@
4
4
  class="image"
5
5
  :style="{marginRight: outSpacing + 'rpx',borderRadius:borderRadius+'rpx'}"
6
6
  >
7
- <image :src="imageUrl" :alt="item['show_name']"></image>
7
+ <image v-if="errorStatus" :src="errorImage" :alt="item['show_name']" ></image>
8
+ <image v-if="!errorStatus" :src="item['poster']" :alt="item['show_name']" @error="handleError()" ></image>
8
9
  </view>
9
10
  <view class="middle">
10
- <view class="name" v-html="name"></view>
11
- <view class="other">类型:{{item['type']}}</view>
12
- <view class="other">导演:{{item['director']}}</view>
13
- <view class="other">主演:{{item['leading_role']}}</view>
14
- </view>
15
- <view class="right">
16
- <view class="score">
17
- <template v-if="item['remark']">
18
- <text>评分:</text><text :style="{color:color}">{{item['remark']}}</text>
19
- </template>
11
+ <view class="top">
12
+ <view class="name">{{item['show_name']}}</view>
13
+ <view class="score">
14
+ <template v-if="item['remark']">
15
+ <text>评分:</text><text :style="{color:color}">{{item['remark']}}</text>
16
+ </template>
17
+ </view>
20
18
  </view>
21
- <view class="btn">
22
- <template v-if="type === 'hot'">
23
- <xd-button
24
- v-if="item['show_button'] === '1'"
25
- type="primary"
26
- style="display:block;"
27
- size="small"
28
- @click.stop="handleBuy(item)">购票</xd-button>
29
- <xd-button
30
- v-else-if="item['show_button'] === '2'"
31
- type="subPrimary"
32
- style="display:block;"
33
- size="small"
34
- @click="handleBuy(item)">预售</xd-button>
35
- </template>
36
- <template v-if="type === 'rightnow'">
37
- <xd-button
38
- v-if="item['show_button'] === '3'"
39
- type="success"
40
- style="display:block;"
41
- size="small"
42
- @click.stop="handleDetail(item)"
43
- >想看</xd-button>
44
- <xd-button
45
- v-else-if="item['show_button'] === '2'"
46
- type="subPrimary"
47
- style="display:block;"
48
- size="small"
49
- @click.stop="handleBuy(item)">预售</xd-button>
50
- </template>
19
+ <view class="bottom">
20
+ <view>
21
+ <view class="other">类型:{{item['type']}}</view>
22
+ <view class="other">导演:{{item['director']}}</view>
23
+ <view class="other">主演:{{item['leading_role']}}</view>
24
+ </view>
25
+ <view class="btn">
26
+ <template v-if="type === 'hot'">
27
+ <xd-button
28
+ v-if="item['show_button'] === '1'"
29
+ type="primary"
30
+ style="display:block;"
31
+ size="small"
32
+ @click.stop="handleBuy(item)">购票</xd-button>
33
+ <xd-button
34
+ v-else-if="item['show_button'] === '2'"
35
+ type="subPrimary"
36
+ style="display:block;"
37
+ size="small"
38
+ @click="handleBuy(item)">预售</xd-button>
39
+ </template>
40
+ <template v-if="type === 'rightnow'">
41
+ <xd-button
42
+ v-if="item['show_button'] === '3'"
43
+ type="success"
44
+ style="display:block;"
45
+ size="small"
46
+ @click.stop="handleDetail(item)"
47
+ >想看</xd-button>
48
+ <xd-button
49
+ v-else-if="item['show_button'] === '2'"
50
+ type="subPrimary"
51
+ style="display:block;"
52
+ size="small"
53
+ @click.stop="handleBuy(item)">预售</xd-button>
54
+ </template>
55
+ </view>
51
56
  </view>
57
+
52
58
  </view>
53
59
  </view>
54
60
  </template>
55
61
 
56
62
  <script>
57
63
  import XdButton from "@/components/XdButton/XdButton.vue";
58
- import getServiceUrl from "@/common/getServiceUrl";
59
- import handleKeyword from "./handleKeyword";
60
-
61
64
  export default {
62
65
  name:'ContentItem',
63
66
  components:{
64
67
  XdButton
65
68
  },
66
69
  props:{
67
- keyword:{
68
- type:String,
69
- default:''
70
- },
71
70
  item:Object,
72
71
  outSpacing: {
73
72
  type: Number|String,
@@ -87,23 +86,26 @@
87
86
  }
88
87
 
89
88
  },
90
- computed:{
91
- imageUrl(){
92
- return getServiceUrl(this.item['poster'])
93
- },
94
- name(){
95
- return handleKeyword(this, this.item.show_name, this.keyword);
89
+ data(){
90
+ return {
91
+ errorImage: 'https://img.jufubao.cn/common/error_movie.png?v20',
92
+ errorStatus: false,
96
93
  }
97
94
  },
98
95
  created() {
99
96
 
100
97
  },
101
98
  methods:{
99
+ handleError(){
100
+ this.errorStatus = true;
101
+ },
102
102
  handleDetail(item){
103
- this.$emit('on-film-detail',item);
103
+ console.log('handleDetail.item',item,item.id);
104
+ this.$emit('on-film-detail',item.id);
104
105
  },
105
106
  handleBuy(item){
106
- this.$emit('on-buy',item);
107
+ console.log('handleDetail.item',item,item.id);
108
+ this.$emit('on-buy',item.id);
107
109
  }
108
110
  }
109
111
  }
@@ -128,51 +130,89 @@
128
130
  }
129
131
  .middle {
130
132
  flex: 1;
131
- & .name {
132
- font-size: 30rpx;
133
- font-weight: 500;
133
+
134
+ & .top {
135
+ display: flex;
136
+ justify-content: space-between;
137
+ align-items: flex-end;
134
138
  margin-bottom: 20rpx;
135
- .uni-max-cut(2, 90);
136
- line-height: 45rpx;
137
- }
138
139
 
139
- & .other {
140
- font-size: 25rpx;
141
- color: #999;
142
- .uni-max-cut(1,36);
143
- line-height: 36rpx;
144
- margin-bottom: 10rpx;
145
- &:last-child {
146
- margin-bottom: 0!important;
140
+ & > view:first-child{
141
+ flex: 1;
142
+ font-size: 36rpx;
143
+ font-weight: 600;
144
+ .uni-max-cut(2, 90);
145
+ line-height: 45rpx;
146
+ }
147
+ & >view:nth-child(2) {
148
+ flex-shrink: 0;
149
+ height: 45rpx;
150
+ line-height: 45rpx;
151
+ margin-left: 20rpx;
152
+ text-align: right;
153
+ & > text:nth-child(1) {
154
+ font-size: 20rpx;
155
+ }
156
+ & > text:nth-child(2) {
157
+ font-size: 28rpx;
158
+ }
147
159
  }
148
160
  }
149
- }
150
161
 
151
- .right {
152
- flex-shrink: 0;
153
- display: flex;
154
- align-content: space-between;
155
- align-items: flex-end;
156
- justify-content: flex-end;
157
- flex-flow: wrap;
158
- height: 100%;
159
- box-sizing: border-box;
160
- width: 160rpx;
161
- min-height: 200rpx;
162
+ & .bottom {
163
+ display: flex;
164
+ justify-content: space-between;
165
+ align-items: center;
162
166
 
163
- & .score {
164
- height: 40rpx;
165
- width:100%;
166
- text-align: right;
167
- & > text:nth-child(1) {
168
- font-size: 20rpx;
169
- }
170
- & > text:nth-child(2) {
171
- font-size: 28rpx;
167
+ & > view:first-child {
168
+ flex: 1;
169
+ & > view {
170
+ font-size: 25rpx;
171
+ color: #999;
172
+ .uni-max-cut(1,36);
173
+ line-height: 36rpx;
174
+ margin-bottom: 10rpx;
175
+ &:last-child {
176
+ margin-bottom: 0!important;
177
+ }
178
+ }
172
179
  }
173
180
 
181
+ & .btn {
182
+ width: 140rpx;
183
+ flex-shrink: 0;
184
+ margin-left: 20rpx;
185
+ }
174
186
  }
187
+ //& .name {
188
+ // font-size: 36rpx;
189
+ // font-weight: 600;
190
+ // margin-bottom: 20rpx;
191
+ // .uni-max-cut(2, 90);
192
+ // line-height: 45rpx;
193
+ //}
194
+ //
195
+ //& .other {
175
196
 
197
+ //}
176
198
  }
199
+
200
+ //.right {
201
+ // flex-shrink: 0;
202
+ // display: flex;
203
+ // align-content: space-between;
204
+ // align-items: flex-end;
205
+ // justify-content: flex-end;
206
+ // flex-flow: wrap;
207
+ // box-sizing: border-box;
208
+ // width: 160rpx;
209
+ // height: 200rpx;
210
+ //
211
+ // & .score {
212
+
213
+ //
214
+ // }
215
+ //
216
+ //}
177
217
  }
178
218
  </style>
@@ -10,7 +10,7 @@
10
10
  borderRadius: borderRadius + 'rpx',
11
11
  }"
12
12
  >
13
- <image :src="imageUrl" :alt="item['product_name']" mode="aspectFit"></image>
13
+ <image :src="imageUrl" :alt="item['product_name']"></image>
14
14
  </view>
15
15
  <view class="prodcut-content" :style="{marginTop:cell === 1? 0: (outSpacing + 'rpx') }">
16
16
  <view class="prodcut-content-info">
@@ -75,7 +75,7 @@ export default {
75
75
  props:{
76
76
  keyword:{
77
77
  type:String,
78
- default:'北京'
78
+ default:''
79
79
  },
80
80
 
81
81
  height:{
@@ -197,6 +197,13 @@ export default {
197
197
  &.tow {
198
198
  .prodcut-image {
199
199
  width: 100%;
200
+ display: flex;
201
+ justify-content: center;
202
+ align-items: center;
203
+ & > image {
204
+ height: 100%;
205
+ width: 100%;
206
+ }
200
207
  }
201
208
 
202
209
  }
@@ -204,8 +211,8 @@ export default {
204
211
  &-image {
205
212
  overflow: hidden;
206
213
  & > image {
207
- max-height: 100%;
208
- max-width: 100%;
214
+ height: 100%;
215
+ width: 100%;
209
216
  }
210
217
  }
211
218
 
@@ -147,11 +147,13 @@ export default {
147
147
  justify-content: flex-start;
148
148
  align-items: flex-start;
149
149
  font-size: 22rpx;
150
+ line-height: 40rpx;
150
151
  color: #999;
151
152
 
152
153
  & > view:first-child {
153
154
  width: 40rpx;
154
155
  height: 40rpx;
156
+ line-height: 40rpx;
155
157
  margin-right: 10rpx;
156
158
  display: flex;
157
159
  justify-content: center;
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="custom-list">
2
+ <view class="custom-list" v-if="parentStatus">
3
3
  <view v-if="dataList === null">
4
4
  <view :class="{productBoxCell2: type_other === 2 }">
5
5
  <view
@@ -8,22 +8,22 @@
8
8
  :class="{productItemCell2: type_other === 2 }"
9
9
  :key="item"
10
10
  :style="{
11
- marginBottom:$parentVm.outSpacing + 'rpx',
11
+ marginBottom:listItemStyle.outSpacing + 'rpx',
12
12
  padding:contMarginComp,
13
- borderRadius:$parentVm.contRradius+ 'rpx',
13
+ borderRadius:listItemStyle.contRradius+ 'rpx',
14
14
  boxShadow:'0 0 10rpx rgba(0,0,0,0.1)',
15
15
  width: (type_code === 'product' && type_other === 2) ? (outItemProduct + 'rpx'): 'auto',
16
16
  }"
17
17
  >
18
18
  <skeleton-product
19
19
  :cell="type_other"
20
- v-if="$parentVm.productConfig !== null && type_code === 'product'"
21
- :product-config="$parentVm.productConfig"
22
- :out-spacing="$parentVm.outSpacing"
20
+ v-if="productConfig !== null && type_code === 'product'"
21
+ :product-config="productConfig"
22
+ :out-spacing="listItemStyle.outSpacing"
23
23
  :height="outItemProduct"
24
24
  ></skeleton-product>
25
- <skeleton-shop v-if="type_code === 'shop'" :out-spacing="$parentVm.outSpacing"></skeleton-shop>
26
- <skeleton-film v-if="type_code === 'film'" :out-spacing="$parentVm.outSpacing"></skeleton-film>
25
+ <skeleton-shop v-if="type_code === 'shop'" :out-spacing="listItemStyle.outSpacing"></skeleton-shop>
26
+ <skeleton-film v-if="type_code === 'film'" :out-spacing="listItemStyle.outSpacing"></skeleton-film>
27
27
  <skeleton-cinema v-if="type_code === 'cinema'"></skeleton-cinema>
28
28
  </view>
29
29
  </view>
@@ -34,61 +34,63 @@
34
34
  v-for="item in dataList"
35
35
  :key="item.cuid"
36
36
  :style="{
37
- marginBottom:$parentVm.outSpacing + 'rpx',
37
+ marginBottom:listItemStyle.outSpacing + 'rpx',
38
38
  padding:contMarginComp,
39
- borderRadius:$parentVm.contRradius+ 'rpx',
40
- border: $parentVm.contBorder,
41
- boxShadow:$parentVm.contShadow,
39
+ borderRadius:listItemStyle.contRradius+ 'rpx',
40
+ border: listItemStyle.contBorder,
41
+ boxShadow:listItemStyle.contShadow,
42
42
  width: (type_code === 'product' && type_other === 2) ? (outItemProduct + 'rpx'): 'auto',
43
43
  height: heightRpx,
44
- backgroundColor: $parentVm.contBgColor
45
- }">
46
- <content-film
47
- type="hot"
48
- v-if="type_code === 'film'"
49
- style="width: 100%; height: 100%"
50
- :keyword="keyword"
51
- :item="item"
52
- :out-spacing="$parentVm.outSpacing"
53
- :color="$parentVm.mainColor"
54
- :border-radius="$parentVm.imgRradius"
55
- @on-film-detail="handleFilmDetail"
56
- @on-buy="handleBuy"
57
- ></content-film>
58
- <content-cinema
59
- v-if="type_code === 'cinema'"
60
- style="width: 100%;height: 100%"
61
- type="list"
62
- :keyword="keyword"
63
- :item="item"
64
- :out-spacing="$parentVm.outSpacing"
65
- :color="{SEAT:$parentVm.mainColor,CODE:$parentVm.subMainColor,SELL:$parentVm.successColor}"
66
- :border-radius="$parentVm.imgRradius"
67
- @on-schedule="handleSchedule"
68
- @on-cashier-detail="handleCashierDetail"
69
- @on-code-detail="handleCodeDetail"
70
- ></content-cinema>
71
- <content-shop
72
- v-if="type_code === 'shop'"
73
- style="width: 100%; height: 100%"
74
- :keyword="keyword"
75
- :out-spacing="$parentVm.outSpacing"
76
- :item="item"
77
- :color="$parentVm.mainColor"
78
- :border-radius="$parentVm.imgRradius"
79
- :is-echange="'Y' || $parentVm.isShowExchange"
80
- @on-shop-jhd="handleShopJhd"
81
- @on-shop-detail="handleShopDetail"
82
- ></content-shop>
44
+ backgroundColor: listItemStyle.contBgColor
45
+ }"
46
+ >
47
+ <content-film
48
+ type="hot"
49
+ v-if="type_code === 'film'"
50
+ style="width: 100%; height: 100%"
51
+ :keyword="keyword"
52
+ :item="item"
53
+ :out-spacing="listItemStyle.outSpacing"
54
+ :color="listItemStyle.mainColor"
55
+ :border-radius="listItemStyle.imgRradius"
56
+ @on-film-detail="handleFilmDetail"
57
+ @on-buy="handleBuy"
58
+ ></content-film>
59
+ <content-cinema
60
+ v-if="type_code === 'cinema'"
61
+ style="width: 100%;height: 100%"
62
+ type="list"
63
+ :keyword="keyword"
64
+ :item="item"
65
+ :out-spacing="listItemStyle.outSpacing"
66
+ :color="{SEAT:listItemStyle.mainColor,CODE:listItemStyle.subMainColor,SELL:listItemStyle.successColor}"
67
+ :border-radius="listItemStyle.imgRradius"
68
+ @on-schedule="handleSchedule"
69
+ @on-cashier-detail="handleCashierDetail"
70
+ @on-code-detail="handleCodeDetail"
71
+ ></content-cinema>
72
+ <content-shop
73
+ v-if="type_code === 'shop'"
74
+ style="width: 100%; height: 100%"
75
+ :keyword="keyword"
76
+ :out-spacing="listItemStyle.outSpacing"
77
+ :item="item"
78
+ :color="listItemStyle.mainColor"
79
+ :border-radius="listItemStyle.imgRradius"
80
+ :is-echange="'Y' || listItemStyle.isShowExchange"
81
+ @on-shop-jhd="handleShopJhd"
82
+ @on-shop-detail="handleShopDetail"
83
+ ></content-shop>
83
84
  <content-product
84
- v-if="$parentVm.productConfig !== null && type_code === 'product'"
85
+ v-if="productConfig !== null && type_code === 'product'"
85
86
  style="width: 100%; height: 100%"
86
- :product-config="$parentVm.productConfig"
87
- :out-spacing="$parentVm.outSpacing"
87
+ :keyword="keyword"
88
+ :product-config="productConfig"
89
+ :out-spacing="listItemStyle.outSpacing"
88
90
  :item="item"
89
- :brand-color="$parentVm.brandColor"
90
- :color="$parentVm.mainColor"
91
- :border-radius="$parentVm.imgRradius"
91
+ :brand-color="listItemStyle.brandColor"
92
+ :color="listItemStyle.mainColor"
93
+ :border-radius="listItemStyle.imgRradius"
92
94
  :cell="type_other"
93
95
  @on-product-detail="handleProductDetail"
94
96
  ></content-product>
@@ -101,26 +103,28 @@
101
103
  v-for="item in productTowList[listKey]"
102
104
  :key="item.cuid"
103
105
  :style="{
104
- marginBottom:$parentVm.outSpacing + 'rpx',
106
+ marginBottom:listItemStyle.outSpacing + 'rpx',
105
107
  padding:contMarginComp,
106
- borderRadius:$parentVm.contRradius+ 'rpx',
107
- border: $parentVm.contBorder,
108
- boxShadow:$parentVm.contShadow,
108
+ borderRadius:listItemStyle.contRradius+ 'rpx',
109
+ border: listItemStyle.contBorder,
110
+ boxShadow:listItemStyle.contShadow,
109
111
  width: (type_code === 'product' && type_other === 2) ? (outItemProduct + 'rpx'): 'auto',
110
112
  height: heightRpx,
111
- backgroundColor: $parentVm.contBgColor
113
+ backgroundColor: listItemStyle.contBgColor
112
114
  }"
113
115
  >
114
116
  <content-product
115
- v-if="$parentVm.productConfig !== null"
117
+
118
+ v-if="productConfig !== null"
116
119
  style="width: 100%; height: 100%"
117
- :product-config="$parentVm.productConfig"
118
- :out-spacing="$parentVm.outSpacing"
120
+ :keyword="keyword"
121
+ :product-config="productConfig"
122
+ :out-spacing="listItemStyle.outSpacing"
119
123
  :item="item"
120
124
  :height="outItemProduct"
121
- :color="$parentVm.mainColor"
122
- :brand-color="$parentVm.brandColor"
123
- :border-radius="$parentVm.imgRradius"
125
+ :color="listItemStyle.mainColor"
126
+ :brand-color="listItemStyle.brandColor"
127
+ :border-radius="listItemStyle.imgRradius"
124
128
  :cell="type_other"
125
129
  @on-product-detail="handleProductDetail"
126
130
  ></content-product>
@@ -159,6 +163,14 @@ export default {
159
163
  type:String,
160
164
  default:'',
161
165
  },
166
+ listItemStyle:{
167
+ type:Object|null,
168
+ default:null,
169
+ },
170
+ productConfig:{
171
+ type:Object|null,
172
+ default:null,
173
+ },
162
174
  tabId:{
163
175
  type:String,
164
176
  required:true
@@ -196,17 +208,19 @@ export default {
196
208
  return params
197
209
  },
198
210
  contMarginComp(){
199
- let str = `${this.$parentVm.checkValue(this.$parentVm.contMargin.top, 20)}rpx`;
200
- str = `${str} ${this.$parentVm.checkValue(this.$parentVm.contMargin.right, 20)}rpx`;
201
- str = `${str} ${this.$parentVm.checkValue(this.$parentVm.contMargin.bottom, 20)}rpx`;
202
- str = `${str} ${this.$parentVm.checkValue(this.$parentVm.contMargin.left, 20)}rpx`;
211
+ if(this.getParent === null) return 0
212
+ let str = `${this.getParent().checkValue(this.listItemStyle.contMargin.top, 20)}rpx`;
213
+ str = `${str} ${this.getParent().checkValue(this.listItemStyle.contMargin.right, 20)}rpx`;
214
+ str = `${str} ${this.getParent().checkValue(this.listItemStyle.contMargin.bottom, 20)}rpx`;
215
+ str = `${str} ${this.getParent().checkValue(this.listItemStyle.contMargin.left, 20)}rpx`;
203
216
  return str
204
217
  },
205
218
  outItemProduct(){
219
+ if(this.getParent === null) return 0
206
220
  //获取每列元素最大宽度
207
- let num = (750 - 3 * Number(this.$parentVm.outSpacing))/2;
208
- num = num - this.$parentVm.checkValue(this.$parentVm.contMargin.right, 20) - this.$parentVm.checkValue(this.$parentVm.contMargin.left, 20);
209
- return num - this.$parentVm.contBorderWidth * 2
221
+ let num = (750 - 3 * Number(this.listItemStyle.outSpacing))/2;
222
+ num = num - this.getParent().checkValue(this.listItemStyle.contMargin.right, 20) - this.getParent().checkValue(this.listItemStyle.contMargin.left, 20);
223
+ return num - this.listItemStyle.contBorderWidth * 2
210
224
  },
211
225
  heightRpx(){
212
226
  let h = 'auto'
@@ -218,13 +232,14 @@ export default {
218
232
  },
219
233
  data(){
220
234
  return {
221
- $parentVm:{},
235
+ /**@type Function|null**/
236
+ getParent:null,
222
237
  parentStatus: false,
223
238
  skeletonCount: 6,
224
239
  hasNoData: false,
225
240
 
226
241
  page_token:'1',
227
- page_size: 100,
242
+ page_size: 20,
228
243
 
229
244
  //参数
230
245
  type_code:'',
@@ -284,7 +299,7 @@ export default {
284
299
  this.type_code = tabs[1];
285
300
  if(this.type_code === 'product'){
286
301
  this.type_other = Number(tabs[3]);
287
- if(this.type_other === 2) this.skeletonCount = 12
302
+ if(this.type_other === 2) this.skeletonCount = 6
288
303
  else this.skeletonCount = 6
289
304
  }
290
305
  else {
@@ -299,7 +314,7 @@ export default {
299
314
  this.is_open_city = 'N';
300
315
  this.dataConfig = null;
301
316
  this.page_token = '1';
302
- this.dataList = [];
317
+ this.dataList = null;
303
318
  this.productTowList = {
304
319
  left:null,
305
320
  right:null,
@@ -307,14 +322,14 @@ export default {
307
322
  },
308
323
 
309
324
  getParentMV(){
310
- this.$emit('on-parent-vm', ($vm)=>{
311
- //this.$parentVm = $vm;
325
+ this.$emit('on-parent-vm', (getParent)=>{
326
+ this.getParent = getParent;
312
327
  this.parentStatus = true;
313
328
  })
314
329
  },
315
330
 
316
331
  onCusReachBottom(){
317
- if(!this.page_token) return false;
332
+ if(this.dataList === null || !this.page_token) return false;
318
333
  this.getList();
319
334
  },
320
335
 
@@ -331,12 +346,11 @@ export default {
331
346
  if(this.keyword === '') {
332
347
  return;
333
348
  }
334
- this.$xdShowLoading({});
335
- console.log(new Date().getTime()-time)
349
+ //this.$xdShowLoading({});
336
350
  this.$emit('on-list', {
337
351
  params:this.getParams,
338
352
  cb:(res)=>{
339
- console.log(new Date().getTime()-time)
353
+ console.log(new Date().getTime()-time);
340
354
  //无数据处理
341
355
  if(res === null){
342
356
  this.hasNoData = true;
@@ -382,34 +396,34 @@ export default {
382
396
 
383
397
  //影片
384
398
  handleFilmDetail(film){
385
- this.$parentVm.handleFilmDetail(film, this.dataConfig)
399
+ this.getParent().handleFilmDetail(film, this.dataConfig)
386
400
  },
387
401
  handleBuy(film){
388
- this.$parentVm.handleBuy(film, this.dataConfig)
402
+ this.getParent().handleBuy(film, this.dataConfig)
389
403
  },
390
404
 
391
405
  //影院
392
406
  handleSchedule(cinema){
393
- this.$parentVm.handleSchedule(cinema, this.dataConfig)
407
+ this.getParent().handleSchedule(cinema, this.dataConfig)
394
408
  },
395
409
  handleCashierDetail(cinema){
396
- this.$parentVm.handleCashierDetail(cinema, this.dataConfig)
410
+ this.getParent().handleCashierDetail(cinema, this.dataConfig)
397
411
  },
398
412
  handleCodeDetail(cinema){
399
- this.$parentVm.handleCodeDetail(cinema, this.dataConfig)
413
+ this.getParent().handleCodeDetail(cinema, this.dataConfig)
400
414
  },
401
415
 
402
416
  //门店
403
417
  handleShopJhd(shop){
404
- this.$parentVm.handleShopJhd(shop, this.dataConfig)
418
+ this.getParent().handleShopJhd(shop, this.dataConfig)
405
419
  },
406
420
  handleShopDetail(shop){
407
- this.$parentVm.handleShopDetail(shop, this.dataConfig)
421
+ this.getParent().handleShopDetail(shop, this.dataConfig)
408
422
  },
409
423
 
410
424
  //商品
411
425
  handleProductDetail(product){
412
- this.$parentVm.handleProductDetail(product, this.dataConfig)
426
+ this.getParent().handleProductDetail(product, this.dataConfig)
413
427
  },
414
428
 
415
429
  }
@@ -41,7 +41,6 @@
41
41
  </view>
42
42
  </view>
43
43
  <view v-if="!isPreview" style="height: 100rpx;"></view>
44
-
45
44
  <view class="tfk-search" :style="{padding: outSpacing + 'rpx'}">
46
45
  <!-- <all-list v-if="tabId === 'all'"-->
47
46
  <!-- :keyword="keyword"-->
@@ -52,13 +51,14 @@
52
51
  <custom-list
53
52
  :tab-id="tabId"
54
53
  :keyword="keyword"
54
+ :list-item-style="listItemStyle"
55
+ :product-config="productConfig"
55
56
  ref="customList"
56
57
  @on-parent-vm="handleParentVm"
57
58
  @on-list="handleList"
58
59
  ></custom-list>
59
60
  </view>
60
61
  </view>
61
-
62
62
  </view>
63
63
  </view>
64
64
  </template>
@@ -75,6 +75,12 @@
75
75
  import CustomList from "./CustomList.vue";
76
76
  //import AllList from "./AllList.vue";
77
77
 
78
+ class EmitParent {
79
+ constructor(options) {
80
+ this.options = options;
81
+ }
82
+ }
83
+
78
84
  export default {
79
85
  name: "JfbBaseTfkSearch",
80
86
  components: {
@@ -120,7 +126,7 @@
120
126
  allModuleItemContPadding: {},
121
127
  allModuleItemContRadius: 16,
122
128
  allModuleItemContBgColor: "#FFFFFF",
123
-
129
+ emitParent:{},
124
130
  }
125
131
  },
126
132
  computed: {
@@ -186,14 +192,19 @@
186
192
  container(value, oldValue) {
187
193
  if (JSON.stringify(value) === JSON.stringify(oldValue)) return;
188
194
  if (this.$configProject['isPreview']){
189
- this.cusInit(value)
190
195
  this.init(value);
196
+ this.cusInit(value)
191
197
  }
192
198
  },
193
199
  },
194
200
  created() {
195
- this.cusInit(this.container);
201
+ this.emitParent = new EmitParent({
202
+ getParent: ()=>{
203
+ return this;
204
+ }
205
+ })
196
206
  this.init(this.container);
207
+ this.cusInit(this.container);
197
208
  },
198
209
 
199
210
  methods: {
@@ -214,6 +225,7 @@
214
225
  }).then(res => {
215
226
  if(this.tabId === 'all'){
216
227
  if(!this.$configProject['isPreview']){
228
+ res = this.filtersResData(res);
217
229
  this.menuList = res.tabs;
218
230
  }
219
231
  cb(res.list)
@@ -221,7 +233,9 @@
221
233
  if(this.isPreview){
222
234
  return cb(res.list.find(item => item.type === this.tabId.split("@")[1]))
223
235
  }
224
- if(res.list.length > 0) cb(res.list[0])
236
+ if(res.list.length > 0) {
237
+ cb(res.list[0])
238
+ }
225
239
  else cb(null)
226
240
  }
227
241
  }).catch((e)=>{
@@ -277,18 +291,10 @@
277
291
  // console.log('event.onJfbScroll', options)
278
292
  },
279
293
 
280
- onJfbShow(options) {
281
- console.log('event.onJfbShow', options)
282
- },
283
- onJfbHide(options) {
284
- console.log('event.onJfbHide', options)
285
- },
286
294
  onJfbBack(options) {
287
- console.log('event.onJfbBack', options)
288
- },
289
- onJfbUpdate(...data) {
290
- console.log('event.onJfbUpdate', data)
295
+ this.$xdUniHelper.navigateBack()
291
296
  },
297
+
292
298
  onJfbCustomEvent({action, data}) {
293
299
  if(action === 'baseHeader@search'){
294
300
  uni.pageScrollTo({
@@ -4,17 +4,7 @@ import { getContainerPropsValue } from "@/utils/xd.base";
4
4
  export default {
5
5
  data(){
6
6
  return {
7
- isShowExchange:'N',
8
-
9
- contMargin:{},
10
- contRradius:'10',
11
- contShadow:'',
12
- contBorder:'',
13
- contBgColor:'',
14
- contBorderWidth: 0,
15
-
16
- imgRradius:'10',
17
-
7
+ listItemStyle:null,
18
8
  productConfig:null,
19
9
  }
20
10
  },
@@ -24,7 +14,6 @@ export default {
24
14
  methods:{
25
15
 
26
16
  cusInit(container){
27
- this.isShowExchange = getContainerPropsValue(container, 'content.isShowExchange', 'N');
28
17
 
29
18
  //商品相关
30
19
  let is_show_brand = getContainerPropsValue(container, 'content.is_show_brand', 'N');
@@ -34,43 +23,60 @@ export default {
34
23
  let isAddCart = getContainerPropsValue(container, 'content.isAddCart', "Y");
35
24
  let differ = getContainerPropsValue(container, 'content.differ', 1);
36
25
  let showActivityPrice = getContainerPropsValue(container, 'content.showActivityPrice', 'N');
37
- this.productConfig = {is_show_brand,isPrice,isShowTag,isShowDiscount,isAddCart,differ,showActivityPrice}
38
-
39
- this.brandColor = getContainerPropsValue(container, 'content.brandColor', '#aaa');
26
+ let isShowExchange = getContainerPropsValue(container, 'content.isShowExchange', 'N');
27
+ this.productConfig = {is_show_brand, isPrice, isShowTag, isShowDiscount, isAddCart, differ, showActivityPrice, isShowExchange};
40
28
 
41
29
  //内容
42
- this.contMargin = getContainerPropsValue(container, 'content.contMargin', {});
43
- this.contRradius = getContainerPropsValue(container, 'content.contRradius', '10');
44
- this.contShadow = this.getXdShadow({width:20, color:'rgba(0,0,0,0)'},getContainerPropsValue(container, 'content.contShadow', {}))
45
- this.contBorder = this.getXdBorder({width:2,color:'rgba(0,0,0,0)'},getContainerPropsValue(container, 'content.contBorder', {}));
46
- this.contBgColor = getContainerPropsValue(container, 'content.contBgColor', '#fff');
47
- this.contObjBorder = getContainerPropsValue(container, 'content.contBorder', {});
48
- if(this.contObjBorder && this.contObjBorder.type === 'Y') {
49
- if(this.contObjBorder.value && this.contObjBorder.value.width) {
50
- this.contBorderWidth = Number(this.contObjBorder.value.width);
30
+ let brandColor = getContainerPropsValue(container, 'content.brandColor', '#aaa');
31
+ let imgRradius = getContainerPropsValue(container, 'content.imgRradius', '10');
32
+ let contMargin = getContainerPropsValue(container, 'content.contMargin', {});
33
+ let contRradius = getContainerPropsValue(container, 'content.contRradius', '10');
34
+ let contShadow = this.getXdShadow({width:20, color:'rgba(0,0,0,0)'},getContainerPropsValue(container, 'content.contShadow', {}))
35
+ let contBorder = this.getXdBorder({width:2,color:'rgba(0,0,0,0)'},getContainerPropsValue(container, 'content.contBorder', {}));
36
+ let contBgColor = getContainerPropsValue(container, 'content.contBgColor', '#fff');
37
+ let contObjBorder = getContainerPropsValue(container, 'content.contBorder', {});
38
+ let contBorderWidth = 0
39
+ if(contObjBorder && contObjBorder.type === 'Y') {
40
+ if(contObjBorder.value && contObjBorder.value.width) {
41
+ contBorderWidth = Number(contObjBorder.value.width);
51
42
  }
52
- else this.contBorderWidth = 2;
43
+ else contBorderWidth = 2;
53
44
  }
45
+ this.listItemStyle = {
46
+ outSpacing: this.outSpacing,
47
+ mainColor: this.mainColor,
48
+ subMainColor: this.subMainColor,
49
+ successColor: this.successColor,
50
+ brandColor,imgRradius,contMargin,contRradius,contShadow,contBorder,contBgColor,contObjBorder,contBorderWidth}
51
+ },
54
52
 
55
- //图片
56
- this.imgRradius = getContainerPropsValue(container, 'content.imgRradius', '10');
57
-
53
+ filtersResData(res){
54
+ let list = res.list.filter(item=>{
55
+ return item.items.length > 0
56
+ });
57
+ if(res.list.length === list.length) return res;
58
+ let tabs = list.map(item=>{
59
+ return {
60
+ label: item.name,
61
+ value: item.tab
62
+ }
63
+ });
64
+ return {...res, list, tabs}
58
65
  },
59
66
 
60
67
 
61
68
  //通信相关================
62
69
  handleParentVm(cb){
63
- cb(this)
70
+ cb(this.emitParent.options.getParent)
64
71
  },
65
72
 
66
73
  onJfbReachBottom(options) {
67
- console.log('event.onJfbReachBottom', options)
68
- this.$refs['customList']['onCusReachBottom'](options)
69
-
74
+ if(this.tabId !== "all") {
75
+ this.$refs['customList']['onCusReachBottom'](options)
76
+ }
70
77
  },
71
78
 
72
79
  onCusReload() {
73
- console.log('event.onCusReload', this.options)
74
80
  this.$refs['customList']['onCusReloadList'](this.options)
75
81
  },
76
82
  //通信相关================
@@ -560,7 +560,7 @@ export default {
560
560
  //#endif
561
561
  },
562
562
 
563
- getUrlHasSpStr(pathDir){
563
+ getUrlHasSpStrDIR(pathDir){
564
564
  if(pathDir.indexOf('@site_domain@/') === 0) {
565
565
  return pathDir.replace('@site_domain@/','').split('/')[0]
566
566
  }
@@ -569,18 +569,48 @@ export default {
569
569
 
570
570
  /**
571
571
  * @description 过滤不可以用
572
- * 当前项目未H5时,过滤所有小程序应用
573
- * 当前项目未小程序时,过滤所有非当前小程序应用
572
+ * 当前项目为H5时,过滤所有小程序应用
573
+ * 当前项目为小程序时,过滤所有非当前小程序应用
574
574
  * 站外地址直接返回
575
575
  * 站内地址未选值直接返回
576
576
  * 预览模式全过
577
577
  * @param url {object}
578
578
  */
579
579
  checkUrlIsValid(url){
580
+ let projectAttr = this.$root.projectAttr;
581
+ //url = '{"dir":"wtxsaas","host":"sandbox-website-05.jufubao.cn","path":"\/main\/order\/detail","appType":"h5","site_id":"17928cc37788be02","site_url":"https:\/\/sandbox-website-05.jufubao.cn\/wtxsaas\/main\/order\/detail","frontPath":"\/wtxsaas\/main\/order\/detail","fixed_business_code":""}'
580
582
  if(!url) return null;
581
583
  try {
584
+ let redirect_data = JSON.parse(url);
585
+ if(!redirect_data['appType']) redirect_data['appType']= 'h5';
586
+
587
+ //#ifdef H5
588
+ if(redirect_data['appType'] === 'wxmp') return null;
589
+ else {
590
+ if(redirect_data.dir === projectAttr.deploy_dir) {
591
+ return redirect_data.path
592
+ }
593
+ else {
594
+ return `//${projectAttr.host}/${redirect_data.frontPath}`
595
+ }
596
+
597
+ }
598
+ //#endif
582
599
 
600
+ //#ifdef MP-WEIXIN
601
+
602
+ let dir = this.getUrlHasSpStrDIR(redirect_data.path);
603
+ if(redirect_data['appType'] === 'wxmp'){
604
+ if(projectAttr.deploy_dir === dir) return redirect_data.path;
605
+ else return null;
606
+ }
607
+ else if(redirect_data['appType'] === 'h5'){
608
+
609
+ }
610
+ else return null;
611
+ //#endif
583
612
  }catch (e){
613
+ console.error(e);
584
614
  return null;
585
615
  }
586
616
  // let content = list.filter(item=>{
@@ -0,0 +1,122 @@
1
+ 'use strict';
2
+
3
+ export default {
4
+ methods:{
5
+ /**
6
+ * @description 过滤不可以用
7
+ * 当前项目未H5时,过滤所有小程序应用
8
+ * 当前项目未小程序时,过滤所有非当前小程序应用
9
+ * 站外地址直接返回
10
+ * 站内地址未选值直接返回
11
+ * 预览模式全过
12
+ */
13
+ posterFilterNoUseData(list = []){
14
+ let content = this.$xdUniHelper.cloneDeep(list).filter(item=>{
15
+ //预览模式
16
+ if( this.$configProject.isPreview) return true;
17
+
18
+ //非内部应用
19
+ if(item.redirect_type !== 'INN') return true
20
+
21
+ //没有配置链接
22
+ if(!item.redirect_data) return true;
23
+
24
+ //内部应用
25
+ else {
26
+ let redirect_data;
27
+ try {
28
+ redirect_data = JSON.parse(item.redirect_data);
29
+ if(!item['app_type']) item['app_type']= 'h5';
30
+
31
+ //#ifdef H5
32
+ return item['app_type'] !== 'wxmp';
33
+ //#endif
34
+
35
+ //#ifdef MP-WEIXIN
36
+ let actDir = this.$parent['projectAttr']['deploy_dir'];
37
+ let dir = this.getPosterPathDir(redirect_data.page);
38
+ if(item['app_type'] === 'wxmp'){
39
+ return actDir === dir;
40
+ }
41
+ else if(item['app_type'] === 'h5') return true;
42
+ else return true
43
+ //#endif
44
+ }
45
+ catch (e) {
46
+ return true
47
+ }
48
+ }
49
+ });
50
+ console.warn(`PostersList:${JSON.stringify(content.map(item=>`${item.app_type}:${item.content_name}:${item.redirect_data}`), null,2)}`)
51
+ return content;
52
+
53
+ },
54
+
55
+ getPosterPathDir(pathDir){
56
+ if(pathDir.indexOf('@site_domain@/') === 0) {
57
+ return pathDir.replace('@site_domain@/','').split('/')[0]
58
+ }
59
+ return ''
60
+ },
61
+
62
+ handlePosterClick(item) {
63
+ if(!item.redirect_data) {
64
+ console.warn(`未配置链接地址: ${item.redirect_data}`);
65
+ console.error(`未配置链接地址: ${item.redirect_data}`);
66
+ return
67
+ }
68
+
69
+ //内部链接跳转地址
70
+ if (item.redirect_type === 'INN') {
71
+ try {
72
+ let url = JSON.parse(item.redirect_data);
73
+ let params = '';
74
+ if(url.page) {
75
+ if (item['redirect_params']) params = `?${item['redirect_params']}`;
76
+ this.$xdUniHelper.navigateTo({url: url.page + params})
77
+ }
78
+ else {
79
+ console.error(`应用链接配置错误: ${url.page}`)
80
+ }
81
+ } catch (e) {
82
+ console.error(`应用链接配置错误: ${item.redirect_data}`)
83
+ }
84
+ }
85
+
86
+ //外部链接
87
+ if (item.redirect_type === 'URL') {
88
+ let reg = /^(http:\/\/|https:\/\/|\/\/)+.+$/;
89
+ let spReg = /(-apiuri\/v)/;
90
+ //#ifdef MP-WEIXIN
91
+ try {
92
+ let url = JSON.parse(item.redirect_data);
93
+ if (reg.test(url.url) || spReg.test(url.url)) {
94
+ console.warn(`广告跳转外站: ${url.url}`)
95
+ this.$xdUniHelper.navigateTo(url);
96
+ } else {
97
+ console.error(`广告跳转外站配置错误: ${url.url}`)
98
+ }
99
+ } catch (e) {
100
+ console.error(`广告跳转外站配置错误: ${item.redirect_data}`)
101
+ }
102
+ //#endif
103
+ //#ifdef H5
104
+ try {
105
+ let url = JSON.parse(item.redirect_data);
106
+ console.warn(`广告跳转外站: ${url.url}`);
107
+ this.$xdUniHelper.redirectTo(url, false)
108
+ } catch (e) {
109
+ console.error(`广告跳转外站配置错误: ${item.redirect_data}`)
110
+ }
111
+ //#endif
112
+
113
+ }
114
+
115
+ //无跳转地址
116
+ if(item.redirect_type === 'EMP') {
117
+ console.warn(`无跳转地址`);
118
+ }
119
+ },
120
+ },
121
+ }
122
+