Pārlūkot izejas kodu

Merge branch 'main' of http://git.ycjcjy.com/marketing/miniapp into main

1002884655 3 gadus atpakaļ
vecāks
revīzija
33ab41fd38
3 mainītis faili ar 29 papildinājumiem un 9 dzēšanām
  1. 3
    3
      config/dev.js
  2. 5
    5
      config/prod.js
  3. 21
    1
      src/utils/image.js

+ 3
- 3
config/dev.js Parādīt failu

@@ -4,11 +4,11 @@ module.exports = {
4 4
   },
5 5
   defineConstants: {
6 6
     HOST: '"https://xlk.njyz.tech"',
7
-    // HOST: '"https://xlj.newlandsh.com"',
7
+    // HOST: '"https://www.newhousehold.cn"',
8 8
     // HOST: '"http://127.0.0.1:8567"',
9 9
     WSS_HOST: '"wss://xlk.njyz.tech"',
10
-    OSS_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
11
-    OSS_FAST_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
10
+    OSS_PATH: '"https://xlk-assets.oss-cn-shanghai.aliyuncs.com/"',
11
+    OSS_FAST_PATH: '"https://xlk-assets.oss-cn-shanghai.aliyuncs.com/"',
12 12
     ICON_FONT: '"https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/css/iconfont.ttf"',
13 13
     Version: '"V0.0.20"'
14 14
   },

+ 5
- 5
config/prod.js Parādīt failu

@@ -3,14 +3,14 @@ module.exports = {
3 3
     NODE_ENV: '"production"'
4 4
   },
5 5
   defineConstants: {
6
-    HOST: '"https://xlj.newlandsh.com"', //正式
7
-    WSS_HOST: '"wss://xlj.newlandsh.com"',
6
+    HOST: '"https://www.newhousehold.cn"', //正式
7
+    WSS_HOST: '"wss://www.newhousehold.cn"',
8 8
     // HOST: '"https://xlk.njyz.tech"', //正式
9 9
     // WSS_HOST: '"wss://xlk.njyz.tech"',
10
-    OSS_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
11
-    OSS_FAST_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
10
+    OSS_PATH: '"https://xlk-assets.oss-cn-shanghai.aliyuncs.com/"',
11
+    OSS_FAST_PATH: '"https://xlk-assets.oss-cn-shanghai.aliyuncs.com/"',
12 12
     ICON_FONT: '"https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/css/iconfont.ttf"',
13
-    Version: '"V0.0.56-20210817"'
13
+    Version: '"V0.0.58-20210819"'
14 14
   },
15 15
   mini: {},
16 16
   h5: {

+ 21
- 1
src/utils/image.js Parādīt failu

@@ -1,14 +1,34 @@
1 1
 
2 2
 import Taro from '@tarojs/taro'
3 3
 import { authorize } from './wxAuth'
4
+
4 5
 // eslint-disable-next-line no-undef
5 6
 const host = HOST;
7
+// eslint-disable-next-line no-undef
8
+const ossPath = OSS_PATH;
9
+
10
+let platform = null;
11
+
12
+function getPlatform() {
13
+  if (!platform) {
14
+    platform = Taro.getSystemInfoSync().platform;
15
+  }
16
+  return platform;
17
+}
6 18
 
7 19
 export function getImgURL(img) {
8 20
   if (!img) return undefined;
9 21
 
10
-  if (img.indexOf('http') === 0) return img;
22
+  if (img.indexOf(ossPath) > -1) {
23
+    const plat = getPlatform();
24
+    if (plat.toLocaleLowerCase().indexOf('ios') > -1) {
25
+      return `${img}?x-oss-process=style/thumb`
26
+    } else {
27
+      return `${img}?x-oss-process=style/webp`
28
+    }
29
+  }
11 30
 
31
+  if (img.indexOf('http') === 0) return img;
12 32
   return `${host}${img}`;
13 33
 }
14 34