Browse Source

弹出框样式调整

huliu 1 year ago
parent
commit
ebc5de575f
5 changed files with 242 additions and 93 deletions
  1. 4 0
      src/App.vue
  2. 32 16
      src/assets/css/home.scss
  3. 1 0
      src/components/UeVideo.vue
  4. 191 69
      src/components/home.vue
  5. 14 8
      src/webrtcVideo.js

+ 4 - 0
src/App.vue

@@ -6,6 +6,10 @@
6 6
 import UeVideo from './components/UeVideo.vue'
7 7
 </script>
8 8
 <style scoped>
9
+#app {
10
+    overflow: hidden;
11
+}
12
+
9 13
 /* html,
10 14
 body,
11 15
 #app,

+ 32 - 16
src/assets/css/home.scss

@@ -24,27 +24,43 @@
24 24
 }
25 25
 
26 26
 // 点击模型弹出框
27
-.model-detail {
28
-    display: flex;
29
-    justify-content: space-between;
30
-    flex-direction: column;
31
-    // flex-wrap: wrap;
27
+.modelInfo {
28
+    position: absolute;
32 29
     padding: 10px;
30
+    border-radius: 5px;
31
+    background-color: #fff;
32
+    width: 206px;
33
+    height: 165px;
34
+    display: none;
35
+    z-index: 999;
33 36
 
34
-    span {
35
-        font-size: 16px;
37
+    .model-detail {
38
+        position: absolute;
39
+        // border: 2px dashed #00CF78;
40
+        display: none;
36 41
 
37
-        width: 100%;
38
-        font-family: Microsoft YaHei UI;
42
+        display: flex;
43
+        justify-content: space-between;
44
+        flex-direction: column;
45
+        // flex-wrap: wrap;
46
+        // padding: 10px;
47
+
48
+
49
+        span {
50
+            font-size: 16px;
51
+
52
+            width: 100%;
53
+            font-family: Microsoft YaHei UI;
39 54
 
40
-        // border: 1px solid red;
41
-        // margin: 6px;
42
-        margin: 6px 0;
43
-        font-weight: 400;
55
+            // border: 1px solid red;
56
+            // margin: 6px;
57
+            margin: 6px 0;
58
+            font-weight: 400;
44 59
 
45
-        .title {
46
-            color: #000;
47
-            font-weight: 700;
60
+            .title {
61
+                color: #000;
62
+                font-weight: 700;
63
+            }
48 64
         }
49 65
     }
50 66
 }

+ 1 - 0
src/components/UeVideo.vue

@@ -57,5 +57,6 @@ export default {
57 57
   width: 100%;
58 58
   height: 100%;
59 59
   position: absolute;
60
+  overflow: hidden;
60 61
 }
61 62
 </style>

+ 191 - 69
src/components/home.vue

@@ -6,33 +6,24 @@
6 6
         <el-container>
7 7
             <left></left>
8 8
             <right></right>
9
-            <div ref="linedomRef" style="width: 2px;height:2px;background-color: green;position: absolute;z-index: 228;">
9
+            <div ref="linedomRef" style="width:10px;height:1px;position: absolute;z-index: 228;">
10 10
             </div>
11 11
 
12 12
         </el-container>
13 13
 
14 14
 
15
-        <el-popover placement="right" v-model:visible="visible" :width="260" :virtual-ref="triggerRef" trigger="click"
16
-            virtual-triggering>
17
-            <div class="model-detail" ref="popoverRef" id="popoverRef">
15
+
16
+        <div ref="popoverRef" id="popoverRef" class="modelInfo">
17
+            <div class="model-detail">
18 18
                 <span v-for="item in classDeviceInfo">
19 19
                     <span class="title">{{ item && item.name }}: </span>
20 20
                     {{ item && item.value }}
21 21
                     {{ classDeviceInfo.value &&
22 22
                         classDeviceInfo.value.status }}
23 23
                 </span>
24
-
25
-                <!-- <span><span class="title">{{ classDeviceInfo.value && classDeviceInfo.value.name }}: </span>{{
26
-                    classDeviceInfo.value &&
27
-                    classDeviceInfo.value.status }}</span>
28
-                <span><span class="title">设备状态: </span>{{ classDeviceInfo.value && classDeviceInfo.value.classes }}</span>
29
-                <span><span class="title">位置: </span>{{ classDeviceInfo.value && classDeviceInfo.value.course }}</span>
30
-                <span><span class="title">型号: </span>{{ classDeviceInfo.value && classDeviceInfo.value.theory }}</span>
31
-                <span><span class="title">质保期: </span>{{ classDeviceInfo.value && classDeviceInfo.value.name }}</span> -->
32
-                <!-- <span><span class="title">实到人数: </span>{{ clickData.value && clickData.value.actual }}</span>
33
-                <span><span class="title">老师: </span>{{ clickData.value && clickData.value.teacher }}</span> -->
34 24
             </div>
35
-        </el-popover>
25
+        </div>
26
+
36 27
 
37 28
         <!-- 视频播放弹框 -->
38 29
         <el-dialog class="videoDialog" v-model="videoDialog" title="互动教师1" width="60%" align="center" top="4%">
@@ -129,7 +120,6 @@ export default ({
129 120
         let centerDialogVisible = ref(false)
130 121
         // 获取点击点数据
131 122
         let clickData = reactive({})
132
-        const visible = ref(false)
133 123
         const triggerRef = ref({
134 124
             getBoundingClientRect() {
135 125
                 // console.log("positon----方法返回元素的大小及其相对于视口的位置", position.value)
@@ -180,15 +170,18 @@ export default ({
180 170
             endPlugOutlineColor: '#2AC367',
181 171
             size: 3,
182 172
             startPlugSize: 1.5,
183
-            startPlugOutlineSize: 1,
184
-            endPlugSize: 3,
185
-            endPlugOutlineSize: 3
173
+            startPlugOutlineSize: 2,
174
+            endPlugSize: 1.5,
175
+            endPlugOutlineSize: 2
186 176
         })
187 177
         const classDeviceInfo = ref([])
178
+        const classDataLoaded = ref(false)
188 179
         const classDevice = async function (deviceCode) {
189 180
             let res = await getClassDetail(deviceCode)
190
-            // console.log("获取到了当前点击物体得详情", res)
191
-            classDeviceInfo.value = res.data
181
+            console.log("获取到了当前点击物体得详情", res)
182
+            classDeviceInfo.value = res.data;
183
+            classDataLoaded.value = true
184
+
192 185
         }
193 186
         const clickData1 = ref({})
194 187
         const mouseClick = function (e) {
@@ -197,75 +190,204 @@ export default ({
197 190
             clickData1.value.y = e.clientY;
198 191
 
199 192
         }
200
-        onMounted(() => {
201
-            // window.addEventListener('mousedown', mouseClick);
202
-
203
-            // 监听一下页面点击情况
204
-            addResponseEventListener("open", (data) => {
205
-                if (data) {
206
-                    let json = eval("(" + data + ")");//转对象
207
-                    clickData.value = json;
208
-                    console.log("clickData---点击的数据", json)
209
-                    // console.log("看一下", linedomRef.value.style.top, json, "json")
210
-                    visible.value = true
211
-                    linedomRef.value.style.top = (json.y - 60) + "px";
212
-                    linedomRef.value.style.left = json.x + "px";
213
-
214
-                    let dot = {
215
-                        x: json.x,
216
-                        y: json.y - 80
217
-                    }
193
+        const handleResponseFunction = (data) => {
194
+            // console.log("从UE返回过来的值", data)
195
+            let json = eval("(" + data + ")");//转对象
196
+            clickData.value = json;
197
+            console.log("clickData---点击的数据", json)
198
+            if (json.deviceCode) {
199
+                getClassDetail(json.deviceCode).then(res => {
200
+                    classDeviceInfo.value = res.data;
201
+                    console.log("json.y ", json,);
202
+                    linedomRef.value.style.top = clickData.value.y + "px";
203
+                    linedomRef.value.style.left = clickData.value.x + "px";
204
+                    console.log("可以开始移动")
218 205
                     console.log("看一下---小圆点的值--top", linedomRef.value.style.top)
219 206
                     console.log("看一下---小圆点的值--left", linedomRef.value.style.left)
220
-                    // alert(json.x, json.y)
207
+
208
+                    // // 弹出框位置
209
+                    popoverRef.value.style.display = "block"
221 210
                     switch (json.direction) {
222 211
                         case "Left":
223
-                            mousemoveHandler(json.x - 380, dot.y)
212
+                            popoverRef.value.style.top = json.y - 30 + 'px'
213
+                            popoverRef.value.style.left = json.x - 320 + 'px'
224 214
                             break;
225 215
                         case "Up":
226
-                            console.log("在最上面", json.x, json.x - 100);
227
-                            mousemoveHandler(dot.x - 80, dot.y - 200);
216
+                            popoverRef.value.style.top = (json.y - 300) + 'px'
217
+                            popoverRef.value.style.left = (json.x - 120) + 'px'
228 218
                             break;
229 219
                         case "Right":
230
-                            console.log("没有走到这里来吗", 12312);
231
-                            mousemoveHandler(Number(json.x) + 30, Number(json.y) - 80)
220
+                            popoverRef.value.style.top = (Number(json.y)) + 'px'
221
+                            popoverRef.value.style.left = Number(json.x) + 100 + 'px'
222
+
232 223
                             break;
233 224
                         case "Down":
234
-                            // console.log("xxxx没有走到这里来吗--down", json.y,);
235
-                            mousemoveHandler(Number(json.y), Number(json.x) - 260);
225
+                            popoverRef.value.style.top = (Number(json.y) + 100) + 'px'
226
+                            popoverRef.value.style.left = Number(json.x) + 'px'
236 227
                             break;
237 228
                         default:
238
-                            mousemoveHandler(json.x, json.y);
229
+                            popoverRef.value.style.top = json.y - 60 + 'px'
230
+                            popoverRef.value.style.left = json.x + 'px'
231
+
239 232
                             break;
240 233
                     }
241
-                    // mousemoveHandler(Number(json.x) + 30, Number(json.y) - 80)
234
+
242 235
                     if (lineContainer.value) {
243 236
                         lineContainer.value.remove()
244 237
                     }
245
-                    setTimeout(() => {
246
-                        lineContainer.value = new LeaderLine(linedomRef.value, popoverRef.value, lineStyleOption.value)
247
-                        lineContainer.value.show('draw', {
248
-                            duration: 1000, //持续时长
249
-                            timing: 'ease-in' // 动画函数
250
-                        })
251
-                        lineContainer.value.endPlugOutline = true;
252
-                        lineContainer.value.startPlugOutline = true;
253
-                        lineContainer.value.position();
254
-                    }, 0);
255 238
 
239
+                    lineContainer.value = new LeaderLine(linedomRef.value, popoverRef.value, lineStyleOption.value)
240
+                    lineContainer.value.show('draw', {
241
+                        duration: 1000, //持续时长
242
+                        timing: 'ease-in' // 动画函数
243
+                    })
244
+                    lineContainer.value.endPlugOutline = true;
245
+                    lineContainer.value.startPlugOutline = true;
246
+                    lineContainer.value.position();
256 247
 
257 248
 
258
-                }
259
-            })
249
+                })
260 250
 
261
-            addResponseEventListener("End", data => {
262
-                let json = eval("(" + data + ")");
263
-                clickData.value = json;
264
-                classDevice()
265
-                // // classDevice()
266
-                // console.log("移动结束", 123123, data)
251
+            }
267 252
 
268
-            })
253
+
254
+
255
+            // linedomRef.value.style.top = json.y + "px";
256
+            // linedomRef.value.style.left = json.x + "px";
257
+
258
+
259
+            // console.log("看一下---小圆点的值--top", linedomRef.value.style.top)
260
+            // console.log("看一下---小圆点的值--left", linedomRef.value.style.left)
261
+
262
+            // // 弹出框位置
263
+
264
+            // popoverRef.value.style.display = "block"
265
+            // switch (json.direction) {
266
+            //     case "Left":
267
+            //         popoverRef.value.style.top = json.y - 30 + 'px'
268
+            //         popoverRef.value.style.left = json.x - 320 + 'px'
269
+            //         break;
270
+            //     case "Up":
271
+            //         popoverRef.value.style.top = (json.y - 350) + 'px'
272
+            //         popoverRef.value.style.left = (json.x - 120) + 'px'
273
+            //         break;
274
+            //     case "Right":
275
+            //         popoverRef.value.style.top = (Number(json.y)) + 'px'
276
+            //         popoverRef.value.style.left = Number(json.x) + 100 + 'px'
277
+
278
+            //         break;
279
+            //     case "Down":
280
+            //         popoverRef.value.style.top = (Number(json.y) + 100) + 'px'
281
+            //         popoverRef.value.style.left = Number(json.x) + 'px'
282
+            //         break;
283
+            //     default:
284
+            //         popoverRef.value.style.top = json.y - 60 + 'px'
285
+            //         popoverRef.value.style.left = json.x + 'px'
286
+
287
+            //         break;
288
+            // }
289
+            // if (lineContainer.value) {
290
+            //     lineContainer.value.remove()
291
+            // }
292
+            // setTimeout(() => {
293
+            //     lineContainer.value = new LeaderLine(linedomRef.value, popoverRef.value, lineStyleOption.value)
294
+            //     lineContainer.value.show('draw', {
295
+            //         duration: 1000, //持续时长
296
+            //         timing: 'ease-in' // 动画函数
297
+            //     })
298
+            //     lineContainer.value.endPlugOutline = true;
299
+            //     lineContainer.value.startPlugOutline = true;
300
+            //     lineContainer.value.position();
301
+            // }, 3000);
302
+
303
+
304
+        }
305
+        onMounted(() => {
306
+            // window.addEventListener('mousedown', mouseClick);
307
+
308
+            // 监听一下页面点击情况
309
+            // addResponseEventListener("open", (data) => {
310
+            //     if (data) {
311
+            //         let json = eval("(" + data + ")");//转对象
312
+            //         clickData.value = json;
313
+            //         console.log("clickData---点击的数据", json)
314
+            //         // console.log("看一下", linedomRef.value.style.top, json, "json")
315
+            //         visible.value = true
316
+            //         linedomRef.value.style.top = json.y + "px";
317
+            //         linedomRef.value.style.left = json.x + "px";
318
+
319
+            //         // let dot = {
320
+            //         //     x: json.x,
321
+            //         //     y: json.y - 80
322
+            //         // }
323
+            //         console.log("看一下---小圆点的值--top", linedomRef.value.style.top)
324
+            //         console.log("看一下---小圆点的值--left", linedomRef.value.style.left)
325
+
326
+            //         // 弹出框位置
327
+            //         // popoverRef.value.style.display = "block"
328
+            //         // popoverRef.value.style.top = json.y - 60 + 'px'
329
+            //         // popoverRef.value.style.left = json.x + 'px'
330
+            //         popoverRef.value.style.display = "block"
331
+            //         // alert(json.x, json.y)
332
+            //         switch (json.direction) {
333
+            //             case "Left":
334
+            //                 // mousemoveHandler(json.x - 380, dot.y)
335
+            //                 popoverRef.value.style.top = json.y - 60 + 'px'
336
+            //                 popoverRef.value.style.left = json.x - 380 + 'px'
337
+
338
+            //                 break;
339
+            //             case "Up":
340
+            //                 // console.log("在最上面", json.x, json.x - 100);
341
+            //                 // mousemoveHandler(dot.x - 80, dot.y - 200);
342
+            //                 popoverRef.value.style.top = (json.y - 350) + 'px'
343
+            //                 popoverRef.value.style.left = (json.x - 120) + 'px'
344
+
345
+            //                 break;
346
+            //             case "Right":
347
+            //                 console.log("没有走到这里来吗", 12312);
348
+            //                 popoverRef.value.style.top = (Number(json.y)) + 'px'
349
+            //                 popoverRef.value.style.left = Number(json.x) + 100 + 'px'
350
+
351
+            //                 // mousemoveHandler(Number(json.x) + 30, Number(json.y) - 80)
352
+            //                 break;
353
+            //             case "Down":
354
+            //                 popoverRef.value.style.top = (Number(json.y) + 100) + 'px'
355
+            //                 popoverRef.value.style.left = Number(json.x) + 'px'
356
+            //                 break;
357
+            //             default:
358
+            //                 popoverRef.value.style.top = json.y - 60 + 'px'
359
+            //                 popoverRef.value.style.left = json.x + 'px'
360
+
361
+            //                 break;
362
+            //         }
363
+            //         if (lineContainer.value) {
364
+            //             lineContainer.value.remove()
365
+            //         }
366
+            //         setTimeout(() => {
367
+            //             lineContainer.value = new LeaderLine(linedomRef.value, popoverRef.value, lineStyleOption.value)
368
+            //             lineContainer.value.show('draw', {
369
+            //                 duration: 1000, //持续时长
370
+            //                 timing: 'ease-in' // 动画函数
371
+            //             })
372
+            //             lineContainer.value.endPlugOutline = true;
373
+            //             lineContainer.value.startPlugOutline = true;
374
+            //             lineContainer.value.position();
375
+            //         }, 0);
376
+
377
+
378
+
379
+            //     }
380
+            // })
381
+
382
+            addResponseEventListener("End", handleResponseFunction)
383
+            // addResponseEventListener("End", (data) => {
384
+            //     let json = eval("(" + data + ")");
385
+            //     // clickData.value = json;
386
+            //     // classDevice()
387
+            //     // // classDevice()
388
+            //     console.log("移动结束", 123123, data)
389
+
390
+            // })
269 391
 
270 392
         })
271 393
 
@@ -273,7 +395,7 @@ export default ({
273 395
             centerDialogVisible,
274 396
             interDevice,
275 397
             clickData,
276
-            visible,
398
+
277 399
             triggerRef,
278 400
             videoData,
279 401
             onPlay,

+ 14 - 8
src/webrtcVideo.js

@@ -25,7 +25,7 @@ const WS_OPEN_STATE = 1;
25 25
 
26 26
 let qualityController = false;
27 27
 let qualityControlOwnershipCheckBox;
28
-let matchViewportResolution = true;
28
+let matchViewportResolution;
29 29
 // TODO: Remove this - workaround because of bug causing UE to crash when switching resolutions too quickly
30 30
 let lastTimeResized = new Date().getTime();
31 31
 let resizeTimeout;
@@ -562,6 +562,7 @@ function createWebRtcOffer() {
562 562
 function sendInputData(data) {
563 563
     if (webRtcPlayerObj) {
564 564
         resetAfkWarningTimer();
565
+        // console.log("最后发送的事件",data )
565 566
         webRtcPlayerObj.send(data);
566 567
     }
567 568
 }
@@ -1300,11 +1301,11 @@ function setupMouseAndFreezeFrame(playerElement) {
1300 1301
 }
1301 1302
 
1302 1303
 function updateVideoStreamSize() {
1303
-    console.log(matchViewportResolution, !matchViewportResolution);
1304
-    // if (!matchViewportResolution) {
1305
-    //     return;
1306
-    // }
1307
-    console.log("看一下走到这里美哟u");
1304
+    // console.log(matchViewportResolution, !matchViewportResolution);
1305
+    if (!matchViewportResolution) {
1306
+        return;
1307
+    }
1308
+    // console.log("看一下走到这里美哟u");
1308 1309
 
1309 1310
     let now = new Date().getTime();
1310 1311
     if (now - lastTimeResized > 1000) {
@@ -1312,10 +1313,15 @@ function updateVideoStreamSize() {
1312 1313
         if (!playerElement)
1313 1314
             return;
1314 1315
 
1316
+        // let descriptor = {
1317
+        //     ConsoleCommand: 'setres ' + playerElement.clientWidth + 'x' + playerElement.clientHeight
1318
+        //     // ConsoleCommand: 'setres ' + playerElement.clientWidth + 'x' + 1080
1319
+        // };
1315 1320
         let descriptor = {
1316
-            // ConsoleCommand: 'setres ' + playerElement.clientWidth + 'x' + playerElement.clientHeight
1317
-            ConsoleCommand: 'setres ' + playerElement.clientWidth + 'x' + 1080
1321
+            "Resolution.Width": playerElement.clientWidth,
1322
+            "Resolution.Height": playerElement.clientHeight
1318 1323
         };
1324
+        console.log(" playerElement.clientWidth ", playerElement.clientWidth, "playerElement.clientHeight", playerElement.clientHeight)
1319 1325
         emitCommand(descriptor);
1320 1326
         console.log(descriptor);
1321 1327
         lastTimeResized = new Date().getTime();