提示修改

This commit is contained in:
tx 2024-09-23 18:03:27 +08:00
parent 18e2d6f938
commit ce78ac2c24
4 changed files with 258 additions and 46 deletions

11
package-lock.json generated
View File

@ -10,6 +10,7 @@
"license": "ISC",
"dependencies": {
"fast-xml-parser": "^4.0.12",
"uqrcodejs": "^4.0.7",
"uview-ui": "^1.8.8"
},
"devDependencies": {
@ -274,6 +275,11 @@
"browserslist": ">= 4.21.0"
}
},
"node_modules/uqrcodejs": {
"version": "4.0.7",
"resolved": "https://registry.npmmirror.com/uqrcodejs/-/uqrcodejs-4.0.7.tgz",
"integrity": "sha512-84+aZmD2godCVI+93lxE3YUAPNY8zAJvNA7xRS7R7U+q57KzMDepBSfNCwoRUhWOfR6eHFoAOcHRPwsP6ka1cA=="
},
"node_modules/uview-ui": {
"version": "1.8.8",
"resolved": "https://registry.npmmirror.com/uview-ui/-/uview-ui-1.8.8.tgz",
@ -404,6 +410,11 @@
"picocolors": "^1.0.1"
}
},
"uqrcodejs": {
"version": "4.0.7",
"resolved": "https://registry.npmmirror.com/uqrcodejs/-/uqrcodejs-4.0.7.tgz",
"integrity": "sha512-84+aZmD2godCVI+93lxE3YUAPNY8zAJvNA7xRS7R7U+q57KzMDepBSfNCwoRUhWOfR6eHFoAOcHRPwsP6ka1cA=="
},
"uview-ui": {
"version": "1.8.8",
"resolved": "https://registry.npmmirror.com/uview-ui/-/uview-ui-1.8.8.tgz",

View File

@ -19,6 +19,7 @@
"homepage": "https://github.com/lchighpass/lchighpass-speaking#readme",
"dependencies": {
"fast-xml-parser": "^4.0.12",
"uqrcodejs": "^4.0.7",
"uview-ui": "^1.8.8"
},
"devDependencies": {

View File

@ -946,6 +946,7 @@
导航去这里
</view>
</view>
<view class="fixdivce" v-if="showdevice&&false">
<view class="scrollable-content">
<view class="divce_li" v-for="(item,index) in nearbyMarkers" :key="index" @click="tapsn(item.sn)">
@ -970,6 +971,7 @@
</view>
</view>
</view>
<u-toast ref="uToast" />
</view>
</template>
@ -1588,53 +1590,117 @@
// });
// } else
if (this.deviceInfos.status == 0) {
uni.showToast({
// uni.showToast({
// title: ',使',
// icon: 'none',
// duration: 4000
// });
this.$refs.uToast.show({
title: '车辆未上架,请使用其他车辆',
icon: 'none',
duration: 4000
});
// typedefault type: 'default'
// type: 'warning',
// false
duration: 1000*2
// icon: false
})
} else if (this.deviceInfos.status == 2) {
uni.showToast({
// uni.showToast({
// title: ',使',
// icon: 'none',
// duration: 4000
// });
this.$refs.uToast.show({
title: '车辆预约中,请使用其他车辆',
icon: 'none',
duration: 4000
});
// typedefault type: 'default'
// type: 'warning',
// false
duration: 1000*2
// icon: false
})
} else if (this.deviceInfos.status == 3) {
uni.showToast({
// uni.showToast({
// title: ',使',
// icon: 'none',
// // duration: 4000
// });
this.$refs.uToast.show({
title: '车辆骑行中,请使用其他车辆',
icon: 'none',
duration: 4000
});
// typedefault type: 'default'
// type: 'warning',
// false
duration: 1000*2
// icon: false
})
} else if (this.deviceInfos.status == 4) {
uni.showToast({
// uni.showToast({
// title: ',使',
// icon: 'none',
// // duration: 4000
// });
this.$refs.uToast.show({
title: '车辆临时锁车中,请使用其他车辆',
icon: 'none',
duration: 4000
});
// typedefault type: 'default'
// type: 'warning',
// false
duration: 1000*2
// icon: false
})
} else if (this.deviceInfos.status == 6) {
uni.showToast({
// uni.showToast({
// title: ',使',
// icon: 'none',
// // duration: 4000
// });
this.$refs.uToast.show({
title: '车辆调度中,请使用其他车辆',
icon: 'none',
duration: 4000
});
// typedefault type: 'default'
// type: 'warning',
// false
duration: 1000*2
// icon: false
})
} else if (this.deviceInfos.status == 8) {
uni.showToast({
// uni.showToast({
// title: '线,使',
// icon: 'none',
// duration: 4000
// });
this.$refs.uToast.show({
title: '车辆下线中,请使用其他车辆',
icon: 'none',
duration: 4000
});
// typedefault type: 'default'
// type: 'warning',
// false
duration: 1000*2
// icon: false
})
} else if (this.deviceInfos.status == 9) {
uni.showToast({
// uni.showToast({
// title: ',使',
// icon: 'none',
// duration: 4000
// });
this.$refs.uToast.show({
title: '车辆已废弃,请使用其他车辆',
icon: 'none',
duration: 4000
});
// typedefault type: 'default'
// type: 'warning',
// false
duration: 1000*2
// icon: false
})
} else if (this.deviceInfos.status == 7) {
uni.showToast({
// uni.showToast({
// title: '线,使',
// icon: 'none',
// duration: 4000
// });
this.$refs.uToast.show({
title: '车辆未上线,请使用其他车辆',
icon: 'none',
duration: 4000
});
// typedefault type: 'default'
// type: 'warning',
// false
duration: 1000*2
// icon: false
})
} else if (this.deviceInfos.status == 1) {
if (this.areaInfo.areaId != res.data.areaId) {

View File

@ -199,6 +199,9 @@
<view class="btn" @click="tipshow=true" v-if="info.type==2">
换电处理
</view> -->
<view class="btn" @click="generateQrcode()">
设备二维码
</view>
</view>
<u-mask :show="false" @click="show = false" :z-index='100' />
@ -284,6 +287,15 @@
</view>
</view>
</view>
<u-mask :show="showqr" @click="closeQr()" :z-index='100' />
<view class="tip_box" v-if="showqr" >
<view class="ewm" style="padding-top: 50rpx;">
<canvas id="qrcode" canvas-id="qrcode" style="width: 350rpx;height:350rpx;margin-left: 164rpx;" />
</view>
<view class="saveQr" @click="saveQrcode()">
保存二维码
</view>
</view>
<u-mask :show="showbtntip" @click="closevehicle()" :z-index='100' />
<view class="tip_box" v-if="showbtntip">
<view class="top" v-if="showbtntip">
@ -312,6 +324,7 @@
</template>
<script>
import UQRCode from 'uqrcodejs';
const app = getApp();
var xBlufi = require("@/utils/blufi/xBlufi.js");
let _this = null;
@ -381,7 +394,10 @@
showvehicle: false,
vehicleNum: '',
showbtntip: false,
btnnum: null
btnnum: null,
showqr: false,
canvasWidth: 300,
deptId:null
}
@ -389,7 +405,7 @@
onLoad(e) {
this.sn = e.id
this.deviceInfo()
this.deptId = uni.getStorageSync('deptId');
},
onUnload: function() {
@ -416,6 +432,111 @@
},
methods: {
closeQr(){
this.showqr=false
},
generateQrcode() {
const qr = new UQRCode();
if(this.deptId==100){
qr.data = 'https://dche.ccttiot.com?sn=' + this.deviceInfos.sn;
}else if(this.deptId==101){
qr.data = 'https://dianche.chuantewulian.cn?sn=' + this.deviceInfos.sn;
}
qr.size = 150;
// canvas
const ctx = uni.createCanvasContext('qrcode', this);
// qr canvas
qr.canvasContext = ctx;
qr.make(); //
//
qr.drawCanvas();
// sn
const sn = this.deviceInfos && this.deviceInfos.sn ? 'SN: ' + this.deviceInfos.sn : 'SN未知';
//
setTimeout(() => {
// sn
ctx.setFontSize(12); //
ctx.setFillStyle('black'); //
ctx.setTextAlign('center'); //
ctx.fillText(sn, qr.size / 2, qr.size + 20); // sn20
//
ctx.draw(true); // true
}, 100); // 100
this.showqr = true;
},
// generateQrcode() {
// const qr = new UQRCode();
// qr.data = 'https://znb.ccttiot.com/w?sn=' + this.deviceInfos.sn;
// qr.size = 157;
// // canvas
// const ctx = uni.createCanvasContext('qrcode', this);
// // qr canvas
// qr.canvasContext = ctx;
// qr.make(); //
// //
// const startX = (uni.getSystemInfoSync().windowWidth - qr.size) / 2; //
// //
// qr.drawCanvas(startX, 0); //
// // sn
// const sn = this.deviceInfos && this.deviceInfos.sn ? 'SN: ' + this.deviceInfos.sn : 'SN';
// //
// setTimeout(() => {
// // sn
// ctx.setFontSize(12); //
// ctx.setFillStyle('black'); //
// ctx.setTextAlign('center'); //
// ctx.fillText(sn, uni.getSystemInfoSync().windowWidth / 2, qr.size + 20); // sn
// //
// ctx.draw(true); // true
// }, 100); // 100
// this.showqr = true;
// },
saveQrcode() {
uni.canvasToTempFilePath({
canvasId: 'qrcode',
x: -10, // x
y: 0, // y
width: 155 , //
height: 157+15, //
success: (res) => {
uni.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: () => {
uni.showToast({
title: '保存成功',
icon: 'success'
});
this.showqr = false;
},
fail: (err) => {
uni.showToast({
title: '保存失败',
icon: 'none'
});
}
});
},
fail: (err) => {
uni.showToast({
title: '生成二维码失败',
icon: 'none'
});
}
});
},
closeshowtip() {
this.showbtntip = false
},
@ -1234,7 +1355,7 @@
},
deviceInfo() {
this.markers=[]
this.markers = []
this.$u.get('/app/device/info?sn=' + this.sn).then((res) => {
console.log(res, 'rererer');
if (res.code === 200) {
@ -1300,8 +1421,8 @@
latitude: parseFloat(this.deviceInfos.latitude),
longitude: parseFloat(this.deviceInfos.longitude),
// title: item.deviceName,
width: 40,
height: 47,
width: 40,
height: 47,
iconPath: this.deviceInfos.onlineStatus == 0 ?
'https://lxnapi.ccttiot.com/bike/img/static/uzhMeExOQJbMcZtrfGUV' :
'https://lxnapi.ccttiot.com/bike/img/static/uheL17wVZn24BwCwEztT',
@ -1321,8 +1442,8 @@
latitude: parseFloat(this.deviceInfos.latitude),
longitude: parseFloat(this.deviceInfos.longitude),
// title: item.deviceName,
width: 40,
height: 47,
width: 40,
height: 47,
iconPath: this.deviceInfos.onlineStatus == 0 ?
'https://lxnapi.ccttiot.com/bike/img/static/uR3DQEssiK62ovhh88y8' :
'https://lxnapi.ccttiot.com/bike/img/static/u460R1NKWHEpHbt0U4H7',
@ -1363,8 +1484,8 @@
latitude: parseFloat(this.deviceInfos.latitude),
longitude: parseFloat(this.deviceInfos.longitude),
// title: item.deviceName,
width: 40,
height: 47,
width: 40,
height: 47,
// joinCluster: true,
iconPath: this.deviceInfos.onlineStatus == 0 ?
'https://lxnapi.ccttiot.com/bike/img/static/uRod2zf3t9dAOYafWoWt' :
@ -1385,13 +1506,13 @@
latitude: parseFloat(this.deviceInfos.latitude),
longitude: parseFloat(this.deviceInfos.longitude),
// title: item.deviceName,
width: 40,
height: 47,
width: 40,
height: 47,
iconPath: this.deviceInfos.onlineStatus == 0 ?
'https://lxnapi.ccttiot.com/bike/img/static/uhZudZM3nEKj0tYKlho2' :
'https://lxnapi.ccttiot.com/bike/img/static/ujur6TezvPf4buFAqPHo',
callout: {
content: '' + this.deviceInfos.remainingPower + '%',
content: '' + this.deviceInfos.remainingPower + '%',
color: '#2679D1', //
fontSize: 10, //
borderRadius: 10, //
@ -1412,7 +1533,7 @@
'https://lxnapi.ccttiot.com/bike/img/static/ucBKG3ebYRAToVweJihu' :
'https://lxnapi.ccttiot.com/bike/img/static/uyK7Vg4Lu8xb3oNVuG2l',
callout: {
content: this.deviceInfos.remainingPower + '%', //
content: this.deviceInfos.remainingPower + '%', //
color: '#ffffff', //
fontSize: 10, //
borderRadius: 10, //
@ -1660,7 +1781,20 @@
border-radius: 30rpx 30rpx 30rpx 30rpx;
z-index: 110;
padding-bottom: 100rpx;
.saveQr{
margin: 0 auto;
margin-top: 30rpx;
display: flex;
align-items: center;
justify-content: center;
width: 502rpx;
height: 68rpx;
background: #4C97E7;
border-radius: 10rpx 10rpx 10rpx 10rpx;
font-weight: 500;
font-size: 36rpx;
color: #FFFFFF;
}
.top {
padding: 52rpx 38rpx 42rpx 36rpx;