소스 검색

:twisted_rightwards_arrows: merge 'dev_base' to 'dev_audio'

zhanghe 6 년 전
부모
커밋
58607c7e32
4개의 변경된 파일34개의 추가작업 그리고 21개의 파일을 삭제
  1. 5 4
      src/stage/index/scene/LessonScene.js
  2. 2 1
      src/stage/index/scene/VideoWareFullScreenScene.js
  3. 2 2
      src/util/Consts.js
  4. 25 14
      src/util/Utils.js

+ 5 - 4
src/stage/index/scene/LessonScene.js

@@ -1,5 +1,6 @@
-import APIClient from '../../../util/API/APIClient'
-import Consts from '../../../util/Consts'
+import APIClient from '../../../util/API/APIClient';
+import Consts from '../../../util/Consts';
+import Utils from '../../../util/Utils';
 import HlsVideoPlugin from '../../../util/HlsVideoPlugin';
 import {CommandBus, CMD_TYPE} from '../../../util/CommandBus';
 
@@ -145,7 +146,7 @@ class LessonScene extends scene {
     		case Consts.TYPE_VIDEO:
     			let playUrl = '';
     			if (list && list.length >= 1) {
-    				playUrl = list[0].url;
+    				playUrl = Utils.videoUrlFormat(list[0].url);
     			}
     			let videoViewDom =
                 `
@@ -299,7 +300,7 @@ class LessonScene extends scene {
     		case Consts.TYPE_VIDEO:
     			let playUrl = '';
     			if (list && list.length >= 1) {
-    				playUrl = list[0].url;
+    				playUrl = Utils.videoUrlFormat(list[0].url);
     			}
                 let playText = '播放';
                 if (this.videoPlayer && this.videoPlayer.playStatus()) {

+ 2 - 1
src/stage/index/scene/VideoWareFullScreenScene.js

@@ -1,4 +1,5 @@
 import Consts from '../../../util/Consts';
+import Utils from '../../../util/Utils';
 import HlsVideoPlugin from '../../../util/HlsVideoPlugin';
 
 class VideoWareFullScreenScene extends scene {
@@ -105,7 +106,7 @@ class VideoWareFullScreenScene extends scene {
         const { list, type, title } = wareItem;
         let playUrl = '';
         if (list.length > 0) {
-          playUrl = list[0].url;
+          playUrl = Utils.videoUrlFormat(list[0].url);
         }
         if (window.efunbox) {
         	window.efunbox.initAndroidPlayer(

+ 2 - 2
src/util/Consts.js

@@ -11,8 +11,8 @@ class Consts {
 }
 
 //图片/视频资源域名
-Consts.IMG_PATH = 'http://ljimgs.ai160.com';
-Consts.VIDEO_PATH = 'http://ljvideo.ai160.com/vs2m';
+Consts.IMG_PATH = 'https://efunimgs.ai160.com';
+Consts.VIDEO_PATH = 'https://efunvideo.ai160.com';
 
 //图片/视频资源类型代号
 Consts.TYPE_VIDEO = 0;

+ 25 - 14
src/util/Utils.js

@@ -152,13 +152,13 @@ class Utils {
        return format;
     }
 
-  static trimJsonStr(src){
-    //所有"'" 替换为"\""
-    if(typeof(src) == "string"){
-      return src.replace(new RegExp("'","gm"), "\"");
+    static trimJsonStr(src){
+        //所有"'" 替换为"\""
+        if(typeof(src) == "string"){
+            return src.replace(new RegExp("'","gm"), "\"");
+        }
+        return src;
     }
-    return src;
-  }
 
 	/**
 	 * @desc uuid生成器
@@ -187,14 +187,25 @@ class Utils {
 		return uuid.join('');
 	}
 
-  static getUuidForWeb() {
-    const uuid = Utils.uuid(32);
-    const start = uuid.slice(0,8);
-    const next = uuid.slice(8,12);
-    const nextNext = uuid.slice(13,17);
-    const last = uuid.slice(17,32);
-    return `${start}-${next}-${nextNext}-${last}`;
-  }
+    static getUuidForWeb() {
+        const uuid = Utils.uuid(32);
+        const start = uuid.slice(0,8);
+        const next = uuid.slice(8,12);
+        const nextNext = uuid.slice(13,17);
+        const last = uuid.slice(17,32);
+        return `${start}-${next}-${nextNext}-${last}`;
+    }
+
+    static videoUrlFormat(url) {
+        if (!url) { return; }
+        if (url.startsWith('http')) {
+            return url.replace('http://ljvideo.ai160.com', Consts.VIDEO_PATH);
+        } else if (url.startsWith('https')) {
+            return url;
+        } else {
+            return url;
+        }
+    }
 }
 
 export default Utils;