gxd-uni-library-editx 1.0.172 → 1.0.174

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/utils/helper.js +41 -68
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gxd-uni-library-editx",
3
- "version": "1.0.172",
3
+ "version": "1.0.174",
4
4
  "private": false,
5
5
  "description": "聚福宝基础插件专用库",
6
6
  "main": "index.js",
@@ -1090,6 +1090,25 @@ class Helpers {
1090
1090
  }
1091
1091
  let isH5 = reg.test(obj.url);
1092
1092
 
1093
+ //第三方平台链接
1094
+ if(isH5) {
1095
+ console.warn(`window.location.href: ${JSON.stringify(obj)},notHistory=${notHistory}`);
1096
+ //#ifdef H5
1097
+ if(notHistory) window.location.replace(obj['url']);
1098
+ else window.location.href = obj['url'];
1099
+ // #endif
1100
+
1101
+ //#ifdef MP-WEIXIN
1102
+ let fn = 'navigateTo';
1103
+ if (!type) fn = 'redirectTo';
1104
+ console.warn(`webview:/pages/webview/webview?seatUrl=${encodeURIComponent(obj['url'])}`)
1105
+ uni[fn]({
1106
+ url: `/pages/webview/webview?seatUrl=${Base64.encodeURI(obj['url'])}`
1107
+ });
1108
+ // #endif
1109
+ return;
1110
+ }
1111
+
1093
1112
  //全平台参数设置(当前页面中获取|参数中获取,入口缓存中获取)
1094
1113
  let params = [];
1095
1114
  xParamsKey.map(key=>{
@@ -1100,40 +1119,12 @@ class Helpers {
1100
1119
  }
1101
1120
  });
1102
1121
 
1103
- // let xdProject= currentPagesParams[PLATFORM_PARAM_SETTING.EVENT_PARAM_NAME]
1104
- // || obj[PLATFORM_PARAM_SETTING.EVENT_PARAM_NAME]
1105
- // || uni.getStorageSync(PLATFORM_PARAM_SETTING.EVENT_PARAM_SAVE_KEY);
1106
- // let xdAllProject = currentPagesParams[PLATFORM_PARAM_SETTING.OVER_ALL_PARAM_NAME]
1107
- // || obj[PLATFORM_PARAM_SETTING.OVER_ALL_PARAM_NAME]
1108
- // || uni.getStorageSync(PLATFORM_PARAM_SETTING.OVER_ALL_PARAM_NAME_SAVE_KEY);
1109
- //
1110
- // let xdTestProject = currentPagesParams[PLATFORM_PARAM_SETTING.TEST_PARAM_NAME]
1111
- // || obj[PLATFORM_PARAM_SETTING.TEST_PARAM_NAME]
1112
- // || uni.getStorageSync(PLATFORM_PARAM_SETTING.TEST_PARAM_NAME_SAVE_KEY);
1113
- //
1114
- // //x-params
1115
- // if(xdProject && obj['url'].indexOf(PLATFORM_PARAM_SETTING.EVENT_PARAM_NAME) === -1){
1116
- // params.push(`${PLATFORM_PARAM_SETTING.EVENT_PARAM_NAME}=${encodeURIComponent(xdProject)}`);
1117
- // }
1118
- //
1119
- // //x-common
1120
- // if(xdAllProject && obj['url'].indexOf(PLATFORM_PARAM_SETTING.OVER_ALL_PARAM_NAME) === -1){
1121
- // params.push(`${PLATFORM_PARAM_SETTING.OVER_ALL_PARAM_NAME}=${encodeURIComponent(xdAllProject)}`);
1122
- // }
1123
- //
1124
- // //x-test
1125
- // if (xdTestProject && obj['url'].indexOf(PLATFORM_PARAM_SETTING.TEST_PARAM_NAME) === -1) {
1126
- // params.push(`${PLATFORM_PARAM_SETTING.TEST_PARAM_NAME}=${encodeURIComponent(xdTestProject)}`);
1127
- // }
1128
-
1129
1122
  //删除参数中等公告参数
1130
1123
  xParamsKey.map(key=>{
1131
1124
  let {paramKey, storageKey} = getPlatformParamsValue(key);
1132
1125
  if(obj[paramKey]) delete obj[paramKey];
1133
1126
  });
1134
- // if (obj[PLATFORM_PARAM_SETTING.EVENT_PARAM_NAME]) delete obj[PLATFORM_PARAM_SETTING.EVENT_PARAM_NAME];
1135
- // if (obj[PLATFORM_PARAM_SETTING.OVER_ALL_PARAM_NAME]) delete obj[PLATFORM_PARAM_SETTING.OVER_ALL_PARAM_NAME];
1136
- // if (obj[PLATFORM_PARAM_SETTING.TEST_PARAM_NAME]) delete obj[PLATFORM_PARAM_SETTING.TEST_PARAM_NAME];
1127
+
1137
1128
 
1138
1129
  //需要设置redirect参数
1139
1130
  if (redirect) {
@@ -1160,52 +1151,34 @@ class Helpers {
1160
1151
  console.warn(`handleTo:isH5=>${isH5},type=>${type},obj=${JSON.stringify(obj)}`);
1161
1152
 
1162
1153
  //带有网络链接地址处理
1163
- if (isH5) {
1164
- console.warn(`window.location.href: ${JSON.stringify(obj)},notHistory=${notHistory}`);
1154
+ if (type){
1165
1155
  //#ifdef H5
1166
- if(notHistory) window.location.replace(obj['url']);
1167
- else window.location.href = obj['url'];
1168
- // #endif
1169
-
1156
+ console.warn(`${type?'navigateTo.jump': 'redirectTo'}: ${JSON.stringify(obj)}`);
1157
+ uni.navigateTo(obj);
1158
+ //#endif
1170
1159
  //#ifdef MP-WEIXIN
1171
- let fn = 'navigateTo';
1172
- if (!type) fn = 'redirectTo';
1173
- console.warn(`webview:/pages/webview/webview?seatUrl=${encodeURIComponent(obj['url'])}`)
1174
- uni[fn]({
1175
- url: `/pages/webview/webview?seatUrl=${Base64.encodeURI(obj['url'])}`
1176
- });
1177
- // #endif
1160
+ this.handleWxTo(type, obj)
1161
+ //#endif
1178
1162
  }
1179
1163
  else {
1180
- if (type){
1181
- //#ifdef H5
1164
+ //#ifdef H5
1165
+ if(notHistory){
1166
+ console.warn(`${type ? 'notHistory.jump' : 'redirectTo'}: ${JSON.stringify(obj)}`);
1167
+ let dir = '';
1168
+ if (store.state.brandInfo && store.state.brandInfo['deploy_dir']) {
1169
+ dir = `/${store.state.brandInfo['deploy_dir']}`
1170
+ }
1171
+ window.location.replace(`${dir}${obj.url}`);
1172
+ }
1173
+ else{
1182
1174
  console.warn(`${type?'navigateTo.jump': 'redirectTo'}: ${JSON.stringify(obj)}`);
1183
- uni.navigateTo(obj);
1184
- //#endif
1185
- //#ifdef MP-WEIXIN
1186
- this.handleWxTo(type, obj)
1187
- //#endif
1175
+ uni.redirectTo(obj);
1188
1176
  }
1189
- else {
1190
- //#ifdef H5
1191
- if(notHistory){
1192
- console.warn(`${type ? 'notHistory.jump' : 'redirectTo'}: ${JSON.stringify(obj)}`);
1193
- let dir = '';
1194
- if (store.state.brandInfo && store.state.brandInfo['deploy_dir']) {
1195
- dir = `/${store.state.brandInfo['deploy_dir']}`
1196
- }
1197
- window.location.replace(`${dir}${obj.url}`);
1198
- }
1199
- else{
1200
- console.warn(`${type?'navigateTo.jump': 'redirectTo'}: ${JSON.stringify(obj)}`);
1201
- uni.redirectTo(obj);
1202
- }
1203
- // #endif
1177
+ // #endif
1204
1178
 
1205
- //#ifdef MP-WEIXIN
1206
- this.handleWxTo(type, obj)
1207
- // #endif
1208
- }
1179
+ //#ifdef MP-WEIXIN
1180
+ this.handleWxTo(type, obj)
1181
+ // #endif
1209
1182
  }
1210
1183
  }
1211
1184