SchoolPhysicalExamination/application/code/view/qrcode/little_tips_project.html

383 lines
12 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1,minimum-scale=1, maximum-scale=1,user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta http-equiv="Access-Control-Allow-Origin" content="*">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no, email=no">
<meta name="full-screen" content="true">
<meta name="screen-orientation" content="portrait">
<meta name="x5-fullscreen" content="true">
<meta name="360-fullscreen" content="true">
<title>小贴士</title>
<script src="/x_admin/js/jq.js"></script>
<style>
*{
padding: 0 0;
margin: 0 0;
}
.yc{
display: none;
}
.big_box{
width: 100vw;
height: 100vh;
padding-bottom: 6vw;
box-sizing: border-box;
position: absolute;
top: 0;
left: 0;
background: linear-gradient(to top right, #00679C, #00BAA0);
display: flex;
overflow: auto;
flex-direction: column;
flex-wrap: nowrap;
align-items: center;
}
.title_data{
width: 100vw;
height: 12vw;
line-height: 12vw;
text-align: center;
font-size: 5vw;
background-color: #BEE0DF;
}
.label{
width: 100vw;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
margin-top: 3vw;
}
.label_c{
margin: 1vw;
border-radius: 5vw;
padding: 1vw 3vw;
box-sizing: border-box;
}
.label_c_color1{
background-color: #E9FDFE;
color: black;
}
.label_c_color2{
background-color: #333333;
color: white;
}
.content{
width: 100vw;
height: 75vh;
display: flex;
flex-wrap: wrap;
overflow: auto;
justify-content: flex-start;
flex-direction: row;
}
.c_c{
width: 45vw;
height: 75vw;
border-radius: 2.5vw;
background-color: #BFDEE0;
position: relative;
margin-bottom: 3vw;
margin-left: 3vw;
}
.c_c_c{
width: 94%;
height: 88%;
border-radius: 2.5vw;
background-color: white;
position: absolute;
top: 6%;
left: 0;
right: 0;
margin: 0 auto;
}
.c_c_c_name{
position: absolute;
top: 58%;
left: 0%;
width: 100%;
font-size: 4vw;
font-weight: bold;
text-align: center;
}
.c_c_c_type{
position: absolute;
top: 66.5%;
left: 4%;
width: 92%;
font-size: 3.2vw;
font-weight: bold;
text-align: center;
}
.c_c_c_describe{
position: absolute;
top: 75%;
left: 4%;
width: 92%;
height: 14%;
font-size: 3vw;
color: #B4B4B4;
text-align: center;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}
.c_c_c_pic{
position: absolute;
top: 2%;
right: 4%;
width: 92%;
height: 55%;
}
.c_c_c_play{
position: absolute;
top: 40%;
left: 70%;
width: 12vw;
height: 12vw;
background: url(/tsf/play.png) no-repeat;
background-position: center;
background-size: cover;
}
.c_c_c_copy{
position: absolute;
top: 92%;
right: 0;
left: 0;
margin: 0 auto;
width: 26vw;
height: 6vw;
background-color: #37CC92;
line-height: 6vw;
text-align: center;
font-weight: bold;
color: white;
border-radius: 5vw;
box-shadow: 1px 1px 1px 1px black;
font-size: 3.6vw;
}
.play_page{
width: 100vw;
height: 100vh;
position: fixed;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.8);
}
.play_page_title{
width: 20vw;
height: 20vw;
position: absolute;
top: 1vw;
right: 1vw;
font-size: 7vw;
color: white;
text-align: center;
line-height: 20vw;
z-index: 99;
}
.play_page_content{
width: 90vw;
position: absolute;
top: 12vw;
left: 5vw;
}
.zg{
width: 100vw;
height: 100vh;
position: fixed;
top: 0;
left: 0;
/* background-color: rgba(0, 0, 0, 0.4); */
z-index: 9999;
}
.zg_content{
min-width: 20vw;
max-width: 40vw;
height: auto;
word-break: break-word; /* 更激进地在任意字符间换行 */
overflow-wrap: break-word; /* 优先在单词间换行 */
white-space: pre-wrap; /* 保留空白符序列,但正常换行 */
background-color: rgba(0, 0, 0, 0.8);
color: white;
position: absolute;
top: 40%;
left: 0;
right: 0;
margin: 0 auto;
padding: 2vw;
box-sizing: border-box;
text-align: center;
}
.zg_content2{
min-width: 20vw;
max-width: 40vw;
height: auto;
word-break: break-word; /* 更激进地在任意字符间换行 */
overflow-wrap: break-word; /* 优先在单词间换行 */
white-space: pre-wrap; /* 保留空白符序列,但正常换行 */
background-color: rgba(0, 0, 0, 0.8);
color: white;
position: absolute;
top: 40%;
left: 0;
right: 0;
margin: 0 auto;
padding: 2vw;
box-sizing: border-box;
text-align: center;
}
</style>
</head>
<body id="box_k">
<div class="big_box">
<div class="title_data">{$title.type_name}</div>
<div class="label">
{volist name="label" id="vo"}
<span id="label_id_{$vo.id}" class="label_c label_c_color1" onclick="get_video('{$vo.id}')">{$vo.type_name}</span>
{/volist}
</div>
<div style="height: 5vw;width: 80vw;border-top: 1px dashed #72C9D2;margin-top: 3vw;"></div>
<div class="content">
</div>
<div class="play_page">
<div class="play_page_title">关闭</div>
<div class="play_page_content"></div>
</div>
<div class="zg yc">
<div class="zg_content">加载中...</div>
</div>
<div class="zg_content2 yc"></div>
</div>
</body>
</html>
<script>
var default_id = "{$default_id}"
$('.play_page').hide();
function play(str){
// 如果已经存在 video 元素,先移除
const existingVideo = document.querySelector('video');
if (existingVideo) {
existingVideo.remove();
}
// 获取对应的视频链接
const videoUrl = str;
if (!videoUrl) {
alert('未找到对应的视频链接!');
return;
}
// 动态创建 video 元素
const video = document.createElement('video');
video.src = videoUrl;
video.controls = true; // 显示控制条
video.autoplay = true; // 自动播放
video.style.width = '100%'; // 设置视频宽度
video.style.marginTop = '20px'; // 设置视频上边距
// 将 video 元素添加到页面中
document.querySelector('.play_page_content').appendChild(video);
$('.play_page').show();
}
$('.play_page_title').on('click',function(){
$('.play_page').hide();
const existingVideo = document.querySelector('video');
if (existingVideo) {
existingVideo.remove();
}
})
get_video(default_id)
function get_video(id){
$('.zg').removeClass('yc')
$('.label_c').removeClass('label_c_color2')
$('.label_c').addClass('label_c_color1')
$('#label_id_'+id).removeClass('label_c_color1')
$('#label_id_'+id).addClass('label_c_color2')
$.ajax({
url:"https://tc.pcxbc.com/little_tips_get_video_list", //请求的url地址
// url:"http://wm.tcxbc.com/little_tips_get_video_list", //请求的url地址
dataType:"json", //返回格式为json
async:true,//请求是否异步默认为异步这也是ajax重要特性
data:{'id':id}, //参数值
type:"POST", //请求方式
success:function(req){
$('.zg').addClass('yc')
if(req.code === 0){
var str='',ls_str=''
for (let index = 0; index < req.data.length; index++) {
ls_str = '<div class="c_c">'
+'<div class="c_c_c">'
+'<div class="c_c_c_name">'+ req.data[index]['device_model'] +'</div>'
+'<div class="c_c_c_type">'+ req.data[index]['device_type'] +'</div>'
+'<div class="c_c_c_describe">'+ req.data[index]['device_describe'] +'</div>'
+'<img class="c_c_c_pic" src="'+ req.data[index]['pic_url'] +'" alt="" onclick="play(\''+ req.data[index]['video_url'] +'\')">'
+'<div class="c_c_c_play" onclick="play(\''+ req.data[index]['video_url'] +'\')"></div>'
+'<div class="c_c_c_copy" data-link="'+ req.data[index]['video_url'] +'" onclick="copy_url(this)" style="cursor: pointer;">复制链接</div>'
+'</div>'
+'</div>'
str = str + ls_str
}
$('.content').html(str)
}else{
}
},
error:function(){
//请求出错处理
}
});
}
function copy_url(td) {
console.log(td)
var link = td.getAttribute('data-link');
console.log(link)
if (navigator.clipboard) {
console.log(1)
navigator.clipboard.writeText(link).then(function() {
// alert('链接已复制到粘贴板');
$('.zg_content2').html('链接已复制到粘贴板')
$('.zg_content2').removeClass('yc')
setTimeout(() => {
$('.zg_content2').addClass('yc')
}, 1000);
}).catch(function(err) {
console.log(3)
// console.error('复制失败: ', err);
// alert('复制链接时出错');
$('.zg_content2').html('复制链接时出错')
$('.zg_content2').removeClass('yc')
setTimeout(() => {
$('.zg_content').addClass('yc')
}, 1000);
});
} else {
console.log(2)
$('.zg_content2').html('你的浏览器不支持剪贴板API,请粘贴后手动提取链接('+link+')')
$('.zg_content2').removeClass('yc')
setTimeout(() => {
$('.zg_content2').addClass('yc')
}, 1000);
// alert('你的浏览器不支持剪贴板API,请手动复制链接('+link+')并在手机浏览器内打开');
}
}
</script>