111
This commit is contained in:
parent
fbb956aecf
commit
486da8d5ea
|
@ -23,8 +23,8 @@ const install = (Vue, vm) => {
|
||||||
// baseUrl: 'http://61.174.243.28:15861',
|
// baseUrl: 'http://61.174.243.28:15861',
|
||||||
// baseUrl: 'http://192.168.2.14:8080',
|
// baseUrl: 'http://192.168.2.14:8080',
|
||||||
// baseUrl: 'http://124.221.246.124:2289',
|
// baseUrl: 'http://124.221.246.124:2289',
|
||||||
baseUrl: 'https://dianche.chuantewulian.cn/prod-api',
|
// baseUrl: 'https://dianche.chuantewulian.cn/prod-api',
|
||||||
// baseUrl: 'https://dche.ccttiot.com/prod-api',
|
baseUrl: 'https://dche.ccttiot.com/prod-api',
|
||||||
loadingText: '努力加载中~',
|
loadingText: '努力加载中~',
|
||||||
// loadingTime: 2000,
|
// loadingTime: 2000,
|
||||||
// 设置自定义头部content-type
|
// 设置自定义头部content-type
|
||||||
|
@ -86,32 +86,7 @@ const install = (Vue, vm) => {
|
||||||
// // return res.result;
|
// // return res.result;
|
||||||
// }
|
// }
|
||||||
if(res.code == 401) {
|
if(res.code == 401) {
|
||||||
// res为服务端返回值,可能有code,result等字段
|
|
||||||
// 这里对res.result进行返回,将会在this.$u.post(url).then(res => {})的then回调中的res的到
|
|
||||||
// 如果配置了originalData为true,请留意这里的返回值
|
|
||||||
|
|
||||||
// return res.result;
|
|
||||||
|
|
||||||
// uni.login({
|
|
||||||
// success: function(ret) {
|
|
||||||
// console.log("main.js==>res", ret)
|
|
||||||
// // vm.$u.post('/user/login',{"js_code": ret.code}).then(res=>{
|
|
||||||
// // if (res.code == 10003) {
|
|
||||||
// // // console.log("新用户登录")
|
|
||||||
// // uni.setStorageSync('token', res.data);
|
|
||||||
|
|
||||||
// // } else if (res.code == 200) {
|
|
||||||
// // // console.log("老用户登录",res.data)
|
|
||||||
// // uni.setStorageSync('token', res.data);
|
|
||||||
|
|
||||||
// // }
|
|
||||||
// // });
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// uni.showLoading({
|
|
||||||
// title: '登录中...',
|
|
||||||
// mask: true // Set to true if you want to prevent user interactions while loading
|
|
||||||
// });
|
|
||||||
wx.login({
|
wx.login({
|
||||||
success(res) {
|
success(res) {
|
||||||
if (res.code) {
|
if (res.code) {
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
/* 小程序特有相关 */
|
/* 小程序特有相关 */
|
||||||
"mp-weixin" : {
|
"mp-weixin" : {
|
||||||
"libVersion" : "latest",
|
"libVersion" : "latest",
|
||||||
"appid" : "wx4d178f8c80348214",
|
"appid" : "wx3428c498d5061192",
|
||||||
"setting" : {
|
"setting" : {
|
||||||
"urlCheck" : false
|
"urlCheck" : false
|
||||||
},
|
},
|
||||||
|
|
83
page_user/khfw/khfw.vue
Normal file
83
page_user/khfw/khfw.vue
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
<template>
|
||||||
|
<view class="page">
|
||||||
|
<u-navbar title="客户服务" :border-bottom="false" :background="bgc" title-color='#000' title-size='36'
|
||||||
|
height='45'></u-navbar>
|
||||||
|
<view class="btn" @click="callPhone">
|
||||||
|
<image src="https://lxnapi.ccttiot.com/bike/img/static/uEM1RpP3J0K51qTjtnA5" mode=""></image>
|
||||||
|
电话咨询:{{areaInfo.servicePhone}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
bgc: {
|
||||||
|
backgroundColor: "#fff",
|
||||||
|
},
|
||||||
|
areaInfo: {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.getarea()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getarea() {
|
||||||
|
let id = uni.getStorageSync('areaId');
|
||||||
|
this.$u.get("/app/area/" + id).then((res) => {
|
||||||
|
|
||||||
|
if (res.code == 200) {
|
||||||
|
this.areaInfo = res.data
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// uni.showToast({
|
||||||
|
// title: res.msg,
|
||||||
|
// icon: 'none',
|
||||||
|
// duration: 2000
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
callPhone(){
|
||||||
|
uni.makePhoneCall({
|
||||||
|
phoneNumber:this.areaInfo.servicePhone
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
page {
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page {
|
||||||
|
width: 750rpx;
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
position: fixed;
|
||||||
|
left: 36rpx;
|
||||||
|
bottom: 44rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
|
||||||
|
width: 680rpx;
|
||||||
|
height: 118rpx;
|
||||||
|
background: #4C97E7;
|
||||||
|
border-radius: 59rpx 59rpx 59rpx 59rpx;
|
||||||
|
|
||||||
|
image {
|
||||||
|
margin-right: 18rpx;
|
||||||
|
width: 34.5rpx;
|
||||||
|
height: 33rpx;
|
||||||
|
}
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 40rpx;
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
18
pages.json
18
pages.json
|
@ -37,6 +37,15 @@
|
||||||
"enablePullDownRefresh": false,
|
"enablePullDownRefresh": false,
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path" : "pages/bind_mac",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "",
|
||||||
|
"enablePullDownRefresh": false,
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -337,6 +346,15 @@
|
||||||
"enablePullDownRefresh" : false,
|
"enablePullDownRefresh" : false,
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path" : "khfw/khfw",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText" : "",
|
||||||
|
"enablePullDownRefresh" : false,
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 其他 userpages 目录下的页面...
|
// 其他 userpages 目录下的页面...
|
||||||
|
|
712
pages/bind_mac.vue
Normal file
712
pages/bind_mac.vue
Normal file
|
@ -0,0 +1,712 @@
|
||||||
|
<template>
|
||||||
|
<view class="page">
|
||||||
|
<u-navbar title="添加设备" :border-bottom="false" :background="bgc" title-color='#262B37' title-size='38'
|
||||||
|
height='50'></u-navbar>
|
||||||
|
<view class="iptbox" @click="backpage()">
|
||||||
|
|
||||||
|
<input type="text" class="ips" v-model="mac" placeholder=" " style="margin-left: 32rpx;" disabled
|
||||||
|
placeholder-class="my-placeholder" />
|
||||||
|
<view class="iconfont icon-xiangyou1 ">
|
||||||
|
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<view class="iptbox">
|
||||||
|
<view class="qrcode" @click="qrcode()">
|
||||||
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uy7BNwAMIKwvstqFnRhs" mode=""></image>
|
||||||
|
</view>
|
||||||
|
<input type="text" class="ips" v-model="sn" placeholder="请扫描设备上的二维码" style="margin-left: 32rpx;"
|
||||||
|
placeholder-class="my-placeholder" />
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<view class="btn" @click="bind()">
|
||||||
|
确认添加
|
||||||
|
</view>
|
||||||
|
<view class="bot_btn" >
|
||||||
|
|
||||||
|
<view class="btn1" @click="Binddevice()">
|
||||||
|
蓝牙链接
|
||||||
|
</view>
|
||||||
|
<view class="btn1" @click="ring()" v-if="carstause">
|
||||||
|
响铃寻车
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="btn1" @click="open()" v-if="carstause">
|
||||||
|
蓝牙开锁
|
||||||
|
</view>
|
||||||
|
<view class="btn1" @click="close()" v-if="carstause">
|
||||||
|
蓝牙关锁
|
||||||
|
</view>
|
||||||
|
<view class="btn1" @click="reboot()" v-if="carstause">
|
||||||
|
设备重启
|
||||||
|
</view>
|
||||||
|
<view class="btn1" @click="Binddevice()" v-if="isbands">
|
||||||
|
接口响铃
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- <view class="bot">
|
||||||
|
<view class="btn">
|
||||||
|
退款
|
||||||
|
</view>
|
||||||
|
</view> -->
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const app = getApp();
|
||||||
|
var xBlufi = require("@/utils/blufi/xBlufi.js");
|
||||||
|
let _this = null;
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
devicesList: [
|
||||||
|
// {name:'110000',
|
||||||
|
// mac:'11111'}
|
||||||
|
],
|
||||||
|
searching: false,
|
||||||
|
texts: '正在扫描蓝牙设备...',
|
||||||
|
btnflag: true,
|
||||||
|
tishiflag: false,
|
||||||
|
option: '',
|
||||||
|
bluthlist: [], //蓝牙数组
|
||||||
|
// status: 'loading',
|
||||||
|
statusflag: false,
|
||||||
|
Bluetoothmac: '',
|
||||||
|
mac: '',
|
||||||
|
ishave: false,
|
||||||
|
ver_data: null,
|
||||||
|
deviceInfoss: {},
|
||||||
|
gps: {},
|
||||||
|
isband: false,
|
||||||
|
// status: false,
|
||||||
|
deviceIds: '',
|
||||||
|
name: '',
|
||||||
|
orderinfo: {},
|
||||||
|
dl: 0,
|
||||||
|
czmoney:true,
|
||||||
|
iscz:true,
|
||||||
|
bgc: {
|
||||||
|
backgroundColor: "#F7FAFE",
|
||||||
|
},
|
||||||
|
sn:'',
|
||||||
|
carstause:false,
|
||||||
|
isbands:false
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(e) {
|
||||||
|
this.mac=e.mac
|
||||||
|
this.Binddevice()
|
||||||
|
this.isbands=false
|
||||||
|
this.carstause=false
|
||||||
|
},
|
||||||
|
onUnload: function() {
|
||||||
|
xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent);
|
||||||
|
xBlufi.notifyStartDiscoverBle({
|
||||||
|
'isStart': false
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onHide(){
|
||||||
|
xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent);
|
||||||
|
xBlufi.notifyStartDiscoverBle({
|
||||||
|
'isStart': false
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onBeforeUnmount(){
|
||||||
|
xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent);
|
||||||
|
xBlufi.notifyStartDiscoverBle({
|
||||||
|
'isStart': false
|
||||||
|
});
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
send(){
|
||||||
|
this.$u.post('/app/device/ring?sn=' + this.sn).then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
|
||||||
|
}else{
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
backpage(){
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1 // delta值为1时表示返回的页面层数
|
||||||
|
});
|
||||||
|
},
|
||||||
|
bind(){
|
||||||
|
this.$u.post(`/appVerify/band?sn=`+this.sn+'&mac='+this.mac).then((res) => {
|
||||||
|
|
||||||
|
if (res.code == 200) {
|
||||||
|
|
||||||
|
uni.showToast({
|
||||||
|
title: '绑定成功',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
setTimeout(()=>{
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1 // delta值为1时表示返回的页面层数
|
||||||
|
});
|
||||||
|
},2000)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
qrcode(){
|
||||||
|
uni.scanCode({
|
||||||
|
onlyFromCamera: true,
|
||||||
|
scanType: ['qrCode'],
|
||||||
|
success: res => {
|
||||||
|
|
||||||
|
let sn = null;
|
||||||
|
let queryParams = res.result.split('?')[1];
|
||||||
|
if (queryParams) {
|
||||||
|
let params = queryParams.split('&');
|
||||||
|
params.forEach(param => {
|
||||||
|
let [key, value] = param.split('=');
|
||||||
|
if (key === 'sn') {
|
||||||
|
sn = value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
this.sn = sn
|
||||||
|
console.log(res.result);
|
||||||
|
if (this.sn != '') {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
fail: err => {
|
||||||
|
console.error('扫描失败:', err);
|
||||||
|
uni.showToast({
|
||||||
|
title: '扫描失败',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
Binddevice(){
|
||||||
|
uni.showLoading({
|
||||||
|
title:'连接中..'
|
||||||
|
})
|
||||||
|
xBlufi.initXBlufi(1);
|
||||||
|
console.log("xBlufi", xBlufi.XMQTT_SYSTEM);
|
||||||
|
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent);
|
||||||
|
xBlufi.notifyStartDiscoverBle({
|
||||||
|
'isStart': true
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// 两秒后停止蓝牙搜索
|
||||||
|
setTimeout(() => {
|
||||||
|
xBlufi.notifyStartDiscoverBle({
|
||||||
|
'isStart': false
|
||||||
|
});
|
||||||
|
setTimeout(()=>{
|
||||||
|
uni.hideLoading()
|
||||||
|
if (this.devicesList.length == 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '暂无发现对应设备,请靠近设备',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
let uniqueDevicesList = Array.from(new Set(this.devicesList));
|
||||||
|
|
||||||
|
// 将去重后的数组重新赋值给 this.devicesList
|
||||||
|
this.devicesList = uniqueDevicesList;
|
||||||
|
// console.log(this.devicesList,'this.devicesListthis.devicesList');
|
||||||
|
this.devicesList.forEach(device => {
|
||||||
|
// 从设备名称中提取 MAC 地址(假设 MAC 地址是设备名称的后6个字符)
|
||||||
|
let macFromName = device.name.substring(device.name.length - 12);
|
||||||
|
console.log(macFromName,'macFromNamemacFromName');
|
||||||
|
// 与 this.mac 进行比较
|
||||||
|
if (macFromName == this.mac) {
|
||||||
|
// 如果相同,则将 this.ishave 设置为 true
|
||||||
|
console.log(device);
|
||||||
|
this.deviceInfoss = device
|
||||||
|
// this.ishave = true;
|
||||||
|
this.createBLEConnection(device)
|
||||||
|
|
||||||
|
console.log('对比正确1111111111');
|
||||||
|
} else {
|
||||||
|
console.log('对比错误');
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},200)
|
||||||
|
// 判断是否存在浇花器设备
|
||||||
|
|
||||||
|
// this.status = true
|
||||||
|
}, 2000)
|
||||||
|
|
||||||
|
},
|
||||||
|
reboot(){
|
||||||
|
let vm = this; // 将外部的 this 绑定到 vm 上
|
||||||
|
uni.getNetworkType({
|
||||||
|
success(res) {
|
||||||
|
if (res.networkType !== 'none') {
|
||||||
|
uni.getConnectedBluetoothDevices({
|
||||||
|
success(res) {
|
||||||
|
console.log('已连接的蓝牙设备信息:', res);
|
||||||
|
// vm.dl = (vm.orderinfo.deviceAmount / vm.orderinfo.unitPrice).toFixed(2); // 使用 vm 访问 Vue 实例的属性
|
||||||
|
xBlufi.notifySendCustomData({
|
||||||
|
customData: "11reboot"
|
||||||
|
});
|
||||||
|
// uni.hideLoading()
|
||||||
|
// vm.remakr()
|
||||||
|
},
|
||||||
|
fail(err) {
|
||||||
|
uni.hideLoading()
|
||||||
|
console.error('获取已连接蓝牙设备信息失败:', err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.log('手机未连接网络');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
open(){
|
||||||
|
let vm = this; // 将外部的 this 绑定到 vm 上
|
||||||
|
uni.getNetworkType({
|
||||||
|
success(res) {
|
||||||
|
if (res.networkType !== 'none') {
|
||||||
|
uni.getConnectedBluetoothDevices({
|
||||||
|
success(res) {
|
||||||
|
console.log('已连接的蓝牙设备信息:', res);
|
||||||
|
// vm.dl = (vm.orderinfo.deviceAmount / vm.orderinfo.unitPrice).toFixed(2); // 使用 vm 访问 Vue 实例的属性
|
||||||
|
xBlufi.notifySendCustomData({
|
||||||
|
customData: "11open"
|
||||||
|
});
|
||||||
|
// uni.hideLoading()
|
||||||
|
// vm.remakr()
|
||||||
|
},
|
||||||
|
fail(err) {
|
||||||
|
uni.hideLoading()
|
||||||
|
console.error('获取已连接蓝牙设备信息失败:', err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.log('手机未连接网络');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
close(){
|
||||||
|
let vm = this; // 将外部的 this 绑定到 vm 上
|
||||||
|
uni.getNetworkType({
|
||||||
|
success(res) {
|
||||||
|
if (res.networkType !== 'none') {
|
||||||
|
uni.getConnectedBluetoothDevices({
|
||||||
|
success(res) {
|
||||||
|
console.log('已连接的蓝牙设备信息:', res);
|
||||||
|
// vm.dl = (vm.orderinfo.deviceAmount / vm.orderinfo.unitPrice).toFixed(2); // 使用 vm 访问 Vue 实例的属性
|
||||||
|
xBlufi.notifySendCustomData({
|
||||||
|
customData: "11close"
|
||||||
|
});
|
||||||
|
// uni.hideLoading()
|
||||||
|
// vm.remakr()
|
||||||
|
},
|
||||||
|
fail(err) {
|
||||||
|
uni.hideLoading()
|
||||||
|
console.error('获取已连接蓝牙设备信息失败:', err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.log('手机未连接网络');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
ring(){
|
||||||
|
let vm = this; // 将外部的 this 绑定到 vm 上
|
||||||
|
uni.getNetworkType({
|
||||||
|
success(res) {
|
||||||
|
if (res.networkType !== 'none') {
|
||||||
|
uni.getConnectedBluetoothDevices({
|
||||||
|
success(res) {
|
||||||
|
console.log('已连接的蓝牙设备信息:', res);
|
||||||
|
// vm.dl = (vm.orderinfo.deviceAmount / vm.orderinfo.unitPrice).toFixed(2); // 使用 vm 访问 Vue 实例的属性
|
||||||
|
xBlufi.notifySendCustomData({
|
||||||
|
customData: "11play1@"
|
||||||
|
});
|
||||||
|
// uni.hideLoading()
|
||||||
|
// vm.remakr()
|
||||||
|
},
|
||||||
|
fail(err) {
|
||||||
|
uni.hideLoading()
|
||||||
|
console.error('获取已连接蓝牙设备信息失败:', err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.log('手机未连接网络');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
btnyc() {
|
||||||
|
this.titleflag = false
|
||||||
|
},
|
||||||
|
|
||||||
|
// 解析自定义数据
|
||||||
|
|
||||||
|
funListenDeviceMsgEvent: function(options) {
|
||||||
|
switch (options.type) {
|
||||||
|
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS:
|
||||||
|
if (options.result) {
|
||||||
|
let devicesarr = options.data
|
||||||
|
// this.devicesList = options.data
|
||||||
|
|
||||||
|
devicesarr.forEach(device => {
|
||||||
|
|
||||||
|
|
||||||
|
// this.$u.get(`/app/device/${mac}/isBind`, data).then((res) => {
|
||||||
|
// if (res.data == false) {
|
||||||
|
this.devicesList.push(device);
|
||||||
|
|
||||||
|
let uniqueDevicesList = Array.from(new Set(this.devicesList));
|
||||||
|
|
||||||
|
// 将去重后的数组重新赋值给 this.devicesList
|
||||||
|
this.devicesList = uniqueDevicesList;
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED:
|
||||||
|
console.log("连接回调:" + JSON.stringify(options));
|
||||||
|
if (options.result) {
|
||||||
|
uni.hideLoading();
|
||||||
|
uni.showToast({
|
||||||
|
title: '连接成功',
|
||||||
|
icon: 'none'
|
||||||
|
}); {
|
||||||
|
|
||||||
|
xBlufi.notifyInitBleEsp32({
|
||||||
|
deviceId: options.data.deviceId
|
||||||
|
});
|
||||||
|
|
||||||
|
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvents);
|
||||||
|
|
||||||
|
this.deviceIds = options.data.deviceId
|
||||||
|
this.name = options.data.name
|
||||||
|
// 连接成功绑定设备
|
||||||
|
// let params = {
|
||||||
|
// mac: this.Bluetoothmac,
|
||||||
|
// userId: this.$store.state.user.userId
|
||||||
|
// }
|
||||||
|
let systemInfo = uni.getSystemInfoSync();
|
||||||
|
if (systemInfo.platform === 'android') {
|
||||||
|
// 当前设备是 Android
|
||||||
|
|
||||||
|
} else if (systemInfo.platform === 'ios') {
|
||||||
|
// 当前设备是 iOS
|
||||||
|
// uni.navigateTo({
|
||||||
|
// url: '/pages/wifilist/index?deviceId=' + options
|
||||||
|
// .data.deviceId + '&name=' + options.data.name
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
|
||||||
|
|
||||||
|
// this.ver_data = this.parseCustomData(options.data)
|
||||||
|
if(options.data){
|
||||||
|
this.carstause=true
|
||||||
|
}
|
||||||
|
// console.log("1收到设备发来的自定义数据结果:", this.ver_data);
|
||||||
|
break;
|
||||||
|
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_STOP:
|
||||||
|
if (options.result) {
|
||||||
|
let uniqueDevicesList = Array.from(new Set(this.devicesList));
|
||||||
|
|
||||||
|
// 过滤出名称字段的前五个字母为 "CTPOW" 的项
|
||||||
|
let filteredDevices = uniqueDevicesList.filter(device => device.name.substring(0, 4) ===
|
||||||
|
"BBLE");
|
||||||
|
|
||||||
|
// 将过滤后的数组重新赋值给 this.devicesList
|
||||||
|
this.devicesList = filteredDevices;
|
||||||
|
|
||||||
|
// console.log('蓝牙停止搜索ok',this.devicesList);
|
||||||
|
} else {
|
||||||
|
//蓝牙停止搜索失败
|
||||||
|
// console.log('蓝牙停止搜索失败');
|
||||||
|
}
|
||||||
|
this.searching = false
|
||||||
|
// _this.setData({
|
||||||
|
// searching: false
|
||||||
|
// });
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
//4、建立连接
|
||||||
|
createBLEConnection(e) {
|
||||||
|
console.log('调用了');
|
||||||
|
xBlufi.notifyStartDiscoverBle({
|
||||||
|
'isStart': false
|
||||||
|
});
|
||||||
|
console.log(e, '蓝牙信息')
|
||||||
|
const deviceId = e.deviceId
|
||||||
|
this.Bluetoothmac = e.localName.substring(5) //从第七位开始截取 只取后面的mac号
|
||||||
|
console.log(this.Bluetoothmac, '11111');
|
||||||
|
let name = e.name;
|
||||||
|
console.log('点击了,蓝牙准备连接的deviceId:' + e.deviceId);
|
||||||
|
xBlufi.notifyConnectBle({
|
||||||
|
isStart: true,
|
||||||
|
deviceId: e.deviceId,
|
||||||
|
name
|
||||||
|
});
|
||||||
|
// for (var i = 0; i < this.devicesList.length; i++) {
|
||||||
|
// if (e.deviceId === this.devicesList[i].deviceId) {
|
||||||
|
|
||||||
|
// uni.showLoading({
|
||||||
|
// title: '连接蓝牙设备中...'
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
// 点击重新搜索
|
||||||
|
Search() {
|
||||||
|
if (this.status) {
|
||||||
|
xBlufi.notifyStartDiscoverBle({
|
||||||
|
'isStart': true
|
||||||
|
});
|
||||||
|
// 重新搜索清空蓝牙数组
|
||||||
|
this.bluthlist = []
|
||||||
|
this.devicesList = []
|
||||||
|
// 重新搜索
|
||||||
|
// this.startBluetoothDevicesDiscovery()
|
||||||
|
this.statusflag = true
|
||||||
|
this.status = false
|
||||||
|
this.texts = '正在扫描蓝牙设备...'
|
||||||
|
setTimeout(() => {
|
||||||
|
this.statusflag = false
|
||||||
|
this.status = true
|
||||||
|
if (this.searching) {
|
||||||
|
xBlufi.notifyStartDiscoverBle({
|
||||||
|
'isStart': false
|
||||||
|
});
|
||||||
|
// 判断是否存在浇花器设备
|
||||||
|
if (this.devicesList.length == 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '暂无发现对应设备,请靠近设备',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.texts = '扫描到以下设备,请点击连接!'
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
xBlufi.notifyStartDiscoverBle({
|
||||||
|
'isStart': true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, 2000)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
funListenDeviceMsgEvents: function(options) {
|
||||||
|
let that = this;
|
||||||
|
switch (options.type) {
|
||||||
|
case xBlufi.XBLUFI_TYPE.TYPE_STATUS_CONNECTED: {
|
||||||
|
console.log('状态', options.result)
|
||||||
|
if( options.result==false){
|
||||||
|
this.carstause=false
|
||||||
|
uni.showToast({
|
||||||
|
title: '设备断开链接,请重新点击蓝牙链接',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
// uni.showModal({
|
||||||
|
// title: '很抱歉提醒你!',
|
||||||
|
// content: '小程序与设备异常断开',
|
||||||
|
// showCancel: false,
|
||||||
|
// success: function(res) {
|
||||||
|
// // uni.navigateBack({
|
||||||
|
// // url: '../search/search'
|
||||||
|
// // });
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// this.statusflag = false
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_MY_DATA:
|
||||||
|
this.loadPercent = options.data;
|
||||||
|
this.loadText = '文件读取中'
|
||||||
|
console.log("文件读取中", options.data);
|
||||||
|
break;
|
||||||
|
case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
|
||||||
|
// this.isband = true
|
||||||
|
// this.ver_data = this.parseCustomData(options.data)
|
||||||
|
console.log("1收到设备发来的自定义数据结果:", options.data);
|
||||||
|
if(options.data){
|
||||||
|
this.carstause=true
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case xBlufi.XBLUFI_TYPE.TYPE_INIT_ESP32_RESULT:
|
||||||
|
uni.hideLoading();
|
||||||
|
if (options.result) {
|
||||||
|
console.log('初始化成功');
|
||||||
|
} else {
|
||||||
|
console.log('初始化失败');
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 点击隐藏没有设备提示
|
||||||
|
btnhd() {
|
||||||
|
this.tishiflag = false
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
page {
|
||||||
|
overflow-x: hidden;
|
||||||
|
background-color: #F3F3F3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page {
|
||||||
|
padding-bottom: 250rpx;
|
||||||
|
width: 750rpx;
|
||||||
|
.btn{
|
||||||
|
margin: 160rpx auto;
|
||||||
|
// position: fixed;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
// bottom: 100rpx;
|
||||||
|
// left: 46rpx;
|
||||||
|
width: 658rpx;
|
||||||
|
height: 88rpx;
|
||||||
|
background: #FFCC25;
|
||||||
|
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
||||||
|
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
.iptbox {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
padding: 22rpx;
|
||||||
|
margin: 28rpx auto 0;
|
||||||
|
width: 658rpx;
|
||||||
|
height: 88rpx;
|
||||||
|
background: #FFFFFF;
|
||||||
|
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15);
|
||||||
|
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
||||||
|
.qrcode{
|
||||||
|
padding-right: 20rpx;
|
||||||
|
border-right: 2rpx solid #D8D8D8;
|
||||||
|
image{
|
||||||
|
width: 54rpx;
|
||||||
|
height: 54rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.ips {
|
||||||
|
width: 630rpx;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 18rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.my-placeholder {
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #808080;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.bot_btn{
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
padding: 40rpx 18rpx;
|
||||||
|
width: 750rpx;
|
||||||
|
// height: 330rpx;
|
||||||
|
background: #fff;
|
||||||
|
// background: linear-gradient( 180deg, #FFFFFF 0%, rgba(255,255,255,0) 100%);
|
||||||
|
box-shadow: 0rpx 10rpx 64rpx 0rpx rgba(0,0,0,0.08);
|
||||||
|
border-radius: 0rpx 0rpx 0rpx 0rpx;
|
||||||
|
.btn:nth-child(4n) {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
.btn1{
|
||||||
|
margin-top: 10rpx;
|
||||||
|
margin-right: 12rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 164rpx;
|
||||||
|
height: 66rpx;
|
||||||
|
background: #E2F2FF;
|
||||||
|
border-radius: 0rpx 0rpx 0rpx 0rpx;
|
||||||
|
border: 2rpx solid #4C97E7;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #3D3D3D;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -21,8 +21,11 @@
|
||||||
MAC:{{item.localName.substring(5)}}
|
MAC:{{item.localName.substring(5)}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="rt">
|
<!-- <view class="rt">
|
||||||
<text :id="item.deviceId" @tap="openConfirmModal(item)">绑定</text>
|
<text :id="item.deviceId" @tap="openConfirmModal(item)">绑定</text>
|
||||||
|
</view> -->
|
||||||
|
<view class="rt">
|
||||||
|
<text :id="item.deviceId" @tap="choose(item)">选择</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
@ -30,9 +33,9 @@
|
||||||
<button>重新扫描</button>
|
<button>重新扫描</button>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<view class="anniu2 " @click="send">
|
<!-- <view class="anniu2 " @click="send">
|
||||||
响铃
|
响铃
|
||||||
</view>
|
</view> -->
|
||||||
|
|
||||||
<view v-if="showConfirmModal" class="modal-overlay">
|
<view v-if="showConfirmModal" class="modal-overlay">
|
||||||
<view class="modal">
|
<view class="modal">
|
||||||
|
@ -92,6 +95,9 @@
|
||||||
if(e.sn){
|
if(e.sn){
|
||||||
this.sn=e.sn
|
this.sn=e.sn
|
||||||
}
|
}
|
||||||
|
this.bluthlist = []
|
||||||
|
this.devicesList = []
|
||||||
|
this.devicesLists=[]
|
||||||
xBlufi.initXBlufi(1);
|
xBlufi.initXBlufi(1);
|
||||||
console.log("xBlufi", xBlufi.XMQTT_SYSTEM);
|
console.log("xBlufi", xBlufi.XMQTT_SYSTEM);
|
||||||
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent);
|
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent);
|
||||||
|
@ -116,6 +122,10 @@
|
||||||
},
|
},
|
||||||
onShow: function() {
|
onShow: function() {
|
||||||
// this.openBluetoothAdapter()
|
// this.openBluetoothAdapter()
|
||||||
|
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent);
|
||||||
|
xBlufi.notifyStartDiscoverBle({
|
||||||
|
'isStart': true
|
||||||
|
});
|
||||||
},
|
},
|
||||||
onUnload: function() {
|
onUnload: function() {
|
||||||
xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent);
|
xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent);
|
||||||
|
@ -140,6 +150,13 @@
|
||||||
// this.videoContext = uni.createVideoContext('myVideo', this)
|
// this.videoContext = uni.createVideoContext('myVideo', this)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
choose(e){
|
||||||
|
console.log(e);
|
||||||
|
let Bluetoothmac = e.name.substring(5)
|
||||||
|
uni.navigateTo({
|
||||||
|
url:'/pages/bind_mac?mac='+Bluetoothmac
|
||||||
|
})
|
||||||
|
},
|
||||||
send(){
|
send(){
|
||||||
this.$u.post('/app/device/ring?sn=' + this.sn).then((res) => {
|
this.$u.post('/app/device/ring?sn=' + this.sn).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
|
@ -227,7 +244,7 @@
|
||||||
if (options.result) {
|
if (options.result) {
|
||||||
let devicesarr = options.data
|
let devicesarr = options.data
|
||||||
// this.devicesList = options.data
|
// this.devicesList = options.data
|
||||||
console.log(devicesarr, 'devicesarrdevicesarr');
|
// console.log(devicesarr, 'devicesarrdevicesarr');
|
||||||
devicesarr.forEach(device => {
|
devicesarr.forEach(device => {
|
||||||
const mac = device.name.substring(6);
|
const mac = device.name.substring(6);
|
||||||
|
|
||||||
|
@ -310,7 +327,7 @@
|
||||||
});
|
});
|
||||||
if (this.devicesList.length == 0) {
|
if (this.devicesList.length == 0) {
|
||||||
this.tishiflag = true
|
this.tishiflag = true
|
||||||
this.texts = '扫描完毕,暂无发现浇花器设备'
|
this.texts = '扫描完毕,暂无发现电动车设备'
|
||||||
} else {
|
} else {
|
||||||
this.texts = '扫描到以下设备,请点击连接!'
|
this.texts = '扫描到以下设备,请点击连接!'
|
||||||
}
|
}
|
||||||
|
@ -337,6 +354,13 @@
|
||||||
// console.log(macFromName);
|
// console.log(macFromName);
|
||||||
// 与 this.mac 进行比较
|
// 与 this.mac 进行比较
|
||||||
list.push(device)
|
list.push(device)
|
||||||
|
// this.$u.get(`/app/device/${macFromName}/isBind`).then((res) => {
|
||||||
|
// if (res.data == false) {
|
||||||
|
// list.push(device)
|
||||||
|
// } else {
|
||||||
|
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
@ -556,6 +580,7 @@
|
||||||
// 重新搜索清空蓝牙数组
|
// 重新搜索清空蓝牙数组
|
||||||
this.bluthlist = []
|
this.bluthlist = []
|
||||||
this.devicesList = []
|
this.devicesList = []
|
||||||
|
this.devicesLists=[]
|
||||||
// 重新搜索
|
// 重新搜索
|
||||||
// this.startBluetoothDevicesDiscovery()
|
// this.startBluetoothDevicesDiscovery()
|
||||||
this.statusflag = true
|
this.statusflag = true
|
||||||
|
@ -574,6 +599,7 @@
|
||||||
'isStart': false
|
'isStart': false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
xBlufi.notifyStartDiscoverBle({
|
xBlufi.notifyStartDiscoverBle({
|
||||||
'isStart': true
|
'isStart': true
|
||||||
|
@ -787,6 +813,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.rt {
|
.rt {
|
||||||
|
margin-left: auto;
|
||||||
margin-top: 22rpx;
|
margin-top: 22rpx;
|
||||||
|
|
||||||
text {
|
text {
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
<view class="tab_top">
|
<view class="tab_top">
|
||||||
<image src="https://lxnapi.ccttiot.com/bike/img/static/uVcMTydm81zCMhHomXl1" mode="" @click="topage(6)">
|
<image src="https://lxnapi.ccttiot.com/bike/img/static/uVcMTydm81zCMhHomXl1" mode="" @click="topage(6)">
|
||||||
</image>
|
</image>
|
||||||
<!-- <view class="txts">
|
|
||||||
创享出行
|
|
||||||
</view> -->
|
|
||||||
<view class="txts">
|
<view class="txts">
|
||||||
嵛你出行
|
创享出行
|
||||||
</view>
|
</view>
|
||||||
|
<!-- <view class="txts">
|
||||||
|
嵛你出行
|
||||||
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
<!-- <u-navbar :is-back="false" title="共享电动车" :border-bottom="false" :background="bgc" title-color='#2E4975'
|
<!-- <u-navbar :is-back="false" title="共享电动车" :border-bottom="false" :background="bgc" title-color='#2E4975'
|
||||||
title-size='36' height='36'></u-navbar> -->
|
title-size='36' height='36'></u-navbar> -->
|
||||||
|
@ -49,9 +49,12 @@
|
||||||
<view class="center_left_top">
|
<view class="center_left_top">
|
||||||
剩余骑行
|
剩余骑行
|
||||||
</view>
|
</view>
|
||||||
<view class="center_left_bot">
|
<view class="center_left_bot" v-if="deviceInfos.remainingMileage">
|
||||||
{{deviceInfos.remainingMileage}}公里
|
{{deviceInfos.remainingMileage}}公里
|
||||||
</view>
|
</view>
|
||||||
|
<view class="center_left_bot" v-else>
|
||||||
|
--公里
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="center_right">
|
<view class="center_right">
|
||||||
<view class="center_right_top">
|
<view class="center_right_top">
|
||||||
|
@ -90,18 +93,28 @@
|
||||||
<view class="text">
|
<view class="text">
|
||||||
剩余骑行
|
剩余骑行
|
||||||
</view>
|
</view>
|
||||||
<view class="txt">
|
<!-- <view class="txt">
|
||||||
{{deviceInfos.remainingMileage}}<span style="font-size: 40rpx;">公里</span>
|
{{deviceInfos.remainingMileage}}<span style="font-size: 40rpx;">公里</span>
|
||||||
|
</view> -->
|
||||||
|
<view class="txt" v-if="deviceInfos.remainingMileage">
|
||||||
|
{{deviceInfos.remainingMileage}}<span style="font-size: 40rpx;">公里</span>
|
||||||
|
</view>
|
||||||
|
<view class="txt" v-else>
|
||||||
|
--<span style="font-size: 40rpx;">公里</span>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="right">
|
<view class="right">
|
||||||
<view class="text">
|
<view class="text">
|
||||||
剩余电量
|
剩余电量
|
||||||
</view>
|
</view>
|
||||||
<view class="txt" style="font-size: 36rpx;">
|
<view class="txt" style="font-size: 36rpx;" v-if="deviceInfos.remainingPower">
|
||||||
{{ deviceInfos.remainingPower}}%
|
{{ deviceInfos.remainingPower}}%
|
||||||
<!-- {{startingPrice}}<span style="font-size: 40rpx;">元</span> -->
|
<!-- {{startingPrice}}<span style="font-size: 40rpx;">元</span> -->
|
||||||
</view>
|
</view>
|
||||||
|
<view class="txt" style="font-size: 36rpx;" v-else>
|
||||||
|
--
|
||||||
|
<!-- {{startingPrice}}<span style="font-size: 40rpx;">元</span> -->
|
||||||
|
</view>
|
||||||
<view class="speed">
|
<view class="speed">
|
||||||
<view class="speeds" :style="{ width: deviceInfos.remainingPower + '%' }">
|
<view class="speeds" :style="{ width: deviceInfos.remainingPower + '%' }">
|
||||||
|
|
||||||
|
@ -574,7 +587,7 @@
|
||||||
polyline: [],
|
polyline: [],
|
||||||
areas: [],
|
areas: [],
|
||||||
gps: {
|
gps: {
|
||||||
deptId: 101
|
deptId: 100
|
||||||
},
|
},
|
||||||
deviceInfos: {},
|
deviceInfos: {},
|
||||||
OrderdeviceInfos: {},
|
OrderdeviceInfos: {},
|
||||||
|
@ -615,6 +628,7 @@
|
||||||
showxy: false,
|
showxy: false,
|
||||||
countdown: 5, // 五秒倒计时
|
countdown: 5, // 五秒倒计时
|
||||||
// userId:this.$store.getters.userId,
|
// userId:this.$store.getters.userId,
|
||||||
|
qParam: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -631,41 +645,8 @@
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
console.log(e, 'eeeeeeeeeeeeeeeeeee');
|
console.log(e, 'eeeeeeeeeeeeeeeeeee');
|
||||||
if (e.q) {
|
if (e.q) {
|
||||||
let qParam = e.q;
|
this.qParam = e
|
||||||
|
|
||||||
// 第2步: URL解码q参数
|
|
||||||
let decodedUrl = decodeURIComponent(qParam);
|
|
||||||
|
|
||||||
// 第3步: 使用正则表达式解析解码后的URL并提取查询参数
|
|
||||||
let sn = null;
|
|
||||||
let queryParams = decodedUrl.split('?')[1];
|
|
||||||
if (queryParams) {
|
|
||||||
let params = queryParams.split('&');
|
|
||||||
params.forEach(param => {
|
|
||||||
let [key, value] = param.split('=');
|
|
||||||
if (key === 'sn') {
|
|
||||||
sn = value;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.sn = sn
|
|
||||||
if (this.sn != '') {
|
|
||||||
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
|
|
||||||
if (!this.orderinfo.status) {
|
|
||||||
this.deviceInfo(1)
|
|
||||||
// this.showdevice = true
|
|
||||||
// this.deviceIndex = 1
|
|
||||||
// this.type = 1
|
|
||||||
} else {
|
|
||||||
// this.showtcs=true
|
|
||||||
}
|
|
||||||
}, 500)
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if (e.sn) {
|
if (e.sn) {
|
||||||
|
@ -713,6 +694,44 @@
|
||||||
that.longitude = Number(lb.longitude.toFixed(5)) + 0.005
|
that.longitude = Number(lb.longitude.toFixed(5)) + 0.005
|
||||||
console.log(that.areaInfo, 'that.areaInfo');
|
console.log(that.areaInfo, 'that.areaInfo');
|
||||||
that.getArea()
|
that.getArea()
|
||||||
|
if (that.qParam) {
|
||||||
|
let qParam = that.qParam.q;
|
||||||
|
|
||||||
|
// 第2步: URL解码q参数
|
||||||
|
let decodedUrl = decodeURIComponent(qParam);
|
||||||
|
|
||||||
|
// 第3步: 使用正则表达式解析解码后的URL并提取查询参数
|
||||||
|
let sn = null;
|
||||||
|
let queryParams = decodedUrl.split('?')[1];
|
||||||
|
if (queryParams) {
|
||||||
|
let params = queryParams.split('&');
|
||||||
|
params.forEach(param => {
|
||||||
|
let [key, value] = param.split('=');
|
||||||
|
if (key === 'sn') {
|
||||||
|
sn = value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
that.sn = sn
|
||||||
|
if (that.sn != '') {
|
||||||
|
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
|
||||||
|
if (!that.orderinfo.status) {
|
||||||
|
that.deviceInfo(1)
|
||||||
|
that.qParam = null
|
||||||
|
// this.showdevice = true
|
||||||
|
// this.deviceIndex = 1
|
||||||
|
// this.type = 1
|
||||||
|
} else {
|
||||||
|
// this.showtcs=true
|
||||||
|
}
|
||||||
|
}, 500)
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
// that.getmarks()
|
// that.getmarks()
|
||||||
|
|
||||||
|
|
||||||
|
@ -844,77 +863,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
toggleIconAndCallout() {
|
|
||||||
this.showIconAndCallout = !this.showIconAndCallout;
|
|
||||||
if (this.showIconAndCallout) {
|
|
||||||
const newMarkers = [];
|
|
||||||
this.parkingList.forEach(item => {
|
|
||||||
if(item.type==1){
|
|
||||||
newMarkers.push({
|
|
||||||
id: parseFloat(item.parkingId),
|
|
||||||
latitude: parseFloat(item.latitude),
|
|
||||||
longitude: parseFloat(item.longitude),
|
|
||||||
width: 20,
|
|
||||||
height: 40,
|
|
||||||
iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/u9yz0bKCWKyev0JYpTne',
|
|
||||||
callout: {
|
|
||||||
content: item.parkingName, // 修改为你想要显示的文字内容
|
|
||||||
color: '#ffffff', // 修改为文字颜色
|
|
||||||
fontSize: 14, // 修改为文字大小
|
|
||||||
borderRadius: 10, // 修改为气泡圆角大小
|
|
||||||
bgColor: '#3A7EDB', // 修改为气泡背景颜色
|
|
||||||
padding: 6, // 修改为气泡内边距
|
|
||||||
display: 'ALWAYS' // 修改为气泡的显示策略
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}else if(item.type==2){
|
|
||||||
newMarkers.push({
|
|
||||||
id: parseFloat(item.parkingId),
|
|
||||||
latitude: parseFloat(item.latitude),
|
|
||||||
longitude: parseFloat(item.longitude),
|
|
||||||
width: 20,
|
|
||||||
height: 40,
|
|
||||||
iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/u9yz0bKCWKyev0JYpTne',
|
|
||||||
callout: {
|
|
||||||
content: item.parkingName, // 修改为你想要显示的文字内容
|
|
||||||
color: '#ffffff', // 修改为文字颜色
|
|
||||||
fontSize: 14, // 修改为文字大小
|
|
||||||
borderRadius: 10, // 修改为气泡圆角大小
|
|
||||||
bgColor: '#FFC107', // 修改为气泡背景颜色
|
|
||||||
padding: 6, // 修改为气泡内边距
|
|
||||||
display: 'ALWAYS' // 修改为气泡的显示策略
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}else if(item.type==3){
|
|
||||||
newMarkers.push({
|
|
||||||
id: parseFloat(item.parkingId),
|
|
||||||
latitude: parseFloat(item.latitude),
|
|
||||||
longitude: parseFloat(item.longitude),
|
|
||||||
width: 20,
|
|
||||||
height: 40,
|
|
||||||
iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/u9yz0bKCWKyev0JYpTne',
|
|
||||||
callout: {
|
|
||||||
content: item.parkingName, // 修改为你想要显示的文字内容
|
|
||||||
color: '#ffffff', // 修改为文字颜色
|
|
||||||
fontSize: 14, // 修改为文字大小
|
|
||||||
borderRadius: 10, // 修改为气泡圆角大小
|
|
||||||
bgColor: '#FF473E', // 修改为气泡背景颜色
|
|
||||||
padding: 6, // 修改为气泡内边距
|
|
||||||
display: 'ALWAYS' // 修改为气泡的显示策略
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
console.log(this.parkingList,'newMarkersnewMarkersnewMarkers');
|
|
||||||
this.$set(this, 'markers', [...this.markers, ...newMarkers]);
|
|
||||||
} else {
|
|
||||||
const parkingIds = this.parkingList.map(item => parseFloat(item.parkingId));
|
|
||||||
this.$set(this, 'markers', this.markers.filter(marker => !parkingIds.includes(marker.id)));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
},
|
|
||||||
getMyLocation() {
|
getMyLocation() {
|
||||||
uni.createMapContext("map", this).moveToLocation({
|
uni.createMapContext("map", this).moveToLocation({
|
||||||
longitude: this.longitude,
|
longitude: this.longitude,
|
||||||
|
@ -1209,9 +1158,28 @@
|
||||||
this.timer = null
|
this.timer = null
|
||||||
this.$u.get('/app/device/info?sn=' + this.orderinfo.sn).then((res) => {
|
this.$u.get('/app/device/info?sn=' + this.orderinfo.sn).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
this.OrderdeviceInfos = res.data
|
// 直接从OrderdeviceInfos对象创建一个新的标记,并标记为设备特定标记
|
||||||
|
const newMarker = {
|
||||||
|
id: parseFloat(this.OrderdeviceInfos.sn),
|
||||||
|
latitude: parseFloat(this.OrderdeviceInfos.latitude),
|
||||||
|
longitude: parseFloat(this.OrderdeviceInfos.longitude),
|
||||||
|
width: 40,
|
||||||
|
height: 28,
|
||||||
|
isDeviceMarker: true, // 添加标识属性
|
||||||
|
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uF9qLejuAZErNTrRuHq7',
|
||||||
|
};
|
||||||
|
|
||||||
|
// 保留显示气泡的标记和设备特定标记
|
||||||
|
const preservedMarkers = this.markers.filter(marker => marker.isCalloutVisible || marker.isDeviceMarker);
|
||||||
|
// 使用单个新标记更新markers数组,如果需要保留之前的标记也可以加入
|
||||||
|
this.markers = [newMarker, ...preservedMarkers];
|
||||||
|
this.oldMarkers = [...this.markers];
|
||||||
|
} else {
|
||||||
|
// 处理接口返回错误的情况
|
||||||
}
|
}
|
||||||
})
|
}).catch(error => {
|
||||||
|
// 处理接口请求失败的情况
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// 预约中
|
// 预约中
|
||||||
|
@ -2321,6 +2289,12 @@
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 4000
|
duration: 4000
|
||||||
});
|
});
|
||||||
|
} else if (this.deviceInfos.status == 7) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '车辆未上线,请使用其他车辆',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 4000
|
||||||
|
});
|
||||||
} else if (this.deviceInfos.status == 1) {
|
} else if (this.deviceInfos.status == 1) {
|
||||||
this.showdevice = true;
|
this.showdevice = true;
|
||||||
this.type = 1;
|
this.type = 1;
|
||||||
|
@ -2414,6 +2388,13 @@
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 4000
|
duration: 4000
|
||||||
});
|
});
|
||||||
|
} else if (this.deviceInfos.status ==
|
||||||
|
7) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '车辆未上线,请使用其他车辆',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 4000
|
||||||
|
});
|
||||||
} else if (this.deviceInfos.status ==
|
} else if (this.deviceInfos.status ==
|
||||||
1) {
|
1) {
|
||||||
this.showdevice = true;
|
this.showdevice = true;
|
||||||
|
@ -2452,6 +2433,38 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
toggleIconAndCallout() {
|
||||||
|
this.showIconAndCallout = !this.showIconAndCallout;
|
||||||
|
if (this.showIconAndCallout) {
|
||||||
|
const newMarkers = [];
|
||||||
|
this.parkingList.forEach(item => {
|
||||||
|
newMarkers.push({
|
||||||
|
id: parseFloat(item.parkingId),
|
||||||
|
latitude: parseFloat(item.latitude),
|
||||||
|
longitude: parseFloat(item.longitude),
|
||||||
|
width: 20,
|
||||||
|
height: 40,
|
||||||
|
iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/u9yz0bKCWKyev0JYpTne',
|
||||||
|
callout: {
|
||||||
|
content: item.parkingName,
|
||||||
|
color: '#ffffff',
|
||||||
|
fontSize: 14,
|
||||||
|
borderRadius: 10,
|
||||||
|
bgColor: item.type == 1 ? '#3A7EDB' : item.type == 2 ? '#FFC107' :
|
||||||
|
'#FF473E',
|
||||||
|
padding: 6,
|
||||||
|
display: 'ALWAYS'
|
||||||
|
},
|
||||||
|
isCalloutVisible: true // 添加标记
|
||||||
|
});
|
||||||
|
});
|
||||||
|
this.$set(this, 'markers', [...this.markers, ...newMarkers]);
|
||||||
|
} else {
|
||||||
|
// 过滤掉所有气泡显示的标记
|
||||||
|
this.$set(this, 'markers', this.markers.filter(marker => !marker.isCalloutVisible));
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
getmarks() {
|
getmarks() {
|
||||||
let data = {
|
let data = {
|
||||||
|
@ -2459,9 +2472,8 @@
|
||||||
};
|
};
|
||||||
if (this.areaInfo.areaId) {
|
if (this.areaInfo.areaId) {
|
||||||
this.$u.get(`/app/allVehicleByArea`, data).then((res) => {
|
this.$u.get(`/app/allVehicleByArea`, data).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200 && res.data != '') {
|
||||||
this.listData = res.data;
|
this.listData = res.data;
|
||||||
|
|
||||||
const newMarkers = this.listData.map(item => ({
|
const newMarkers = this.listData.map(item => ({
|
||||||
id: parseFloat(item.sn),
|
id: parseFloat(item.sn),
|
||||||
latitude: parseFloat(item.latitude),
|
latitude: parseFloat(item.latitude),
|
||||||
|
@ -2471,21 +2483,21 @@
|
||||||
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uF9qLejuAZErNTrRuHq7',
|
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uF9qLejuAZErNTrRuHq7',
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// 检查新数据和旧数据是否有变化
|
// 保留显示气泡的标记
|
||||||
if (this.oldMarkers.length === 0 || this.isMarkersChanged(newMarkers)) {
|
const preservedMarkers = this.markers.filter(marker => marker.isCalloutVisible || marker.isDeviceMarker);
|
||||||
// console.log('有变化');
|
|
||||||
this.markers = newMarkers;
|
|
||||||
this.oldMarkers = [...newMarkers];
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
// 假设newMarkers是从新数据生成的标记数组
|
||||||
// 处理接口返回错误的情况
|
// 更新markers数组,避免删除已标识的重要标记
|
||||||
|
this.markers = [...newMarkers.filter(newMarker =>
|
||||||
|
!preservedMarkers.some(preservedMarker => preservedMarker.id === newMarker.id)
|
||||||
|
), ...preservedMarkers];
|
||||||
|
|
||||||
|
this.oldMarkers = [...this.markers];
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
// 处理接口请求失败的情况
|
// 处理接口请求失败的情况
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
isMarkersChanged(newMarkers) {
|
isMarkersChanged(newMarkers) {
|
||||||
if (this.oldMarkers.length !== newMarkers.length) {
|
if (this.oldMarkers.length !== newMarkers.length) {
|
||||||
|
@ -2653,21 +2665,21 @@
|
||||||
});
|
});
|
||||||
const validBoundaries = type1Data.map(row => row.boundaryStr).filter(boundary =>
|
const validBoundaries = type1Data.map(row => row.boundaryStr).filter(boundary =>
|
||||||
typeof boundary === 'string' && boundary.trim() !== '');
|
typeof boundary === 'string' && boundary.trim() !== '');
|
||||||
const polylines = this.convertBoundaryToPolylines(validBoundaries,1);
|
const polylines = this.convertBoundaryToPolylines(validBoundaries, 1);
|
||||||
|
|
||||||
|
|
||||||
const validBoundaries1 = type2Data.map(row => row.boundaryStr).filter(boundary =>
|
const validBoundaries1 = type2Data.map(row => row.boundaryStr).filter(boundary =>
|
||||||
typeof boundary === 'string' && boundary.trim() !== '');
|
typeof boundary === 'string' && boundary.trim() !== '');
|
||||||
const polylines1 = this.convertBoundaryToPolylines(validBoundaries1,2);
|
const polylines1 = this.convertBoundaryToPolylines(validBoundaries1, 2);
|
||||||
|
|
||||||
const validBoundaries2 = type3Data.map(row => row.boundaryStr).filter(boundary =>
|
const validBoundaries2 = type3Data.map(row => row.boundaryStr).filter(boundary =>
|
||||||
typeof boundary === 'string' && boundary.trim() !== '');
|
typeof boundary === 'string' && boundary.trim() !== '');
|
||||||
const polylines2 = this.convertBoundaryToPolylines(validBoundaries2,3);
|
const polylines2 = this.convertBoundaryToPolylines(validBoundaries2, 3);
|
||||||
// 将处理后的数据添加到 this.polyline 中
|
// 将处理后的数据添加到 this.polyline 中
|
||||||
this.polyline = this.polyline.concat(polylines2);
|
this.polyline = this.polyline.concat(polylines2);
|
||||||
this.polyline = this.polyline.concat(polylines1);
|
this.polyline = this.polyline.concat(polylines1);
|
||||||
this.polyline = this.polyline.concat(polylines);
|
this.polyline = this.polyline.concat(polylines);
|
||||||
this.parkingList=res.rows
|
this.parkingList = res.rows
|
||||||
// console.log(this.polyline);
|
// console.log(this.polyline);
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
@ -2692,8 +2704,8 @@
|
||||||
|
|
||||||
return polyline;
|
return polyline;
|
||||||
},
|
},
|
||||||
convertBoundaryToPolylines(boundaries,num) {
|
convertBoundaryToPolylines(boundaries, num) {
|
||||||
if(num==1){
|
if (num == 1) {
|
||||||
console.log('判断1');
|
console.log('判断1');
|
||||||
return boundaries.map(boundary => {
|
return boundaries.map(boundary => {
|
||||||
if (!boundary) return null;
|
if (!boundary) return null;
|
||||||
|
@ -2721,7 +2733,7 @@
|
||||||
|
|
||||||
};
|
};
|
||||||
}).filter(polyline => polyline !== null); // 过滤掉无效的折线数据
|
}).filter(polyline => polyline !== null); // 过滤掉无效的折线数据
|
||||||
}else if(num==2){
|
} else if (num == 2) {
|
||||||
return boundaries.map(boundary => {
|
return boundaries.map(boundary => {
|
||||||
if (!boundary) return null;
|
if (!boundary) return null;
|
||||||
let coords;
|
let coords;
|
||||||
|
@ -2748,7 +2760,7 @@
|
||||||
|
|
||||||
};
|
};
|
||||||
}).filter(polyline => polyline !== null); // 过滤掉无效的折线数据
|
}).filter(polyline => polyline !== null); // 过滤掉无效的折线数据
|
||||||
}else if(num==3){
|
} else if (num == 3) {
|
||||||
return boundaries.map(boundary => {
|
return boundaries.map(boundary => {
|
||||||
if (!boundary) return null;
|
if (!boundary) return null;
|
||||||
let coords;
|
let coords;
|
||||||
|
@ -3344,12 +3356,25 @@
|
||||||
|
|
||||||
.tit {
|
.tit {
|
||||||
padding: 18rpx 0 0 18rpx;
|
padding: 18rpx 0 0 18rpx;
|
||||||
width: 350rpx;
|
/* Adds padding to the top and left sides */
|
||||||
|
width: 300rpx;
|
||||||
|
/* Sets a fixed width for the element */
|
||||||
display: flex;
|
display: flex;
|
||||||
|
/* Uses flexbox for layout */
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
/* Vertically centers the content */
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
/* Sets the font weight to medium */
|
||||||
font-size: 36rpx;
|
font-size: 36rpx;
|
||||||
|
/* Sets the font size */
|
||||||
color: #3D3D3D;
|
color: #3D3D3D;
|
||||||
|
/* Sets the text color */
|
||||||
|
white-space: nowrap;
|
||||||
|
/* Prevents the text from wrapping to the next line */
|
||||||
|
overflow: hidden;
|
||||||
|
/* Hides any content that overflows the element's box */
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
/* 显示省略号 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.nmtxt {
|
.nmtxt {
|
||||||
|
|
57
pages/my.vue
57
pages/my.vue
|
@ -84,6 +84,18 @@
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view> -->
|
</view> -->
|
||||||
|
<view class="card_li" @click="topage(10)" >
|
||||||
|
<view class="card_left">
|
||||||
|
<image src="https://lxnapi.ccttiot.com/bike/img/static/uk7i80QWz02cAfbbC518" mode=""></image>
|
||||||
|
<view class="text">
|
||||||
|
客户服务
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<view class="iconfont icon-xiangyou1" >
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<view class="card_li" @click="topage(8)" v-if="info.role==3||info.role==2">
|
<view class="card_li" @click="topage(8)" v-if="info.role==3||info.role==2">
|
||||||
<view class="card_left">
|
<view class="card_left">
|
||||||
<image src="https://lxnapi.ccttiot.com/bike/img/static/unIGXFEhvTgtXVcfPH33" mode=""></image>
|
<image src="https://lxnapi.ccttiot.com/bike/img/static/unIGXFEhvTgtXVcfPH33" mode=""></image>
|
||||||
|
@ -212,10 +224,14 @@
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:'/page_fix/fix_index'
|
url:'/page_fix/fix_index'
|
||||||
})
|
})
|
||||||
}else if(num=9){
|
}else if(num==9){
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:'/pages_admin/admin_index'
|
url:'/pages_admin/admin_index'
|
||||||
})
|
})
|
||||||
|
}else if(num==10){
|
||||||
|
uni.navigateTo({
|
||||||
|
url:'/page_user/khfw/khfw'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -239,10 +255,41 @@
|
||||||
|
|
||||||
let areaId=uni.getStorageSync('areaId');
|
let areaId=uni.getStorageSync('areaId');
|
||||||
if(areaId){
|
if(areaId){
|
||||||
setTimeout(()=>{
|
let that =this
|
||||||
this.getuserInfo()
|
wx.login({
|
||||||
// if()
|
success(res) {
|
||||||
},500)
|
if (res.code) {
|
||||||
|
console.log('登录!', res);
|
||||||
|
let data = {
|
||||||
|
wxOpenId: res.code,
|
||||||
|
|
||||||
|
};
|
||||||
|
let areaId = uni.getStorageSync('areaId');
|
||||||
|
that.$u.post('/loginByopenid?jsCode=' + res.code + '&areaId=' + areaId).then(
|
||||||
|
res => {
|
||||||
|
uni.hideLoading();
|
||||||
|
if (res.code == 200) {
|
||||||
|
uni.setStorageSync('token', res.token);
|
||||||
|
that.getuserInfo()
|
||||||
|
|
||||||
|
|
||||||
|
} else if (res.code == 501) {
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// console.log("老用户登录",res.data)
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pages/login/login'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
});
|
||||||
}else{
|
}else{
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '请授权位置信息后再尝试',
|
title: '请授权位置信息后再尝试',
|
||||||
|
|
|
@ -98,40 +98,41 @@
|
||||||
url:'/pages/index/index'
|
url:'/pages/index/index'
|
||||||
})
|
})
|
||||||
}else if(num==5){
|
}else if(num==5){
|
||||||
uni.scanCode({
|
|
||||||
onlyFromCamera: true,
|
|
||||||
scanType: ['qrCode'],
|
|
||||||
success: res => {
|
|
||||||
|
|
||||||
let sn = null;
|
|
||||||
let queryParams = res.result.split('?')[1];
|
|
||||||
if (queryParams) {
|
|
||||||
let params = queryParams.split('&');
|
|
||||||
params.forEach(param => {
|
|
||||||
let [key, value] = param.split('=');
|
|
||||||
if (key === 'sn') {
|
|
||||||
sn = value;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
this.sn = sn
|
|
||||||
console.log(res.result);
|
|
||||||
if (this.sn != '') {
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:'/pages/bind_sn?sn='+this.sn
|
url:'/pages/bind_sn'
|
||||||
})
|
})
|
||||||
}
|
// uni.scanCode({
|
||||||
|
// onlyFromCamera: true,
|
||||||
|
// scanType: ['qrCode'],
|
||||||
|
// success: res => {
|
||||||
|
|
||||||
},
|
// let sn = null;
|
||||||
fail: err => {
|
// let queryParams = res.result.split('?')[1];
|
||||||
console.error('扫描失败:', err);
|
// if (queryParams) {
|
||||||
uni.showToast({
|
// let params = queryParams.split('&');
|
||||||
title: '扫描失败',
|
// params.forEach(param => {
|
||||||
icon: 'none'
|
// let [key, value] = param.split('=');
|
||||||
});
|
// if (key === 'sn') {
|
||||||
}
|
// sn = value;
|
||||||
});
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
// this.sn = sn
|
||||||
|
// console.log(res.result);
|
||||||
|
// if (this.sn != '') {
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
// },
|
||||||
|
// fail: err => {
|
||||||
|
// console.error('扫描失败:', err);
|
||||||
|
// uni.showToast({
|
||||||
|
// title: '扫描失败',
|
||||||
|
// icon: 'none'
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,7 @@
|
||||||
type:this.typeidx,
|
type:this.typeidx,
|
||||||
key:this.searchKeyword
|
key:this.searchKeyword
|
||||||
}
|
}
|
||||||
this.$u.get(`/app/device/search?`, data).then((res) => {
|
this.$u.get(`/appVerify/device/search?`, data).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.searchList=res.data
|
this.searchList=res.data
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user