Files
energy_storage/bin/Release/assets/html/test.html
2025-05-19 09:54:33 +08:00

106 lines
3.3 KiB
HTML
Raw Permalink 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>
<head>
<meta charset="UTF-8" />
<title>光储充站控系统</title>
<script src="./libs/jquery/jquery-3.7.1.min.js"></script>
<link rel="stylesheet" href="./libs/DataTables-2.1.8/css/dataTables.dataTables.css" />
<script src="./libs/DataTables-2.1.8/js/dataTables.js"></script>
<link rel="stylesheet" href="./libs/bootstrap-5.3.3-dist/css/bootstrap.min.css" />
<script src="./libs/bootstrap-5.3.3-dist/js/bootstrap.min.js"></script>
<script src="./libs/bootstrap-5.3.3-dist/js/bootstrap.bundle.min.js"></script>
<script src="./libs/echarts/echarts.min.js"></script>
<script type="text/javascript" src="./js/qwebchannel.js"></script>
<link rel="stylesheet" type="text/css" href="./css/mystyle.css" />
<style>
body {
background-color: #012036;
/* background-image: url('../ui/bkg01.png'); */
background-size: 100% 100%;
background-attachment: fixed;
}
button {
color: #f0f0f0;
background-color: #44aaec;
border: 1px solid #0a87da;
border-radius: 5px;
margin: 5px;
height: 40px;
font-size: 16px;
}
</style>
</head>
<body>
<button onclick="jsCallCpp()">调用C++接口</button>
<button id="showPopup" onclick="showPopup()">弹出</button>
<div id="popMask" class="mask">
<div class="pop">
<p class="pop_title">提示</p>
<p class="pop_content">学会制作弹出框了吗?</p>
<div class="pop_btn">
<button class="cancelBtn" onclick="hidePopup()">取消</button>
<button class="confirmBtn" onclick="hidePopup()">确认</button>
</div>
</div>
</div>
<script>
function showPopup() {
var mask = document.getElementById('popMask')
mask.style.display = 'block'
}
function hidePopup() {
var mask = document.getElementById('popMask')
mask.style.display = 'none'
}
function initQtWebChannel() {
// var cppNative
// //第一个参数是QtWebEngine 挂载到前端全局环境中的 window.qt.webChannelTransport
// new QWebChannel(qt.webChannelTransport, function (channel) {
// // 在C++侧注册的对象名称为 cppNative所以channel.objects后面的名字是cppNative
// cppNative = channel.objects.cppNative
// // 连接WebObject类的signalNativeTextChanged信号
// // cppNative.signalNativeTextChanged.connect(function (text) {
// // alert('signalNativeTextChanged: ' + text)
// // })
// })
}
function jsCallCpp() {
// 【readFile】 为 C++ 侧定义实现的 webChannel 接口
// var file = 'assets/html/系统管理/index.html'
// cppNative.readFile(file).then(function (text) {
// alert('readFile: ' + text)
// })
}
function setPageJS(id) {
var pageId = id;
// 此处可通过 CPP 接口读取脚本文件内容
var scriptText = 'function clickTest() { alert("点击按钮:" + pageid) }'
// 删除上一个page的脚步内容再创建加载新的脚本
var elemt = document.getElementById('mypagejs')
if (elemt) { elemt.remove() }
elemt = document.createElement('script')
//elemt.src = jsUrl + '?t=' + new Date().getTime()
elemt.setAttribute('id', 'mypagejs')
elemt.innerHTML = scriptText
document.body.appendChild(elemt)
}
</script>
</body>
</html>