jufubao-base 1.0.289-beta2 → 1.0.290-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.
Files changed (28) hide show
  1. package/package.json +1 -1
  2. package/src/components/JfbBaseFooter/Attr.js +155 -10
  3. package/src/components/JfbBaseFooter/JfbBaseFooter.vue +43 -96
  4. package/src/components/JfbBaseSavingDetail/JfbBaseSavingDetail.vue +14 -2
  5. package/src/components/JfbBaseTfkSearch/Api.js +0 -15
  6. package/src/components/JfbBaseTfkSearch/CustomList.vue +0 -10
  7. package/src/components/JfbBaseTfkSearch/JfbBaseTfkSearch.vue +7 -247
  8. package/src/components/JfbBaseUserInfo/Attr.js +0 -12
  9. package/src/components/JfbBaseUserInfo/JfbBaseUserInfo.vue +2 -8
  10. package/src/mixins/componentsMixins.js +55 -363
  11. package/src/mixins/posterMixins.js +199 -27
  12. package/src/components/CusCouponChose/CusCouponChose.vue +0 -1027
  13. package/src/components/CusCouponItem/CusCouponItem.vue +0 -298
  14. package/src/components/CusEnter/CusEnter.vue +0 -360
  15. package/src/components/CusPoster/CusPoster.vue +0 -212
  16. package/src/components/CusPoster/CusSwiperDot.vue +0 -234
  17. package/src/components/CusProduct/CusProduct.vue +0 -372
  18. package/src/components/CusShops/CusShops.vue +0 -518
  19. package/src/components/CusSwiperDot/CusSwiperDot.vue +0 -234
  20. package/src/components/CusTab/CusTab.vue +0 -411
  21. package/src/components/CusVideo/CusVideo.vue +0 -170
  22. package/src/components/JfbBaseFooter/cusAttr/advanced.js +0 -12
  23. package/src/components/JfbBaseFooter/cusAttr/content.js +0 -447
  24. package/src/components/JfbBaseFooter/cusAttr/style.js +0 -7
  25. package/src/components/JfbBaseFooter/cusAttr/tools.js +0 -17
  26. package/src/components/JfbBaseTfkSearch/XdQueryFilter.vue +0 -354
  27. package/src/components/JfbBaseTfkSearch/XdQuerySort.vue +0 -192
  28. package/src/mixins/productCompMixins.js +0 -252
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
+ import {mapActions} from "vuex";
2
3
 
3
4
  export default {
4
- data(){
5
-
6
- },
7
5
  methods:{
6
+ ...mapActions(['wxCodeForGetAppId']),
7
+
8
8
  /**
9
9
  * @description 过滤不可以用
10
10
  * 当前项目未H5时,过滤所有小程序应用
@@ -14,53 +14,225 @@ export default {
14
14
  * 预览模式全过
15
15
  */
16
16
  posterFilterNoUseData(list = []){
17
- let content = this.$xdUniHelper.cloneDeep(list).filter(item=>{
17
+ return this.filterPosterItem(list);
18
+ },
19
+
20
+ //====== h5 to wxmp(外部链接) 或者 wxmp to wxmp(外部链接) =========
21
+ filterPosterItem(list){
22
+ let content = list.filter(item=>{
18
23
  //预览模式
19
24
  if( this.$configProject.isPreview) return true;
20
25
 
21
- //非内部应用
26
+ //非内部应用(URL|EMP|WMP)
22
27
  if(item.redirect_type !== 'INN') return true
23
28
 
24
29
  //没有配置链接
25
30
  if(!item.redirect_data) return true;
26
31
 
27
32
  //内部应用
33
+ return true;
34
+ });
35
+ console.warn(`filterPosterItem.posterMixins:${JSON.stringify(content.map(item=>`${item.app_type}:${item.content_name}:${item.redirect_data}`), null,2)}`)
36
+ return content;
37
+ },
38
+
39
+ getSchemeUrl(app_id, url, params){
40
+ let env_version = 'release';
41
+ let query = '';
42
+ if(params) query = `&query=${encodeURIComponent(params)}`;
43
+ return `weixin://dl/business/?appid=${app_id}&path=${url}${query}&env_version=${env_version}`;;
44
+ },
45
+
46
+ //#ifdef H5
47
+ handleH5ToMP(app_id , url, params){
48
+ let newUrl = '/' + url.split('/').splice(-3).join('/');
49
+ let entry = '/pages/loading/loading';
50
+ let query = `callback_local=${newUrl}`;
51
+ if(params) query = `${query}&${params}`;
52
+ window.location.href = this.getSchemeUrl(app_id, entry, query);
53
+ },
54
+ //#endif
55
+
56
+ //#ifdef MP-WEIXIN
57
+ handleToMp(app_id,entry){
58
+ let envVersion = 'release';
59
+ wx.navigateToMiniProgram({
60
+ appId: app_id,
61
+ path: entry,
62
+ envVersion,
63
+ success(res) {
64
+ console.log(res);
65
+ },
66
+ fail:(err)=>{
67
+ console.error(err);
68
+ }
69
+ });
70
+ },
71
+
72
+ handleMpToMP(app_id , url, params){
73
+ let newUrl = '/' + url.split('/').splice(-3).join('/');
74
+ let entry = '/pages/loading/loading';
75
+ let query = `callback_local=${newUrl}`;
76
+ if(params) query = `${query}&${params}`;
77
+ entry = `${entry}?${query}`;
78
+ this.handleToMp(app_id,entry)
79
+ },
80
+ //#endif
81
+
82
+ /**
83
+ * @description 处理站点应用内部跳转微信小程序处理
84
+ * @param code {string} 站点内部微信小程序aopen_app_code
85
+ * @param type {string} h5|wxmp
86
+ * @param url {string} 内部链接地址
87
+ * @param params {string} 自定义参数 例如:id=1&cid=1234
88
+ */
89
+ codeForGetAppId(code, type, url,params){
90
+ this.wxCodeForGetAppId({app_code: code})
91
+ .then(app_id=>{
92
+ //#ifdef H5
93
+ if(type === 'h5') this.handleH5ToMP(app_id,url, params || '');
94
+ //#endif
95
+
96
+ //#ifdef MP-WEIXIN
97
+ let obj = parsePath(url);
98
+ //跳转路径所在应用为微信小程序并且不属于当前应用
99
+ if(!obj.isSameApp && type === 'wxmp'){
100
+ this.handleMpToMP( app_id, url, params || '')
101
+ }
102
+ //#endif
103
+ })
104
+ .catch(err=>{
105
+ console.error(err)
106
+ })
107
+ },
108
+
109
+ /**
110
+ * @description 跳转到第三方维修小程序
111
+ * @param item
112
+ */
113
+ toOtherWxMp(item){
114
+ try {
115
+ let url = JSON.parse(item.redirect_data);
116
+
117
+ //url = {data: `/pages/loading/loading?callback=${encodeURIComponent('/pages/loading/loading')}&version=1.0.0`, app_id: '11212121212'}
118
+ //url = {data: `weixin://dl/business/?appid=11212121212&path=/pages/loading/loading&query=callback%3D%252Fpages%252Floading%252Floading%26version%3D1.0.0&env_version=release`, app_id: '11212121212'}
119
+
120
+ //#ifdef H5
121
+ let businessUrl = '';
122
+ if(url.data.indexOf('weixin://dl/business/?appid=') === 0) businessUrl = url.data;
28
123
  else {
29
- let redirect_data;
30
- try {
31
- redirect_data = JSON.parse(item.redirect_data);
32
- if(!item['app_type']) item['app_type']= 'h5';
124
+ let arr = url.data.split('?');
125
+ if(url.app_id) {
126
+ businessUrl = this.getSchemeUrl(url.app_id, arr[0], arr[1]||'');
127
+ }
128
+ else console.error(`未设置APP_ID: ${url.app_id}`);
129
+ }
130
+ if(businessUrl) window.location.href = businessUrl;
131
+ //#endif
132
+
133
+ //#ifdef MP-WEIXIN
134
+ this.handleToMp(url.app_id, url.data)
135
+ //#endif
136
+ }catch (e) {
137
+ console.error(`应用链接配置错误: ${item.redirect_data}`)
138
+ }
139
+
140
+ },
141
+
142
+ handlePosterClick(item){
143
+ console.warn(`handlePosterClick.posterMixins`);
144
+
145
+ //预览模式
146
+ if( this.$configProject.isPreview) return;
147
+
148
+ //未配置链接地址
149
+ if(!item.redirect_data) {
150
+ console.warn(`未配置链接地址: ${item.redirect_data}`);
151
+ console.error(`未配置链接地址: ${item.redirect_data}`);
152
+ return
153
+ }
154
+
155
+ //内部链接跳转地址
156
+ if (item.redirect_type === 'INN') {
157
+ try {
158
+ let url = JSON.parse(item.redirect_data);
159
+
160
+ let params = '';
161
+ if(url.page) {
33
162
 
34
163
  //#ifdef H5
35
- return item['app_type'] !== 'wxmp';
164
+ //h5 to wxmp (外部链接)
165
+ if(item.app_type === 'wxmp') {
166
+ if(url.app_code) this.codeForGetAppId(url.app_code, 'h5', url.page,item['redirect_params']);
167
+ else console.error(`应用外部链接为设置Code: ${url.app_code}`)
168
+ return;
169
+ }
36
170
  //#endif
37
171
 
38
172
  //#ifdef MP-WEIXIN
39
- let actDir = this.$parent['projectAttr']['deploy_dir'];
40
- let dir = this.getPosterPathDir(redirect_data.page);
41
- if(item['app_type'] === 'wxmp'){
42
- return actDir === dir;
173
+ //wxmp to wxmp(外部链接)
174
+ if(item.app_type === 'wxmp') {
175
+ if(url.app_code) this.codeForGetAppId(url.app_code, 'wxmp', url.page, item['redirect_params']);
176
+ else console.error(`应用外部链接为设置Code: ${url.app_code}`)
177
+ return;
43
178
  }
44
- else if(item['app_type'] === 'h5') return true;
45
- else return true
46
179
  //#endif
180
+
181
+ //属于站点应用内部链接:h5 to h5 或者 wxmp to wxmp
182
+ //属于站点应用外部链接:h5 to h5(外部链接)
183
+ if (item['redirect_params']) params = `?${item['redirect_params']}`;
184
+ debugger
185
+ this.$xdUniHelper.navigateTo({url: url.page + params})
47
186
  }
48
- catch (e) {
49
- return true
187
+ else {
188
+ console.error(`应用链接配置错误: ${url.page}`)
50
189
  }
190
+ } catch (e) {
191
+ console.error(e)
192
+ console.error(`应用链接配置错误: ${item.redirect_data}`)
51
193
  }
52
- });
53
- console.warn(`PostersList:${JSON.stringify(content.map(item=>`${item.app_type}:${item.content_name}:${item.redirect_data}`), null,2)}`)
54
- return content;
194
+ }
55
195
 
56
- },
196
+ //外部链接
197
+ if (item.redirect_type === 'URL') {
198
+ let reg = /^(http:\/\/|https:\/\/|\/\/)+.+$/;
199
+ let spReg = /(-apiuri\/v)/;
200
+ //#ifdef MP-WEIXIN
201
+ try {
202
+ let url = JSON.parse(item.redirect_data);
203
+ if (reg.test(url.url) || spReg.test(url.url)) {
204
+ console.warn(`广告跳转外站: ${url.url}`)
205
+ this.$xdUniHelper.navigateTo(url);
206
+ } else {
207
+ console.error(`广告跳转外站配置错误: ${url.url}`)
208
+ }
209
+ } catch (e) {
210
+ console.error(`广告跳转外站配置错误: ${item.redirect_data}`)
211
+ }
212
+ //#endif
213
+ //#ifdef H5
214
+ try {
215
+ let url = JSON.parse(item.redirect_data);
216
+ console.warn(`广告跳转外站: ${url.url}`);
217
+ this.$xdUniHelper.redirectTo(url, false)
218
+ } catch (e) {
219
+ console.error(`广告跳转外站配置错误: ${item.redirect_data}`)
220
+ }
221
+ //#endif
57
222
 
58
- getPosterPathDir(pathDir){
59
- if(pathDir.indexOf('@site_domain@/') === 0) {
60
- return pathDir.replace('@site_domain@/','').split('/')[0]
61
223
  }
62
- return ''
63
- },
224
+
225
+ //跳转到微信小程序
226
+ if(item.redirect_type === 'WMP') {
227
+ this.toOtherWxMp(item);
228
+ }
229
+
230
+ //无跳转地址
231
+ if(item.redirect_type === 'EMP') {
232
+ console.warn(`无跳转地址`);
233
+ }
234
+ }
235
+ //====== h5 to wxmp(外部链接) 或者 wxmp to wxmp(外部链接) =========
64
236
  },
65
237
  }
66
238