|
@@ -10,3 +10,30 @@ export const getPage = () => {
|
10
|
10
|
const router = getCurrentInstance().router
|
11
|
11
|
return pages.filter(x => router.path.indexOf(x.page) > -1)[0]
|
12
|
12
|
}
|
|
13
|
+
|
|
14
|
+/**
|
|
15
|
+ * 压缩图片 80%, 最大宽度 750
|
|
16
|
+ * @param {*} img
|
|
17
|
+ */
|
|
18
|
+export function transferImage(img) {
|
|
19
|
+ if (!img) return img;
|
|
20
|
+
|
|
21
|
+ const ossStr = 'oss-'
|
|
22
|
+
|
|
23
|
+ if (img.indexOf(ossStr) > -1) {
|
|
24
|
+ if (store.getState().system.systemInfo.platform !== "ios") {
|
|
25
|
+ // ios 暂时不支持 webp
|
|
26
|
+ return `${img.replace(
|
|
27
|
+ ossPath,
|
|
28
|
+ ossFastPath
|
|
29
|
+ )}?x-oss-process=style/transwebp`;
|
|
30
|
+ }
|
|
31
|
+
|
|
32
|
+ return `${img.replace(
|
|
33
|
+ ossPath,
|
|
34
|
+ ossFastPath
|
|
35
|
+ )}?x-oss-process=style/compress`;
|
|
36
|
+ }
|
|
37
|
+
|
|
38
|
+ return img;
|
|
39
|
+}
|