gxd-uni-library-editx 1.0.86 → 1.0.87-beta2

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": "gxd-uni-library-editx",
3
- "version": "1.0.86",
3
+ "version": "1.0.87-beta2",
4
4
  "private": false,
5
5
  "description": "聚福宝基础插件专用库",
6
6
  "main": "index.js",
@@ -24,7 +24,7 @@
24
24
  <!--返回上一个界元素-->
25
25
  <view class="xd-custom-bar__fixed-content-icon" @click.stop="back" v-if="!isSlotTopBar">
26
26
  <xd-font-icon
27
- v-if="noPrevToIndex && showBack && isPrev !== null"
27
+ v-if="isTopIcon"
28
28
  :icon="isPrev ? 'iconxiangzuo_xian' : 'iconshouye_mian'"
29
29
  :color="uiTextColor"
30
30
  :size="uiIconSize"
@@ -157,7 +157,7 @@
157
157
  // #ifdef H5
158
158
  return isThirdLogin().isICB && !this.isPrev
159
159
  // #endif
160
- // #ifndef H5
160
+ // #ifdef MP-WEIXIN
161
161
  return false
162
162
  // #endif
163
163
  },
@@ -177,6 +177,18 @@
177
177
  return bgc;
178
178
 
179
179
  },
180
+ isTopIcon(){
181
+ // #ifdef H5
182
+ return this.noPrevToIndex && this.showBack && this.isPrev !== null
183
+ // #endif
184
+ // #ifdef MP-WEIXIN
185
+ //自定义导航并且不显示导航设置
186
+ if(this.$parent.navigationStyle && !this.showBack) {
187
+ return this.noPrevToIndex && this.isPrev !== null
188
+ }
189
+ return this.noPrevToIndex && this.showBack && this.isPrev !== null
190
+ // #endif
191
+ }
180
192
  },
181
193
  created(){
182
194
  this.noPrevToIndex = this.$settings['noPrevPageToIndex'] === undefined ? false : this.$settings['noPrevPageToIndex'];
@@ -270,6 +282,14 @@
270
282
  },
271
283
 
272
284
  back(){
285
+ // #ifdef MP-WEIXIN
286
+ //自定义导航并且不显示导航设置
287
+ if(this.$parent.navigationStyle && !this.showBack) {
288
+ this.$xdUniHelper.navigateBack();
289
+ return;
290
+ }
291
+ // #endif
292
+
273
293
  if(!this.showBack) return;
274
294
 
275
295
  //临时兼容
@@ -288,7 +288,13 @@
288
288
 
289
289
  startAnimation : false, //开始动画效果
290
290
  doneAnimation: false, //完成动画效果
291
- defaultImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MDM4QTUyMkNDRUQyMTFFQzkzRTZDOUJBNTFBNTA3RDUiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MDM4QTUyMkRDRUQyMTFFQzkzRTZDOUJBNTFBNTA3RDUiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDozMkE3N0VGRkNFRDAxMUVDOTNFNkM5QkE1MUE1MDdENSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDozMkE3N0YwMENFRDAxMUVDOTNFNkM5QkE1MUE1MDdENSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PliHXlsAAAAQSURBVHjaYvj//z8DQIABAAj8Av7bok0WAAAAAElFTkSuQmCC',
291
+ // #ifdef H5
292
+ defaultImage: '//img.jufubao.cn/common/empty.png?ver=1',
293
+ //#endif
294
+ //#ifdef MP-WEIXIN
295
+ defaultImage: 'https://img.jufubao.cn/common/empty.png?ver=1',
296
+ //#endif
297
+
292
298
  bgImage: '',
293
299
  barBgColor: '', //bar背景颜色
294
300
  systemInfoSyn: null,
@@ -325,7 +331,13 @@
325
331
  //底部是否插槽模式
326
332
  isFooterSolt: true,
327
333
  wiewType: false,
334
+
335
+ // #ifdef H5
328
336
  loadingUrl: '//img.jufubao.cn/loading-block.jpg?v=1',
337
+ //#endif
338
+ //#ifdef MP-WEIXIN
339
+ loadingUrl: 'https://img.jufubao.cn/loading-block.jpg?v=1',
340
+ //#endif
329
341
 
330
342
  //自定义背景
331
343
  customBg: null,
@@ -1,4 +1,5 @@
1
1
  'use strict';
2
+
2
3
  import {Base64} from 'js-base64';
3
4
  import {
4
5
  PLATFORM_PARAM_SETTING
@@ -512,14 +513,15 @@ class Helpers {
512
513
  pathname = url.split('?')[0];
513
514
  search = url.split('?')[1];
514
515
  }
515
-
516
+ let partReplaceStr = '/$1';
517
+ if(/(\/\/|http:\/\/|https:\/\/).+$/.test(url)) partReplaceStr = '$1';
516
518
  return{
517
519
  source: url,
518
520
  query: search,
519
521
  params: params(search),
520
522
  relative: url,
521
523
  segments: pathname.replace(/^\//, '').split('/'),
522
- path: pathname.replace(/^([^\/])/, '/$1'),
524
+ path: pathname.replace(/^([^\/])/, partReplaceStr),
523
525
  file: (pathname.match(/\/([^\/?#]+)$/i) || [, ''])[1],
524
526
  }
525
527
  //#endif
@@ -812,16 +814,31 @@ class Helpers {
812
814
  }
813
815
 
814
816
  replacePathForDir(url){
815
- //#ifndef H5
816
- return url
817
+ let dir = '';
818
+ let host = '';
819
+ if(store.state.brandInfo) {
820
+ dir = store.state.brandInfo.deploy_dir
821
+ host = store.state.brandInfo.host;
822
+ }
823
+
824
+ //#ifdef MP-WEIXIN
825
+ //带有应用部署目录处理
826
+ if(/@site_domain@\//.test(url)) {
827
+ let indexReg = new RegExp(`@site_domain@/${dir}`);
828
+ //相同应用处理
829
+ if(indexReg.test(url)) {
830
+ return url.replace(indexReg,'');
831
+ }
832
+ //不同应用处理
833
+ else{
834
+ return `https://${host}${url.replace('@site_domain@','')}`;
835
+ }
836
+ }
837
+ else return url;
817
838
  //#endif
818
839
 
819
840
  //#ifdef H5
820
841
  let siteDomain = `${window.location.protocol}//${window.location.host}`;
821
- let dir = '';
822
- if(store.state.brandInfo && store.state.brandInfo.deploy_dir) {
823
- dir = store.state.brandInfo.deploy_dir
824
- }
825
842
  let reg = new RegExp(`@site_domain@`); //检查是否为站点下其他应用的链接地址
826
843
  let selfReg = new RegExp(`@site_domain@/${dir}`); //检查是否为自己内部链接
827
844
  let relfRedirectReg = new RegExp(`^/${dir}\/.+$`); //检查是否带有内容部署目录地址
@@ -962,7 +979,7 @@ class Helpers {
962
979
  else window.location.href = obj['url'];
963
980
  // #endif
964
981
 
965
- //#ifndef H5
982
+ //#ifdef MP-WEIXIN
966
983
  let fn = 'navigateTo';
967
984
  if (!type) fn = 'redirectTo';
968
985
  console.warn(`webview:/pages/webview/webview?seatUrl=${encodeURIComponent(obj['url'])}`)
@@ -972,8 +989,16 @@ class Helpers {
972
989
  // #endif
973
990
  }
974
991
  else {
975
- console.warn(`${type?'navigateTo.jump': 'redirectTo'}: ${JSON.stringify(obj)}`);
976
- if (type) uni.navigateTo(obj);
992
+ console.log(type, obj)
993
+ if (type){
994
+ //#ifdef H5
995
+ console.warn(`${type?'navigateTo.jump': 'redirectTo'}: ${JSON.stringify(obj)}`);
996
+ uni.navigateTo(obj);
997
+ //#endif
998
+ //#ifdef MP-WEIXIN
999
+ this.handleWxTo(type, obj)
1000
+ //#endif
1001
+ }
977
1002
  else {
978
1003
  //#ifdef H5
979
1004
  if(notHistory){
@@ -984,16 +1009,53 @@ class Helpers {
984
1009
  }
985
1010
  window.location.replace(`${dir}${obj.url}`);
986
1011
  }
987
- else uni.redirectTo(obj);
1012
+ else{
1013
+ console.warn(`${type?'navigateTo.jump': 'redirectTo'}: ${JSON.stringify(obj)}`);
1014
+ uni.redirectTo(obj);
1015
+ }
988
1016
  // #endif
989
1017
 
990
- //#ifndef H5
991
- uni.redirectTo(obj);
1018
+ //#ifdef MP-WEIXIN
1019
+ this.handleWxTo(type, obj)
992
1020
  // #endif
993
1021
  }
994
1022
  }
995
1023
  }
996
1024
 
1025
+ /**
1026
+ * @description 微信跳转
1027
+ * @param type
1028
+ * @param obj {object}
1029
+ * @param obj.url {string}
1030
+ */
1031
+ handleWxTo(type, obj) {
1032
+ let fnName = 'navigateTo';
1033
+ if (!type) fnName = 'redirectTo';
1034
+
1035
+ //带有@site_domain@设置标识
1036
+ if(obj.url.indexOf('@site_domain@') === 0) {
1037
+ const {host,deploy_dir} = store.state.brandInfo;
1038
+ let url = obj.url.replace(/@site_domain@/,'');
1039
+ //相同应用
1040
+ if(url.indexOf(`/${deploy_dir}/`) === 0){
1041
+ obj.url = url.replace(`/${deploy_dir}/`,'/');
1042
+ uni[fnName](obj)
1043
+ }
1044
+ //不同应用
1045
+ else {
1046
+ url = `https://${host}${url}`;
1047
+ console.warn(`webview:/pages/webview/webview?seatUrl=${encodeURIComponent(url)}`)
1048
+ uni[fnName]({
1049
+ url: `/pages/webview/webview?seatUrl=${Base64.encodeURI(url)}`
1050
+ });
1051
+ }
1052
+
1053
+ }
1054
+ else{
1055
+ uni[fnName](obj)
1056
+ }
1057
+ }
1058
+
997
1059
  /**
998
1060
  * @description 返回处理
999
1061
  * @param type {boolean} 跳转类型 true=>navigateTo false=>redirectTo
@@ -1046,7 +1108,7 @@ class Helpers {
1046
1108
  */
1047
1109
  async specialApiTransform(obj, cb){
1048
1110
  let reg = /(-apiuri\/v)/;
1049
- let regHttp = /^(\/\/)|(http:\/\/)|(http:\/\/).+/;
1111
+ let regHttp = /^(\/\/)|(http:\/\/)|(https:\/\/).+/;
1050
1112
  //需要转化的特殊访问地址
1051
1113
  if(reg.test(obj.url)){
1052
1114
  if(!regHttp.test(obj.url)) {