gxd-uni-library-editx 1.0.140 → 1.0.142
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 +1 -1
- package/src/utils/helper.js +28 -0
package/package.json
CHANGED
package/src/utils/helper.js
CHANGED
|
@@ -883,6 +883,29 @@ class Helpers {
|
|
|
883
883
|
}
|
|
884
884
|
}
|
|
885
885
|
|
|
886
|
+
/**
|
|
887
|
+
* @description 检查路径是否为当前站点格式或者返回URL争取值
|
|
888
|
+
* @param url {string} 格式:/applyCode/pages/cake/index or /applyCode/pages/cake/index?v1=1
|
|
889
|
+
* @param isBackValue {boolean}
|
|
890
|
+
*/
|
|
891
|
+
sitePathRole(url, isBackValue= false){
|
|
892
|
+
let [path,search] = url.split('?');
|
|
893
|
+
let urlArr = path.split('/');
|
|
894
|
+
debugger
|
|
895
|
+
|
|
896
|
+
//等于5段为站点露肩格式
|
|
897
|
+
if(isBackValue === false) {
|
|
898
|
+
return urlArr.length === 5
|
|
899
|
+
}
|
|
900
|
+
else {
|
|
901
|
+
if(urlArr.length === 5) {
|
|
902
|
+
return `@site_domain@${url}`;
|
|
903
|
+
}
|
|
904
|
+
else return url
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
}
|
|
908
|
+
|
|
886
909
|
/**
|
|
887
910
|
* @description 检查地址合法性
|
|
888
911
|
* @param url {string}
|
|
@@ -919,6 +942,10 @@ class Helpers {
|
|
|
919
942
|
//地址访问错误
|
|
920
943
|
else {
|
|
921
944
|
if(!/^(@site_domain@\/).+$/.test(url)){
|
|
945
|
+
//判断是不是站点规则
|
|
946
|
+
if(this.sitePathRole(url)) {
|
|
947
|
+
return this.sitePathRole(url, true);
|
|
948
|
+
}
|
|
922
949
|
this.updateValidateUrlFailLog(url);
|
|
923
950
|
console.error(`非网络跳转地址不合法:${url}`);
|
|
924
951
|
return settings.index
|
|
@@ -973,6 +1000,7 @@ class Helpers {
|
|
|
973
1000
|
});
|
|
974
1001
|
}
|
|
975
1002
|
// #endif
|
|
1003
|
+
return;
|
|
976
1004
|
}
|
|
977
1005
|
|
|
978
1006
|
//#ifdef H5
|