jufubao-base 1.0.156 → 1.0.157-beta1

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.156",
3
+ "version": "1.0.157-beta1",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件基础插件包",
6
6
  "main": "index.js",
@@ -7,6 +7,28 @@ export default {
7
7
  style: [],
8
8
  content: (data) => {
9
9
  return [
10
+ {
11
+ label: '选择综合入口类型:',
12
+ ele: 'xd-site-select-list',
13
+ valueKey: 'entryType',
14
+ value: data['entryType'],
15
+ placeholder: '请选择综合入口类型',
16
+ multiple: false,
17
+ groupKey:'content',
18
+ className: 'input50',
19
+ rules: [
20
+ {required: true, message: '请选择综合入口类型', trigger: ['blur', 'change']}
21
+ ],
22
+ handleCustom({action, data}) {
23
+ XdBus.getParentApi('getEntryGroupOption')({key: Date.now()})
24
+ .then(res => {
25
+ data.cb(res.list)
26
+ })
27
+ .catch(error => {
28
+ console.error(error);
29
+ });
30
+ },
31
+ },
10
32
  {
11
33
  label: '每行显示数量',
12
34
  ele: 'xd-radio',
@@ -49,7 +49,7 @@
49
49
  import componentsMixins from "@/mixins/componentsMixins";
50
50
  import extsMixins from "@/mixins/extsMixins";
51
51
  import getServiceUrl from "@/common/getServiceUrl";
52
- import {base64} from 'js-base64';
52
+ import {mapState} from "vuex";
53
53
  export default {
54
54
  name: "JfbBaseEntry",
55
55
  components: {
@@ -66,9 +66,11 @@
66
66
  paddingInput: 20,
67
67
  loadingList: true,
68
68
  margin: {},
69
+ entryType: '',
69
70
  }
70
71
  },
71
72
  computed: {
73
+ ...mapState(['brandInfo']),
72
74
  bodyStyle(){
73
75
  return {
74
76
  backgroundColor: this.bgcolor,
@@ -111,17 +113,67 @@
111
113
  this.rowNum = getContainerPropsValue(container, 'content.rowNum', 1);
112
114
  this.paddingInput = getContainerPropsValue(container, 'content.paddingInput', 20);
113
115
  this.margin = getContainerPropsValue(container, 'content.margin', {});
116
+ this.entryType = getContainerPropsValue(container, 'content.entryType', 'default');
117
+ },
118
+
119
+ getCardPath(custom_redirect_data = {}){
120
+ //#ifdef H5
121
+ return null;
122
+ //#endif
123
+ //#ifdef MP-WEIXIN
124
+ const dir = custom_redirect_data.dir;
125
+ const actDir = this.projectAttr['deploy_dir'];
126
+ if(custom_redirect_data.appType === 'wxmp') {
127
+ if(dir === actDir) {
128
+ return {
129
+ cardPath: custom_redirect_data.path,
130
+ cardSelf: 'wxmp',
131
+ };
132
+ }
133
+ else return null;
134
+ }
135
+ else if(custom_redirect_data.appType === 'h5'){
136
+ return {
137
+ cardPath: custom_redirect_data.site_url,
138
+ cardSelf: 'h5',
139
+ };
140
+ }
141
+ else return null;
142
+ //#endif
114
143
  },
115
144
  getEntrySetting(){
116
145
  this.$xdShowLoading({});
117
146
  jfbRootExec("getEntrySetting", {
118
147
  vm: this,
119
- data: {}
148
+ data: {
149
+ group_id:this.entryType || 'default'
150
+ }
120
151
  }).then(res => {
121
152
  this.loadingList = false;
122
153
  this.$xdHideLoading();
123
- this.entryList = res.list.map(item => {
124
- const {dir, path, host} = item['redirect_data'];
154
+ let isH5FilterEntryList = [];
155
+ let isMpFilterEntryList = [];
156
+ this.entryList = res.list.filter(item=>{
157
+ //#ifdef H5
158
+ //在H5平台应用中不可跳转到微信小程序应用
159
+ if(item.redirect_data.appType === 'wxmp'){
160
+ isH5FilterEntryList.push(item)
161
+ }
162
+ return item.redirect_data.appType !== 'wxmp';
163
+ //#endif
164
+
165
+ //#ifdef MP-WEIXIN
166
+ const dir = item['redirect_data'].dir;
167
+ const actDir = this.projectAttr['deploy_dir'];
168
+ if(item.redirect_data.appType === 'wxmp') {
169
+ if(dir !== actDir) isMpFilterEntryList.push(item)
170
+ return dir === actDir;
171
+ }
172
+ return true
173
+ //#endif
174
+ }).map(item => {
175
+ const {dir, path, host,appType} = item['redirect_data'];
176
+ if(appType === undefined) item.redirect_data.appType = 'h5';
125
177
  item['image_url'] = getServiceUrl(item.image_url);
126
178
  item['image_url2'] = item.image_url2 ? getServiceUrl(item.image_url2) : "";
127
179
  item['image_url3'] = item.image_url3 ? getServiceUrl(item.image_url3) : "";
@@ -139,24 +191,36 @@
139
191
  let jumpUrl = path;
140
192
 
141
193
  //域名相同并且应用路径不相同时候处理
142
- if(host === this.projectAttr.host
143
- && this.projectAttr['deploy_dir'] !== dir
144
- ){
194
+ if(host === this.projectAttr.host && this.projectAttr['deploy_dir'] !== dir){
145
195
  jumpUrl = `//${host}/${dir}${path}`;
146
196
  //#ifdef MP-WEIXIN
147
197
  jumpUrl = `https:${jumpUrl}`;
148
198
  //#endif
149
199
  }
150
200
 
151
- if(item['redirect_data']['fixed_business_code'] === '') {
152
- item['redirect_data']['path'] = `${jumpUrl}?x-common=${nsp}&vs=${new Date().getTime()}`
153
- }
154
- else{
155
- item['redirect_data']['path'] = `${jumpUrl}?x-common=${nsp}&vs=${new Date().getTime()}`
201
+ //获取自定义卡券登录地址(微信小程序跳转到H5平台起作用)
202
+ let cardPathStr = '';
203
+ //#ifdef MP-WEIXIN
204
+ if(item.redirect_data.appType === 'h5') {
205
+ const custom_redirect_data = this.$xdUniHelper.checkVarType(item['custom_redirect_data']) === 'object'?item['custom_redirect_data']:{};
206
+ const cardPathObject = this.getCardPath(custom_redirect_data);
207
+ if(cardPathObject !== null) {
208
+ const {cardPath, cardSelf} =cardPathObject
209
+ if(cardPath) cardPathStr = `&card-login=${encodeURIComponent(cardPath)}&cardSelf=${cardSelf}`
210
+ }
211
+
156
212
  }
213
+ //#endif
214
+ item['redirect_data']['path'] = `${jumpUrl}?x-common=${nsp}&vs=${new Date().getTime()}${cardPathStr}`
157
215
  return item;
158
216
  });
159
- console.log( this.entryList)
217
+ //#ifdef MP-WEIXIN
218
+ console.warn(`微信小程序端被过滤的入口列表:${JSON.stringify(isMpFilterEntryList.map(item=> `${item.redirect_data.appType}:${item.entry_name}:${item.redirect_data['frontPath']}`),null,2)}`)
219
+ //#endif
220
+ //#ifdef H5
221
+ console.warn(`H5端被过滤的入口列表:${JSON.stringify(isH5FilterEntryList.map(item=> `${item.redirect_data.appType}:${item.entry_name}:${item.redirect_data['frontPath']}`),null,2)}`)
222
+ //#endif
223
+ console.warn(`福利入口链接列表:${JSON.stringify(this.entryList.map(item=> `${item.redirect_data.appType}:${item.redirect_data['path']}`),null,2)}`);
160
224
  if(res.list.length === 1) this.toLink(this.entryList[0]);
161
225
  if(res.list.length === 0) {
162
226
  this.$xdAlert({content: '当前票券暂无支持服务'})
@@ -261,8 +261,6 @@ export default {
261
261
  {"label": "滚动显示", "value": '2'},
262
262
  {"label": "弹窗显示", "value": '3'},
263
263
  ],
264
- inline:false,
265
- notice:'预览模式点击使用“<span style="color:red">弹窗显示</span>”会重新触发页面刷新,可点击弹出遮罩层进行关闭功能'
266
264
  },
267
265
  {
268
266
  label: '是否隐藏弹框(仅预览模式生效):',
@@ -235,7 +235,13 @@
235
235
  this.speedKey = Date.now()
236
236
  }, 400)
237
237
 
238
- }
238
+ },
239
+ is_hide_dailog(value){
240
+ if(value === 'N') {
241
+ storage.remove(this.containerId);
242
+ this.onJfbLoad();
243
+ }
244
+ },
239
245
  },
240
246
  computed:{
241
247
  marginUi() {
@@ -281,13 +287,6 @@
281
287
  return this.num > 1
282
288
  },
283
289
 
284
- is_hide_dailog(value){
285
- if(value === 'N') {
286
- storage.remove(this.containerId);
287
- this.onJfbLoad();
288
- }
289
- },
290
-
291
290
  },
292
291
  created() {
293
292
  this.backgroundColor = Color(this.warningColor).alpha(0.2).toString();
@@ -147,6 +147,50 @@
147
147
  handleAnimationfinish(e) {
148
148
  this.current = e.detail.current;
149
149
  },
150
+
151
+ /**
152
+ * @description 过滤不可以用
153
+ * 当前项目未H5时,过滤所有小程序应用
154
+ * 当前项目未小程序时,过滤所有非当前小程序应用
155
+ * 站外地址直接返回
156
+ * 站内地址未选值直接返回
157
+ * 预览模式全过
158
+ */
159
+ filterItem(){
160
+ let content = this.content.filter(item=>{
161
+ //预览模式
162
+ if( this.$configProject.isPreview) return true;
163
+
164
+ //非内部应用
165
+ if(item.redirect_type !== 'INN') {
166
+ return true
167
+ }
168
+
169
+ //内部应用
170
+ else {
171
+ let redirect_data;
172
+ try {
173
+ redirect_data = JSON.parse(item.redirect_data);
174
+ if(!redirect_data.appType) redirect_data.appType = 'h5'
175
+ //#ifdef H5
176
+ return redirect_data.appType !== 'wxmp';
177
+ //#endif
178
+
179
+ //#ifdef MP-WEIXIN
180
+ console.log(redirect_data,item,this.$parent.projectAttr)
181
+ debugger
182
+ //#endif
183
+ } catch (e) {
184
+ console.error(e)
185
+ return true
186
+ }
187
+ }
188
+ });
189
+ console.log(content)
190
+ return content;
191
+
192
+ },
193
+
150
194
  init() {
151
195
  if (this.timer) clearTimeout(this.timer);
152
196
  this.timer = setTimeout(() => {
@@ -154,19 +198,22 @@
154
198
  this.height = this.config.height;
155
199
  this.padding = 0;
156
200
 
201
+ //过滤不可以用
202
+ const content = this.filterItem();
203
+
157
204
  //静态图显示
158
205
  if(this.config.isCarousel === false) {
159
- this.list = this.content.filter((item,index)=>{
206
+ this.list = content.filter((item,index)=>{
160
207
  return index < (this.config.cells * this.config.jdRows);
161
208
  })
162
209
  }
163
210
  //轮播图显示
164
211
  else {
165
212
  let num = this.config.cells * this.config.jdRows;
166
- let maxPage = Math.ceil(this.content.length / num);
213
+ let maxPage = Math.ceil(content.length / num);
167
214
  let arr = [];
168
215
  for(let i =1 ; i <= maxPage; i++) {
169
- arr.push(this.$xdUniHelper.getLocalPaginationData(this.content, i, num))
216
+ arr.push(this.$xdUniHelper.getLocalPaginationData(content, i, num))
170
217
  }
171
218
  this.list = arr;
172
219
  }
@@ -175,7 +222,6 @@
175
222
  }, 100)
176
223
  },
177
224
  handleClick(item) {
178
- debugger
179
225
  //内部链接跳转地址
180
226
  if (item.redirect_type === 'INN') {
181
227
  try {
@@ -131,41 +131,6 @@
131
131
  handleAnimationfinish(e) {
132
132
  this.current = e.detail.current;
133
133
  },
134
- handleClick(item, index){
135
- this.current = index;
136
- const handle = (data) => {
137
- try {
138
- return JSON.parse(data);
139
- } catch (e) {
140
- return {}
141
- }
142
- };
143
- if(this.$configProject.isPreview) {
144
- console.log(item)
145
- }
146
- else {
147
- if (item['redirect_type'] === 'EMP') return;
148
- let url = '';
149
-
150
- if (item['redirect_type'] === 'URL') {
151
- url = handle(item['redirect_data']).url || ''
152
- }
153
-
154
- if (item['redirect_type'] === 'INN') {
155
- url = handle(item['redirect_data']).page || ''
156
- }
157
- if (item['redirect_type'] === 'APP') {
158
- return;
159
- }
160
- if (url === '') {
161
- return;
162
- }
163
-
164
- if(url.indexOf('?') === -1) url = `${url}?vs=${new Date().getTime()}`;
165
- else url = `${url}&vs=${new Date().getTime()}`;
166
- this.$xdUniHelper.navigateTo({url})
167
- }
168
- },
169
134
  handleImage(list){
170
135
  return list.map(item => {
171
136
  return {
@@ -32,7 +32,6 @@
32
32
  :key="videoKey"
33
33
  :poster="videoSetting"
34
34
  :video="video"
35
- :pack-this="$vm"
36
35
  ></xd-video>
37
36
  <view class="not-video" v-if="video === ''">
38
37
  <image :src="getVideoSrc"></image>
@@ -73,7 +72,6 @@
73
72
  width:750,
74
73
  bgColor:'',
75
74
  radius:0,
76
- $vm: {},
77
75
  videoKey : Date.now()
78
76
  }
79
77
  },
@@ -126,7 +124,6 @@
126
124
  }
127
125
  },
128
126
  created() {
129
- this.$vm = this;
130
127
  this.isPreview = this.$configProject.isPreview;
131
128
  this.init(this.container);
132
129
  },
@@ -50,10 +50,6 @@
50
50
  type: String|Number,
51
51
  default: 0
52
52
  },
53
- packThis:{
54
- type:Object,
55
- required: true
56
- },
57
53
  video:{
58
54
  type:Object,
59
55
  required: true