Commit 1294246c authored by xinzhedeai's avatar xinzhedeai

搜索页面样式调整

parent f37eb022
......@@ -27,43 +27,15 @@ const blueToothMixin = {
},
data() {
return {
startMeasureText: '开始测量',
pageLoadText: '',
form: {
// 回显详情
'engineeringName': '',
'middleSectionName': '',
'segmentName': '',
'alignmentLineName': '',
'boreholeNumber': '',
'throughHole': '',
'designHoleDepth': '',
'designInclination': '',
// 新录入
realTestHoleDepth: '',
realTestInclination: '',
// realTestTime: '',
},
// 蓝牙连接相关
// 目标机器信息
serviceu: '0000FFE0-0000-1000-8000-00805F9B34FB'.toUpperCase(),
txdu: '0000FFE1-0000-1000-8000-00805F9B34FB'.toUpperCase(),
rxdu: '0000FFE1-0000-1000-8000-00805F9B34FB'.toUpperCase(),
deviceName: '',
deviceId: '',
characteristicId: '',
connectState: false, // false不正常 true正常
connected: false,
// reconnect: '连接中...',
// connectState: '正在连接',
readyRec: false, // 通知事件是否准备就绪标记。
canWrite: false,
// recdata:'',
leavePageFlag: false,
// 交互优化
btnLoading: false,
};
},
methods: {
......@@ -80,17 +52,6 @@ const blueToothMixin = {
// uni.reLaunch({
// url: '/pages/home/home',
// });
// }else if(this.btnLoading){
// showCustomModal({
// content: '正在测量中,是否要中断测量?',
// showCancel: true,
// success: ()=> {
// this.gosend('STOP')
// uni.reLaunch({
// url: '/pages/home/home',
// });
// },
// })
// }else{
// showCustomModal({
// content: '验收仪设备正在连接中,是否要中断连接?',
......@@ -156,15 +117,6 @@ const blueToothMixin = {
async stopLink(opt) {
await blueToother.closeBLEConnection(storager.get('deviceInfo').deviceId)
await blueToother.closeBluetoothAdapter()
// uni.closeBLEConnection({
// deviceId: this.deviceId,
// success: (res) => {
// commonStateCodeDeal(2, 'stopLink=>断开链接成功', this)
// },
// fail: (err) => {
// commonStateCodeDeal(res.errCode || res, 'stopLink=>断开链接失败', this)
// }
// });
this.setNavBarTitle('已断开 ')
this.setConnectState(false)
......@@ -192,17 +144,6 @@ const blueToothMixin = {
commonStateCodeDeal(2,
`onBLEConnectionStateChange=>蓝牙设备 ${res.deviceId} 连接状态改变=> ${res.connected}`
)
// 如果是非主动离开页面导致断开链接则不显示链接蓝牙弹框
// if (!res.connected && !this.leavePageFlag) {
// showCustomModal({
// content: '当前连接已断开,是否重新连接?',
// showCancel: true,
// success: ()=>{
// uni.hideLoading()
// this.initLink()
// }
// })
// }
})
}
......@@ -241,10 +182,10 @@ const blueToothMixin = {
`getBLEDeviceServices获取${res.services.length}条服务`
)
for (let i = 0; i < res.services.length; i++) {
if (this.serviceu == res.services[i].uuid) {
if (blueToother.serviceId == res.services[i].uuid) {
isService = true;
this.setNavBarTitle('服务已匹配')
this.getBLEDeviceCharacteristics(storager.get('deviceInfo').deviceId, this.serviceu);
this.getBLEDeviceCharacteristics(storager.get('deviceInfo').deviceId, blueToother.serviceId);
}
}
if (!isService) {
......@@ -327,12 +268,9 @@ const blueToothMixin = {
// that.readBLECharacteristicValue(deviceId, serviceId, item.uuid)
// }
if (item.properties.write) {
this.setData({
canWrite: true
});
// console.log('[Write]', item.uuid);
this._deviceId = deviceId;
if (this.txdu == item.uuid) {
if (blueToother.characteristicId_WRITE == item.uuid) {
commonStateCodeDeal(2,
`特征值【WRITE】支持 => txdu:${that.txdu} CHARACTERISTIC_UUID:${item.uuid}`
)
......@@ -353,12 +291,10 @@ const blueToothMixin = {
*/
if (item.properties.notify) {
// console.log('[Notify]', item.uuid);
if (this.rxdu == item.uuid) {
if (blueToother.characteristicId_NOTIFY == item.uuid) {
commonStateCodeDeal(2,
`特征值【Notify】支持=> rxdu:${this.rxdu} CHARACTERISTIC_UUID:${item.uuid}`
`特征值【Notify】支持=> rxdu:${blueToother.characteristicId_NOTIFY} CHARACTERISTIC_UUID:${item.uuid}`
)
// console.warn('find notity uuid try enablec....', item.uuid);
// this.showModalTips(this.rxdu + "\r正在开启通知...")
that.setNavBarTitle('正在开启通知')
that.notifyBLECharacteristicValueChange(storager.get('deviceInfo').deviceId, serviceId, item.uuid, true)
......@@ -378,8 +314,8 @@ const blueToothMixin = {
// var buf = new Uint8Array(characteristic.value);
var recStr = ab2Str(characteristic.value);
// console.warn('recstr: ', recStr, characteristic.characteristicId);
if (this.rxdu != characteristic.characteristicId) {
// console.error('no same : ', this.rxdu, characteristic.characteristicId);
if (blueToother.characteristicId_NOTIFY != characteristic.characteristicId) {
// console.error('no same : ', blueToother.characteristicId_NOTIFY, characteristic.characteristicId);
this.setConnectState(false)
that.setNavBarTitle('特征值UUID值不匹配')
commonStateCodeDeal(2, '特征值UUID值不匹配onBLECharacteristicValueChange')
......
......@@ -2,14 +2,10 @@
<view class="wrapper">
<CustomNavbar title="蓝牙扫描" @gobackDeal="gobackDeal('blueSearch')">
</CustomNavbar>
<view class="" style="text-align: center; color: #fff; font-size: 32rpx; margin-top:20rpx;">
<view class="pageLoadText">
{{ pageLoadText }}
</view>
<view class="body-wrapper">
<!-- 横向均分 -->
<!-- <view class="found"></view> -->
<view class="devices_summary found">已发现 {{ devices.length }} 个BLE设备:</view>
<scroll-view class="device_list" scroll-y scroll-with-animation>
<view :data-device-id="item.deviceId" :data-device-name="item.name || item.localName" @tap="goto_Comm"
......@@ -21,7 +17,7 @@
<view style="font-size: 27rpx; color: #676767">{{ item.deviceId}}</view>
</view>
</scroll-view>
</view>
<button :loading="misScanding" class="button_sp" hover-class="button_sp2"
@tap="openBluetoothAdapter">{{ scandbutName }}</button>
......@@ -68,8 +64,8 @@
},
mixins: [blueToothMixin],
components: {
CustomNavbar,
},
CustomNavbar,
},
data() {
return {
devices: [],
......@@ -86,8 +82,7 @@
onShow() {
popuper.hideLoading()
},
onLoad(options) {
},
onLoad(options) {},
methods: {
// gobackDeal(){
// console.log('XXXXXXXXX****8泛会上一页')
......@@ -111,6 +106,7 @@
// });
// },
openBluetoothAdapter() {
this.pageLoadText = ''
this.misScanding = false;
uni.openBluetoothAdapter({
success: (res) => {
......@@ -198,14 +194,14 @@
},
goto_Comm(e) {
if(this.$store.state.connected){
if (this.$store.state.connected) {
showCustomModal({
content: '已有连接的蓝牙设备,是否要中断当前连接?',
showCancel: true,
success: ()=> {
success: () => {
this.stopLink({
showTip: false,
cb: function(){
cb: function() {
showCustomToast({
title: '设备连接已断开'
})
......@@ -214,7 +210,7 @@
// this.goto_Comm(e)
},
})
}else{
} else {
popuper.showLoading({
title: '设备连接中...'
})
......@@ -223,7 +219,7 @@
this.deviceId = deviceInfo.deviceId
this.stopBluetoothDevicesDiscovery();
uni.setStorageSync('deviceInfo', deviceInfo)
this.startLink()
this.startLink()
}
},
closeBluetoothAdapter() {
......@@ -234,13 +230,25 @@
};
</script>
<style lang="scss">
.wrapper{
.pageLoadText {
position: absolute;
bottom: -100rpx;
right: 50%;
color: gray;
transform: translateX(50%);
width: 80vw;
text-align: center;
}
.wrapper {
position: relative;
width: 100vw;
height: calc(100vh-44rpx);
padding-top: 44rpx;
background: linear-gradient(180deg, #007AFF 0%, #419AFF 16%, #EFF1F4 43%);
}
.body-wrapper{
.body-wrapper {
margin: 0 auto;
/* display: flex;
justify-content: center;
......@@ -252,7 +260,8 @@
padding-top: 20rpx;
background: #FFFFFF;
border-radius: 10rpx;
.found{
.found {
width: 642rpx;
height: 60rpx;
margin: 20rpx auto;
......@@ -264,11 +273,12 @@
text-align: center;
}
}
page {
color: #333;
}
/* .devices_summary {
/* .devices_summary {
padding: 10px;
font-size: 16px;
background-color: hsl(216, 5%, 22%);
......
......@@ -161,9 +161,10 @@
const fileName='炮孔测量数据导出'
const header = ['productName', 'artilleryAreaName', 'cannonHoleArrayNum',
'cannonHoleNum', 'expectedDepth','remark',
'cannonHoleNum', 'expectedDepth',
'actualDepth', 'actualWaterLevel',
'afterActualDepth', 'afterActualWaterLevel',
'remark',
];
const headerName = {
productName: '工程名称',
......@@ -175,7 +176,7 @@
actualWaterLevel: '实测水深',
afterActualDepth: '装药后孔深',
afterActualWaterLevel: '装药后水深',
// remark: '备注'
remark: '备注'
};
showCustomToast({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment