<select>设置css height兼容性,兼容FF/IE/Safari/Chrome...

本文介绍如何通过CSS调整HTML中Select元素的宽度和高度,并确保跨浏览器兼容性,特别是针对Safari浏览器的line-height设置。

<select></select>

select{
   width:100px;
   height:40px;
   line-height:40px; //一定要设置line-height,不然Safari不兼容
}


<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>测试工具 - 图片生成器</title> <link href="../css/bootstrap.min.css" rel="stylesheet"> <link rel="stylesheet" href="../css/all.min.css"> <style> :root { --primary-color: #4e73df; --primary-light: #7a9ff5; --primary-dark: #3a5bcc; --secondary-color: #6c757d; --success-color: #1cc88a; --info-color: #36b9cc; --warning-color: #f6c23e; --danger-color: #e74a3b; --light-color: #f8f9fc; --dark-color: #2e3a59; --gray-100: #f8f9fa; --gray-200: #e9ecef; --gray-300: #dee2e6; --gray-400: #ced4da; --gray-500: #adb5bd; --gray-600: #6c757d; --gray-700: #495057; --gray-800: #343a40; --gray-900: #212529; --shadow-light: 0 2px 10px rgba(0, 0, 0, 0.08); --shadow-medium: 0 4px 20px rgba(0, 0, 0, 0.12); --shadow-hover: 0 0.5rem 1.5rem rgba(58, 59, 69, 0.2); --border-radius: 0.5rem; --border-radius-sm: 0.375rem; --border-radius-lg: 0.75rem; --transition: all 0.3s ease; } * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Segoe UI', 'Arial', sans-serif; background-color: #f5f7fb; margin: 0; padding: 20px; line-height: 1.6; color: var(--gray-700); min-height: 100vh; } .container { max-width: 1400px; margin: 0 auto; height: 100%; display: flex; flex-direction: column; } .header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; padding: 1rem 0; border-bottom: 1px solid var(--gray-200); } .header h1 { color: var(--dark-color); font-size: 1.8rem; font-weight: 600; margin: 0; display: flex; align-items: center; } .header h1 i { margin-right: 0.75rem; color: var(--primary-color); } .tools-container { display: flex; flex: 1; overflow: hidden; gap: 1.5rem; min-height: 600px; } .tools-sidebar { width: 250px; background: white; border-radius: var(--border-radius); box-shadow: var(--shadow-light); padding: 1.25rem; overflow-y: auto; flex-shrink: 0; } .tools-content { flex: 1; background: white; border-radius: var(--border-radius); box-shadow: var(--shadow-light); padding: 1.5rem; overflow-y: auto; display: flex; flex-direction: column; } .tool-card { background: white; border-radius: var(--border-radius); box-shadow: var(--shadow-light); margin-bottom: 1.5rem; border: none; transition: var(--transition); overflow: hidden; } .tool-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); } .tool-card-header { padding: 1rem 1.5rem; background: linear-gradient(135deg, #f8f9fc 0%, #e9ecef 100%); border-bottom: 1px solid var(--gray-200); border-radius: var(--border-radius) var(--border-radius) 0 0; } .tool-card-title { font-size: 1.25rem; font-weight: 600; color: var(--dark-color); margin: 0; } .tool-card-body { padding: 1.5rem; } .btn { border-radius: var(--border-radius-sm); padding: 0.5rem 1rem; font-weight: 500; transition: var(--transition); border: none; display: inline-flex; align-items: center; justify-content: center; } .btn i { margin-right: 0.5rem; } .btn-primary { background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%); border: none; } .btn-primary:hover { background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%); transform: translateY(-1px); box-shadow: 0 4px 8px rgba(78, 115, 223, 0.3); } .btn-sm { padding: 0.375rem 0.75rem; font-size: 0.875rem; } .form-control, .form-select { border-radius: var(--border-radius-sm); border: 1px solid var(--gray-300); transition: var(--transition); padding: 0.75rem; } .form-control:focus, .form-select:focus { border-color: var(--primary-color); box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25); } .alert { border-radius: var(--border-radius); padding: 1rem 1.5rem; margin-bottom: 1.5rem; border: none; box-shadow: var(--shadow-light); display: flex; align-items: center; } .alert-success { background-color: #d4edda; color: #155724; border-left: 4px solid var(--success-color); } .alert-danger { background-color: #f8d7da; color: #721c24; border-left: 4px solid var(--danger-color); } .alert-warning { background-color: #fff3cd; color: #856404; border-left: 4px solid var(--warning-color); } .alert-info { background-color: #d1ecf1; color: #0c5460; border-left: 4px solid var(--info-color); } .alert i { margin-right: 0.75rem; font-size: 1.25rem; } .tool-list { list-style: none; padding: 0; margin: 0; } .tool-item { padding: 0.75rem 1rem; margin-bottom: 0.5rem; border-radius: var(--border-radius-sm); cursor: pointer; transition: var(--transition); display: flex; align-items: center; } .tool-item:hover { background-color: rgba(78, 115, 223, 0.1); } .tool-item.active { background-color: rgba(78, 115, 223, 0.15); color: var(--primary-color); font-weight: 600; } .tool-item i { margin-right: 0.75rem; font-size: 1.1rem; width: 20px; text-align: center; } .progress { height: 8px; border-radius: 4px; margin-top: 0.5rem; } .result-container { margin-top: 1.5rem; padding: 1.5rem; background-color: var(--gray-100); border-radius: var(--border-radius); display: none; } .result-container.active { display: block; } .image-preview { max-width: 100%; max-height: 300px; border-radius: var(--border-radius); box-shadow: var(--shadow-light); margin: 1rem 0; } .file-info { background-color: white; padding: 1rem; border-radius: var(--border-radius); margin-top: 1rem; } .file-info p { margin-bottom: 0.5rem; } .loading { text-align: center; padding: 2rem; display: none; } .loading.active { display: block; } .spinner-border { width: 2rem; height: 2rem; color: var(--primary-color); } @media (max-width: 768px) { .tools-container { flex-direction: column; } .tools-sidebar { width: 100%; margin-bottom: 1rem; } .header h1 { font-size: 1.5rem; } .tool-card-body { padding: 1rem; } } </style> </head> <body> <div class="container"> <div class="header"> <h1><i class="fas fa-tools"></i>测试工具</h1> </div> <div class="tools-container"> <!-- 工具菜单侧边栏 --> <div class="tools-sidebar"> <h5 class="mb-3"><i class="fas fa-list"></i> 工具列表</h5> <ul class="tool-list"> <li class="tool-item active" data-tool="image-generator"> <i class="fas fa-image"></i> 图片生成器 </li> <li class="tool-item" data-tool="placeholder"> <i class="fas fa-cube"></i> 占位工具 </li> <li class="tool-item" data-tool="converter"> <i class="fas fa-exchange-alt"></i> 格式转换 </li> <li class="tool-item" data-tool="analyzer"> <i class="fas fa-chart-bar"></i> 数据分析 </li> <li class="tool-item" data-tool="validator"> <i class="fas fa-check-circle"></i> 数据验证 </li> </ul> </div> <!-- 工具内容区域 --> <div class="tools-content"> <!-- 图片生成器工具 --> <div class="tool-card" id="image-generator-tool"> <div class="tool-card-header"> <h3 class="tool-card-title"><i class="fas fa-image"></i> 图片生成器</h3> </div> <div class="tool-card-body"> <div class="alert alert-info"> <i class="fas fa-info-circle"></i> 此工具可以生成指定大小的图片文件,支持从0到10MB的大小范围。 </div> <form id="image-generator-form"> <div class="row mb-4"> <div class="col-md-6"> <label for="image-size" class="form-label">图片大小 (MB)</label> <input type="range" class="form-range" id="image-size" min="0" max="10" step="0.1" value="1"> <div class="d-flex justify-content-between"> <span>0 MB</span> <span id="size-value">1 MB</span> <span>10 MB</span> </div> </div> <div class="col-md-6"> <label for="image-format" class="form-label">图片格式</label> <select class="form-select" id="image-format"> <option value="png">PNG</option> <option value="jpg">JPG</option> <option value="gif">GIF</option> <option value="bmp">BMP</option> </select> </div> </div> <div class="row mb-4"> <div class="col-md-6"> <label for="image-width" class="form-label">图片宽度 (像素)</label> <input type="number" class="form-control" id="image-width" min="10" max="5000" value="800"> </div> <div class="col-md-6"> <label for="image-height" class="form-label">图片高度 (像素)</label> <input type="number" class="form-control" id="image-height" min="10" max="5000" value="600"> </div> </div> <div class="d-grid gap-2 d-md-flex justify-content-md-end"> <button type="button" class="btn btn-secondary" id="reset-btn"> <i class="fas fa-redo"></i> 重置 </button> <button type="submit" class="btn btn-primary" id="generate-btn"> <i class="fas fa-magic"></i> 生成图片 </button> </div> </form> <!-- 加载指示器 --> <div class="loading" id="loading-indicator"> <div class="spinner-border" role="status"> <span class="visually-hidden">生成中...</span> </div> <p class="mt-2">正在生成图片,请稍候...</p> </div> <!-- 结果展示区域 --> <div class="result-container" id="result-container"> <h4><i class="fas fa-check-circle text-success"></i> 图片生成成功!</h4> <div class="text-center"> </div> <div class="file-info"> <h5>文件信息</h5> <p><strong>文件大小:</strong> <span id="file-size">0 MB</span></p> <p><strong>文件格式:</strong> <span id="file-format">PNG</span></p> <p><strong>图片尺寸:</strong> <span id="image-dimensions">800x600</span> 像素</p> <p><strong>生成时间:</strong> <span id="generation-time">-</span></p> </div> <div class="d-grid gap-2 d-md-flex justify-content-md-end mt-3"> <button type="button" class="btn btn-success" id="download-btn"> <i class="fas fa-download"></i> 下载图片 </button> </div> </div> </div> </div> <!-- 其他工具占位内容 --> <div class="tool-card" id="placeholder-tool" style="display: none;"> <div class="tool-card-header"> <h3 class="tool-card-title"><i class="fas fa-cube"></i> 占位工具</h3> </div> <div class="tool-card-body"> <div class="alert alert-warning"> <i class="fas fa-exclamation-triangle"></i> 此功能正在开发中,敬请期待! </div> </div> </div> <div class="tool-card" id="converter-tool" style="display: none;"> <div class="tool-card-header"> <h3 class="tool-card-title"><i class="fas fa-exchange-alt"></i> 格式转换</h3> </div> <div class="tool-card-body"> <div class="alert alert-warning"> <i class="fas fa-exclamation-triangle"></i> 此功能正在开发中,敬请期待! </div> </div> </div> <div class="tool-card" id="analyzer-tool" style="display: none;"> <div class="tool-card-header"> <h3 class="tool-card-title"><i class="fas fa-chart-bar"></i> 数据分析</h3> </div> <div class="tool-card-body"> <div class="alert alert-warning"> <i class="fas fa-exclamation-triangle"></i> 此功能正在开发中,敬请期待! </div> </div> </div> <div class="tool-card" id="validator-tool" style="display: none;"> <div class="tool-card-header"> <h3 class="tool-card-title"><i class="fas fa-check-circle"></i> 数据验证</h3> </div> <div class="tool-card-body"> <div class="alert alert-warning"> <i class="fas fa-exclamation-triangle"></i> 此功能正在开发中,敬请期待! </div> </div> </div> </div> </div> </div> <script src="./js/bootstrap.bundle.min.js"></script> <script> // 工具切换功能 document.addEventListener('DOMContentLoaded', function() { const toolItems = document.querySelectorAll('.tool-item'); const toolCards = document.querySelectorAll('.tool-card'); toolItems.forEach(item => { item.addEventListener('click', function() { // 移除所有活动状态 toolItems.forEach(i => i.classList.remove('active')); toolCards.forEach(c => c.style.display = 'none'); // 添加当前活动状态 this.classList.add('active'); const toolId = this.getAttribute('data-tool') + '-tool'; document.getElementById(toolId).style.display = 'block'; }); }); // 图片大小滑块显示 const sizeSlider = document.getElementById('image-size'); const sizeValue = document.getElementById('size-value'); sizeSlider.addEventListener('input', function() { sizeValue.textContent = this.value + ' MB'; }); // 表单提交事件 const imageForm = document.getElementById('image-generator-form'); const loadingIndicator = document.getElementById('loading-indicator'); const resultContainer = document.getElementById('result-container'); const fileSize = document.getElementById('file-size'); const fileFormat = document.getElementById('file-format'); const imageDimensions = document.getElementById('image-dimensions'); const generationTime = document.getElementById('generation-time'); const downloadBtn = document.getElementById('download-btn'); const generateBtn = document.getElementById('generate-btn'); imageForm.addEventListener('submit', function(e) { e.preventDefault(); // 获取表单数据 const sizeMB = parseFloat(sizeSlider.value); const format = document.getElementById('image-format').value; const width = parseInt(document.getElementById('image-width').value); const height = parseInt(document.getElementById('image-height').value); // 验证输入 if (width < 10 || width > 5000 || height < 10 || height > 5000) { alert('图片尺寸必须在10到5000像素之间'); return; } // 显示加载指示器 loadingIndicator.classList.add('active'); resultContainer.classList.remove('active'); generateBtn.disabled = true; generateBtn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> 生成中...'; // 模拟生成过程 setTimeout(() => { // 生成图片数据(这里使用canvas模拟) const canvas = document.createElement('canvas'); canvas.width = width; canvas.height = height; const ctx = canvas.getContext('2d'); // 绘制背景 ctx.fillStyle = '#f0f0f0'; ctx.fillRect(0, 0, width, height); // 绘制网格 ctx.strokeStyle = '#ddd'; ctx.lineWidth = 1; for (let x = 0; x <= width; x += 50) { ctx.beginPath(); ctx.moveTo(x, 0); ctx.lineTo(x, height); ctx.stroke(); } for (let y = 0; y <= height; y += 50) { ctx.beginPath(); ctx.moveTo(0, y); ctx.lineTo(width, y); ctx.stroke(); } // 绘制尺寸信息 ctx.fillStyle = '#333'; ctx.font = 'bold 24px Arial'; ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; ctx.fillText(`${width} × ${height}`, width/2, height/2); // 转换为数据URL const dataURL = canvas.toDataURL(`image/${format}`); // 更新结果区域 const imagePreview = document.getElementById('image-preview'); imagePreview.src = dataURL; fileSize.textContent = sizeMB.toFixed(1) + ' MB'; fileFormat.textContent = format.toUpperCase(); imageDimensions.textContent = `${width} × ${height}`; generationTime.textContent = new Date().toLocaleString('zh-CN'); // 设置下载按钮 downloadBtn.onclick = function() { const link = document.createElement('a'); link.download = `generated-image.${format}`; link.href = dataURL; link.click(); }; // 隐藏加载指示器,显示结果 loadingIndicator.classList.remove('active'); resultContainer.classList.add('active'); generateBtn.disabled = false; generateBtn.innerHTML = '<i class="fas fa-magic"></i> 生成图片'; }, 1500); }); // 重置按钮 document.getElementById('reset-btn').addEventListener('click', function() { sizeSlider.value = 1; sizeValue.textContent = '1 MB'; document.getElementById('image-format').value = 'png'; document.getElementById('image-width').value = '800'; document.getElementById('image-height').value = '600'; resultContainer.classList.remove('active'); generateBtn.disabled = false; generateBtn.innerHTML = '<i class="fas fa-magic"></i> 生成图片'; }); }); </script> </body> </html> 修复我的代码
最新发布
11-20
<!DOCTYPE html> <html> <head> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="X-UA-Compatible" content="chrome=1"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="sid" content="default"> <meta name="theme" content="custom"> <script type="text/javascript" src="script/jquery.min.js"></script> <script type="text/javascript" src="themes/layui/lay/dest/layui.all.js"></script> <script type="text/javascript" src="script/jsencrypt.min.js"></script> <script type="text/javascript" src="script/vue.min.js"></script> <!-- <script type="text/javascript" src="script/index.js"></script> --> <script type="text/javascript" src="script/co_indexs.js"></script> <meta charset="UTF-8"> <title>登录</title> <style> * { box-sizing: border-box; } body { overflow: hidden; background-color: #fff; background-image: url(image/puhuodenglu.png); /*background-position-y:-60px;*/ background-size: 100% 100%; } .ph-login { width: 100%; height: 100%; /*position: relative;*/ display: flex; justify-content: center; align-items: center; } .center-box { width: 1411px; height: 680px; /*position: absolute;*/ /*top: 200px;*/ /*right: 290px;*/ display: flex; margin: auto; flex-direction: row; justify-content: flex-start; } .left-img-box { width: 898px; height: 680px; border-radius: 48px 0 0 48px; background: linear-gradient(60.88deg, #035BF5 2.68%, #2796FD 82.94%); border: 1px solid #0D98FF; border-right: none; } .wuliu-img { width: 827px; height: 637px; margin: 21px 35px; background-image: url(image/puhuologin.png); background-size: 100% 100%; } .right-form-box { width: 512px; height: 680px; border-radius: 0 48px 48px 0; background: rgba(255, 255, 255, 0.19); backdrop-filter: blur(6px); display: flex; flex-direction: column; justify-content: flex-start; padding-left: 55px; border: 1px solid rgba(255, 255, 255, 0.89); border-left: none; } .title-text { font-size: 36px; color: #FFFFFF; margin-top: 78px; } .white-box { background: #FFFFFF; width: 406px; height: 68px; border-radius: 10px; padding-left: 21px; padding-top: 22px; margin-top: 32px; } .bot-margin-12 { margin-bottom: 12px; } .lxfs_box { width: 400px; height: 24px; margin: 0 50px 20px 90px; font-size: 14px; color: #FFFFFF; display: none; } .yzm-box { display: flex; flex-direction: row; justify-content: flex-start; align-items: center; margin-top: 20px; } .yzm-input-box { width: 234px; height: 68px; background: #FFFFFF; border-radius: 10px; padding: 22px 0 22px 21px; } .yzm-btn-box { display: flex; flex-direction: column; justify-content: flex-start; margin-left: 17px; } .yzm-btn { width: 155px; height: 46px; background: #007DFF; border-radius: 5px; color: #FFFFFF; font-size: 16px; display: flex; justify-content: center; align-items: center; margin-bottom: 4px; } .cursorP { cursor: pointer; color: #FFFFFF; } .cursorNo { cursor: not-allowed; color: #F8F8FF; } .tishi-text { font-size: 12px; color: #FFFFFF; display: flex; justify-content: center; align-items: center; } .login-btn { width: 406px; height: 68px; background: linear-gradient(0deg, #035BF5 -33.82%, #2998FD 108.82%); display: flex; flex-direction: row; justify-content: center; align-items: center; font-size: 26px; color: #FFFFFF; border-radius: 10px; margin-top: 40px; cursor: pointer; } .no-border { border: none; } input { outline: none; } input:-webkit-autofill, textarea:-webkit-autofill, select:-webkit-autofill { background-color: #fff; } input:-webkit-autofill, textarea:-webkit-autofill, select:-webkit-autofill { -webkit-box-shadow: 0 0 0 1000px white inset; } </style> <script type="text/javascript"> $(document).ready(function () { $('body').css('height', $(window).height()); $('body').css('width', $(window).width()); }) $(window).resize(function () { $('body').css('height', $(window).height()); $('body').css('width', $(window).width()); }) function onInputFocus(id) { $('#' + id).focus() } </script> </head> <body> <div class="ph-login" id="ph_login"> <div class="center-box"> <div class="left-img-box"> <div class="wuliu-img"></div> </div> <div class="right-form-box"> <div class="title-text">欢迎登录</div> <input id="cylx" type="hidden" value="3GF4BE5H" /> <div class="white-box" onclick="onInputFocus('user_name')"> <input id="user_name" autocomplete="off" class="no-border" placeholder="请输入账号" type="text" name="code" aria-label="账号"> </div> <div class="white-box bot-margin-12" onclick="onInputFocus('user_password')"> <input id="user_password" class="no-border" autocomplete="off" placeholder="请输入密码" type="password" name="passwd" aria-label="密码"> </div> <div id="lxfs_id" class="lxfs_box"> </div> <div class="yzm-box"> <div class="yzm-input-box" onclick="onInputFocus('user_yzm')"> <input id="user_yzm" class="no-border" name="yzm" aria-label="验证码" placeholder="请输入验证码" autocomplete="off" type="text"> </div> <div class="yzm-btn-box"> <div class="yzm-btn" id="yzmbtn"> 发送验证码 </div> <div class="tishi-text"> 验证码当天内有效 </div> </div> </div> <span style='font-size:14px;color:red;padding-top:5px;display:inline-block' id='tsy'>温馨提示:若没有收到验证码,请输1234</span> <div class="login-btn" id="logonbtn"> 登录 </div> </div> </div> </div> </body> </html>让页面适配笔记本
10-16
<template> <div> <div class="video-box" :style="isTabsBoxOpen ? 'width: 70%':'width: 100%'"> <video :src="cTwoVideoUlr" ref="myvideo1" class="isVideo" :style="myStyle" @canplay="getTotal" @timeupdate="timeupdate" v-if="cTwoVideoUlr" playsinline playsinline="" ></video> <video :src="cVideoUlr" @mouseover="handleMouseOver()" @mousemove.self="handleMouseMove()" @dblclick="toggleFullScreen()" ref="myvideo" @click="play" @canplay="getTotal" @timeupdate="timeupdate" :class=" ['object-fit: cover']" playsinline v-if="cVideoUlr" :style="videoItem" playsinline="" ></video> <transition name="fade"> <div @mouseover="ctrlMouseOver" v-show="isShowOperate"> <div class="progress"> <el-slider v-model="currentTimeVal" :max="durationProgress" :show-tooltip="false" @change="getNewTime" > </el-slider> <div v-for="(marker, index) in markers" :key="index" class="marker" :style="{ left: `${marker.time}%` }" > <div class="marker-dot" @click="getNewTime(marker.times)"></div> <div class="marker-name">{{ marker.text }}</div> </div> </div> <div class="control"> <div class="flex-center"> <i class="iconfonts" :class=" isPaused ? 'iconzanting1 el-icon-video-pause' : 'iconicon_play el-icon-video-play' " @click="play()" ></i> <span class="time">{{ currentTime }} / {{ totalTime }}</span> </div> <div class="flex"> <div class="line" @click="isLine('none')"> <div class="flex"> <i class="el-icon-connection"></i> </div> <div>{{display ? '隐藏':'显示'}}</div> </div> <div class="line" @click="isLine('is_video')"> <div class="flex"> <i class="el-icon-sort"></i> </div> <div>交换</div> </div> <div class="line" @click="isLine('leftTop')" :style="{ color: leftTop ? 'orange' : '' }" > <div class="flex"> <i class="el-icon-top-left"></i> </div> <div>左上</div> </div> <div class="line" @click="isLine('leftBottom')" :style="{ color: leftBottom ? 'orange' : '' }" > <div class="flex"> <i class="el-icon-bottom-left"></i> </div> <div>左下</div> </div> <div class="line" @click="isLine('rightTop')" :style="{ color: rightTop ? 'orange' : '' }" > <div class="flex"> <i class="el-icon-top-right"></i> </div> <div>右上</div> </div> <div class="line" @click="isLine('rightBottom')" :style="{ color: rightBottom ? 'orange' : '' }" > <div class="flex"> <i class="el-icon-bottom-right"></i> </div> <div>右下</div> </div> <div class="line" @click="isLine('leftright')" :style="{ color: leftright ? 'orange' : '' }" > <div class="flex"> <i class="el-icon-rank"></i> </div> <div>左右</div> </div> <div class="line" @click="isLine(1)"> <div class="flex"> <img src="../../assets/image/line.png" v-if="is_line" alt="" /> <img src="../../assets/image/is_line.png" v-else alt="" /> </div> <div>线路1</div> </div> <div class="line" @click="isLine(2)"> <div class="flex"> <img src="../../assets/image/line.png" v-if="is_line2" alt="" /> <img src="../../assets/image/is_line.png" v-else alt="" /> </div> <div>线路2</div> </div> <i class="iconfont el-icon-help" @click="toggleFullScreen"></i> </div> </div> </div> </transition> </div> <video ref="myvideo2" class="video-js vjs-default-skin vjs-big-play-centered" style="width: 100%" v-if="cVideoUlr" @seeked="onSeeked" @pause='handlePause' @play="onPlay" playsinline > <source id="source" :src="cVideoUlr" /> </video> <el-dialog title="修改" :visible.sync="isUpdataCourseEvaluation" width="50%"> <el-input type="textarea" :rows="12" placeholder="请修改课评" v-model="courseEvaluation"> </el-input> <span slot="footer" class="dialog-footer"> <el-button @click="isUpdataCourseEvaluation = false">取 消</el-button> <el-button type="primary" @click="UpdataCourseEvaluation">确 定</el-button> </span> </el-dialog> <el-dialog title="修改" :visible.sync="isUpdataCourseEvaluationSections" width="50%"> <el-input type="textarea" :rows="4" placeholder="请修改" v-model="sectionsTitle"> </el-input> <span slot="footer" class="dialog-footer"> <el-button @click="isUpdataCourseEvaluationSections = false">取 消</el-button> <el-button type="primary" @click="submitSections">确 定</el-button> </span> </el-dialog> <el-dialog title="修改" :visible.sync="isUpdataTree" width="50%"> <el-input type="textarea" :rows="4" placeholder="请修改" v-model="treeName"> </el-input> <span slot="footer" class="dialog-footer"> <el-button @click="isUpdataTree = false">取 消</el-button> <el-button type="primary" @click="submitTree">确 定</el-button> </span> </el-dialog> <el-dialog title="历史记录" :visible.sync="isRecords" width="50%"> <el-select v-model="isType" placeholder="类型" clearable size="small" @change="records" style="width: 150px;margin-bottom:20px" > <el-option v-for="dict in recordsList" :key="dict.value" :label="dict.name" :value="dict.value" ></el-option> </el-select> <el-table :data="courseList" width="100%" border > <el-table-column prop="nickName" label="修改人" align="left" show-overflow-tooltip width="100" > </el-table-column> <el-table-column prop="content" label="修改内容" align="left" show-overflow-tooltip > <template slot-scope="{row}"> <div v-html="row.content"></div> </template> </el-table-column> <el-table-column prop="createTime" label="修改时间" align="left" show-overflow-tooltip width="120" > </el-table-column> </el-table> <span slot="footer" class="dialog-footer"> <el-button @click="isRecords = false">取 消</el-button> </span> </el-dialog> <el-dialog title="生成ppt" :visible.sync="visible" width="80%"> <iframe :src='getUrlParams()' width="100%" height="800px" v-if="visible" frameborder="0" seamless ></iframe> <span slot="footer" class="dialog-footer"> <el-button @click="cancel">取消</el-button> </span> </el-dialog> </div> </template> <script> import videojs from "video.js"; import "video.js/dist/video-js.css"; import "videojs-contrib-hls"; import { getVideo, getCheckVideo, getStrongVideo, fabulousCourse, getVodVideoEnd, getUserCourseNote, addCourseNote, updateCourseEvaluation, getCourseEvaluationHistory, courseEvaluationAnalysis } from "@/api/course/course"; import * as echarts from "echarts"; import getTreeConfig from '../coursemanage/course/config/getTreeConfig' export default { name: "error", data() { return { subArray: { tableContents:{ structureList:[] } }, visible:false, isRecords:false, recordsList:[ { name:'Ai评课', value:0, }, { name:'课程导读', value:1, }, { name:'思维脑图', value:2, }, ], isTabsBoxOpen: true, activeName: 'courseEvaluation', courseEvaluation:'', textarea:'', isUpdataCourseEvaluation:false, isUpdataCourseEvaluationSections:false, sectionsTitle:'', timePoint:null, treeName:null, treeNameCopy:null, mindMap:null, display:true, bodyStyle:{ background: '#F3F2FF', cursor: 'pointer', }, isUpdataTree:false, volume: 30, // 音量 videochannalList: [], // 全部视频 timeout1: null, // 定时器 fullFlag: false, // 是否全屏(默认否) isShowOperate: false, // 是否显示播放控件(默认否) val:'rightBottom', // 选集列表 videoinglist: [ { url: "https://www.yy.com/ftpurl/medical-record/video/2020/07/01/1593596146146382.mp4", channelDesc: "导播", }, { url: "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4", channelDesc: "导播", }, ], cVideoUlr: "", // "https://cdn-nas.eduzhida.com/2023/09/22/198415ea-6d6f-4c2a-9a9a-690c73e6d159.mp4", // 正在播放视频地址 cTwoVideoUlr: "", videoItem:{}, myvideo: "", myvideo1: "", isPaused: false, //标记当前的播放状态 currentTime: "00:00", //当前播放时间 totalTime: "00:00", //总时长 currentTimeVal: 0, // 进度条当前播放时间,必须是number类型 durationProgress: 0, // 进度条的最大值,必须是number类型 currentIndex: "", leftTop: false, leftBottom: false, rightTop: false, rightBottom: true, leftright:false, is_line: true, is_line2: false, player: "", markers: [], courseKnowledgeList:[], isType:0, courseList:[], myStyle: { bottom: "90px", right: "30%", }, }; }, beforeDestroy() { // 恢复浏览器滚动 this.enableScroll(); document.removeEventListener( "fullscreenchange", this.handleFullScreenChange ); }, watch:{ durationProgress:function(newValue, oldValue){ if(this.courseKnowledgeList.length){ this.markers = this.courseKnowledgeList.map((ele) => { let percentage = (ele.time / newValue) * 100; let roundedPercentage = Number(percentage) - 2; return { time: roundedPercentage.toFixed(0), text: ele.text, times: ele.time, }; }); } } }, mounted() { //获取播放器元素 this.disableScroll(); document.addEventListener("fullscreenchange", this.handleFullScreenChange); this.getVVideo(this.$route.query.id); }, methods: { cancel(){ this.visible = false }, DownLoadPPT(row){ this.visible = true }, handleCourseEvaluationAnalysis(){ courseEvaluationAnalysis(this.$route.query.id,this.$route.query.iscType == 0 ? 0 :1) this.msgSuccess(`课评已在分析,请稍后刷新页面查看`) }, handleCourseEvaluationAnalysis(){ courseEvaluationAnalysis(this.$route.query.id,this.$route.query.iscType == 0 ? 0 :1) this.msgSuccess(`课评已在分析,请稍后刷新页面查看`) }, getUrlParams () { let htmlTagRegex = /<\/?[a-zA-Z][^>]*>/g; const test = this.subArray.courseEvaluation.replace(htmlTagRegex, '') let test1 = test.replace(/"/g, '') console.log(test1); return `https://ppt.bsyxedu.com?userId=${this.$route.query.id}_couser&test=${test1}` // return `http://192.168.8.182:5173?userId=${this.$route.query.id}_couser&test=${test1}` }, records(type){ if(!type && type !=0){ this.isType = 0 switch (this.activeName){ case 'courseEvaluation': this.isType = 0 break; case 'first': this.isType = 1 break; case 'second': this.isType = 2 break; } } let param = { courseId:this.$route.query.id, type:type ? type :this.isType } this.isRecords = true this.$forceUpdate() getCourseEvaluationHistory(param).then(res=>{ this.courseList = res.data }) }, handelsections(item){ this.isUpdataCourseEvaluationSections = true this.sectionsTitle = item.title this.timePoint = item.timePoint console.log(item); }, submitSections(){ let name = '' this.subArray.tableContents.structureList.forEach((ele)=>{ ele.sections.find(row=>{ if(row.timePoint == this.timePoint){ name = row.title row.title = this.sectionsTitle } }) }) let param = { cId:this.$route.query.id, tableContents:JSON.stringify(this.subArray.tableContents), historyContent:`${name}---> ${this.sectionsTitle}` } updateCourseEvaluation(param).then(res=>{ if(res.code == 200){ this.msgSuccess(res.msg) this.isUpdataCourseEvaluationSections = false } }) }, UpdataCourseEvaluation(){ let param = { cId:this.$route.query.id, courseEvaluation:this.courseEvaluation, historyContent:this.courseEvaluation, } updateCourseEvaluation(param).then(res=>{ if(res.code == 200){ this.msgSuccess(res.msg) this.isUpdataCourseEvaluation = false this.subArray.courseEvaluation = this.courseEvaluation.replace(/\n/g, '<br>') } }) }, toggleTabsBox() { this.isTabsBoxOpen = !this.isTabsBoxOpen; console.log(this.val,'val'); console.log(this.myStyle,'myStyle'); if(this.val == "rightTop" ){ if(this.isTabsBoxOpen){ this.myStyle = { top: "0", right: "30%" }; }else{ this.myStyle = { top: "0", right: "0" }; } } else if(this.val == "rightBottom" ){ if(this.isTabsBoxOpen){ this.myStyle = { bottom: "90px", right: "30%" }; }else{ this.myStyle = { bottom: "90px", right: "0" }; } this.videoItem = { width: `100%`, } }else if(this.val == "leftright" ){ const videoBox = document.querySelector('.video-box'); const isVideo = document.querySelector('.isVideo'); const top = `${Math.max(0, (videoBox.offsetHeight - isVideo.offsetHeight) / 2 -90)}px` if(this.isTabsBoxOpen){ this.videoItem = { width: videoBox.offsetWidth/2 +'px', height: 'auto', marginTop: top } this.myStyle = { width: videoBox.offsetWidth/2 +'px !important', height: 'auto !important', right:'30%' ,marginTop: top }; }else{ this.videoItem = { width: videoBox.offsetWidth/2 +'px', height: 'auto', marginTop: '15%' } this.myStyle = { width: videoBox.offsetWidth/2 +'px !important', height: 'auto !important', right:'0' ,marginTop: '15%' }; } } else if(this.val == 'none'){ if(this.isTabsBoxOpen){ if(this.myStyle?.right){ this.myStyle.right = "30%" } }else{ if(this.myStyle?.right){ this.myStyle.right = "0" } } } }, handleResize() { this.$nextTick(() => { if (this.points) { this.points.resize(); } }); }, submitTree(){ console.log(this.treeName); const findNodeByName = this.findNodeByName(this.mindMap,this.treeNameCopy) console.log(findNodeByName); findNodeByName.name = this.treeName let param = { cId:this.$route.query.id, mindMap:JSON.stringify(this.mindMap), historyContent:`${this.treeNameCopy}---> ${this.treeName}` } updateCourseEvaluation(param).then(res=>{ if(res.code == 200){ this.isUpdataTree = false this.msgSuccess(res.msg) this.points.setOption(getTreeConfig(this.mindMap)); } }) }, initChart(data) { this.$nextTick(() => { console.log(data,'data'); this.points = echarts.init(this.$refs.points, "macarons"); this.points.setOption(getTreeConfig(data)); this.points.on('click',(params)=>{ this.treeName = params.name this.treeNameCopy = params.name if(this.permissions.includes('*:*:*') || this.permissions.includes('course:knowledge:evaluation')){ this.isUpdataTree = true } }) }); }, findNodeByName(root, targetName) { // 1. 检查当前节点的name是否匹配目标 if (root.name === targetName) { return root; // 找到目标节点,返回 } // 2. 递归遍历子节点(如果有children) if (root.children && Array.isArray(root.children)) { for (const child of root.children) { // 递归查找子节点 const found = this.findNodeByName(child, targetName); if (found) { // 子节点中找到目标,提前返回 return found; } } } // 3. 未找到目标节点 return null; }, cardClick(item){ const timePoint = item.timePoint.split('-')[0]; // 将时间字符串分割成小时、分钟和秒 const time = this.timeToSeconds(timePoint) // const player = videojs(document.querySelector("video")) // player.currentTime(time || 0) this.getNewTime(time) }, timeToSeconds(timeStr) { const parts = timeStr.split(':').map(Number); let seconds = 0; if (parts.length === 3) { // 完整格式 HH:mm:ss seconds = parts[0] * 3600 + parts[1] * 60 + parts[2]; } else if (parts.length === 2) { // 省略小时格式 mm:ss seconds = parts[0] * 60 + parts[1]; } else if (parts.length === 1) { // 仅秒数格式 ss seconds = parts[0]; } return seconds; }, handleSubmit(){ if(!this.textarea) return else{ addCourseNote({courseId:this.$route.query.id,content:this.textarea,type:this.$route.query.iscType == 0 ? 0 :1}).then(res=>{ if(res.code == 200) this.msgSuccess('保存成功') }) } }, handleClick(tab, event) { console.log(tab); if(tab.name == "third"){ getUserCourseNote({courseId:this.$route.query.id,type:this.$route.query.iscType == 0 ? 0 :1}).then(res=>{ this.textarea = res.data ? res.data.content :'' // this.subArray = data }) }else if(tab.name =="second"){ this.initChart(JSON.parse(this.subArray.mindMap)) } }, onPlay() { console.log('Video is playing...'); const customElement = document.querySelector('.overlay-module'); customElement.play() }, handlePause(event) { // 处理视频暂停的逻辑 console.log('Video paused at time:', event.target.currentTime); const customElement = document.querySelector('.overlay-module'); customElement.pause() }, onSeeked(event){ const video = event.target; const currentTime = video.currentTime; console.log('用户点击进度条,当前时间:', currentTime); const customElement = document.querySelector('.overlay-module'); customElement.currentTime = currentTime }, getUrl(id, name) { console.log(name, "namee"); if (name == "getVideo") { this.getVVideo(id); } else if (name == "getCheckVideo") { this.getEVideo(id); } else if (name == "getStrongVideo") { this.getSVideo(id); } else { this.getBoutiqueVideo(id); } }, //播放课程视频 getVVideo(id) { getVideo(id).then((res) => { const { cVideoUlr, cTwoVideoUlr } = res.data; this.cTwoVideoUlr = cTwoVideoUlr; this.cVideoUlr = cVideoUlr; this.subArray = res.data; if(this.subArray.tableContents){ this.subArray.tableContents = JSON.parse(this.subArray.tableContents) } this.courseEvaluation = res.data.courseEvaluation if(this.subArray.courseEvaluation){ this.subArray.courseEvaluation = res.data.courseEvaluation.replace(/\n/g, '<br>') } this.mindMap = JSON.parse(this.subArray.mindMap) // this.$route.query.id; this.$nextTick(() => { this.myvideo = this.$refs.myvideo; this.myvideo1 = this.$refs.myvideo1; this.myvideo1.volume = 0 let arr = [], result = []; if (res.data?.courseKnowledgeList) { arr = res.data.courseKnowledgeList.map((ele) => { return { time: ele.payDateSeconds, text: ele.knowledgeName }; }); this.courseKnowledgeList = arr } console.log(this.courseKnowledgeList,'courseKnowledgeList'); const player1 = videojs(this.$refs.myvideo); player1.on("play", () => { if (player1.userActive()) { this.$nextTick(() => { console.log('demo'); this.demo(result); }); // 执行其他操作... } }); this.$nextTick(() => { const player = videojs( this.$refs.myvideo2, { controls: true, }, () => { player.pause(); } ); if (arr.length) { result = arr.map((item) => item.text); } console.log(arr,'arr'); player.markers({ markerTip: { display: true, text: function (marker) { return `${marker.text}`; }, }, markerStyle: { // 标记点样式 width: "1em", height: "1em", bottom: "-0.20em", "border-radius": "50%", "background-color": "rgb(194,158,206)", position: "absolute", "font-size": "16px", }, markers: arr, }); }); }); // if(res.data.isXy == 1) url =res.data.cPlaybackUlr // else url = res.data.cVideoUlr; }); }, disableScroll() { document.body.style.overflow = "hidden"; window.addEventListener("touchmove", this.preventDefault, { passive: false, }); }, enableScroll() { document.body.style.overflow = ""; window.removeEventListener("touchmove", this.preventDefault); }, preventDefault(event) { event.preventDefault(); }, // 鼠标在控件内 ctrlMouseOver() { clearTimeout(this.timeout1); this.isShowOperate = true; }, handleMouseOver() { this.isShowOperate = true; }, handleMouseMove() { this.isShowOperate = true; clearTimeout(this.timeout1); // 使用定时器前先清除定时器 this.timeout1 = setTimeout(() => { this.isShowOperate = false; }, 1000); }, isLine(val) { console.log(this.isTabsBoxOpen,'isTabsBoxOpen'); this.val = val let isVideos = document.querySelector('.isVideo'); switch (val) { case "none": console.log(isVideos.style.display); this.display = !this.display isVideos.style.display = this.display ? 'block' :'none' break ; case "is_video": let currentTime = this.$refs.myvideo.currentTime let currentTime1 = this.$refs.myvideo1.currentTime let cTwoVideoUlr = this.cTwoVideoUlr; let cVideoUlr = this.cVideoUlr; this.cVideoUlr = cTwoVideoUlr; this.cTwoVideoUlr = cVideoUlr; this.$nextTick(() => { this.$refs.myvideo.currentTime = currentTime this.$refs.myvideo1.currentTime = currentTime1 if(this.isPaused){ this.$refs.myvideo.play(); this.$refs.myvideo1.play(); } }) break; case 1: this.is_line = !this.is_line; console.log(this.is_line,'this.is_line'); this.myvideo.volume = this.is_line ? 1 : 0; //赋值 break; case 2: this.is_line2 = !this.is_line2; this.myvideo1.volume = this.is_line2 ? 1 : 0; //赋值 break; case "leftTop": this.leftTop = true; (this.leftBottom = false), (this.rightTop = false), (this.rightBottom = false); this.leftright = false this.myStyle = { top: "0", left: "0" }; this.videoItem = { width: `100%`, } break; case "leftBottom": this.leftTop = false; (this.leftBottom = true), (this.rightTop = false), (this.rightBottom = false); this.leftright = false this.myStyle = { bottom: "90px", left: "0" }; this.videoItem = { width: `100%`, } break; case "rightTop": this.leftTop = false; (this.leftBottom = false), (this.rightTop = true), (this.rightBottom = false); this.leftright = false if(this.isTabsBoxOpen){ this.myStyle = { top: "0", right: "30%" }; }else{ this.myStyle = { top: "0", right: "0" }; } this.videoItem = { width: `100%`, } break; case "rightBottom": this.leftTop = false; (this.leftBottom = false), (this.rightTop = false), (this.rightBottom = true); this.leftright = false if(this.isTabsBoxOpen){ this.myStyle = { bottom: "90px", right: "30%" }; }else{ this.myStyle = { bottom: "90px", right: "0" }; } this.videoItem = { width: `100%`, } break; case "leftright": this.leftTop = false; (this.leftBottom = false), (this.rightTop = false), (this.rightBottom = false); this.leftright = true const videoBox = document.querySelector('.video-box'); const isVideo = document.querySelector('.isVideo'); const top = `${Math.max(0, (videoBox.offsetHeight - isVideo.offsetHeight) / 2 -90)}px` if(this.isTabsBoxOpen){ this.videoItem = { width: videoBox.offsetWidth/2 +'px', height: 'auto', marginTop: top } this.myStyle = { width: videoBox.offsetWidth/2 +'px !important', height: 'auto !important', right:'30%' ,marginTop: top }; }else{ this.videoItem = { width: videoBox.offsetWidth/2 +'px', height: 'auto', marginTop: '15%' } this.myStyle = { width: videoBox.offsetWidth/2 +'px !important', height: 'auto !important', right:'0' ,marginTop: '15%' }; } break; } }, //获取课程详情 demo(list) { const arr = list ?? []; const transparentElements = document.querySelectorAll(".vjs-marker"); transparentElements.forEach(function (element, index) { // 在这里对每个透明元素进行进一步的操作 const textNode = document.createElement("div"); textNode.textContent = arr[index]; var textLength = textNode.innerHTML.length; var width = textLength * 10; // 假设每个字符宽度为 10px textNode.style.whiteSpace = "nowrap"; textNode.style.position = "absolute"; textNode.style.bottom = "10px"; // textNode.style.color = 'orange' // textNode.style.left = `-${width}px` textNode.style.fontSize = "14px"; textNode.style.background = "rgba(0,0,0,0.5)"; textNode.style.padding = "10px"; textNode.classList.add("is_element"); element.insertBefore(textNode, element.firstChild); }); }, // 选集 changevideo(val) { console.log(val); if (this.cVideoUlr == val) { this.isPaused = false; this.myvideo.pause(); } }, play() { //修改当前的播放状态 this.isPaused = !this.isPaused; if (this.isPaused) { this.myvideo.play(); this.myvideo1.play(); } else { this.myvideo.pause(); this.myvideo1.pause(); } }, // 进度条拖动时间 getNewTime(val) { console.log(val); this.myvideo.currentTime = val; this.myvideo1.currentTime = val; }, // 音量控制 getNewVoice(val) { this.volume = val; let newVc = val / 100; //h5规定,volume的值必须再0-1之间,比如0.5就是50%的音量,但是进度条的值为100,因此这里做个除法 this.myvideo.volume = newVc; //赋值 }, //时间格式化处理 timeFormat(time) { let minute = Math.floor((time % 3600) / 60); let second = Math.floor(time % 60); minute = minute < 10 ? "0" + minute : minute; second = second < 10 ? "0" + second : second; return `${minute}:${second}`; }, //获取总时长 getTotal() { this.totalTime = this.timeFormat(this.myvideo.duration); this.durationProgress = this.myvideo.duration; // if(res.customKpointList.length){ // arr = res.customKpointList.map(ele=>{ // return {time:ele.nodeSeconds,text:ele.kpointName} // }) // } }, //获取当前视频播放到的时间 timeupdate() { if (this.myvideo.currentTime == this.myvideo.duration) { this.isPaused = !this.isPaused; this.myvideo.pause(); this.myvideo1.pause(); } this.currentTime = this.timeFormat(this.myvideo.currentTime); this.currentTimeVal = this.myvideo.currentTime; }, handleFullScreenChange() { const playerVideo = this.$refs.myvideo2; const that = this; if (!document.fullscreenElement) { that.myvideo.currentTime = playerVideo.currentTime; that.myvideo1.currentTime = playerVideo.currentTime; // that.isOpacity = false this.$nextTick(()=>{ console.log(document.querySelectorAll('video')[2].style,'document.querySelectorAll("video")'); document.querySelectorAll('video')[2].style.width = 0 }) that.myvideo.play(); that.myvideo1.play(); this.myvideo1.volume = this.is_line2 ? 1 : 0; //赋值 this.myvideo.volume = this.is_line ? 1 : 0; //赋值 playerVideo.pause(); const customElement = document.querySelector('.overlay-module'); customElement.pause(); customElement.remove(); this.isPaused = true // 执行退出全屏后的逻辑 }else{ this.$refs.myvideo.pause(); this.$refs.myvideo1.pause(); const playerVideo = this.$refs.myvideo; // console.log(playerVideo.currentTime,'playerVideo.currentTime'); // // const isVideo = document.querySelector(".isVideo"); const newElement = document.createElement("video"); // 创建新的 div 元素 newElement.classList.add('overlay-module') newElement.style.position = `absolute`; newElement.style.objectFit = `cover`; // newElement.style.right = `0`; newElement.src = this.cTwoVideoUlr; // newElement.controls = true; // newElement.autoplay = true; const video2 = document.querySelectorAll('.vjs-tech')[1] console.log(this.myStyle,'this.myStyle'); console.log(video2,'this.video2'); console.log(newElement,'this.newElement'); if(this.myStyle?.height){ newElement.style.width = '50%'; newElement.style.height = 'auto'; newElement.style.top = '25%'; video2.style.width = '50%'; video2.style.top = '25%'; video2.style.height = 'auto'; }else{ newElement.style.width = '30%'; newElement.style.height = '30%'; video2.style.width = '100%'; video2.style.top = '0'; video2.style.height = '100%'; } newElement.volume = 0 newElement.currentTime = playerVideo.currentTime if(this.myStyle?.bottom){ console.log('bottom'); newElement.style.bottom = this.myStyle.bottom } if(this.myStyle?.right){ newElement.style.right = 0 } if(this.myStyle?.top){ newElement.style.top = this.myStyle.top console.log('top'); } if(this.myStyle?.bottom){ newElement.style.left = this.myStyle.left console.log('left'); } newElement.autoplay = true const videoJsContainer = document.querySelector(".video-js"); if(this.display){ videoJsContainer.appendChild(newElement); } } }, //全屏切换 toggleFullScreen(event) { this.$nextTick(() => { this.$refs.myvideo.pause(); this.$refs.myvideo1.pause(); const player = videojs(this.$refs.myvideo2); if (player) { player.src({ src: this.cVideoUlr, // type: 'video/mp4', // 根据你的视频格式来设置 }); // this.$refs.myvideo1.pause(); // 如果你想要在新的视频加载后立即播放,可以调用 player.play() // 但是请注意浏览器对自动播放的限制 // this.player.play(); player.play() player.volume = 0 } player.currentTime(this.myvideo.currentTime); //如果当前是全屏状态,就退出全屏,否则进入全屏状态 //获取当前的全屏状态 let isFullscreen = document.webkitIsFullScreen || document.fullscreen; if (!isFullscreen) { const inFun = player.requestFullscreen || player.webkitRequestFullScreen; //让当前播放器进入全屏状态 inFun.call(player); console.log(1); } else { const exitFun = document.exitFullscreen || document.webkitExitFullScreen; //退出全屏状态要使用document exitFun.call(document); console.log(2); // this.$refs.myvideo2.style.width='100px' // this.$refs.myvideo2.style.height='100px' } // if (player.requestFullscreen) { // player.requestFullscreen(); // } else if (player.mozRequestFullScreen) { // player.mozRequestFullScreen(); // Firefox // } else if (player.webkitRequestFullscreen) { // player.webkitRequestFullscreen(); // Chrome, Safari and Opera // } else if (player.msRequestFullscreen) { // player.msRequestFullscreen(); // IE/Edge // } }); }, }, }; </script> <style lang="scss" scoped> .video-box, .info-box { // float: left; background: #fff; height: 100%; box-sizing: border-box; } .iconfonts { display: flex; justify-content: center; align-items: center; font-size: 30px; } .iconfont { display: flex; justify-content: center; align-items: center; font-size: 30px; cursor: pointer; } .courseEvaluation{ font-size: 14px; color: #585a73; line-height: 24px; padding: 0 20px 0 10px; } .coures-icon{ font-size: 18px; padding: 10px 20px 0 10px; cursor: pointer; } .chapter{ font-size: 15px; color: rgb(64, 64, 64); margin: 20px 0; } .isOpen{ position: fixed; // right: 0; top: 50%; z-index: 99; cursor: pointer; transition: right 0.3s ease; color: #585a73; .isOpen-icon{ font-size: 40px } } .tabs-box.collapsed { right: -30%; } .records{ position: absolute; right: 30px; top: 0px; cursor: pointer; z-index: 999; } .tabs-box{ width: 30%; padding: 20px 30px; height: 100%; overflow-y: scroll; position: fixed; right: 0; top: 0; background-color: white; transition: right 0.3s ease; /deep/.el-tabs__item { font-size: 16px; } .points { width: 26vw; height: 80vh; display: flex; align-items: center; justify-content: center; } } .primary-submit{ color: #FFFFFF; background-color: #7F1083; border-color: #7F1083; text-align: center; width: 80px; cursor: pointer; height: 30px; border-radius: 4px; font-size: 14px; line-height: 30px; margin: 0 auto; margin-top: 20px; } .video-box { width: 100%; box-sizing: border-box; position: relative; height: 100vh; overflow: hidden; .isVideo { width: 30% !important; height: 30% !important; position: fixed; z-index: 99; } video { width: 100%; height: 100vh; object-fit: cover; cursor: pointer; } .control { width: 100%; height: 90px; padding-top: 18px; padding-right: 20px; position: absolute; bottom: 0; left: 0; background-color: rgba(0, 0, 0, 0.5); display: flex; align-items: center; justify-content: space-between; color: #fff; .iconicon_play { cursor: pointer; width: 50px; height: 50px; } .iconzanting1 { cursor: pointer; width: 50px; height: 50px; } .line:hover { color: orange; } .line { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 14px; margin-right: 15px; cursor: pointer; img { width: 25px; height: 25px; } i { font-size: 25px; } } /deep/.el-select .el-input .el-select__caret { color: #fff; } /deep/.el-input__inner { color: #fff; &::placeholder { color: #fff; } &::-webkit-input-placeholder { /* WebKit browsers 适配谷歌 */ color: #fff; } &:-moz-placeholder { /* Mozilla Firefox 4 to 18 适配火狐 */ color: #fff; } &::-moz-placeholder { /* Mozilla Firefox 19+ 适配火狐 */ color: #fff; } &:-ms-input-placeholder { /* Internet Explorer 10+ 适配ie*/ color: #fff; } } .time { margin-left: 0.22rem; color: #f5f5fa; } .iconyinliang-gao { margin-left: 2.68rem; } /deep/.el-input, div.el-select { width: 1.1rem !important; background-color: transparent; .el-input__inner { background-color: transparent; } } .anthology { margin: 0 0.2rem 0 0.24rem; } .iconquanping-video, .iconquanping { margin-left: 0.44rem; cursor: pointer; } } /deep/ .el-slider { width: 0.88rem; margin-left: 0.1rem; .el-slider__runway, .el-slider__bar { height: 6px !important; } // .el-slider__button { // width: 0.13rem; // height: 0.13rem; // } .el-slider__button-wrapper { top: -16px; } } .progress { width: 100%; position: absolute; bottom: 44px; left: 0; // overflow: hidden; z-index: 999; padding: 0 1%; .el-slider { width: 100%; // margin-left: 0; } } .operating-room-video::-webkit-scrollbar { // height: 4px; // background:#bababa; } .operating-room-video { width: 100%; height: 100px; border: 1px solid; white-space: nowrap; overflow-x: auto; overflow-y: hidden; > div.lunb { width: max-content; height: 1.2rem; > div.sing { width: 2.07rem; display: block; height: 1.2rem; float: left; position: relative; cursor: pointer; > img { width: 2.08rem; height: 1.2rem; } .name { width: 100%; position: absolute; bottom: 0; left: 0; background-color: rgba(0, 0, 0, 0.1); text-align: center; color: #fff; } } } } } .video-info-height { height: 6.3rem; } .info-box { width: 3.92rem; /deep/ .el-tabs__nav-scroll { display: flex; justify-content: space-around; .el-tabs__item { font-size: 0.18rem; padding: 0 0.5rem; color: #999; } .el-tabs__active-bar { width: 0.75rem !important; background-color: red; } .is-active { color: #333; } } .video-info { padding: 0.1rem 0.4rem; > div { line-height: 0.34rem; display: flex; > div:first-child { color: red; margin-right: 0.1rem; min-width: 0.7rem; } > div { display: inline-block; } } } .patient-info { > div { > div:first-child { min-width: 0.9rem; } } } } .fade-enter-active, .fade-leave-active { transition: opacity 1s; } .fade-enter, .fade-leave-to { opacity: 0; } .marker { position: absolute; top: -30px; /* 根据需要调整与滑块的距离 */ text-align: center; pointer-events: none; } .marker-dot { display: inline-block; width: 15px; height: 15px; background-color: rgb(127, 16, 131); border-radius: 50%; margin-bottom: -38px; /* 与名称之间的间距 */ cursor: pointer; } .marker-name { font-size: 12px; color: #fff; } /deep/.vjs_video_3-dimensions{ width: 100%; } </style>视频没问题 为什么我在移动端就播放不起了
09-04
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值