feat: init project with miniprogram, cloud functions and admin console
这个提交包含在:
@@ -0,0 +1,39 @@
|
||||
var ble = require('../../services/ble')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
checking: false,
|
||||
result: null,
|
||||
error: ''
|
||||
},
|
||||
|
||||
onShow: function () {
|
||||
this.checkWearing()
|
||||
},
|
||||
|
||||
checkWearing: function () {
|
||||
var self = this
|
||||
self.setData({ checking: true, result: null, error: '' })
|
||||
|
||||
ble.on('status', function (status) {
|
||||
self.setData({ checking: false })
|
||||
if (status.bind_status === 1) {
|
||||
self.setData({ result: 'ok' })
|
||||
} else {
|
||||
self.setData({ result: 'fail', error: '请确认设备已正确佩戴' })
|
||||
}
|
||||
})
|
||||
|
||||
ble.queryStatus().catch(function (err) {
|
||||
self.setData({ checking: false, result: 'fail', error: err.error_msg || '查询失败' })
|
||||
})
|
||||
},
|
||||
|
||||
onNext: function () {
|
||||
wx.navigateTo({ url: '/pages/treatment-setup/treatment-setup' })
|
||||
},
|
||||
|
||||
onRetry: function () {
|
||||
this.checkWearing()
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "确认佩戴"
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<view class="container">
|
||||
<view class="card text-center">
|
||||
<view class="section-title">确认佩戴</view>
|
||||
|
||||
<view wx:if="{{checking}}" class="text-muted mb-30">
|
||||
<view class="loading-area">
|
||||
<view class="spinner-sm"></view>
|
||||
<text>正在检测佩戴状态...</text>
|
||||
</view>
|
||||
<view class="tip-area mt-20">
|
||||
<text class="text-muted">请将设备贴合面部,确保佩戴稳固</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{result === 'ok'}}">
|
||||
<view class="success-mark">✓</view>
|
||||
<view class="text-success mb-30">佩戴确认成功</view>
|
||||
<view class="btn-primary" bindtap="onNext">设置护理参数</view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{result === 'fail'}}">
|
||||
<view class="fail-mark">✗</view>
|
||||
<view class="text-error mb-20">{{error}}</view>
|
||||
<view class="btn-primary" bindtap="onRetry">重新检测</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,50 @@
|
||||
.loading-area {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 40rpx 0;
|
||||
}
|
||||
|
||||
.spinner-sm {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
border: 4rpx solid #eeeeee;
|
||||
border-top-color: #333333;
|
||||
border-radius: 50%;
|
||||
animation: spin 0.8s linear infinite;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
.success-mark {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 50%;
|
||||
background-color: #52c41a;
|
||||
color: #ffffff;
|
||||
font-size: 48rpx;
|
||||
line-height: 80rpx;
|
||||
text-align: center;
|
||||
margin: 20rpx auto;
|
||||
}
|
||||
|
||||
.fail-mark {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 50%;
|
||||
background-color: #ff4d4f;
|
||||
color: #ffffff;
|
||||
font-size: 48rpx;
|
||||
line-height: 80rpx;
|
||||
text-align: center;
|
||||
margin: 20rpx auto;
|
||||
}
|
||||
|
||||
.tip-area {
|
||||
padding: 20rpx;
|
||||
background-color: #fffbe6;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户