Quellcode durchsuchen

【更新】:
1.数据上报修改(参数异常,上报有反馈后切换浏览器地址);
2.视频除第一次进入时需要点击,其他视频加入触发播放函数;

youhaitao vor 2 Jahren
Ursprung
Commit
1fef90c52a

+ 15 - 4
assets/main/SceneMain.ts

@@ -288,14 +288,25 @@ export default class Scene extends cc.Component {
             this.addPrefab(curUint, curPage + 1);
         }
         else{
+            let funcSB = (req, right)=>{
+                common.log('上报 ', right, ' : ', JSON.stringify(req));
+                // 返回课程详情页
+                window.location.href = common.urlClass;
+            };
             let token = Tools.getLocalStorage('token', null);
             let xhr = new XMLHttpRequest();
-            xhr.open("GET", common.urlOver, true);
-            xhr.setRequestHeader('itemId', common.getItemId());
+            xhr.open("GET", common.urlOver + common.getItemId(), true);
             xhr.setRequestHeader('token', token);
+            xhr.onreadystatechange = function () {
+                if (xhr.readyState === 4 && (xhr.status >= 200 && xhr.status < 300)) {
+                    funcSB(xhr, true);
+                }
+            };
+            xhr.onerror = function () {
+                funcSB(xhr, false);
+            }
             xhr.send();
-            // 返回课程详情页
-            window.location.href = common.urlClass;
+            
         }
     }
 

+ 1 - 0
assets/res/videoPlayer/src/VideoPlayer.ts

@@ -48,6 +48,7 @@ export default class VideoPlayer extends GameBase {
         let attribute: AttributeUnit = common.attributeMap[unitCur];
         let configOne = attribute.config[pageNum - 1];
         this.video.remoteURL = configOne.videoName;
+        this.playVideo();
     };
 
     /** 事件-点击屏幕 */

+ 3 - 3
assets/src/common/Tools.ts

@@ -670,9 +670,9 @@ class Tools {
         physics.enabled = true;
         physics.debugDrawFlags = 0;
         physics.gravity = gravity;
-        if (isDrwoBits) {
-            physics.debugDrawFlags = cc.PhysicsManager.DrawBits.e_shapeBit;
-        }
+        // if (isDrwoBits) {
+        //     physics.debugDrawFlags = cc.PhysicsManager.DrawBits.e_shapeBit;
+        // }
 
         // 添加刚体-左右两侧碰撞边界(高适配,只添加左右边界即可)
         this.physicsAddSide(nodeGame);

+ 2 - 2
assets/src/common/common.ts

@@ -37,7 +37,7 @@ class common {
         return this._instance;
     };
 
-    isDebug: boolean = false;
+    isDebug: boolean = true;
     project: string = "luojigou_yinliu";
     itemId: string = '';
     unitCur: number = 1;// 第几集,从1开始
@@ -45,7 +45,7 @@ class common {
     isCanPlayVideo = false;
     attributeMap: any = {};// 内部形式为 { "0" : AttributeUtil } 
     urlToken: string = 'https://open.api.luojigou.vip/mall/mobile/common/verify/token';// 验证token的地址;
-    urlOver: string = 'https://open.api.luojigou.vip/app/app/gameCourse/record/12321312';// 当前集游戏完结,上报地址;
+    urlOver: string = 'https://open.api.luojigou.vip/app/app/gameCourse/record/';// 当前集游戏完结,上报地址;
     urlClass: string = 'https://luojigou.vip/ac/#/courseDetail?id=1568062284888866817&mode=luojigou';// 课程页
     objRes: any = {};//通用音频