fin control panel

This commit is contained in:
Jay
2017-09-14 15:55:10 +08:00
parent 0aad260946
commit 0ff6508d2f
5 changed files with 67 additions and 22 deletions
+11 -1
View File
@@ -29,6 +29,12 @@
</div>
</div>
<h3 class="ui dividing header">WebAPI設定</h3>
<div class="field">
<label for="api-secret">API密鑰</label>
<input type="text" name="api-secret" placeholder="請輸入密鑰,空白不設定" id="api-secret">
</div>
<div style="margin-top: 40px; text-align: right;">
<button class="ui button blue" type="submit">送出設定</button>
</div>
@@ -76,7 +82,8 @@
let json = {
tty: '',
feed: 0,
ble: ''
ble: '',
secret: ''
}
let dev = getValue(document.querySelector('select#tty'))
let feed = getValue(document.querySelector('input#feed'))
@@ -87,9 +94,12 @@
if(!dev) return alert('請選擇印表機連接埠')
if (!isFinite(feed) || feed < 0) return alert('切紙前空行請輸入整數')
let secret = getValue(document.querySelector('input#api-secret'))
json.tty = dev
json.feed = Math.floor(parseInt(feed))
json.ble = ble
json.secret = secret
$.ajax({
url: '/install/write_config',