Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
blue-update
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
iambtr
blue-update
Commits
446d2267
Commit
446d2267
authored
Jan 11, 2020
by
王榕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改固件可输入
parent
59719230
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
7 deletions
+33
-7
index.js
pages/index/index.js
+17
-4
index.wxml
pages/index/index.wxml
+9
-3
index.wxss
pages/index/index.wxss
+7
-0
No files found.
pages/index/index.js
View file @
446d2267
...
@@ -64,6 +64,8 @@ Page({
...
@@ -64,6 +64,8 @@ Page({
inputDeviceId
:
''
,
inputDeviceId
:
''
,
deviceListShow
:
false
,
deviceListShow
:
false
,
discovery
:
false
,
discovery
:
false
,
firmware
:
false
,
firmwareNo
:
''
,
hex
:
''
,
hex
:
''
,
hexStr
:
''
hexStr
:
''
},
},
...
@@ -74,13 +76,19 @@ Page({
...
@@ -74,13 +76,19 @@ Page({
onLoad
:
function
()
{
onLoad
:
function
()
{
// 初始化蓝牙
// 初始化蓝牙
this
.
initBlueTooth
()
this
.
initBlueTooth
()
this
.
getUpdateStr
()
//
this.getUpdateStr()
},
},
getUpdateStr
()
{
getUpdateStr
()
{
Api
.
get
(
'http://yadi-upgrade.zhuzhux.com/download/getFileHex?typeHex=3'
)
let
{
firmwareNo
}
=
this
.
data
if
(
!
firmwareNo
){
alertTip
(
'请输入固件编号'
)
return
}
Api
.
get
(
'http://yadi-upgrade.zhuzhux.com/download/getFileHex?typeHex='
+
firmwareNo
)
.
then
(
res
=>
{
.
then
(
res
=>
{
this
.
setData
({
this
.
setData
({
hexStr
:
res
hexStr
:
res
,
firmware
:
true
})
})
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
...
@@ -280,6 +288,11 @@ Page({
...
@@ -280,6 +288,11 @@ Page({
hex
:
e
.
detail
.
value
.
toUpperCase
()
hex
:
e
.
detail
.
value
.
toUpperCase
()
})
})
},
},
bindFirmwareNoInput
:
function
(
e
)
{
this
.
setData
({
firmwareNo
:
e
.
detail
.
value
})
},
bindDeviceIdInput
:
function
(
e
)
{
bindDeviceIdInput
:
function
(
e
)
{
this
.
setData
({
this
.
setData
({
inputDeviceId
:
e
.
detail
.
value
inputDeviceId
:
e
.
detail
.
value
...
@@ -443,7 +456,7 @@ Page({
...
@@ -443,7 +456,7 @@ Page({
},
},
hexFocus
:
function
()
{
hexFocus
:
function
()
{
this
.
setData
({
this
.
setData
({
hex
:
''
,
firmwareNo
:
''
,
})
})
},
},
connectByHand
()
{
connectByHand
()
{
...
...
pages/index/index.wxml
View file @
446d2267
...
@@ -3,6 +3,11 @@
...
@@ -3,6 +3,11 @@
<view class="panel-title">状态</view>
<view class="panel-title">状态</view>
<view class="panel-body">
<view class="panel-body">
<view class="body-item">
<view class="body-item">
<text>固件:</text>
<text wx:if="{{firmware}}" style='color:green'>已下载(编号:{{firmwareNo}})</text>
<text wx:else style='color:red'>未下载</text>
</view>
<view class="body-item">
<text>手机蓝牙:</text>
<text>手机蓝牙:</text>
<text wx:if="{{blueOpen}}" style='color:green'>已开启</text>
<text wx:if="{{blueOpen}}" style='color:green'>已开启</text>
<text wx:else style='color:red'>已关闭</text>
<text wx:else style='color:red'>已关闭</text>
...
@@ -18,10 +23,10 @@
...
@@ -18,10 +23,10 @@
<view class="panel-title">操作</view>
<view class="panel-title">操作</view>
<view class="panel-body">
<view class="panel-body">
<view wx:if="{{blueOpen}}">
<view wx:if="{{blueOpen}}">
<button bindtap='searchStart' type='primary' wx:if="{{!discovery}}">搜索蓝牙设备</button>
<button bindtap='searchStart' type='primary' wx:if="{{!discovery
&&firmware
}}">搜索蓝牙设备</button>
<button bindtap='searchEnd' wx:else>停止搜索</button>
<button bindtap='searchEnd' wx:else>停止搜索</button>
</view>
</view>
<button bindtap='scanDevice' wx:if="{{blueOpen}}" type='primary'>扫码连接</button>
<button bindtap='scanDevice' wx:if="{{blueOpen
&&firmware
}}" type='primary'>扫码连接</button>
<!-- <input bindinput="bindDeviceIdInput" value='{{inputDeviceId}}' wx:if="{{blueOpen}}" placeholder="请输入设备deviceId" />
<!-- <input bindinput="bindDeviceIdInput" value='{{inputDeviceId}}' wx:if="{{blueOpen}}" placeholder="请输入设备deviceId" />
<button bindtap='connectByHand' wx:if="{{blueOpen}}" type='primary'>直接连接</button> -->
<button bindtap='connectByHand' wx:if="{{blueOpen}}" type='primary'>直接连接</button> -->
<view wx:if="{{blueConnect}}">
<view wx:if="{{blueConnect}}">
...
@@ -29,7 +34,8 @@
...
@@ -29,7 +34,8 @@
</view>
</view>
<button bindtap='closeBlueTooth' wx:if="{{blueOpen}}" type='warn'>关闭蓝牙</button>
<button bindtap='closeBlueTooth' wx:if="{{blueOpen}}" type='warn'>关闭蓝牙</button>
<button bindtap='initBlueTooth' wx:else type='primary'>开启蓝牙</button>
<button bindtap='initBlueTooth' wx:else type='primary'>开启蓝牙</button>
<button bindtap='getUpdateStr' type='info'>重新获取升级文件</button>
<input class="firem-ware" bindinput="bindFirmwareNoInput" value='{{firmwareNo}}' placeholder="请输入固件编号" bindfocus="hexFocus" />
<button bindtap='getUpdateStr' type='info'>下载固件</button>
</view>
</view>
</view>
</view>
<view class="panel">
<view class="panel">
...
...
pages/index/index.wxss
View file @
446d2267
...
@@ -76,4 +76,10 @@ button {
...
@@ -76,4 +76,10 @@ button {
font-size: 12px;
font-size: 12px;
border: 1rpx solid #000;
border: 1rpx solid #000;
border-radius: 3px;
border-radius: 3px;
}
.firem-ware{
border: 1rpx solid #e5e5e5;
border-radius: 5px;
margin: 10px 0;
padding: 20rpx;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment