补充图片
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 21 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 236 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 106 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 86 KiB |
@@ -68,8 +68,12 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
onShow() {
|
onShow() {
|
||||||
|
let token = wx.getStorageSync("token") || null;
|
||||||
|
let userInfo = wx.getStorageSync("userInfo") || null;
|
||||||
let deviceSelect = app.globalData.ppScale.device.connection;
|
let deviceSelect = app.globalData.ppScale.device.connection;
|
||||||
this.setData({
|
this.setData({
|
||||||
|
token: token,
|
||||||
|
userInfo: userInfo,
|
||||||
name: deviceSelect.name,
|
name: deviceSelect.name,
|
||||||
deviceSelect: deviceSelect
|
deviceSelect: deviceSelect
|
||||||
})
|
})
|
||||||
@@ -83,6 +87,27 @@ Page({
|
|||||||
|
|
||||||
// 配对
|
// 配对
|
||||||
openConnectionSuccessful() {
|
openConnectionSuccessful() {
|
||||||
|
let token = this.data.token;
|
||||||
|
let userInfo = this.data.userInfo;
|
||||||
|
if (token && userInfo) {
|
||||||
|
this.starConnection();
|
||||||
|
} else {
|
||||||
|
wx.login({
|
||||||
|
success: (res) => {
|
||||||
|
if (res.code) {
|
||||||
|
this.checkOpenIdLogin(res.code);
|
||||||
|
} else {
|
||||||
|
wx.showToast({
|
||||||
|
icon: "none",
|
||||||
|
title: "登录失败,请稍后再试!",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
starConnection() {
|
||||||
let deviceSelect = this.data.deviceSelect;
|
let deviceSelect = this.data.deviceSelect;
|
||||||
if (deviceSelect) {
|
if (deviceSelect) {
|
||||||
let name = this.data.name;
|
let name = this.data.name;
|
||||||
@@ -106,4 +131,16 @@ Page({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 微信一键登录
|
||||||
|
checkOpenIdLogin(code) {
|
||||||
|
let params = {
|
||||||
|
code: code
|
||||||
|
};
|
||||||
|
$.ajax("weighingScale/checkOpenIdLogin", params, "POST", true, "登录中...").then((res) => {
|
||||||
|
wx.setStorageSync("userInfo", res.result.user);
|
||||||
|
wx.setStorageSync("token", res.result.token);
|
||||||
|
this.starConnection();
|
||||||
|
})
|
||||||
|
},
|
||||||
})
|
})
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
<view class="equipmentModel">型号:{{deviceSelect.name}}</view>
|
<view class="equipmentModel">型号:{{deviceSelect.name}}</view>
|
||||||
|
|
||||||
<view class="equipmentIcon">
|
<view class="equipmentIcon">
|
||||||
<image src="/images/connectedDevice/device.png" />
|
<block wx:if="{{deviceSelect && deviceSelect.name}}">
|
||||||
|
<image src="/images/devices/{{deviceSelect.name}}.png" />
|
||||||
|
</block>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="equipmentName arrowAfter">
|
<view class="equipmentName arrowAfter">
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import $ from "../../utils/request";
|
|||||||
|
|
||||||
Page({
|
Page({
|
||||||
data: {
|
data: {
|
||||||
deviceConnect: false,
|
// deviceConnect: false,
|
||||||
|
|
||||||
deviceInfo: null,
|
deviceInfo: null,
|
||||||
},
|
},
|
||||||
@@ -11,58 +11,58 @@ Page({
|
|||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.getDevice();
|
this.getDevice();
|
||||||
|
|
||||||
app.globalData.ppScale.plugin.bus.subscribe("deviceConnect", (res) => {
|
// app.globalData.ppScale.plugin.bus.subscribe("deviceConnect", (res) => {
|
||||||
console.log('deviceInfo ===》deviceConnect', res);
|
// console.log('deviceInfo ===》deviceConnect', res);
|
||||||
|
|
||||||
app.globalData.ppScale.plugin.ScaleAction.startDataProgress();
|
// app.globalData.ppScale.plugin.ScaleAction.startDataProgress();
|
||||||
app.globalData.ppScale.activeProtocol = app.globalData.ppScale.plugin.ScaleAction.getActiveProtocol();
|
// app.globalData.ppScale.activeProtocol = app.globalData.ppScale.plugin.ScaleAction.getActiveProtocol();
|
||||||
|
|
||||||
app.globalData.ppScale.activeProtocol.codeUpdateMTU((res) => {
|
// app.globalData.ppScale.activeProtocol.codeUpdateMTU((res) => {
|
||||||
console.log("deviceInfo ===》codeUpdateMTU", res);
|
// console.log("deviceInfo ===》codeUpdateMTU", res);
|
||||||
|
|
||||||
this.setData({
|
// this.setData({
|
||||||
deviceConnect: true
|
// deviceConnect: true
|
||||||
})
|
// })
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
},
|
},
|
||||||
|
|
||||||
// 初始化蓝牙
|
// 初始化蓝牙
|
||||||
initBluetooth() {
|
// initBluetooth() {
|
||||||
wx.openBluetoothAdapter({
|
// wx.openBluetoothAdapter({
|
||||||
success: () => {
|
// success: () => {
|
||||||
this.getDeviceSettingList();
|
// this.getDeviceSettingList();
|
||||||
},
|
// },
|
||||||
fail: (err) => {
|
// fail: (err) => {
|
||||||
if (err.errCode === 10001) {
|
// if (err.errCode === 10001) {
|
||||||
wx.showModal({
|
// wx.showModal({
|
||||||
title: "提示",
|
// title: "提示",
|
||||||
content: "请打开手机蓝牙",
|
// content: "请打开手机蓝牙",
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
|
|
||||||
getDeviceSettingList() {
|
// getDeviceSettingList() {
|
||||||
let seviceList = [];
|
// let seviceList = [];
|
||||||
app.globalData.ppScale.device.setting.map(item => {
|
// app.globalData.ppScale.device.setting.map(item => {
|
||||||
if(this.data.deviceInfo.type === item.deviceName) {
|
// if(this.data.deviceInfo.type === item.deviceName) {
|
||||||
seviceList.push(item);
|
// seviceList.push(item);
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
if(seviceList && seviceList.length) {
|
// if(seviceList && seviceList.length) {
|
||||||
app.globalData.ppScale.plugin.Blue.setDeviceSetting(seviceList);
|
// app.globalData.ppScale.plugin.Blue.setDeviceSetting(seviceList);
|
||||||
app.globalData.ppScale.plugin.Blue.start(seviceList[0].deviceName, false);
|
// app.globalData.ppScale.plugin.Blue.start(seviceList[0].deviceName, false);
|
||||||
app.globalData.ppScale.plugin.bus.subscribe("devicesList", (res) => {
|
// app.globalData.ppScale.plugin.bus.subscribe("devicesList", (res) => {
|
||||||
let fIndex = res.findIndex(item => item.deviceId === this.data.deviceInfo.deviceId);
|
// let fIndex = res.findIndex(item => item.deviceId === this.data.deviceInfo.deviceId);
|
||||||
if (fIndex > -1) {
|
// if (fIndex > -1) {
|
||||||
app.globalData.ppScale.plugin.Blue.stopBluetoothDevicesDiscovery();
|
// app.globalData.ppScale.plugin.Blue.stopBluetoothDevicesDiscovery();
|
||||||
app.globalData.ppScale.plugin.Blue.createBLEConnection(res[fIndex]);
|
// app.globalData.ppScale.plugin.Blue.createBLEConnection(res[fIndex]);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
|
|
||||||
// 获取已经绑定的设备列表
|
// 获取已经绑定的设备列表
|
||||||
getDevice() {
|
getDevice() {
|
||||||
@@ -71,14 +71,14 @@ Page({
|
|||||||
this.setData({
|
this.setData({
|
||||||
deviceInfo: res.result[0]
|
deviceInfo: res.result[0]
|
||||||
})
|
})
|
||||||
this.initBluetooth();
|
// this.initBluetooth();
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
delDevice() {
|
delDevice() {
|
||||||
if(this.data.deviceConnect) {
|
// if(this.data.deviceConnect) {
|
||||||
app.globalData.ppScale.activeProtocol.codeClearDeviceData("00", (res) => {
|
// app.globalData.ppScale.activeProtocol.codeClearDeviceData("00", (res) => {
|
||||||
console.log("deviceInfo === codeClearDeviceData", res);
|
// console.log("deviceInfo === codeClearDeviceData", res);
|
||||||
|
|
||||||
let scaleDeviceId = this.data.deviceInfo.macAddress.replace(/:/g, '');
|
let scaleDeviceId = this.data.deviceInfo.macAddress.replace(/:/g, '');
|
||||||
let params = {
|
let params = {
|
||||||
@@ -95,18 +95,18 @@ Page({
|
|||||||
})
|
})
|
||||||
}, 1500);
|
}, 1500);
|
||||||
});
|
});
|
||||||
})
|
// })
|
||||||
} else {
|
// } else {
|
||||||
wx.showToast({
|
// wx.showToast({
|
||||||
icon: "none",
|
// icon: "none",
|
||||||
title: "删除失败,请靠近设备并点亮后再试"
|
// title: "删除失败,请靠近设备并点亮后再试"
|
||||||
})
|
// })
|
||||||
app.globalData.ppScale.plugin.Blue.stop();
|
// app.globalData.ppScale.plugin.Blue.stop();
|
||||||
this.getDeviceSettingList();
|
// this.getDeviceSettingList();
|
||||||
}
|
// }
|
||||||
},
|
},
|
||||||
|
|
||||||
onUnload() {
|
// onUnload() {
|
||||||
app.globalData.ppScale.plugin.Blue.stop();
|
// app.globalData.ppScale.plugin.Blue.stop();
|
||||||
}
|
// }
|
||||||
})
|
})
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
<view class="device">
|
<view class="device">
|
||||||
<view>
|
<view>
|
||||||
<image src="/images/deviceInfo/device.png" />
|
<block wx:if="{{deviceInfo && deviceInfo.type}}">
|
||||||
|
<image src="/images/devices/{{deviceInfo.type}}.png" />
|
||||||
|
</block>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view>{{deviceInfo.equipmentName}}</view>
|
<view>{{deviceInfo.equipmentName}}</view>
|
||||||
@@ -18,8 +20,8 @@
|
|||||||
<view>{{deviceInfo.equipmentCode}}</view>
|
<view>{{deviceInfo.equipmentCode}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view>配置Wi-Fi</view>
|
<view>Wi-Fi名称</view>
|
||||||
<view class="arrowAfter" style="padding-right: 30rpx;">{{deviceInfo.wifiName}}</view>
|
<view>{{deviceInfo.wifiName}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view>成员</view>
|
<view>成员</view>
|
||||||
|
|||||||
+15
-9
@@ -76,17 +76,23 @@ Page({
|
|||||||
|
|
||||||
// 添加设备
|
// 添加设备
|
||||||
openSearchDevice() {
|
openSearchDevice() {
|
||||||
let token = this.data.token;
|
// let token = this.data.token;
|
||||||
let userInfo = this.data.userInfo;
|
// let userInfo = this.data.userInfo;
|
||||||
if (token && userInfo) {
|
// if (token && userInfo) {
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: "/pages/searchDevice/searchDevice"
|
url: "/pages/searchDevice/searchDevice"
|
||||||
})
|
})
|
||||||
} else {
|
// } else {
|
||||||
wx.showToast({
|
// wx.showToast({
|
||||||
icon: "none",
|
// icon: "none",
|
||||||
title: "请先登录"
|
// title: "请先登录"
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
|
},
|
||||||
|
|
||||||
|
openDeviceInfo() {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: "/pages/deviceInfo/deviceInfo"
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
+21
-16
@@ -6,12 +6,7 @@
|
|||||||
<view class="title">
|
<view class="title">
|
||||||
<view>
|
<view>
|
||||||
<view>
|
<view>
|
||||||
<block wx:if="{{userInfo && userInfo.avatar}}">
|
<image src="/images/home/user.png" />
|
||||||
<image src="{{userInfo.avatar}}" />
|
|
||||||
</block>
|
|
||||||
<block wx:else>
|
|
||||||
<image src="/images/home/user.png" />
|
|
||||||
</block>
|
|
||||||
</view>
|
</view>
|
||||||
<block wx:if="{{userInfo && token}}">
|
<block wx:if="{{userInfo && token}}">
|
||||||
<view>{{userInfo.realname}}</view>
|
<view>{{userInfo.realname}}</view>
|
||||||
@@ -24,14 +19,24 @@
|
|||||||
<view>注重更好的健康生活品质</view>
|
<view>注重更好的健康生活品质</view>
|
||||||
<view></view>
|
<view></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="device">
|
<block wx:if="{{deviceList && deviceList.length}}">
|
||||||
<view>请添加设备</view>
|
<view class="device" bind:tap="openDeviceInfo">
|
||||||
<view>添加设备后,解锁更多体验</view>
|
<view>
|
||||||
<block wx:if="{{userInfo && token}}">
|
<image src="/images/devices/{{deviceList[0].type}}.png" />
|
||||||
<view bind:tap="openSearchDevice">添加设备</view>
|
</view>
|
||||||
</block>
|
<view>设备名称:{{deviceList[0].equipmentName}}</view>
|
||||||
<block wx:else>
|
</view>
|
||||||
<view bind:tap="openLoginOrReg">登录/注册</view>
|
</block>
|
||||||
</block>
|
<block wx:else>
|
||||||
</view>
|
<view class="addDevice">
|
||||||
|
<view>请添加设备</view>
|
||||||
|
<view>添加设备后,解锁更多体验</view>
|
||||||
|
<!-- <block wx:if="{{userInfo && token}}"> -->
|
||||||
|
<view bind:tap="openSearchDevice">添加设备</view>
|
||||||
|
<!-- </block>
|
||||||
|
<block wx:else>
|
||||||
|
<view bind:tap="openLoginOrReg">登录/注册</view>
|
||||||
|
</block> -->
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
</view>
|
</view>
|
||||||
+23
-3
@@ -80,11 +80,31 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.device {
|
.device {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device>view:nth-of-type(1) {
|
||||||
|
width: 500rpx;
|
||||||
|
height: 500rpx;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device>view:nth-of-type(2) {
|
||||||
|
color: #ffffff;
|
||||||
|
width: 100%;
|
||||||
|
height: 32rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 32rpx;
|
||||||
|
line-height: 32rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.addDevice {
|
||||||
width: 580rpx;
|
width: 580rpx;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.device>view:nth-of-type(1) {
|
.addDevice>view:nth-of-type(1) {
|
||||||
color: #FFFFFF;
|
color: #FFFFFF;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 36rpx;
|
height: 36rpx;
|
||||||
@@ -95,7 +115,7 @@
|
|||||||
margin-bottom: 30rpx;
|
margin-bottom: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.device>view:nth-of-type(2) {
|
.addDevice>view:nth-of-type(2) {
|
||||||
color: #FFFFFF;
|
color: #FFFFFF;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 30rpx;
|
height: 30rpx;
|
||||||
@@ -105,7 +125,7 @@
|
|||||||
margin-bottom: 80rpx;
|
margin-bottom: 80rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.device>view:nth-of-type(3) {
|
.addDevice>view:nth-of-type(3) {
|
||||||
color: #FFFFFF;
|
color: #FFFFFF;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 106rpx;
|
height: 106rpx;
|
||||||
|
|||||||
@@ -10,7 +10,3 @@
|
|||||||
<view>{{initText}}</view>
|
<view>{{initText}}</view>
|
||||||
<view>请轻轻踩秤,保证屏幕亮起</view>
|
<view>请轻轻踩秤,保证屏幕亮起</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<block wx:for="{{devicesList}}" wx:key="index">
|
|
||||||
<view>{{item.name}}</view>
|
|
||||||
</block>
|
|
||||||
@@ -2,8 +2,10 @@ const app = getApp();
|
|||||||
|
|
||||||
Page({
|
Page({
|
||||||
data: {
|
data: {
|
||||||
|
type: true,
|
||||||
|
|
||||||
wifiInfo: null,
|
wifiInfo: null,
|
||||||
password: "mimahaojige8"
|
password: ""
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
@@ -18,6 +20,12 @@ Page({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
inputTypeChange() {
|
||||||
|
this.setData({
|
||||||
|
type: !this.data.type
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
// 打开配网
|
// 打开配网
|
||||||
openSetNetwork() {
|
openSetNetwork() {
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
|
|||||||
@@ -9,13 +9,13 @@
|
|||||||
<view>密码</view>
|
<view>密码</view>
|
||||||
<view>
|
<view>
|
||||||
<input
|
<input
|
||||||
type="password"
|
password="{{type}}"
|
||||||
value="{{password}}"
|
value="{{password}}"
|
||||||
bindinput="passwordInput"
|
bindinput="passwordInput"
|
||||||
placeholder="8~16位密码"
|
placeholder="8~16位密码"
|
||||||
placeholder-class="placeholderClass" />
|
placeholder-class="placeholderClass" />
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view bind:tap="inputTypeChange">
|
||||||
<image src="/images/setWifiPassword/open.png" />
|
<image src="/images/setWifiPassword/open.png" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
Reference in New Issue
Block a user