@foundbyte/uni-libs 1.0.8 → 1.1.0
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.
|
@@ -89,6 +89,8 @@ let EBusinessLine = /* @__PURE__ */ function(EBusinessLine) {
|
|
|
89
89
|
EBusinessLine[EBusinessLine["TulvCheckIn"] = 271] = "TulvCheckIn";
|
|
90
90
|
/** 徒旅贵州-自由行 */
|
|
91
91
|
EBusinessLine[EBusinessLine["TulvFreeWalker"] = 272] = "TulvFreeWalker";
|
|
92
|
+
/** 权益中心 */
|
|
93
|
+
EBusinessLine[EBusinessLine["BenefitsCenter"] = 28] = "BenefitsCenter";
|
|
92
94
|
/** ai助手页面(问道贵州,后端无定义) */
|
|
93
95
|
EBusinessLine[EBusinessLine["AiHelper"] = 1023] = "AiHelper";
|
|
94
96
|
return EBusinessLine;
|
package/es/utils/common/index.js
CHANGED
|
@@ -32,7 +32,8 @@ function getQueryParameters(url) {
|
|
|
32
32
|
const key = decodeURIComponent(pair[0]);
|
|
33
33
|
let value = decodeURIComponent(pair[1] || "");
|
|
34
34
|
try {
|
|
35
|
-
|
|
35
|
+
const parsed = JSON.parse(value);
|
|
36
|
+
if (typeof parsed === "number" && String(parsed) !== value) {} else value = parsed;
|
|
36
37
|
} catch (_unused) {}
|
|
37
38
|
params[key] = value;
|
|
38
39
|
}
|
package/es/utils/obs/image.d.ts
CHANGED
|
@@ -4,20 +4,21 @@ declare enum EObsSource {
|
|
|
4
4
|
Huawei = 1,
|
|
5
5
|
/** 腾讯 */
|
|
6
6
|
Tencent = 2,
|
|
7
|
-
/**
|
|
7
|
+
/** 阿里 */
|
|
8
8
|
Ali = 2,
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* 参考 https://support.huaweicloud.com/intl/zh-cn/fg-obs/obs_01_0430.html
|
|
12
|
+
* 腾讯云目前只支持部分参数(w/h)
|
|
12
13
|
*/
|
|
13
14
|
type CompressOptions = {
|
|
14
15
|
w?: number;
|
|
15
16
|
h?: number;
|
|
16
17
|
/**
|
|
17
18
|
* 缩率类型,默认 'lfit'
|
|
18
|
-
* - `lfit`:
|
|
19
|
-
* - `mfit`:
|
|
20
|
-
* - `fill`:
|
|
19
|
+
* - `lfit`: 等比缩放,限制在容器内,类似 css container
|
|
20
|
+
* - `mfit`: 等比缩放,覆盖容器,类似 css cover ,但保留裁剪掉的部分
|
|
21
|
+
* - `fill`: 等比缩放,裁剪填充容器,类似 css cover
|
|
21
22
|
*/
|
|
22
23
|
m?: 'lfit' | 'mfit' | 'fill';
|
|
23
24
|
p?: number;
|
package/es/utils/obs/image.js
CHANGED
|
@@ -5,7 +5,7 @@ let EObsSource = /* @__PURE__ */ function(EObsSource) {
|
|
|
5
5
|
EObsSource[EObsSource["Huawei"] = 1] = "Huawei";
|
|
6
6
|
/** 腾讯 */
|
|
7
7
|
EObsSource[EObsSource["Tencent"] = 2] = "Tencent";
|
|
8
|
-
/**
|
|
8
|
+
/** 阿里 */
|
|
9
9
|
EObsSource[EObsSource["Ali"] = 2] = "Ali";
|
|
10
10
|
return EObsSource;
|
|
11
11
|
}({});
|
|
@@ -71,8 +71,32 @@ function compressHuaweiObsImg(url, opts) {
|
|
|
71
71
|
* @returns
|
|
72
72
|
*/
|
|
73
73
|
function compressTencentObsImg(url, opts) {
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
const { w = "", h = "", m = "lfit", p, q } = opts;
|
|
75
|
+
const actions = ["imageMogr2"];
|
|
76
|
+
if (p) {
|
|
77
|
+
actions.push("thumbnail");
|
|
78
|
+
actions.push(`!${p}p`);
|
|
79
|
+
} else if (w || h) {
|
|
80
|
+
actions.push("thumbnail");
|
|
81
|
+
switch (m) {
|
|
82
|
+
case "mfit":
|
|
83
|
+
actions.push(`!${w}x${h}r`);
|
|
84
|
+
break;
|
|
85
|
+
case "fill":
|
|
86
|
+
actions.push(`!${w}x${h}r`);
|
|
87
|
+
actions.push("crop");
|
|
88
|
+
actions.push(`${w || h}x${h || w}`);
|
|
89
|
+
actions.push("gravity");
|
|
90
|
+
actions.push("center");
|
|
91
|
+
break;
|
|
92
|
+
default: actions.push(`${w}x${h}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (q) {
|
|
96
|
+
actions.push("rquality");
|
|
97
|
+
actions.push(Math.min(100, Math.max(0, q)));
|
|
98
|
+
}
|
|
99
|
+
return `${url}?${actions.join("/")}`;
|
|
76
100
|
}
|
|
77
101
|
function compressObsImg(url, opts) {
|
|
78
102
|
switch (opts.source) {
|