51 lines
1.5 KiB
HTML
51 lines
1.5 KiB
HTML
<%
|
|
local util = require "luci.util"
|
|
local container_status = util.trim(util.exec("/usr/libexec/istorec/bmtedge.sh status"))
|
|
local container_install = (string.len(container_status) > 0)
|
|
local container_running = container_status == "running"
|
|
local uci = require "luci.model.uci".cursor()
|
|
local uid = uci:get_first("bmtedge", "bmtedge", "uid", ""),
|
|
-%>
|
|
<script src="/luci-static/bmtedge/qrcode.min.js"></script>
|
|
<div class="cbi-value">
|
|
<label class="cbi-value-title"><%:Status%></label>
|
|
<div class="cbi-value-field">
|
|
<% if container_running then %>
|
|
<button class="cbi-button cbi-button-success" id="btnShowQr"><%:Running, click to show QR%></button>
|
|
<% else %>
|
|
<button class="cbi-button cbi-button-negative" disabled="true"><%:BlueMountain Edge is not running%></button>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="winContainer" style="display: none">
|
|
<div id="qrimage" style="
|
|
width: 256px;
|
|
height: 256px;
|
|
">
|
|
</div>
|
|
<h6>用“蓝山云”小程序扫码,请查看:<a href="https://doc.linkease.com/zh/guide/istoreos/software/bmtedge.html" target="_blank">教程</a></h6>
|
|
</div>
|
|
|
|
<script>
|
|
(function() {
|
|
'use strict';
|
|
var shown = false;
|
|
var tryShowQr = function() {
|
|
if (shown) {
|
|
return;
|
|
}
|
|
shown = true;
|
|
new QRCode(document.getElementById("qrimage"), "lsyK17032_"+"<%=uid%>");
|
|
$("#winContainer").show();
|
|
};
|
|
|
|
$('#btnShowQr').click(function(e){
|
|
e.preventDefault();
|
|
tryShowQr();
|
|
});
|
|
|
|
})();
|
|
|
|
</script>
|