提示修改
This commit is contained in:
parent
18e2d6f938
commit
ce78ac2c24
11
package-lock.json
generated
11
package-lock.json
generated
|
@ -10,6 +10,7 @@
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fast-xml-parser": "^4.0.12",
|
"fast-xml-parser": "^4.0.12",
|
||||||
|
"uqrcodejs": "^4.0.7",
|
||||||
"uview-ui": "^1.8.8"
|
"uview-ui": "^1.8.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -274,6 +275,11 @@
|
||||||
"browserslist": ">= 4.21.0"
|
"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": {
|
"node_modules/uview-ui": {
|
||||||
"version": "1.8.8",
|
"version": "1.8.8",
|
||||||
"resolved": "https://registry.npmmirror.com/uview-ui/-/uview-ui-1.8.8.tgz",
|
"resolved": "https://registry.npmmirror.com/uview-ui/-/uview-ui-1.8.8.tgz",
|
||||||
|
@ -404,6 +410,11 @@
|
||||||
"picocolors": "^1.0.1"
|
"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": {
|
"uview-ui": {
|
||||||
"version": "1.8.8",
|
"version": "1.8.8",
|
||||||
"resolved": "https://registry.npmmirror.com/uview-ui/-/uview-ui-1.8.8.tgz",
|
"resolved": "https://registry.npmmirror.com/uview-ui/-/uview-ui-1.8.8.tgz",
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
"homepage": "https://github.com/lchighpass/lchighpass-speaking#readme",
|
"homepage": "https://github.com/lchighpass/lchighpass-speaking#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fast-xml-parser": "^4.0.12",
|
"fast-xml-parser": "^4.0.12",
|
||||||
|
"uqrcodejs": "^4.0.7",
|
||||||
"uview-ui": "^1.8.8"
|
"uview-ui": "^1.8.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -946,6 +946,7 @@
|
||||||
导航去这里
|
导航去这里
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="fixdivce" v-if="showdevice&&false">
|
<view class="fixdivce" v-if="showdevice&&false">
|
||||||
<view class="scrollable-content">
|
<view class="scrollable-content">
|
||||||
<view class="divce_li" v-for="(item,index) in nearbyMarkers" :key="index" @click="tapsn(item.sn)">
|
<view class="divce_li" v-for="(item,index) in nearbyMarkers" :key="index" @click="tapsn(item.sn)">
|
||||||
|
@ -970,6 +971,7 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<u-toast ref="uToast" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -1588,53 +1590,117 @@
|
||||||
// });
|
// });
|
||||||
// } else
|
// } else
|
||||||
if (this.deviceInfos.status == 0) {
|
if (this.deviceInfos.status == 0) {
|
||||||
uni.showToast({
|
// uni.showToast({
|
||||||
|
// title: '车辆未上架,请使用其他车辆',
|
||||||
|
// icon: 'none',
|
||||||
|
// duration: 4000
|
||||||
|
// });
|
||||||
|
this.$refs.uToast.show({
|
||||||
title: '车辆未上架,请使用其他车辆',
|
title: '车辆未上架,请使用其他车辆',
|
||||||
icon: 'none',
|
// 如果不传此type参数,默认为default,也可以手动写上 type: 'default'
|
||||||
duration: 4000
|
// type: 'warning',
|
||||||
});
|
// 如果不需要图标,请设置为false
|
||||||
|
duration: 1000*2
|
||||||
|
// icon: false
|
||||||
|
})
|
||||||
} else if (this.deviceInfos.status == 2) {
|
} else if (this.deviceInfos.status == 2) {
|
||||||
uni.showToast({
|
// uni.showToast({
|
||||||
|
// title: '车辆预约中,请使用其他车辆',
|
||||||
|
// icon: 'none',
|
||||||
|
// duration: 4000
|
||||||
|
// });
|
||||||
|
this.$refs.uToast.show({
|
||||||
title: '车辆预约中,请使用其他车辆',
|
title: '车辆预约中,请使用其他车辆',
|
||||||
icon: 'none',
|
// 如果不传此type参数,默认为default,也可以手动写上 type: 'default'
|
||||||
duration: 4000
|
// type: 'warning',
|
||||||
});
|
// 如果不需要图标,请设置为false
|
||||||
|
duration: 1000*2
|
||||||
|
// icon: false
|
||||||
|
})
|
||||||
} else if (this.deviceInfos.status == 3) {
|
} else if (this.deviceInfos.status == 3) {
|
||||||
uni.showToast({
|
// uni.showToast({
|
||||||
|
// title: '车辆骑行中,请使用其他车辆',
|
||||||
|
// icon: 'none',
|
||||||
|
// // duration: 4000
|
||||||
|
// });
|
||||||
|
this.$refs.uToast.show({
|
||||||
title: '车辆骑行中,请使用其他车辆',
|
title: '车辆骑行中,请使用其他车辆',
|
||||||
icon: 'none',
|
// 如果不传此type参数,默认为default,也可以手动写上 type: 'default'
|
||||||
duration: 4000
|
// type: 'warning',
|
||||||
});
|
// 如果不需要图标,请设置为false
|
||||||
|
duration: 1000*2
|
||||||
|
// icon: false
|
||||||
|
})
|
||||||
} else if (this.deviceInfos.status == 4) {
|
} else if (this.deviceInfos.status == 4) {
|
||||||
uni.showToast({
|
// uni.showToast({
|
||||||
|
// title: '车辆临时锁车中,请使用其他车辆',
|
||||||
|
// icon: 'none',
|
||||||
|
// // duration: 4000
|
||||||
|
// });
|
||||||
|
this.$refs.uToast.show({
|
||||||
title: '车辆临时锁车中,请使用其他车辆',
|
title: '车辆临时锁车中,请使用其他车辆',
|
||||||
icon: 'none',
|
// 如果不传此type参数,默认为default,也可以手动写上 type: 'default'
|
||||||
duration: 4000
|
// type: 'warning',
|
||||||
});
|
// 如果不需要图标,请设置为false
|
||||||
|
duration: 1000*2
|
||||||
|
// icon: false
|
||||||
|
})
|
||||||
} else if (this.deviceInfos.status == 6) {
|
} else if (this.deviceInfos.status == 6) {
|
||||||
uni.showToast({
|
// uni.showToast({
|
||||||
|
// title: '车辆调度中,请使用其他车辆',
|
||||||
|
// icon: 'none',
|
||||||
|
// // duration: 4000
|
||||||
|
// });
|
||||||
|
this.$refs.uToast.show({
|
||||||
title: '车辆调度中,请使用其他车辆',
|
title: '车辆调度中,请使用其他车辆',
|
||||||
icon: 'none',
|
// 如果不传此type参数,默认为default,也可以手动写上 type: 'default'
|
||||||
duration: 4000
|
// type: 'warning',
|
||||||
});
|
// 如果不需要图标,请设置为false
|
||||||
|
duration: 1000*2
|
||||||
|
// icon: false
|
||||||
|
})
|
||||||
} else if (this.deviceInfos.status == 8) {
|
} else if (this.deviceInfos.status == 8) {
|
||||||
uni.showToast({
|
// uni.showToast({
|
||||||
|
// title: '车辆下线中,请使用其他车辆',
|
||||||
|
// icon: 'none',
|
||||||
|
// duration: 4000
|
||||||
|
// });
|
||||||
|
this.$refs.uToast.show({
|
||||||
title: '车辆下线中,请使用其他车辆',
|
title: '车辆下线中,请使用其他车辆',
|
||||||
icon: 'none',
|
// 如果不传此type参数,默认为default,也可以手动写上 type: 'default'
|
||||||
duration: 4000
|
// type: 'warning',
|
||||||
});
|
// 如果不需要图标,请设置为false
|
||||||
|
duration: 1000*2
|
||||||
|
// icon: false
|
||||||
|
})
|
||||||
} else if (this.deviceInfos.status == 9) {
|
} else if (this.deviceInfos.status == 9) {
|
||||||
uni.showToast({
|
// uni.showToast({
|
||||||
|
// title: '车辆已废弃,请使用其他车辆',
|
||||||
|
// icon: 'none',
|
||||||
|
// duration: 4000
|
||||||
|
// });
|
||||||
|
this.$refs.uToast.show({
|
||||||
title: '车辆已废弃,请使用其他车辆',
|
title: '车辆已废弃,请使用其他车辆',
|
||||||
icon: 'none',
|
// 如果不传此type参数,默认为default,也可以手动写上 type: 'default'
|
||||||
duration: 4000
|
// type: 'warning',
|
||||||
});
|
// 如果不需要图标,请设置为false
|
||||||
|
duration: 1000*2
|
||||||
|
// icon: false
|
||||||
|
})
|
||||||
} else if (this.deviceInfos.status == 7) {
|
} else if (this.deviceInfos.status == 7) {
|
||||||
uni.showToast({
|
// uni.showToast({
|
||||||
|
// title: '车辆未上线,请使用其他车辆',
|
||||||
|
// icon: 'none',
|
||||||
|
// duration: 4000
|
||||||
|
// });
|
||||||
|
this.$refs.uToast.show({
|
||||||
title: '车辆未上线,请使用其他车辆',
|
title: '车辆未上线,请使用其他车辆',
|
||||||
icon: 'none',
|
// 如果不传此type参数,默认为default,也可以手动写上 type: 'default'
|
||||||
duration: 4000
|
// type: 'warning',
|
||||||
});
|
// 如果不需要图标,请设置为false
|
||||||
|
duration: 1000*2
|
||||||
|
// icon: false
|
||||||
|
})
|
||||||
} else if (this.deviceInfos.status == 1) {
|
} else if (this.deviceInfos.status == 1) {
|
||||||
|
|
||||||
if (this.areaInfo.areaId != res.data.areaId) {
|
if (this.areaInfo.areaId != res.data.areaId) {
|
||||||
|
|
|
@ -199,6 +199,9 @@
|
||||||
<view class="btn" @click="tipshow=true" v-if="info.type==2">
|
<view class="btn" @click="tipshow=true" v-if="info.type==2">
|
||||||
换电处理
|
换电处理
|
||||||
</view> -->
|
</view> -->
|
||||||
|
<view class="btn" @click="generateQrcode()">
|
||||||
|
设备二维码
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<u-mask :show="false" @click="show = false" :z-index='100' />
|
<u-mask :show="false" @click="show = false" :z-index='100' />
|
||||||
|
|
||||||
|
@ -284,6 +287,15 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</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' />
|
<u-mask :show="showbtntip" @click="closevehicle()" :z-index='100' />
|
||||||
<view class="tip_box" v-if="showbtntip">
|
<view class="tip_box" v-if="showbtntip">
|
||||||
<view class="top" v-if="showbtntip">
|
<view class="top" v-if="showbtntip">
|
||||||
|
@ -312,6 +324,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import UQRCode from 'uqrcodejs';
|
||||||
const app = getApp();
|
const app = getApp();
|
||||||
var xBlufi = require("@/utils/blufi/xBlufi.js");
|
var xBlufi = require("@/utils/blufi/xBlufi.js");
|
||||||
let _this = null;
|
let _this = null;
|
||||||
|
@ -381,7 +394,10 @@
|
||||||
showvehicle: false,
|
showvehicle: false,
|
||||||
vehicleNum: '',
|
vehicleNum: '',
|
||||||
showbtntip: false,
|
showbtntip: false,
|
||||||
btnnum: null
|
btnnum: null,
|
||||||
|
showqr: false,
|
||||||
|
canvasWidth: 300,
|
||||||
|
deptId:null
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -389,7 +405,7 @@
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
this.sn = e.id
|
this.sn = e.id
|
||||||
this.deviceInfo()
|
this.deviceInfo()
|
||||||
|
this.deptId = uni.getStorageSync('deptId');
|
||||||
|
|
||||||
},
|
},
|
||||||
onUnload: function() {
|
onUnload: function() {
|
||||||
|
@ -416,6 +432,111 @@
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
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); // 在二维码下方绘制sn,偏移20像素
|
||||||
|
|
||||||
|
// 保留二维码,绘制文字
|
||||||
|
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() {
|
closeshowtip() {
|
||||||
this.showbtntip = false
|
this.showbtntip = false
|
||||||
},
|
},
|
||||||
|
@ -1234,7 +1355,7 @@
|
||||||
|
|
||||||
},
|
},
|
||||||
deviceInfo() {
|
deviceInfo() {
|
||||||
this.markers=[]
|
this.markers = []
|
||||||
this.$u.get('/app/device/info?sn=' + this.sn).then((res) => {
|
this.$u.get('/app/device/info?sn=' + this.sn).then((res) => {
|
||||||
console.log(res, 'rererer');
|
console.log(res, 'rererer');
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
|
@ -1660,7 +1781,20 @@
|
||||||
border-radius: 30rpx 30rpx 30rpx 30rpx;
|
border-radius: 30rpx 30rpx 30rpx 30rpx;
|
||||||
z-index: 110;
|
z-index: 110;
|
||||||
padding-bottom: 100rpx;
|
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 {
|
.top {
|
||||||
padding: 52rpx 38rpx 42rpx 36rpx;
|
padding: 52rpx 38rpx 42rpx 36rpx;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user