7305修改人员信息的点阵方式
This commit is contained in:
2
App.vue
2
App.vue
@ -36,10 +36,10 @@
|
|||||||
//将检查更新换到onshow,因为苹果用户喜欢一直挂着
|
//将检查更新换到onshow,因为苹果用户喜欢一直挂着
|
||||||
uni.getSystemInfo({success:function(res){
|
uni.getSystemInfo({success:function(res){
|
||||||
if(res.uniPlatform=='app'){
|
if(res.uniPlatform=='app'){
|
||||||
|
bleTool.getBleTool();
|
||||||
let appid=plus.runtime.appid;
|
let appid=plus.runtime.appid;
|
||||||
if(appid!=='HBuilder'){
|
if(appid!=='HBuilder'){
|
||||||
console.log("appid=",appid);
|
console.log("appid=",appid);
|
||||||
bleTool.getBleTool();
|
|
||||||
upgrade.checkAndUpdateWgt();
|
upgrade.checkAndUpdateWgt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -87,8 +87,8 @@
|
|||||||
<text class="usrtitle fleft">人员信息登记</text>
|
<text class="usrtitle fleft">人员信息登记</text>
|
||||||
<view class="btnSend fright" v-on:click.stop="sendUsr">发送</view>
|
<view class="btnSend fright" v-on:click.stop="sendUsr">发送</view>
|
||||||
<view class="clear"></view>
|
<view class="clear"></view>
|
||||||
<textToDotMatrix class="TextToHex" ref="textToHex" :txts="formData.textLines" :bgColor="'#FFFFFF'"
|
<textToDotMatrixV1 class="TextToHex" ref="textToHex" :txts="formData.textLines" :bgColor="'#FFFFFF'"
|
||||||
:color="'#000000'" :fontSize="14" />
|
:color="'#000000'" :fontSize="13" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="item">
|
<view class="item">
|
||||||
@ -147,7 +147,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import textToDotMatrix from '@/components/TextToHex/textToDotMatrix.vue';
|
import textToDotMatrixV1 from '@/components/TextToHex/textToDotMatrixV1.vue';
|
||||||
import bleTool from '@/utils/BleHelper.js';
|
import bleTool from '@/utils/BleHelper.js';
|
||||||
import usrApi from '@/api/670/HBY670.js'
|
import usrApi from '@/api/670/HBY670.js'
|
||||||
import {
|
import {
|
||||||
@ -165,7 +165,7 @@
|
|||||||
var pagePath = "pages/7305/BJQ7305";
|
var pagePath = "pages/7305/BJQ7305";
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
textToDotMatrix
|
textToDotMatrixV1
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -1023,6 +1023,24 @@
|
|||||||
these.showBleUnConnect()
|
these.showBleUnConnect()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
let err=false;
|
||||||
|
this.formData.textLines.find((txt)=>{
|
||||||
|
if(txt.length===0 || txt.length>5){
|
||||||
|
console.log("txt=",txt);
|
||||||
|
err=true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
})
|
||||||
|
if(err){
|
||||||
|
this.showPop({
|
||||||
|
message: "单位、部门、姓名必须填写且最多5字",
|
||||||
|
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||||
|
borderColor: "#e034344d",
|
||||||
|
buttonBgColor: "#E03434",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
showLoading(these, {
|
showLoading(these, {
|
||||||
text: "请稍候..."
|
text: "请稍候..."
|
||||||
});
|
});
|
||||||
|
|||||||
@ -733,16 +733,17 @@ class BleHelper {
|
|||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
console.error("将数据转文本失败", ex);
|
console.error("将数据转文本失败", ex);
|
||||||
}
|
}
|
||||||
let recData = {
|
|
||||||
deviceId: receive.deviceId,
|
|
||||||
serviceId: receive.serviceId,
|
|
||||||
characteristicId: receive.characteristicId,
|
|
||||||
bytes: bytes,
|
|
||||||
str: str,
|
|
||||||
hexs: hexs
|
|
||||||
};
|
|
||||||
// console.log("监听到特征值:" + JSON.stringify(recData));
|
|
||||||
try {
|
try {
|
||||||
|
let recData = {
|
||||||
|
deviceId: receive.deviceId,
|
||||||
|
serviceId: receive.serviceId,
|
||||||
|
characteristicId: receive.characteristicId,
|
||||||
|
bytes: bytes,
|
||||||
|
str: str,
|
||||||
|
hexs: hexs
|
||||||
|
};
|
||||||
|
console.log("监听到特征值:" + JSON.stringify(recData));
|
||||||
if (this.cfg.receivDataCallback) {
|
if (this.cfg.receivDataCallback) {
|
||||||
|
|
||||||
if (this.cfg.receivDataCallback.length > 0) {
|
if (this.cfg.receivDataCallback.length > 0) {
|
||||||
@ -1410,24 +1411,10 @@ class BleHelper {
|
|||||||
|
|
||||||
// 处理 MTU 设置
|
// 处理 MTU 设置
|
||||||
if (plus.os.name === 'Android') {
|
if (plus.os.name === 'Android') {
|
||||||
uni.setBLEMTU({
|
this.setMtu(deviceId);
|
||||||
deviceId: deviceId,
|
|
||||||
mtu: 512,
|
|
||||||
success: (mtu) => {
|
|
||||||
|
|
||||||
resolve(true);
|
|
||||||
},
|
|
||||||
fail: () => {
|
|
||||||
console.error(
|
|
||||||
"mtu设置失败");
|
|
||||||
resolve(
|
|
||||||
true
|
|
||||||
); // MTU设置失败不影响连接成功
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
resolve(true);
|
|
||||||
}
|
}
|
||||||
|
resolve(true);
|
||||||
|
|
||||||
}).catch((ex) => {
|
}).catch((ex) => {
|
||||||
reject(this.getError(ex));
|
reject(this.getError(ex));
|
||||||
});
|
});
|
||||||
@ -1511,6 +1498,30 @@ class BleHelper {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setMtu(deviceId){
|
||||||
|
let prom=new Promise((_succ,_err)=>{
|
||||||
|
uni.setBLEMTU({
|
||||||
|
deviceId: deviceId,
|
||||||
|
mtu: 512,
|
||||||
|
success: (mtuRes) => {
|
||||||
|
console.log("mtu约定成功");
|
||||||
|
_succ(mtuRes);
|
||||||
|
},
|
||||||
|
fail: (ex) => {
|
||||||
|
console.error(
|
||||||
|
"mtu设置失败",ex);
|
||||||
|
ex=this.getError(ex);
|
||||||
|
_err(
|
||||||
|
ex
|
||||||
|
); // MTU设置失败不影响连接成功
|
||||||
|
},complete(){
|
||||||
|
console.log("设置mtu完毕");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return prom;
|
||||||
|
}
|
||||||
//断开连接
|
//断开连接
|
||||||
disconnectDevice(deviceId) {
|
disconnectDevice(deviceId) {
|
||||||
var disconnect = (id) => {
|
var disconnect = (id) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user