diff --git a/page_user/dingshi.vue b/page_user/dingshi.vue index 2ac5588..26684b3 100644 --- a/page_user/dingshi.vue +++ b/page_user/dingshi.vue @@ -87,6 +87,22 @@ minutekq:'--' } }, + // 分享到好友(会话) + onShareAppMessage: function() { + return { + title: '绿小能', + path: '/pages/index/index' + } + }, + + // 分享到朋友圈 + onShareTimeline: function() { + return { + title: '绿小能', + query: '', + path: '/pages/index/index' + } + }, onLoad() { }, diff --git a/page_user/jiaoshui.vue b/page_user/jiaoshui.vue index 6319469..514a81c 100644 --- a/page_user/jiaoshui.vue +++ b/page_user/jiaoshui.vue @@ -49,6 +49,22 @@ }, } }, + // 分享到好友(会话) + onShareAppMessage: function() { + return { + title: '绿小能', + path: '/pages/index/index' + } + }, + + // 分享到朋友圈 + onShareTimeline: function() { + return { + title: '绿小能', + query: '', + path: '/pages/index/index' + } + }, onLoad() { }, diff --git a/page_user/kefu.vue b/page_user/kefu.vue index b167ac0..6594339 100644 --- a/page_user/kefu.vue +++ b/page_user/kefu.vue @@ -68,6 +68,22 @@ flag:false } }, + // 分享到好友(会话) + onShareAppMessage: function() { + return { + title: '绿小能', + path: '/pages/index/index' + } + }, + + // 分享到朋友圈 + onShareTimeline: function() { + return { + title: '绿小能', + query: '', + path: '/pages/index/index' + } + }, onLoad() { }, diff --git a/page_user/kefuxq.vue b/page_user/kefuxq.vue index caea942..2cb0df1 100644 --- a/page_user/kefuxq.vue +++ b/page_user/kefuxq.vue @@ -19,6 +19,22 @@ flag:false } }, + // 分享到好友(会话) + onShareAppMessage: function() { + return { + title: '绿小能', + path: '/pages/index/index' + } + }, + + // 分享到朋友圈 + onShareTimeline: function() { + return { + title: '绿小能', + query: '', + path: '/pages/index/index' + } + }, onLoad() { }, diff --git a/page_user/lanya.vue b/page_user/lanya.vue index d70723d..610413a 100644 --- a/page_user/lanya.vue +++ b/page_user/lanya.vue @@ -3,9 +3,51 @@ - - - + + + + 扫描到以下设备,点击添加! + + + 如未找到想添加的设备,点击重新搜索 + + + + + + + 丁丁浇花器 + + + MAC:{{item.name}} + + + + 添加 + + + + + + + + + + + 搜索附近的设备失败 + + + 搜索失败点击重新搜索注意打开蓝牙 + + + + + + 重新搜索 + + + 重新搜索 + @@ -19,11 +61,28 @@ backgroundColor: "#fff", }, active:1, - flag:false, + flag:true, devicesList:[], deviceId:'', name:'', mac:'2952BB7A4EE0', + flags:true + } + }, + // 分享到好友(会话) + onShareAppMessage: function() { + return { + title: '绿小能', + path: '/pages/index/index' + } + }, + + // 分享到朋友圈 + onShareTimeline: function() { + return { + title: '绿小能', + query: '', + path: '/pages/index/index' } }, onLoad() { @@ -47,52 +106,35 @@ }, 2000) }, methods:{ - btnkq(){ - let that = this - uni.getNetworkType({ - success(res) { - if (res.networkType !== 'none') { - uni.getConnectedBluetoothDevices({ - success(res) { - setTimeout(()=> { - xBlufi.notifySendCustomData({ - customData: '11open' - }) - },1500) - }, - fail(err) { - console.error('获取已连接蓝牙设备信息失败:',err) - } - }) - } else { - console.log('手机未连接网络') - } - } - }) - }, - btngb(){ - let that = this - uni.getNetworkType({ - success(res) { - if (res.networkType !== 'none') { - uni.getConnectedBluetoothDevices({ - success(res) { - setTimeout(()=> { - xBlufi.notifySendCustomData({ - customData: '11close' - }) - },1500) - }, - fail(err) { - console.error('获取已连接蓝牙设备信息失败:',err) - } - }) - } else { - console.log('手机未连接网络') - } - } - }) - }, + btnss(){ + uni.showLoading({ + title: '搜索中...' + }) + this.flag = false + let that = this + xBlufi.initXBlufi(1); + xBlufi.listenDeviceMsgEvent(true, that.funListenDeviceMsgEvent); + xBlufi.notifyStartDiscoverBle({ + 'isStart': true + }) + setTimeout(() => { + xBlufi.notifyStartDiscoverBle({ + 'isStart': false + }) + if (that.devicesList.length > 0) { + that.flags = true + xBlufi.notifyConnectBle({ + isStart: true, + deviceId: that.deviceId, + name: that.name + }) + }else{ + that.flags = false + } + uni.hideLoading() + that.flag = true + }, 2000) + }, // 获取附近蓝牙设备列表 @@ -117,18 +159,19 @@ case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS: if (options.result) { let devicesarr = options.data + this.devicesList = devicesarr console.log(devicesarr,'111'); - devicesarr.forEach(device => { - const mac = device.name.substring(4); - if (device.name.slice(5, 17) == this.mac) { - this.deviceId = device.deviceId - this.name = device.name - console.log(device.name,this.mac,'222'); - this.devicesList.push(device); - let uniqueDevicesList = Array.from(new Set(this.devicesList)); - this.devicesList = uniqueDevicesList; - } - }) + // devicesarr.forEach(device => { + // const mac = device.name.substring(4); + // if (device.name.slice(5, 17) == this.mac) { + // this.deviceId = device.deviceId + // this.name = device.name + // console.log(device.name,this.mac,'222'); + // this.devicesList.push(device); + // let uniqueDevicesList = Array.from(new Set(this.devicesList)); + // this.devicesList = uniqueDevicesList; + // } + // }) } break; case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED: @@ -163,7 +206,8 @@ title: '蓝牙未开启', icon: 'none', duration: 3000 - }); + }) + this.flags = false return } else { @@ -202,12 +246,111 @@ /deep/ .uicon-nav-back{ margin-bottom: 22rpx; } + .wei{ + text-align: center; + image{ + width: 380rpx; + height: 394rpx; + } + .sbname{ + font-size: 40rpx; + color: #3D3D3D; + margin-top: 80rpx; + width: 100%; + text-align: center; + } + .sbwz{ + font-size: 28rpx; + color: #737B80; + margin-top: 24rpx; + width: 100%; + text-align: center; + } + } + .btnss{ + width: 512rpx; + height: 92rpx; + background: #48893B; + border-radius: 46rpx 46rpx 46rpx 46rpx; + border-radius: 50rpx; + text-align: center; + line-height: 92rpx; + font-weight: 600; + font-size: 40rpx; + color: #FFFFFF; + position: fixed; + left: 50%; + transform: translateX(-50%); + bottom: 106rpx; + } + .list{ + width: 100%; + border-radius: 20rpx; + margin: auto; + margin-top: 72rpx; + .list_item{ + margin-top: 18rpx; + display: flex; + justify-content: space-between; + align-items: center; + width: 100%; + height: 152rpx; + background: #FFFFFF; + border-radius: 20rpx; + box-shadow: 0rpx 10rpx 64rpx 0rpx rgba(0,0,0,0.08); + padding: 18rpx 30rpx; + box-sizing: border-box; + image{ + width: 96rpx; + height: 94rpx; + } + .cen{ + .name{ + font-size: 32rpx; + color: #50565A; + } + .devmac{ + font-size: 24rpx; + color: #BDBCBC; + margin-top: 6rpx; + } + } + .add{ + width: 108rpx; + height: 60rpx; + background: #FFFFFF; + border: 3rpx solid #48893B; + filter: blur(0px); + border-radius: 20rpx; + text-align: center; + line-height: 60rpx; + font-size: 28rpx; + color: #48893B; + } + } + } page{ width: 100%; - padding: 20rpx 30rpx; + padding: 20rpx 64rpx; box-sizing: border-box; background-color: #fff; } - + .topone{ + font-size: 36rpx; + color: #3D3D3D; + display: flex; + image{ + width: 48rpx; + height: 48rpx; + } + } + .toptwo{ + font-size: 28rpx; + color: #737B7F; + margin-top: 14rpx; + width: 100%; + padding-left: 48rpx; + box-sizing: border-box; + } \ No newline at end of file diff --git a/page_user/opinion.vue b/page_user/opinion.vue index 7258251..8454507 100644 --- a/page_user/opinion.vue +++ b/page_user/opinion.vue @@ -90,6 +90,22 @@ }, computed: { + }, + // 分享到好友(会话) + onShareAppMessage: function() { + return { + title: '绿小能', + path: '/pages/index/index' + } + }, + + // 分享到朋友圈 + onShareTimeline: function() { + return { + title: '绿小能', + query: '', + path: '/pages/index/index' + } }, onLoad() { diff --git a/page_user/photo.vue b/page_user/photo.vue index 39c694b..2ecfdee 100644 --- a/page_user/photo.vue +++ b/page_user/photo.vue @@ -46,6 +46,22 @@ maskpic: '' } }, + // 分享到好友(会话) + onShareAppMessage: function() { + return { + title: '绿小能', + path: '/pages/index/index' + } + }, + + // 分享到朋友圈 + onShareTimeline: function() { + return { + title: '绿小能', + query: '', + path: '/pages/index/index' + } + }, onLoad() { this.gettiken() this.getinfo() diff --git a/page_user/photolist.vue b/page_user/photolist.vue index f92f5d7..0c0cdd1 100644 --- a/page_user/photolist.vue +++ b/page_user/photolist.vue @@ -38,6 +38,22 @@ } }, + // 分享到好友(会话) + onShareAppMessage: function() { + return { + title: '绿小能', + path: '/pages/index/index' + } + }, + + // 分享到朋友圈 + onShareTimeline: function() { + return { + title: '绿小能', + query: '', + path: '/pages/index/index' + } + }, onLoad(option) { this.cartpic = JSON.parse(option.cart) this.zwlist = JSON.parse(option.list) diff --git a/page_user/photoxq.vue b/page_user/photoxq.vue index 952daa2..92fe33c 100644 --- a/page_user/photoxq.vue +++ b/page_user/photoxq.vue @@ -69,6 +69,22 @@ list:[] } }, + // 分享到好友(会话) + onShareAppMessage: function() { + return { + title: '绿小能', + path: '/pages/index/index' + } + }, + + // 分享到朋友圈 + onShareTimeline: function() { + return { + title: '绿小能', + query: '', + path: '/pages/index/index' + } + }, onLoad(option) { this.plantId = option.plantId this.getxq() diff --git a/page_user/upload.vue b/page_user/upload.vue index 52c6528..ab865be 100644 --- a/page_user/upload.vue +++ b/page_user/upload.vue @@ -94,6 +94,22 @@ }], } }, + // 分享到好友(会话) + onShareAppMessage: function() { + return { + title: '绿小能', + path: '/pages/index/index' + } + }, + + // 分享到朋友圈 + onShareTimeline: function() { + return { + title: '绿小能', + query: '', + path: '/pages/index/index' + } + }, onLoad() { }, diff --git a/page_user/yinsixq.vue b/page_user/yinsixq.vue index 533b83f..e46797a 100644 --- a/page_user/yinsixq.vue +++ b/page_user/yinsixq.vue @@ -18,6 +18,22 @@ tit:'' } }, + // 分享到好友(会话) + onShareAppMessage: function() { + return { + title: '绿小能', + path: '/pages/index/index' + } + }, + + // 分享到朋友圈 + onShareTimeline: function() { + return { + title: '绿小能', + query: '', + path: '/pages/index/index' + } + }, onLoad(option) { this.tit = option.tit }, diff --git a/pages/index/index.vue b/pages/index/index.vue index e1004ad..cd08aa4 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -81,7 +81,7 @@ - 雨水感应 + 雨水感应 @@ -203,6 +203,22 @@ } }, + // 分享到好友(会话) + onShareAppMessage: function() { + return { + title: '绿小能', + path: '/pages/index/index' + } + }, + + // 分享到朋友圈 + onShareTimeline: function() { + return { + title: '绿小能', + query: '', + path: '/pages/index/index' + } + }, onLoad() { let that = this xBlufi.initXBlufi(1); @@ -222,11 +238,66 @@ }) } }, 2000) + }, + onShow() { + }, mounted() { }, methods: { + // 雨水感应 + btnyushui(){ + let that = this + if(that.yschecked == true){ + uni.getNetworkType({ + success(res) { + if (res.networkType !== 'none') { + uni.getConnectedBluetoothDevices({ + success(res) { + setTimeout(()=> { + xBlufi.notifySendCustomData({ + customData:'qlose' + }) + that.yschecked = false + },1500) + }, + fail(err) { + console.error('获取已连接蓝牙设备信息失败:',err) + } + }) + } else { + console.log('手机未连接网络') + } + } + }) + }else{ + console.log(11); + let that = this + uni.getNetworkType({ + success(res) { + if (res.networkType !== 'none') { + uni.getConnectedBluetoothDevices({ + success(res) { + setTimeout(()=> { + xBlufi.notifySendCustomData({ + customData:'qpen' + }) + that.yschecked = true + },1500) + }, + fail(err) { + console.error('获取已连接蓝牙设备信息失败:',err) + } + }) + } else { + console.log('手机未连接网络') + } + } + }) + } + }, + // 点击添加设备 btnaddsb(){ uni.navigateTo({ @@ -260,8 +331,6 @@ duration: 3000 }) }else{ - this.sdjsflag = false - this.kgflag = true let that = this uni.getNetworkType({ success(res) { @@ -272,6 +341,8 @@ xBlufi.notifySendCustomData({ customData: "11time@" + that.jstime }) + that.sdjsflag = false + that.kgflag = true },1500) }, fail(err) { @@ -286,10 +357,30 @@ } }, - // 开启和关闭 + // 关闭 btnkq() { - this.kgflag = false + let that = this + uni.getNetworkType({ + success(res) { + if (res.networkType !== 'none') { + uni.getConnectedBluetoothDevices({ + success(res) { + setTimeout(()=> { + xBlufi.notifySendCustomData({ + customData: "11close" + }) + that.kgflag = false + },1500) + }, + fail(err) { + console.error('获取已连接蓝牙设备信息失败:',err) + } + }) + } + } + }) }, + // 开启 btngb() { this.sdjsflag = true }, @@ -327,9 +418,6 @@ funListenDeviceMsgEvent: function(options) { switch (options.type) { case xBlufi.XBLUFI_TYPE.TYPE_STATUS_CONNECTED: - // that.setData({ - // connected: options.result - // }) if (!options.result) { uni.showModal({ title: '很抱歉提醒你!', @@ -337,7 +425,8 @@ showCancel: false, //是否显示取消按钮 success: function(res) { - + uni.hideLoading() + uni.removeStorage({key:'device_key'}) } }) } @@ -351,7 +440,7 @@ if (device.name.slice(5, 17) == this.mac) { this.deviceId = device.deviceId this.name = device.name - console.log(device.name,this.mac,'222'); + // console.log(device.name,this.mac,'222'); this.devicesList.push(device); let uniqueDevicesList = Array.from(new Set(this.devicesList)); this.devicesList = uniqueDevicesList; @@ -361,6 +450,7 @@ break; case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED: console.log("连接回调:" + JSON.stringify(options)); + uni.setStorageSync('device_key', 'true') if (options.result) { { xBlufi.notifyInitBleEsp32({ @@ -375,7 +465,7 @@ break; case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA: this.ver_data = this.parseCustomData(options.data) - console.log("1收到设备发来的自定义数据结果:", this.ver_data); + console.log("1收到设备发来的自定义数据结果:", options.data); break; case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_STOP: if (options.result) { @@ -911,4 +1001,5 @@ } } } + \ No newline at end of file diff --git a/pages/login/denglu.vue b/pages/login/denglu.vue index 7b402c3..3f907e8 100644 --- a/pages/login/denglu.vue +++ b/pages/login/denglu.vue @@ -57,6 +57,22 @@ mobileCode:'' } }, + // 分享到好友(会话) + onShareAppMessage: function() { + return { + title: '绿小能', + path: '/pages/index/index' + } + }, + + // 分享到朋友圈 + onShareTimeline: function() { + return { + title: '绿小能', + query: '', + path: '/pages/index/index' + } + }, onLoad() { }, diff --git a/pages/login/login.vue b/pages/login/login.vue index 9059d2d..76958d1 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -19,6 +19,22 @@ } }, + // 分享到好友(会话) + onShareAppMessage: function() { + return { + title: '绿小能', + path: '/pages/index/index' + } + }, + + // 分享到朋友圈 + onShareTimeline: function() { + return { + title: '绿小能', + query: '', + path: '/pages/index/index' + } + }, onLoad() { }, diff --git a/pages/login/wjpassword.vue b/pages/login/wjpassword.vue index 6067d2a..ccc7a26 100644 --- a/pages/login/wjpassword.vue +++ b/pages/login/wjpassword.vue @@ -73,6 +73,22 @@ timer: null } }, + // 分享到好友(会话) + onShareAppMessage: function() { + return { + title: '绿小能', + path: '/pages/index/index' + } + }, + + // 分享到朋友圈 + onShareTimeline: function() { + return { + title: '绿小能', + query: '', + path: '/pages/index/index' + } + }, onLoad() { }, diff --git a/pages/login/zhuce.vue b/pages/login/zhuce.vue index 8360605..754cd48 100644 --- a/pages/login/zhuce.vue +++ b/pages/login/zhuce.vue @@ -78,6 +78,22 @@ timer: null } }, + // 分享到好友(会话) + onShareAppMessage: function() { + return { + title: '绿小能', + path: '/pages/index/index' + } + }, + + // 分享到朋友圈 + onShareTimeline: function() { + return { + title: '绿小能', + query: '', + path: '/pages/index/index' + } + }, onLoad() { }, diff --git a/pages/my.vue b/pages/my.vue index 7467568..0119f60 100644 --- a/pages/my.vue +++ b/pages/my.vue @@ -68,6 +68,22 @@ } }, + // 分享到好友(会话) + onShareAppMessage: function() { + return { + title: '绿小能', + path: '/pages/index/index' + } + }, + + // 分享到朋友圈 + onShareTimeline: function() { + return { + title: '绿小能', + query: '', + path: '/pages/index/index' + } + }, onLoad() { this.getinfo() this.gettiken() @@ -105,7 +121,10 @@ success: (res) => { that.imageSrc = that.picdomain + '/' + JSON.parse(res.data).key console.log(that.imageSrc); - that.$u.get(`/app/avatar?img=${that.imageSrc}`).then(res => { + let data = { + img:that.imageSrc + } + that.$u.get(`/appVerify/avatar?img=${that.imageSrc}`,data).then(res => { }) } diff --git a/pages/myorder/index.vue b/pages/myorder/index.vue index 2c83704..6b05b88 100644 --- a/pages/myorder/index.vue +++ b/pages/myorder/index.vue @@ -39,6 +39,22 @@ } }, + // 分享到好友(会话) + onShareAppMessage: function() { + return { + title: '绿小能', + path: '/pages/index/index' + } + }, + + // 分享到朋友圈 + onShareTimeline: function() { + return { + title: '绿小能', + query: '', + path: '/pages/index/index' + } + }, onLoad() { }, diff --git a/pages/myorder/returned/index.vue b/pages/myorder/returned/index.vue index 131a67a..72a1836 100644 --- a/pages/myorder/returned/index.vue +++ b/pages/myorder/returned/index.vue @@ -85,6 +85,22 @@ } }, + // 分享到好友(会话) + onShareAppMessage: function() { + return { + title: '绿小能', + path: '/pages/index/index' + } + }, + + // 分享到朋友圈 + onShareTimeline: function() { + return { + title: '绿小能', + query: '', + path: '/pages/index/index' + } + }, onLoad() { }, diff --git a/pages/nearbystores/index.vue b/pages/nearbystores/index.vue index 371d363..a83ab62 100644 --- a/pages/nearbystores/index.vue +++ b/pages/nearbystores/index.vue @@ -52,6 +52,22 @@ }, onLoad() { + }, + // 分享到好友(会话) + onShareAppMessage: function() { + return { + title: '绿小能', + path: '/pages/index/index' + } + }, + + // 分享到朋友圈 + onShareTimeline: function() { + return { + title: '绿小能', + query: '', + path: '/pages/index/index' + } }, methods: { mapFun() { diff --git a/pages/tj.vue b/pages/tj.vue index 296e767..579423f 100644 --- a/pages/tj.vue +++ b/pages/tj.vue @@ -15,6 +15,22 @@ } }, + // 分享到好友(会话) + onShareAppMessage: function() { + return { + title: '绿小能', + path: '/pages/index/index' + } + }, + + // 分享到朋友圈 + onShareTimeline: function() { + return { + title: '绿小能', + query: '', + path: '/pages/index/index' + } + }, onLoad() { },