Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
640966ae61 | ||
|
|
8b91edcef7 | ||
|
|
55911b1fce | ||
|
|
f7e7f7c561 | ||
|
|
497b6d9a56 | ||
|
|
925977acef | ||
|
|
2a24dc0d4d | ||
|
|
eb16621b5f | ||
|
|
5ec3b1c84b | ||
|
|
f63ebe0f36 | ||
|
|
f8957b0852 | ||
|
|
4fc829a81f | ||
|
|
4e2e8fb899 | ||
|
|
04740730da | ||
|
|
8fd53c074d | ||
|
|
571b222ad6 | ||
|
|
0b3eb25a62 | ||
|
|
8cb7a11fbe | ||
|
|
65acceba2a | ||
|
|
e7c890fee4 | ||
|
|
de8fa1fca8 | ||
|
|
5096ceaa53 | ||
|
|
8e1be13602 | ||
|
|
228c68abca | ||
|
|
3b65d2fb0d | ||
|
|
a38db163bd | ||
|
|
c86f3c3d5c | ||
|
|
d2c914df79 | ||
|
|
7a662d7c34 | ||
|
|
912fafc539 | ||
|
|
b157ef5d57 | ||
|
|
c41c7d9f63 | ||
|
|
0a6578c2c9 | ||
|
|
f89f0f9531 | ||
|
|
05b388020b | ||
|
|
e20638030b | ||
|
|
1e3f1934b1 | ||
|
|
81f9301c64 | ||
|
|
6924a1ff5b | ||
|
|
21e69f06c3 | ||
|
|
efa959d6d3 |
@@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
* Eslint config file
|
|
||||||
* Documentation: https://eslint.org/docs/user-guide/configuring/
|
|
||||||
* Install the Eslint extension before using this feature.
|
|
||||||
*/
|
|
||||||
module.exports = {
|
|
||||||
env: {
|
|
||||||
es6: true,
|
|
||||||
browser: true,
|
|
||||||
node: true,
|
|
||||||
},
|
|
||||||
ecmaFeatures: {
|
|
||||||
modules: true,
|
|
||||||
},
|
|
||||||
parserOptions: {
|
|
||||||
ecmaVersion: 2018,
|
|
||||||
sourceType: 'module',
|
|
||||||
},
|
|
||||||
globals: {
|
|
||||||
wx: true,
|
|
||||||
App: true,
|
|
||||||
Page: true,
|
|
||||||
getCurrentPages: true,
|
|
||||||
getApp: true,
|
|
||||||
Component: true,
|
|
||||||
requirePlugin: true,
|
|
||||||
requireMiniProgram: true,
|
|
||||||
},
|
|
||||||
// extends: 'eslint:recommended',
|
|
||||||
rules: {},
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# 默认忽略的文件
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# 已忽略包含查询文件的默认文件夹
|
||||||
|
/queries/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
|
# 基于编辑器的 HTTP 客户端请求
|
||||||
|
/httpRequests/
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="WEB_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ClaudeCodeTabState">
|
||||||
|
<option name="tabCount" value="3" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="KubernetesApiPersistence">{}</component>
|
||||||
|
<component name="KubernetesApiProvider">{
|
||||||
|
"isMigrated": true
|
||||||
|
}</component>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/bodyWeight.iml" filepath="$PROJECT_DIR$/.idea/bodyWeight.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -1,238 +0,0 @@
|
|||||||
App({
|
|
||||||
onLaunch() {
|
|
||||||
this.initPpScale();
|
|
||||||
},
|
|
||||||
|
|
||||||
globalData: {
|
|
||||||
// wx.request 请求的服务地址
|
|
||||||
wxRequestUrl: "https://device.shuziweidao.com/gateway/",
|
|
||||||
// wxRequestUrl: "http://192.168.1.12:8889/",
|
|
||||||
|
|
||||||
// 秤的所有信息
|
|
||||||
ppScale: {
|
|
||||||
plugin: null,
|
|
||||||
activeProtocol: null,
|
|
||||||
domain: "http://device.shuziweidao.com:80/gateway",
|
|
||||||
// domain: "http://192.168.1.12:8889",
|
|
||||||
wifi: {
|
|
||||||
ssid: "",
|
|
||||||
password: ""
|
|
||||||
},
|
|
||||||
options: {
|
|
||||||
key: "lefudc91611833e18d94",
|
|
||||||
secret: "eQ50JYimMp0X7uhNLj6D3lTEk4TUUvEG7dvaqKM9t1U="
|
|
||||||
},
|
|
||||||
device: {
|
|
||||||
setting: [{
|
|
||||||
"advLength": 999,
|
|
||||||
"calorieStatus": 0,
|
|
||||||
"createBy": null,
|
|
||||||
"deviceAccuracyType": 2,
|
|
||||||
"deviceCalcuteType": 3,
|
|
||||||
"deviceConnectType": 2,
|
|
||||||
"deviceFuncType": 223,
|
|
||||||
"deviceName": "CF568_G",
|
|
||||||
"devicePowerType": 3,
|
|
||||||
"deviceProtocolType": 3,
|
|
||||||
"deviceType": 1,
|
|
||||||
"deviceUnitType": "0,1,11",
|
|
||||||
"id": 65,
|
|
||||||
"imgUrl": null,
|
|
||||||
"macAddressStart": 6,
|
|
||||||
"remark": null,
|
|
||||||
"sign": "FF",
|
|
||||||
"status": 0,
|
|
||||||
"uhStatus": 1,
|
|
||||||
"updateBy": null
|
|
||||||
}, {
|
|
||||||
"advLength": 999,
|
|
||||||
"calorieStatus": 0,
|
|
||||||
"createBy": null,
|
|
||||||
"deviceAccuracyType": 2,
|
|
||||||
"deviceCalcuteType": 3,
|
|
||||||
"deviceConnectType": 2,
|
|
||||||
"deviceFuncType": 223,
|
|
||||||
"deviceName": "YX-B4-568-BW",
|
|
||||||
"devicePowerType": 3,
|
|
||||||
"deviceProtocolType": 3,
|
|
||||||
"deviceType": 1,
|
|
||||||
"deviceUnitType": "0,1,11",
|
|
||||||
"id": 65,
|
|
||||||
"imgUrl": null,
|
|
||||||
"macAddressStart": 6,
|
|
||||||
"remark": null,
|
|
||||||
"sign": "FF",
|
|
||||||
"status": 0,
|
|
||||||
"uhStatus": 1,
|
|
||||||
"updateBy": null
|
|
||||||
}, {
|
|
||||||
"advLength": 999,
|
|
||||||
"calorieStatus": 0,
|
|
||||||
"createBy": null,
|
|
||||||
"deviceAccuracyType": 2,
|
|
||||||
"deviceCalcuteType": 4,
|
|
||||||
"deviceConnectType": 2,
|
|
||||||
"deviceFuncType": 65759,
|
|
||||||
"deviceName": "CF636_G",
|
|
||||||
"devicePowerType": 3,
|
|
||||||
"deviceProtocolType": 3,
|
|
||||||
"deviceType": 1,
|
|
||||||
"deviceUnitType": "0,1,2",
|
|
||||||
"id": 216,
|
|
||||||
"imgUrl": null,
|
|
||||||
"macAddressStart": 6,
|
|
||||||
"remark": null,
|
|
||||||
"sign": "FF",
|
|
||||||
"status": 0,
|
|
||||||
"uhStatus": 1,
|
|
||||||
"updateBy": null
|
|
||||||
}, {
|
|
||||||
"advLength": 999,
|
|
||||||
"calorieStatus": 0,
|
|
||||||
"createBy": null,
|
|
||||||
"deviceAccuracyType": 2,
|
|
||||||
"deviceCalcuteType": 4,
|
|
||||||
"deviceConnectType": 2,
|
|
||||||
"deviceFuncType": 65759,
|
|
||||||
"deviceName": "YX-B8-636-BW",
|
|
||||||
"devicePowerType": 3,
|
|
||||||
"deviceProtocolType": 3,
|
|
||||||
"deviceType": 1,
|
|
||||||
"deviceUnitType": "0,1,2",
|
|
||||||
"id": 216,
|
|
||||||
"imgUrl": null,
|
|
||||||
"macAddressStart": 6,
|
|
||||||
"remark": null,
|
|
||||||
"sign": "FF",
|
|
||||||
"status": 0,
|
|
||||||
"uhStatus": 1,
|
|
||||||
"updateBy": null
|
|
||||||
}, {
|
|
||||||
"advLength": 999,
|
|
||||||
"calorieStatus": 0,
|
|
||||||
"createBy": null,
|
|
||||||
"deviceAccuracyType": 2,
|
|
||||||
"deviceCalcuteType": 4,
|
|
||||||
"deviceConnectType": 2,
|
|
||||||
"deviceFuncType": 223,
|
|
||||||
"deviceName": "CF577",
|
|
||||||
"devicePowerType": 3,
|
|
||||||
"deviceProtocolType": 3,
|
|
||||||
"deviceType": 1,
|
|
||||||
"deviceUnitType": "0,1,11",
|
|
||||||
"id": 51,
|
|
||||||
"imgUrl": null,
|
|
||||||
"macAddressStart": 6,
|
|
||||||
"remark": null,
|
|
||||||
"sign": "FF",
|
|
||||||
"status": 0,
|
|
||||||
"uhStatus": 1,
|
|
||||||
"updateBy": null
|
|
||||||
}], // 即将要搜索周边秤的配置
|
|
||||||
list: [], // 根据配置搜索到秤的列表
|
|
||||||
name: "",
|
|
||||||
mac: null, // 选中的设备mac地址/SN码
|
|
||||||
connection: null, // 默认选中连接的设备
|
|
||||||
connectState: null, // 当前连接设备的状态
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
_callbacks: {} // 用于存储所有 globalData 属性的监听回调
|
|
||||||
},
|
|
||||||
|
|
||||||
initPpScale() {
|
|
||||||
this.globalData.ppScale.plugin = requirePlugin('ppScale-plugin');
|
|
||||||
|
|
||||||
// 蓝牙连接状态监听
|
|
||||||
this.globalData.ppScale.plugin.bus.subscribe("connectState", (res) => {
|
|
||||||
console.log("app.js ===> connectState", res);
|
|
||||||
this.setGlobalData('ppScale.device.connectState', res);
|
|
||||||
|
|
||||||
// 连接失败则重新连接
|
|
||||||
if (res == this.globalData.ppScale.plugin.BLUE_STATE.CONNECTFAILED) {
|
|
||||||
this.reconnectDevice()
|
|
||||||
}
|
|
||||||
wx.hideLoading();
|
|
||||||
});
|
|
||||||
|
|
||||||
// 同步时间
|
|
||||||
this.globalData.ppScale.plugin.bus.subscribe("syncDeviceTimeSuccess", (res) => {
|
|
||||||
console.log("app.js ===> syncDeviceTimeSuccess", res);
|
|
||||||
})
|
|
||||||
|
|
||||||
// 设备自动断开监听
|
|
||||||
this.globalData.ppScale.plugin.bus.subscribe("deviceWillDisconnect", (res) => {
|
|
||||||
console.log("app.js ===> deviceWillDisconnect", res);
|
|
||||||
|
|
||||||
this.reconnectDevice();
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
reconnectDevice() {
|
|
||||||
this.globalData.ppScale.plugin.Blue.disconnect((disres) => {
|
|
||||||
if (disres.errCode == 0) {
|
|
||||||
this.globalData.ppScale.plugin.Blue.startBluetoothDevicesDiscovery();
|
|
||||||
} else {
|
|
||||||
this.reconnectDevice();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 注册 globalData 某个属性的监听
|
|
||||||
* @param {string} keyPath 要监听的 globalData 属性路径,例如 'ppScale.device.connectState'
|
|
||||||
* @param {function} callback 属性变化时执行的回调函数 (newValue, oldValue) => {}
|
|
||||||
*/
|
|
||||||
watch(keyPath, callback) {
|
|
||||||
if (!this.globalData._callbacks[keyPath]) {
|
|
||||||
this.globalData._callbacks[keyPath] = [];
|
|
||||||
}
|
|
||||||
this.globalData._callbacks[keyPath].push(callback);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 取消 globalData 某个属性的监听
|
|
||||||
* @param {string} keyPath 要取消监听的 globalData 属性路径
|
|
||||||
* @param {function} callback 之前注册的回调函数
|
|
||||||
*/
|
|
||||||
unwatch(keyPath, callback) {
|
|
||||||
if (this.globalData._callbacks[keyPath]) {
|
|
||||||
this.globalData._callbacks[keyPath] = this.globalData._callbacks[keyPath].filter(cb => cb !== callback);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置 globalData 的值并触发所有相关监听器
|
|
||||||
* 支持点表示法设置嵌套属性,例如 'ppScale.device.connectState'
|
|
||||||
* @param {string} keyPath 要设置的 globalData 属性路径
|
|
||||||
* @param {*} value 要设置的新值
|
|
||||||
*/
|
|
||||||
setGlobalData(keyPath, value) {
|
|
||||||
const keys = keyPath.split('.');
|
|
||||||
let current = this.globalData;
|
|
||||||
let oldValue = undefined;
|
|
||||||
|
|
||||||
// 遍历到目标属性的父级
|
|
||||||
for (let i = 0; i < keys.length - 1; i++) {
|
|
||||||
if (!current[keys[i]]) {
|
|
||||||
current[keys[i]] = {}; // 如果路径不存在,创建空对象
|
|
||||||
}
|
|
||||||
current = current[keys[i]];
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取旧值
|
|
||||||
oldValue = current[keys[keys.length - 1]];
|
|
||||||
|
|
||||||
// 只有当值发生变化时才更新并通知
|
|
||||||
if (oldValue !== value) {
|
|
||||||
current[keys[keys.length - 1]] = value; // 设置新值
|
|
||||||
|
|
||||||
// 触发监听器
|
|
||||||
if (this.globalData._callbacks[keyPath]) {
|
|
||||||
this.globalData._callbacks[keyPath].forEach(callback => {
|
|
||||||
callback(value, oldValue);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
{
|
|
||||||
"pages": [
|
|
||||||
"pages/home/home",
|
|
||||||
"pages/searchDevice/searchDevice",
|
|
||||||
"pages/configureDevice/configureDevice",
|
|
||||||
"pages/my/my",
|
|
||||||
"pages/userInfo/userInfo",
|
|
||||||
"pages/deviceInfo/deviceInfo",
|
|
||||||
"pages/replaceNetwork/replaceNetwork"
|
|
||||||
],
|
|
||||||
"window": {
|
|
||||||
"navigationBarTitleText": "",
|
|
||||||
"navigationBarTextStyle": "black",
|
|
||||||
"navigationBarBackgroundColor": "#ffffff"
|
|
||||||
},
|
|
||||||
"tabBar": {
|
|
||||||
"color": "#808080",
|
|
||||||
"selectedColor": "#1385FA",
|
|
||||||
"borderStyle": "white",
|
|
||||||
"list": [{
|
|
||||||
"pagePath": "pages/home/home",
|
|
||||||
"iconPath": "/images/tabBar/home.png",
|
|
||||||
"selectedIconPath": "/images/tabBar/home_.png",
|
|
||||||
"text": "首页"
|
|
||||||
}, {
|
|
||||||
"pagePath": "pages/my/my",
|
|
||||||
"iconPath": "/images/tabBar/my.png",
|
|
||||||
"selectedIconPath": "/images/tabBar/my_.png",
|
|
||||||
"text": "我的"
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
"style": "v2",
|
|
||||||
"plugins": {
|
|
||||||
"ppScale-plugin": {
|
|
||||||
"version": "1.2.15",
|
|
||||||
"provider": "wx0ffb48417ce6345c"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"permission": {
|
|
||||||
"scope.userLocation": {
|
|
||||||
"desc": "您的位置信息将用于发现附近的蓝牙设备,以便连接蓝牙秤。"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"requiredPrivateInfos": [
|
|
||||||
"getLocation"
|
|
||||||
],
|
|
||||||
"sitemapLocation": "sitemap.json",
|
|
||||||
"lazyCodeLoading": "requiredComponents"
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
page {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
box-sizing: border-box;
|
|
||||||
background-color: #F5F7FB;
|
|
||||||
}
|
|
||||||
|
|
||||||
image {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
button {
|
|
||||||
all: unset;
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
button::after {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.scrollView {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.arrowAfter {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.arrowAfter::after {
|
|
||||||
position: absolute;
|
|
||||||
right: 6rpx;
|
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
margin: auto;
|
|
||||||
content: "";
|
|
||||||
width: 12rpx;
|
|
||||||
height: 12rpx;
|
|
||||||
border-left: 5rpx solid #b6b6b6;
|
|
||||||
border-top: 5rpx solid #b6b6b6;
|
|
||||||
transform: rotate(135deg);
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
const app = getApp();
|
|
||||||
|
|
||||||
Component({
|
|
||||||
data: {
|
|
||||||
devices: []
|
|
||||||
},
|
|
||||||
|
|
||||||
// 生命周期方法
|
|
||||||
lifetimes: {
|
|
||||||
attached() {
|
|
||||||
this.setData({
|
|
||||||
devices: app.globalData.ppScale.device.list
|
|
||||||
})
|
|
||||||
},
|
|
||||||
detached() {
|
|
||||||
this.setData({
|
|
||||||
devices: []
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 组件的方法
|
|
||||||
methods: {
|
|
||||||
selectDevice(e) {
|
|
||||||
let device = this.data.devices[e.currentTarget.dataset.i];
|
|
||||||
this.triggerEvent('deviceEvent', {
|
|
||||||
device: device,
|
|
||||||
status: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"component": true,
|
|
||||||
"usingComponents": {}
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
<view class="configureDevice1">
|
|
||||||
<view class="title">蓝牙</view>
|
|
||||||
<view class="describe">可用设备</view>
|
|
||||||
<view class="deviceName">
|
|
||||||
<block wx:for="{{devices}}" wx:key="index">
|
|
||||||
<view data-i="{{index}}" bind:tap="selectDevice">
|
|
||||||
<view>
|
|
||||||
<image src="/images/configureDevice/bluetooth.png"/>
|
|
||||||
</view>
|
|
||||||
<view>
|
|
||||||
<view>{{item.name}}</view>
|
|
||||||
<!-- <view>正在配对</view> -->
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</block>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
.configureDevice1 {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
padding: 60rpx 60rpx 0;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
|
||||||
color: #252535;
|
|
||||||
width: 100%;
|
|
||||||
height: 48rpx;
|
|
||||||
font-size: 48rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
line-height: 48rpx;
|
|
||||||
margin-bottom: 48rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.describe {
|
|
||||||
color: #B6B6B6;
|
|
||||||
width: 100%;
|
|
||||||
height: 30rpx;
|
|
||||||
font-size: 30rpx;
|
|
||||||
line-height: 30rpx;
|
|
||||||
margin-bottom: 40rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.deviceName {
|
|
||||||
width: 100%;
|
|
||||||
height: calc(100% - 166rpx);
|
|
||||||
}
|
|
||||||
|
|
||||||
.deviceName>view {
|
|
||||||
width: 100%;
|
|
||||||
height: 80rpx;
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: nowrap;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 32rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.deviceName>view>view:nth-of-type(1) {
|
|
||||||
width: 80rpx;
|
|
||||||
height: 80rpx;
|
|
||||||
overflow: hidden;
|
|
||||||
border-radius: 50%;
|
|
||||||
margin-right: 22rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.deviceName>view>view:nth-of-type(2) {
|
|
||||||
flex: 1;
|
|
||||||
width: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.deviceName>view>view:nth-of-type(2)>view:nth-of-type(1) {
|
|
||||||
color: #252535;
|
|
||||||
width: 100%;
|
|
||||||
height: 32rpx;
|
|
||||||
font-size: 32rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
line-height: 32rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.deviceName>view>view:nth-of-type(2)>view:nth-of-type(2) {
|
|
||||||
color: #808080;
|
|
||||||
width: 100%;
|
|
||||||
height: 28rpx;
|
|
||||||
font-size: 28rpx;
|
|
||||||
line-height: 28rpx;
|
|
||||||
margin-top: 10rpx;
|
|
||||||
}
|
|
||||||
@@ -1,294 +0,0 @@
|
|||||||
const app = getApp();
|
|
||||||
import $ from "../../utils/request";
|
|
||||||
|
|
||||||
Component({
|
|
||||||
data: {
|
|
||||||
BLUE_STATE: {},
|
|
||||||
device: null,
|
|
||||||
connectState: "",
|
|
||||||
|
|
||||||
userId: "",
|
|
||||||
realname: "",
|
|
||||||
sex: {
|
|
||||||
index: "",
|
|
||||||
data: [{
|
|
||||||
id: 1,
|
|
||||||
name: '男'
|
|
||||||
}, {
|
|
||||||
id: 2,
|
|
||||||
name: '女'
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
birthday: {
|
|
||||||
label: "1980年01月01日",
|
|
||||||
value: "1980-01-01"
|
|
||||||
},
|
|
||||||
height: {
|
|
||||||
index: 50,
|
|
||||||
data: Array.from({ length: 200 - 120 + 1 }, (_, i) => i + 120)
|
|
||||||
},
|
|
||||||
weight: {
|
|
||||||
index: [60, 0],
|
|
||||||
data: [Array.from({ length: 120 + 1 }, (_, i) => i + 10), Array.from({ length: 10 }, (_, i) => i)]
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
// 存储回调函数的引用,以便在 detached 时取消监听
|
|
||||||
_connectStateWatcher: null,
|
|
||||||
|
|
||||||
lifetimes: {
|
|
||||||
attached() {
|
|
||||||
console.log(`[Component] connectState 获取: ${app.globalData.ppScale.device.connectState}`);
|
|
||||||
this.setData({
|
|
||||||
BLUE_STATE: app.globalData.ppScale.plugin.BLUE_STATE,
|
|
||||||
connectState: app.globalData.ppScale.device.connectState,
|
|
||||||
device: app.globalData.ppScale.device.connection
|
|
||||||
})
|
|
||||||
this._connectStateWatcher = (newValue, oldValue) => {
|
|
||||||
console.log(`[Component] connectState 变化: ${oldValue} -> ${newValue}`);
|
|
||||||
this.setData({
|
|
||||||
connectState: newValue || ''
|
|
||||||
});
|
|
||||||
};
|
|
||||||
app.watch('ppScale.device.connectState', this._connectStateWatcher);
|
|
||||||
|
|
||||||
let userInfo = wx.getStorageSync("userInfo") || null;
|
|
||||||
if(userInfo) {
|
|
||||||
let [year, month, day] = userInfo.birthday.split("-");
|
|
||||||
|
|
||||||
this.setData({
|
|
||||||
userId: userInfo.userId,
|
|
||||||
realname: userInfo.realname,
|
|
||||||
["sex.index"]: this.data.sex.data.findIndex(item => {return item.id === userInfo.sex}),
|
|
||||||
birthday: {
|
|
||||||
label: year + "年" + month + "月" + day + "日",
|
|
||||||
value: userInfo.birthday
|
|
||||||
},
|
|
||||||
["height.index"]: this.data.height.data.findIndex(item => {return item === userInfo.height}),
|
|
||||||
})
|
|
||||||
|
|
||||||
if(userInfo.weight) {
|
|
||||||
const integerPart = Math.floor(userInfo.weight);
|
|
||||||
const decimalPart = Math.round((userInfo.weight - integerPart) * 10);
|
|
||||||
const integerIndex = this.data.weight.data[0].indexOf(integerPart);
|
|
||||||
const decimalIndex = this.data.weight.data[1].indexOf(decimalPart);
|
|
||||||
this.setData({
|
|
||||||
["weight.index"]: [integerIndex !== -1 ? integerIndex : null, decimalIndex !== -1 ? decimalIndex : null],
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
detached() {
|
|
||||||
// 4. 在组件销毁时取消监听,防止内存泄漏
|
|
||||||
if (this._connectStateWatcher) {
|
|
||||||
app.unwatch('ppScale.device.connectState', this._connectStateWatcher);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 组件的方法
|
|
||||||
methods: {
|
|
||||||
// 二次连接设备
|
|
||||||
connectedDevice() {
|
|
||||||
this.triggerEvent('connectedDeviceEvent', {
|
|
||||||
device: this.data.device
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
// 姓名输入
|
|
||||||
realnameInput(e) {
|
|
||||||
let realname = e.detail.value.replace(/\s+/g, '');
|
|
||||||
this.setData({
|
|
||||||
realname: realname
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
// 性别选择
|
|
||||||
sexChange(e) {
|
|
||||||
let sex = e.detail.value;
|
|
||||||
console.log(sex);
|
|
||||||
this.setData({
|
|
||||||
['sex.index']: e.detail.value
|
|
||||||
})
|
|
||||||
if(this.data.height.index === null) {
|
|
||||||
this.setData({
|
|
||||||
['height.index']: sex == 0 ? 50 : 40
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if(this.data.weight.index === null) {
|
|
||||||
this.setData({
|
|
||||||
['weight.index']: sex == 0 ? 20 : 10
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 生日选择
|
|
||||||
birthdayChange(e) {
|
|
||||||
let v = e.detail.value;
|
|
||||||
let [year, month, day] = v.split("-");
|
|
||||||
this.setData({
|
|
||||||
birthday: {
|
|
||||||
label: year + "年" + month + "月" + day + "日",
|
|
||||||
value: v
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
// 身高选择
|
|
||||||
heightChange(e) {
|
|
||||||
this.setData({
|
|
||||||
['height.index']: e.detail.value
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
// 体重选择
|
|
||||||
weightChange(e) {
|
|
||||||
console.log(e.detail.value)
|
|
||||||
this.setData({
|
|
||||||
['weight.index']: e.detail.value
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
setUserInfo() {
|
|
||||||
if(this.data.connectState == this.data.BLUE_STATE.CONNECTSUCCESS) {
|
|
||||||
if(this.data.userId) {
|
|
||||||
app.globalData.ppScale.activeProtocol.dataSyncUserInfo({
|
|
||||||
userID: this.data.userId,
|
|
||||||
userName: this.data.realname,
|
|
||||||
memberID: "",
|
|
||||||
age: this.getAge(this.data.birthday.value),
|
|
||||||
gender: this.data.sex.data[this.data.sex.index].id,
|
|
||||||
height: this.data.height.data[this.data.height.index],
|
|
||||||
isAthleteMode: 0,
|
|
||||||
currentWeight: this.data.weight.data[0][this.data.weight.index[0]] + '.' + this.data.weight.data[1][this.data.weight.index[1]],
|
|
||||||
deviceHeaderIndex: 0,
|
|
||||||
targetWeight: "",
|
|
||||||
idealWeight: "",
|
|
||||||
recentData: [],
|
|
||||||
}, (res) => {
|
|
||||||
if(res == 0) {
|
|
||||||
this.triggerEvent('deviceEvent', {
|
|
||||||
status: true
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
console.log("dataSyncUserInfo", res)
|
|
||||||
wx.showToast({
|
|
||||||
title: "用户信息下发失败,请重试。",
|
|
||||||
icon: "none"
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
let realname = this.data.realname;
|
|
||||||
let sex = this.data.sex;
|
|
||||||
let birthday = this.data.birthday;
|
|
||||||
let height = this.data.height;
|
|
||||||
let weight = this.data.weight;
|
|
||||||
if(!realname) {
|
|
||||||
wx.showToast({
|
|
||||||
icon: "none",
|
|
||||||
title: "姓名不能为空"
|
|
||||||
})
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if(sex.index === "") {
|
|
||||||
wx.showToast({
|
|
||||||
icon: "none",
|
|
||||||
title: "性别不能为空"
|
|
||||||
})
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if(!birthday.value) {
|
|
||||||
wx.showToast({
|
|
||||||
icon: "none",
|
|
||||||
title: "生日不能为空"
|
|
||||||
})
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if(height.index === "") {
|
|
||||||
wx.showToast({
|
|
||||||
icon: "none",
|
|
||||||
title: "身高不能为空"
|
|
||||||
})
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if(weight.index[0] === null && weight.index[1] === null) {
|
|
||||||
console.log(weight)
|
|
||||||
wx.showToast({
|
|
||||||
icon: "none",
|
|
||||||
title: "体重不能为空"
|
|
||||||
})
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
let sn = app.globalData.ppScale.device.mac.replace(/:/g, '');
|
|
||||||
$.ajax("weighingScale/edit/user", {
|
|
||||||
sn: sn,
|
|
||||||
realname: realname,
|
|
||||||
sex: sex.data[sex.index].id,
|
|
||||||
birthday: birthday.value,
|
|
||||||
height: height.data[height.index],
|
|
||||||
weight: weight.data[0][weight.index[0]] + '.' + weight.data[1][weight.index[1]]
|
|
||||||
}, "POST", true, "保存中...").then(res => {
|
|
||||||
$.ajax("weighingScale/select/user", {
|
|
||||||
sn: sn
|
|
||||||
}, "GET", true, "更新用户信息中...").then(res_ => {
|
|
||||||
wx.setStorageSync("userInfo", res_.result);
|
|
||||||
wx.showToast({
|
|
||||||
icon: "none",
|
|
||||||
title: res.message
|
|
||||||
})
|
|
||||||
app.globalData.ppScale.activeProtocol.dataSyncUserInfo({
|
|
||||||
userID: res_.result.userId,
|
|
||||||
userName: res_.result.realname,
|
|
||||||
memberID: "",
|
|
||||||
age: this.getAge(res_.result.birthday), //
|
|
||||||
gender: res_.result.sex, //
|
|
||||||
height: res_.result.height, //
|
|
||||||
isAthleteMode: 0,
|
|
||||||
currentWeight: res_.result.weight, //
|
|
||||||
deviceHeaderIndex: 0,
|
|
||||||
targetWeight: "",
|
|
||||||
idealWeight: "",
|
|
||||||
recentData: [],
|
|
||||||
}, (res) => {
|
|
||||||
if(res == 0) {
|
|
||||||
this.triggerEvent('deviceEvent', {
|
|
||||||
status: true
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
console.log("dataSyncUserInfo", res)
|
|
||||||
wx.showToast({
|
|
||||||
title: "用户信息下发失败,请重试。",
|
|
||||||
icon: "none"
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
wx.showToast({
|
|
||||||
title: "设备连接失败,请重试。",
|
|
||||||
icon: "none"
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 根据生日获取年龄
|
|
||||||
getAge(birthDateString) {
|
|
||||||
const birthDate = new Date(birthDateString);
|
|
||||||
const today = new Date();
|
|
||||||
|
|
||||||
let age = today.getFullYear() - birthDate.getFullYear();
|
|
||||||
const monthDiff = today.getMonth() - birthDate.getMonth();
|
|
||||||
const dayDiff = today.getDate() - birthDate.getDate();
|
|
||||||
|
|
||||||
// 如果当前月份小于出生月份,或者同月但当前日期小于出生日期,年龄需要减 1
|
|
||||||
if (monthDiff < 0 || (monthDiff === 0 && dayDiff < 0)) {
|
|
||||||
age--;
|
|
||||||
}
|
|
||||||
|
|
||||||
return age;
|
|
||||||
},
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"component": true,
|
|
||||||
"usingComponents": {}
|
|
||||||
}
|
|
||||||
@@ -1,127 +0,0 @@
|
|||||||
<view class="configureDevice2">
|
|
||||||
<view class="header">
|
|
||||||
<view>
|
|
||||||
<view>智能蓝牙秤</view>
|
|
||||||
<view>型号:{{device.name}}</view>
|
|
||||||
</view>
|
|
||||||
<view>
|
|
||||||
<block wx:if="{{device && connectState == BLUE_STATE.CONNECTSUCCESS}}">
|
|
||||||
<view style="background-color: #2AC79F;"></view>
|
|
||||||
<view style="color: #2AC79F;">连接成功</view>
|
|
||||||
</block>
|
|
||||||
<block wx:else>
|
|
||||||
<view style="background-color: #F24439;"></view>
|
|
||||||
<view bind:tap="connectedDevice" style="color: #F24439;">连接失败,点击重试</view>
|
|
||||||
</block>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="section">
|
|
||||||
<view class="from">
|
|
||||||
<view>
|
|
||||||
<view>姓名</view>
|
|
||||||
<block wx:if="{{userId}}">
|
|
||||||
<view class="valueClass">{{realname}}</view>
|
|
||||||
</block>
|
|
||||||
<block wx:else>
|
|
||||||
<view>
|
|
||||||
<view>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
value="{{realname}}"
|
|
||||||
bindinput="realnameInput"
|
|
||||||
placeholder="请输入您的姓名"
|
|
||||||
class="valueClass"
|
|
||||||
placeholder-class="placeholderClass" />
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</block>
|
|
||||||
</view>
|
|
||||||
<view>
|
|
||||||
<view>性别</view>
|
|
||||||
<block wx:if="{{userId}}">
|
|
||||||
<view class="valueClass">{{sex.data[sex.index].name}}</view>
|
|
||||||
</block>
|
|
||||||
<block wx:else>
|
|
||||||
<view class="~arrowAfter">
|
|
||||||
<view>
|
|
||||||
<picker mode="selector" bindchange="sexChange" value="{{sex.index}}" range="{{sex.data}}" range-key="name">
|
|
||||||
<block wx:if="{{sex.index === ''}}">
|
|
||||||
<view class="placeholderClass">请选择您的性别</view>
|
|
||||||
</block>
|
|
||||||
<block wx:else>
|
|
||||||
<view class="valueClass">{{sex.data[sex.index].name}}</view>
|
|
||||||
</block>
|
|
||||||
</picker>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</block>
|
|
||||||
</view>
|
|
||||||
<view>
|
|
||||||
<view>生日</view>
|
|
||||||
<block wx:if="{{userId}}">
|
|
||||||
<view class="valueClass">{{birthday.label}}</view>
|
|
||||||
</block>
|
|
||||||
<block wx:else>
|
|
||||||
<view class="~arrowAfter">
|
|
||||||
<view>
|
|
||||||
<picker mode="date" bindchange="birthdayChange" value="{{birthday.value}}">
|
|
||||||
<block wx:if="{{birthday.value === ''}}">
|
|
||||||
<view class="placeholderClass">请选择您的生日</view>
|
|
||||||
</block>
|
|
||||||
<block wx:else>
|
|
||||||
<view class="valueClass">{{birthday.label}}</view>
|
|
||||||
</block>
|
|
||||||
</picker>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</block>
|
|
||||||
</view>
|
|
||||||
<view>
|
|
||||||
<view>身高</view>
|
|
||||||
<block wx:if="{{userId}}">
|
|
||||||
<view class="valueClass">{{height.data[height.index]}}cm</view>
|
|
||||||
</block>
|
|
||||||
<block wx:else>
|
|
||||||
<view class="~arrowAfter">
|
|
||||||
<view>
|
|
||||||
<picker mode="selector" bindchange="heightChange" value="{{height.index}}" range="{{height.data}}">
|
|
||||||
<block wx:if="{{height.index === ''}}">
|
|
||||||
<view class="placeholderClass">请选择您的身高</view>
|
|
||||||
</block>
|
|
||||||
<block wx:else>
|
|
||||||
<view class="valueClass">{{height.data[height.index]}}</view>
|
|
||||||
</block>
|
|
||||||
</picker>
|
|
||||||
</view>
|
|
||||||
<view>cm</view>
|
|
||||||
</view>
|
|
||||||
</block>
|
|
||||||
</view>
|
|
||||||
<view>
|
|
||||||
<view>体重</view>
|
|
||||||
<block wx:if="{{userId}}">
|
|
||||||
<view class="valueClass">{{weight.data[0][weight.index[0]]}}.{{weight.data[1][weight.index[1]]}}kg</view>
|
|
||||||
</block>
|
|
||||||
<block wx:else>
|
|
||||||
<view class="~arrowAfter">
|
|
||||||
<view>
|
|
||||||
<picker mode="multiSelector" bindchange="weightChange" value="{{weight.index}}" range="{{weight.data}}">
|
|
||||||
<block wx:if="{{weight.index && weight.index.length && weight.index[0] !== null && weight.index[1] !== null}}">
|
|
||||||
<view class="valueClass">{{weight.data[0][weight.index[0]]}}.{{weight.data[1][weight.index[1]]}}</view>
|
|
||||||
</block>
|
|
||||||
<block wx:else>
|
|
||||||
<view class="placeholderClass">请选择您的体重</view>
|
|
||||||
</block>
|
|
||||||
</picker>
|
|
||||||
</view>
|
|
||||||
<view>kg</view>
|
|
||||||
</view>
|
|
||||||
</block>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="btn">
|
|
||||||
<view bind:tap="setUserInfo">下一步</view>
|
|
||||||
</view>
|
|
||||||
<view class="describe">请认真填写和完善您家人的健康信息,用于计算身体数据及运动卡路里消耗等,以便准确的分析数据。<text>(填写数据同时,踩亮蓝牙秤并与其保持连接)。</text></view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
@@ -1,158 +0,0 @@
|
|||||||
|
|
||||||
input {
|
|
||||||
width: 100%;
|
|
||||||
height: 58rpx;
|
|
||||||
font-size: 28rpx;
|
|
||||||
line-height: 58rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.placeholderClass {
|
|
||||||
color: #B6B6B6;
|
|
||||||
height: 58rpx;
|
|
||||||
font-size: 28rpx;
|
|
||||||
line-height: 58rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.valueClass {
|
|
||||||
color: #77849E;
|
|
||||||
height: 58rpx;
|
|
||||||
font-size: 28rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
line-height: 58rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.configureDevice2 {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header {
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: nowrap;
|
|
||||||
align-items: center;
|
|
||||||
padding: 30rpx 40rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
border-bottom: 1rpx solid #EAECF1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header>view:nth-of-type(1) {
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header>view:nth-of-type(1)>view:nth-of-type(1) {
|
|
||||||
color: #252535;
|
|
||||||
height: 32rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 32rpx;
|
|
||||||
line-height: 32rpx;
|
|
||||||
margin-bottom: 16rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header>view:nth-of-type(1)>view:nth-of-type(2) {
|
|
||||||
color: #808080;
|
|
||||||
height: 26rpx;
|
|
||||||
font-size: 26rpx;
|
|
||||||
line-height: 26rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header>view:nth-of-type(2) {
|
|
||||||
height: 28rpx;
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: nowrap;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header>view:nth-of-type(2)>view:nth-of-type(1) {
|
|
||||||
width: 12rpx;
|
|
||||||
height: 12rpx;
|
|
||||||
border-radius: 50%;
|
|
||||||
margin-right: 14rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header>view:nth-of-type(2)>view:nth-of-type(2) {
|
|
||||||
height: 28rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 28rpx;
|
|
||||||
line-height: 28rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.section {
|
|
||||||
width: 100%;
|
|
||||||
padding: 0 30rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.from {
|
|
||||||
width: 100%;
|
|
||||||
margin-bottom: 66rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.from>view {
|
|
||||||
width: 100%;
|
|
||||||
padding: 48rpx 10rpx 0;
|
|
||||||
box-sizing: border-box;
|
|
||||||
border-bottom: 1rpx solid #EAECF1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.from>view>view:nth-of-type(1) {
|
|
||||||
color: #252535;
|
|
||||||
height: 32rpx;
|
|
||||||
font-size: 32rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
line-height: 32rpx;
|
|
||||||
margin-bottom: 18rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.from>view>view:nth-of-type(2) {
|
|
||||||
width: 100%;
|
|
||||||
height: 58rpx;
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: nowrap;
|
|
||||||
padding-right: 26rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.from>view>view:nth-of-type(2)>view:nth-of-type(1) {
|
|
||||||
flex: 1;
|
|
||||||
width: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.from>view>view:nth-of-type(2)>view:nth-of-type(2) {
|
|
||||||
color: #77849E;
|
|
||||||
height: 58rpx;
|
|
||||||
font-size: 28rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
line-height: 58rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.btn {
|
|
||||||
width: 100%;
|
|
||||||
padding: 0 26rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn>view {
|
|
||||||
color: #FFFFFF;
|
|
||||||
width: 100%;
|
|
||||||
height: 88rpx;
|
|
||||||
font-size: 32rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 88rpx;
|
|
||||||
border-radius: 44rpx;
|
|
||||||
margin-bottom: 40rpx;
|
|
||||||
background-color: #1385FA;
|
|
||||||
}
|
|
||||||
|
|
||||||
.describe {
|
|
||||||
color: #77849E;
|
|
||||||
width: 100%;
|
|
||||||
font-size: 24rpx;
|
|
||||||
line-height: 40rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.describe text {
|
|
||||||
color: #F24439;
|
|
||||||
}
|
|
||||||
@@ -1,157 +0,0 @@
|
|||||||
const app = getApp();
|
|
||||||
import $ from "../../utils/request";
|
|
||||||
|
|
||||||
Component({
|
|
||||||
data: {
|
|
||||||
progress: 0,
|
|
||||||
|
|
||||||
wifiList: [],
|
|
||||||
|
|
||||||
selectWifi: null,
|
|
||||||
type: true,
|
|
||||||
selectWifiPWD: ""
|
|
||||||
},
|
|
||||||
|
|
||||||
lifetimes: {
|
|
||||||
attached() {
|
|
||||||
this.initWifi();
|
|
||||||
},
|
|
||||||
detached() {
|
|
||||||
// 在组件实例被从页面节点树移除时执行
|
|
||||||
console.log('MyComponent detached!');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 组件的方法
|
|
||||||
methods: {
|
|
||||||
initWifi() {
|
|
||||||
wx.showLoading({
|
|
||||||
title: "正在获取Wi-Fi列表...",
|
|
||||||
mask: true
|
|
||||||
});
|
|
||||||
app.globalData.ppScale.activeProtocol.dataFindSurroundDevice((res) => {
|
|
||||||
wx.hideLoading();
|
|
||||||
this.setData({
|
|
||||||
wifiList: res
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
selectDevice(e) {
|
|
||||||
this.setData({
|
|
||||||
progress: 1,
|
|
||||||
selectWifi: e.currentTarget.dataset.item,
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
inputTypeChange() {
|
|
||||||
this.setData({
|
|
||||||
type: !this.data.type
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
passwordInput(e) {
|
|
||||||
this.setData({
|
|
||||||
selectWifiPWD: e.detail.value
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
setWifiPWD() {
|
|
||||||
this.setData({
|
|
||||||
progress: 2
|
|
||||||
})
|
|
||||||
|
|
||||||
app.globalData.ppScale.activeProtocol.dataConfigNetWork({
|
|
||||||
domain: app.globalData.ppScale.domain,
|
|
||||||
ssid: this.data.selectWifi.ssid,
|
|
||||||
password: this.data.selectWifiPWD
|
|
||||||
}, (res) => {
|
|
||||||
console.log("setNetwork.js dataConfigNetWork", res);
|
|
||||||
|
|
||||||
if(res === 23) {
|
|
||||||
app.globalData.ppScale.wifi.ssid = this.data.selectWifi.ssid;
|
|
||||||
app.globalData.ppScale.wifi.password = this.data.selectWifiPWD;
|
|
||||||
|
|
||||||
let mac = app.globalData.ppScale.device.mac;
|
|
||||||
let deviceId = app.globalData.ppScale.device.connection.deviceId;
|
|
||||||
if(mac && deviceId) {
|
|
||||||
let scaleDeviceId = mac.replace(/:/g, '');
|
|
||||||
let params = {
|
|
||||||
equipmentName: app.globalData.ppScale.device.name,
|
|
||||||
scaleDeviceId: scaleDeviceId,
|
|
||||||
deviceId: deviceId
|
|
||||||
};
|
|
||||||
$.ajax("weighingScale/binding/device", params, "POST").then(res => {
|
|
||||||
if (res.success) {
|
|
||||||
app.globalData.ppScale.activeProtocol.codeSetBindingState((res) => {
|
|
||||||
console.log("setNetwork.js codeSetBindingState", res);
|
|
||||||
|
|
||||||
if(res == 0) {
|
|
||||||
this.triggerEvent('deviceEvent', {
|
|
||||||
status: true
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
app.globalData.ppScale.plugin.Blue.stop();
|
|
||||||
wx.showToast({
|
|
||||||
title: "绑定失败,请重试。",
|
|
||||||
icon: "none"
|
|
||||||
})
|
|
||||||
setTimeout(() => {
|
|
||||||
wx.navigateBack({
|
|
||||||
delta: 2
|
|
||||||
})
|
|
||||||
}, 1500)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
app.globalData.ppScale.plugin.Blue.stop();
|
|
||||||
wx.showToast({
|
|
||||||
icon: "none",
|
|
||||||
title: res.message
|
|
||||||
})
|
|
||||||
setTimeout(() => {
|
|
||||||
wx.navigateBack({
|
|
||||||
delta: 2
|
|
||||||
})
|
|
||||||
}, 1500)
|
|
||||||
}
|
|
||||||
}).catch(err => {
|
|
||||||
app.globalData.ppScale.plugin.Blue.stop();
|
|
||||||
wx.showToast({
|
|
||||||
icon: "none",
|
|
||||||
title: err.message
|
|
||||||
})
|
|
||||||
setTimeout(() => {
|
|
||||||
wx.navigateBack({
|
|
||||||
delta: 2
|
|
||||||
})
|
|
||||||
}, 1500)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
app.globalData.ppScale.plugin.Blue.stop();
|
|
||||||
wx.showToast({
|
|
||||||
icon: "none",
|
|
||||||
title: "Mac 地址与 deviceId 获取失败,请重新绑定"
|
|
||||||
})
|
|
||||||
setTimeout(() => {
|
|
||||||
wx.navigateBack({
|
|
||||||
delta: 2
|
|
||||||
})
|
|
||||||
}, 1500)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
app.globalData.ppScale.plugin.Blue.stop();
|
|
||||||
wx.showToast({
|
|
||||||
icon: "none",
|
|
||||||
title: "配网失败,错误码:" + res
|
|
||||||
})
|
|
||||||
setTimeout(() => {
|
|
||||||
wx.navigateBack({
|
|
||||||
delta: 2
|
|
||||||
})
|
|
||||||
}, 1500)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"component": true,
|
|
||||||
"usingComponents": {}
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
<view class="configureDevice3">
|
|
||||||
<block wx:if="{{progress === 0}}">
|
|
||||||
<view class="progress0">
|
|
||||||
<view class="progress0_title">
|
|
||||||
<view>可用Wi-Fi</view>
|
|
||||||
<view>网络列表(设备暂不支持5GWi-Fi网络)</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="progress0_content">
|
|
||||||
<scroll-view class="scrollView" scroll-y>
|
|
||||||
<view class="scrollViewContent">
|
|
||||||
<block wx:for="{{wifiList}}" wx:key="index">
|
|
||||||
<view data-item="{{item}}" bind:tap="selectDevice" class="~arrowAfter">
|
|
||||||
<view>
|
|
||||||
<image src="/images/configureDevice/wifi.png" />
|
|
||||||
</view>
|
|
||||||
<view>{{item.ssid}}</view>
|
|
||||||
</view>
|
|
||||||
</block>
|
|
||||||
</view>
|
|
||||||
</scroll-view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</block>
|
|
||||||
<block wx:if="{{progress === 1}}">
|
|
||||||
<view class="progress1">
|
|
||||||
<view class="progress1_title">输入Wi-Fi密码</view>
|
|
||||||
<view class="progress1_form">
|
|
||||||
<view>
|
|
||||||
<view>
|
|
||||||
<image src="/images/configureDevice/wifiPwd.png" />
|
|
||||||
</view>
|
|
||||||
<view>{{selectWifi.ssid}}</view>
|
|
||||||
</view>
|
|
||||||
<view>
|
|
||||||
<view>密码</view>
|
|
||||||
<view>
|
|
||||||
<block wx:if="{{type}}">
|
|
||||||
<input
|
|
||||||
password="{{true}}"
|
|
||||||
value="{{selectWifiPWD}}"
|
|
||||||
bindinput="passwordInput"
|
|
||||||
placeholder="输入您的wi-fi密码"
|
|
||||||
placeholder-class="placeholderClass" />
|
|
||||||
</block>
|
|
||||||
<block wx:else>
|
|
||||||
<input
|
|
||||||
password="{{false}}"
|
|
||||||
value="{{selectWifiPWD}}"
|
|
||||||
bindinput="passwordInput"
|
|
||||||
placeholder="输入您的wi-fi密码"
|
|
||||||
placeholder-class="placeholderClass" />
|
|
||||||
</block>
|
|
||||||
</view>
|
|
||||||
<view bind:tap="inputTypeChange">
|
|
||||||
<image src="/images/configureDevice/{{type ? 'open' : 'close'}}.png" />
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="progress1_btn" bind:tap="setWifiPWD">连接</view>
|
|
||||||
</view>
|
|
||||||
</block>
|
|
||||||
<block wx:if="{{progress === 2}}">
|
|
||||||
<view class="progress2">
|
|
||||||
<view>
|
|
||||||
<image src="/images/configureDevice/configureDevice_3_icon.png" />
|
|
||||||
</view>
|
|
||||||
<view>设备正在配对网络中,请稍等...</view>
|
|
||||||
<view>请持续站在秤上,耐心等待</view>
|
|
||||||
</view>
|
|
||||||
</block>
|
|
||||||
</view>
|
|
||||||
@@ -1,207 +0,0 @@
|
|||||||
.configureDevice3 {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress0 {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
padding-top: 60rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress0_title {
|
|
||||||
width: 100%;
|
|
||||||
padding: 0 60rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
margin-bottom: 40rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress0_title>view:nth-of-type(1) {
|
|
||||||
color: #252535;
|
|
||||||
width: 100%;
|
|
||||||
height: 48rpx;
|
|
||||||
font-size: 48rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
line-height: 48rpx;
|
|
||||||
margin-bottom: 48rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress0_title>view:nth-of-type(2) {
|
|
||||||
color: #B6B6B6;
|
|
||||||
width: 100%;
|
|
||||||
height: 30rpx;
|
|
||||||
font-size: 30rpx;
|
|
||||||
line-height: 30rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress0_content {
|
|
||||||
width: 100%;
|
|
||||||
height: calc(100% - 166rpx);
|
|
||||||
}
|
|
||||||
|
|
||||||
.scrollView {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.scrollViewContent {
|
|
||||||
width: 100%;
|
|
||||||
padding: 0 60rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.scrollViewContent>view {
|
|
||||||
width: 100%;
|
|
||||||
height: 80rpx;
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: nowrap;
|
|
||||||
margin-bottom: 32rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.scrollViewContent>view>view:nth-of-type(1) {
|
|
||||||
width: 80rpx;
|
|
||||||
height: 80rpx;
|
|
||||||
margin-right: 24rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.scrollViewContent>view>view:nth-of-type(2) {
|
|
||||||
color: #252535;
|
|
||||||
flex: 1;
|
|
||||||
width: 0;
|
|
||||||
height: 80rpx;
|
|
||||||
font-size: 32rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
line-height: 80rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.progress1 {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
padding: 60rpx 30rpx 0;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress1_title {
|
|
||||||
color: #252535;
|
|
||||||
width: 100%;
|
|
||||||
height: 48rpx;
|
|
||||||
font-size: 48rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
line-height: 48rpx;
|
|
||||||
margin-bottom: 48rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress1_form {
|
|
||||||
width: 100%;
|
|
||||||
margin-bottom: 64rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress1_form>view {
|
|
||||||
width: 100%;
|
|
||||||
height: 96rpx;
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: nowrap;
|
|
||||||
align-items: center;
|
|
||||||
padding: 0 24rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
border-radius: 16rpx;
|
|
||||||
background-color: #F6F6F6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress1_form>view:first-of-type {
|
|
||||||
margin-bottom: 32rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress1_form>view>view:nth-of-type(1) {
|
|
||||||
color: #252535;
|
|
||||||
width: 100rpx;
|
|
||||||
height: 96rpx;
|
|
||||||
line-height: 96rpx;
|
|
||||||
font-size: 32rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress1_form>view:first-of-type>view:nth-of-type(1) {
|
|
||||||
padding: 24rpx 45rpx 24rpx 7rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress1_form>view>view:nth-of-type(2) {
|
|
||||||
color: #252535;
|
|
||||||
flex: 1;
|
|
||||||
width: 0;
|
|
||||||
height: 96rpx;
|
|
||||||
font-size: 32rpx;
|
|
||||||
line-height: 96rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress1_form>view>view:nth-of-type(2) input {
|
|
||||||
color: #252535;
|
|
||||||
width: 100%;
|
|
||||||
height: 96rpx;
|
|
||||||
font-size: 32rpx;
|
|
||||||
line-height: 96rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.placeholderClass {
|
|
||||||
color: #B6B6B6;
|
|
||||||
height: 96rpx;
|
|
||||||
font-size: 32rpx;
|
|
||||||
line-height: 96rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress1_form>view>view:nth-of-type(3) {
|
|
||||||
width: 56rpx;
|
|
||||||
height: 56rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress1_btn {
|
|
||||||
color: #FFFFFF;
|
|
||||||
width: 580rpx;
|
|
||||||
height: 88rpx;
|
|
||||||
font-size: 32rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
line-height: 88rpx;
|
|
||||||
margin: 0 auto;
|
|
||||||
text-align: center;
|
|
||||||
border-radius: 44rpx;
|
|
||||||
background-color: #1385FA;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.progress2 {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
padding: 90rpx 62rpx 0;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress2>view:nth-of-type(1) {
|
|
||||||
width: 565rpx;
|
|
||||||
height: 500rpx;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress2>view:nth-of-type(2) {
|
|
||||||
color: #1385FA;
|
|
||||||
width: 100%;
|
|
||||||
height: 36rpx;
|
|
||||||
font-size: 36rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
line-height: 36rpx;
|
|
||||||
text-align: center;
|
|
||||||
margin-bottom: 28rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress2>view:nth-of-type(3) {
|
|
||||||
color: #808080;
|
|
||||||
width: 100%;
|
|
||||||
height: 30rpx;
|
|
||||||
font-size: 30rpx;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 30rpx;
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
Component({
|
|
||||||
methods: {
|
|
||||||
bindOk() {
|
|
||||||
this.triggerEvent('deviceEvent', {
|
|
||||||
status: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"component": true,
|
|
||||||
"usingComponents": {}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<view class="configureDevice4">
|
|
||||||
<view class="icon">
|
|
||||||
<view>
|
|
||||||
<image src="/images/configureDevice/configureDevice_4_icon.png" />
|
|
||||||
</view>
|
|
||||||
<view>绑定成功</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="describe">随时随地同步测量数据</view>
|
|
||||||
|
|
||||||
<view class="btn" bind:tap="bindOk">完成</view>
|
|
||||||
</view>
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
.configureDevice4 {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
padding: 105rpx 55rpx 0;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon {
|
|
||||||
width: 100%;
|
|
||||||
margin-bottom: 475rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon>view:first-of-type {
|
|
||||||
width: 360rpx;
|
|
||||||
height: 295rpx;
|
|
||||||
margin: 0 auto 50rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon>view:last-of-type {
|
|
||||||
color: #252535;
|
|
||||||
width: 100%;
|
|
||||||
height: 40rpx;
|
|
||||||
font-size: 40rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
line-height: 40rpx;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.describe {
|
|
||||||
color: #B6B6B6;
|
|
||||||
width: 100%;
|
|
||||||
height: 26rpx;
|
|
||||||
font-size: 28rpx;
|
|
||||||
line-height: 28rpx;
|
|
||||||
text-align: center;
|
|
||||||
margin-bottom: 46rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn {
|
|
||||||
color: #FFFFFF;
|
|
||||||
width: 100%;
|
|
||||||
height: 88rpx;
|
|
||||||
font-size: 32rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
line-height: 88rpx;
|
|
||||||
text-align: center;
|
|
||||||
border-radius: 44rpx;
|
|
||||||
background-color: #1385FA;
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
const app = getApp();
|
|
||||||
|
|
||||||
Component({
|
|
||||||
data: {
|
|
||||||
wifiList: []
|
|
||||||
},
|
|
||||||
|
|
||||||
// 生命周期方法
|
|
||||||
lifetimes: {
|
|
||||||
attached() {
|
|
||||||
|
|
||||||
},
|
|
||||||
detached() {
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 组件的方法
|
|
||||||
methods: {
|
|
||||||
getWiFiList() {
|
|
||||||
wx.showLoading({
|
|
||||||
title: "正在获取Wi-Fi列表...",
|
|
||||||
mask: true
|
|
||||||
});
|
|
||||||
app.globalData.ppScale.activeProtocol.dataFindSurroundDevice((res) => {
|
|
||||||
console.log("connectedDevice ===》dataFindSurroundDevice", res);
|
|
||||||
|
|
||||||
wx.hideLoading();
|
|
||||||
this.setData({
|
|
||||||
wifiList: res
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
selectDevice(e) {
|
|
||||||
this.triggerEvent('wifiEvent', {
|
|
||||||
status: true,
|
|
||||||
data: e.currentTarget.dataset.item
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"component": true,
|
|
||||||
"usingComponents": {}
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
<view class="replaceNetwork1">
|
|
||||||
<view class="title">
|
|
||||||
<view>可用Wi-Fi</view>
|
|
||||||
<view>网络列表(设备暂不支持5GWi-Fi网络)</view>
|
|
||||||
</view>
|
|
||||||
<view class="content">
|
|
||||||
<scroll-view class="scrollView" scroll-y>
|
|
||||||
<view class="scrollViewContent">
|
|
||||||
<block wx:for="{{wifiList}}" wx:key="index">
|
|
||||||
<view data-item="{{item}}" bind:tap="selectDevice" class="~arrowAfter">
|
|
||||||
<view>
|
|
||||||
<image src="/images/replaceNetwork/wifi.png" />
|
|
||||||
</view>
|
|
||||||
<view>{{item.ssid}}</view>
|
|
||||||
</view>
|
|
||||||
</block>
|
|
||||||
</view>
|
|
||||||
</scroll-view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
.replaceNetwork1 {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
padding-top: 60rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
|
||||||
width: 100%;
|
|
||||||
padding: 0 60rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
margin-bottom: 40rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title>view:nth-of-type(1) {
|
|
||||||
color: #252535;
|
|
||||||
width: 100%;
|
|
||||||
height: 48rpx;
|
|
||||||
font-size: 48rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
line-height: 48rpx;
|
|
||||||
margin-bottom: 48rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title>view:nth-of-type(2) {
|
|
||||||
color: #B6B6B6;
|
|
||||||
width: 100%;
|
|
||||||
height: 30rpx;
|
|
||||||
font-size: 30rpx;
|
|
||||||
line-height: 30rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content {
|
|
||||||
width: 100%;
|
|
||||||
height: calc(100% - 166rpx);
|
|
||||||
}
|
|
||||||
|
|
||||||
.scrollView {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.scrollViewContent {
|
|
||||||
width: 100%;
|
|
||||||
padding: 0 60rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.scrollViewContent>view {
|
|
||||||
width: 100%;
|
|
||||||
height: 80rpx;
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: nowrap;
|
|
||||||
margin-bottom: 32rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.scrollViewContent>view>view:nth-of-type(1) {
|
|
||||||
width: 80rpx;
|
|
||||||
height: 80rpx;
|
|
||||||
margin-right: 24rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.scrollViewContent>view>view:nth-of-type(2) {
|
|
||||||
color: #252535;
|
|
||||||
flex: 1;
|
|
||||||
width: 0;
|
|
||||||
height: 80rpx;
|
|
||||||
font-size: 32rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
line-height: 80rpx;
|
|
||||||
}
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
const app = getApp();
|
|
||||||
|
|
||||||
Component({
|
|
||||||
properties: {
|
|
||||||
ssid: {
|
|
||||||
type: String,
|
|
||||||
value: ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
data: {
|
|
||||||
type: true,
|
|
||||||
|
|
||||||
ssid: "",
|
|
||||||
password: ""
|
|
||||||
},
|
|
||||||
|
|
||||||
// 生命周期方法
|
|
||||||
lifetimes: {
|
|
||||||
attached() {
|
|
||||||
|
|
||||||
},
|
|
||||||
detached() {
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 组件的方法
|
|
||||||
methods: {
|
|
||||||
setWiFiName() {
|
|
||||||
this.setData({
|
|
||||||
ssid: this.properties.ssid,
|
|
||||||
type: true,
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
passwordInput(e) {
|
|
||||||
this.setData({
|
|
||||||
password: e.detail.value
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
inputTypeChange() {
|
|
||||||
this.setData({
|
|
||||||
type: !this.data.type
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
setWifiPWD() {
|
|
||||||
this.triggerEvent('wifiEvent', {
|
|
||||||
status: true,
|
|
||||||
data: this.data.password
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"component": true,
|
|
||||||
"usingComponents": {}
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
<view class="replaceNetwork2">
|
|
||||||
<view class="title">输入Wi-Fi密码</view>
|
|
||||||
<view class="form">
|
|
||||||
<view>
|
|
||||||
<view>
|
|
||||||
<image src="/images/replaceNetwork/wifiPwd.png" />
|
|
||||||
</view>
|
|
||||||
<view>{{ssid}}</view>
|
|
||||||
</view>
|
|
||||||
<view>
|
|
||||||
<view>密码</view>
|
|
||||||
<view>
|
|
||||||
<block wx:if="{{type}}">
|
|
||||||
<input
|
|
||||||
password="{{true}}"
|
|
||||||
value="{{password}}"
|
|
||||||
bindinput="passwordInput"
|
|
||||||
placeholder="输入您的wi-fi密码"
|
|
||||||
placeholder-class="placeholderClass" />
|
|
||||||
</block>
|
|
||||||
<block wx:else>
|
|
||||||
<input
|
|
||||||
password="{{false}}"
|
|
||||||
value="{{password}}"
|
|
||||||
bindinput="passwordInput"
|
|
||||||
placeholder="输入您的wi-fi密码"
|
|
||||||
placeholder-class="placeholderClass" />
|
|
||||||
</block>
|
|
||||||
</view>
|
|
||||||
<view bind:tap="inputTypeChange">
|
|
||||||
<image src="/images/replaceNetwork/{{type ? 'open' : 'close'}}.png" />
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="btn" bind:tap="setWifiPWD">连接</view>
|
|
||||||
</view>
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
.replaceNetwork2 {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
padding: 60rpx 30rpx 0;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
|
||||||
color: #252535;
|
|
||||||
width: 100%;
|
|
||||||
height: 48rpx;
|
|
||||||
font-size: 48rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
line-height: 48rpx;
|
|
||||||
margin-bottom: 48rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form {
|
|
||||||
width: 100%;
|
|
||||||
margin-bottom: 64rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form>view {
|
|
||||||
width: 100%;
|
|
||||||
height: 96rpx;
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: nowrap;
|
|
||||||
align-items: center;
|
|
||||||
padding: 0 24rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
border-radius: 16rpx;
|
|
||||||
background-color: #F6F6F6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form>view:first-of-type {
|
|
||||||
margin-bottom: 32rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form>view>view:nth-of-type(1) {
|
|
||||||
color: #252535;
|
|
||||||
width: 100rpx;
|
|
||||||
height: 96rpx;
|
|
||||||
line-height: 96rpx;
|
|
||||||
font-size: 32rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form>view:first-of-type>view:nth-of-type(1) {
|
|
||||||
padding: 24rpx 45rpx 24rpx 7rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form>view>view:nth-of-type(2) {
|
|
||||||
color: #252535;
|
|
||||||
flex: 1;
|
|
||||||
width: 0;
|
|
||||||
height: 96rpx;
|
|
||||||
font-size: 32rpx;
|
|
||||||
line-height: 96rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form>view>view:nth-of-type(2) input {
|
|
||||||
color: #252535;
|
|
||||||
width: 100%;
|
|
||||||
height: 96rpx;
|
|
||||||
font-size: 32rpx;
|
|
||||||
line-height: 96rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.placeholderClass {
|
|
||||||
color: #B6B6B6;
|
|
||||||
height: 96rpx;
|
|
||||||
font-size: 32rpx;
|
|
||||||
line-height: 96rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form>view>view:nth-of-type(3) {
|
|
||||||
width: 56rpx;
|
|
||||||
height: 56rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn {
|
|
||||||
color: #FFFFFF;
|
|
||||||
width: 580rpx;
|
|
||||||
height: 88rpx;
|
|
||||||
font-size: 32rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
line-height: 88rpx;
|
|
||||||
margin: 0 auto;
|
|
||||||
text-align: center;
|
|
||||||
border-radius: 44rpx;
|
|
||||||
background-color: #1385FA;
|
|
||||||
}
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
const app = getApp();
|
|
||||||
import $ from "../../utils/request";
|
|
||||||
|
|
||||||
Component({
|
|
||||||
properties: {
|
|
||||||
ssid: {
|
|
||||||
type: String,
|
|
||||||
value: ""
|
|
||||||
},
|
|
||||||
password: {
|
|
||||||
type: String,
|
|
||||||
value: ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
data: {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
// 生命周期方法
|
|
||||||
lifetimes: {
|
|
||||||
attached() {
|
|
||||||
this.setNerwork();
|
|
||||||
},
|
|
||||||
detached() {
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 组件的方法
|
|
||||||
methods: {
|
|
||||||
setNerwork() {
|
|
||||||
let ssid = this.properties.ssid;
|
|
||||||
let password = this.properties.password;
|
|
||||||
app.globalData.ppScale.activeProtocol.dataConfigNetWork({
|
|
||||||
domain: app.globalData.ppScale.domain,
|
|
||||||
ssid: ssid,
|
|
||||||
password: password
|
|
||||||
}, (res) => {
|
|
||||||
console.log("setNetwork.js dataConfigNetWork", res);
|
|
||||||
|
|
||||||
if(res === 23) {
|
|
||||||
app.globalData.ppScale.wifi.ssid = ssid;
|
|
||||||
app.globalData.ppScale.wifi.password = password;
|
|
||||||
|
|
||||||
let scaleDeviceId = app.globalData.ppScale.device.mac.replace(/:/g, '');
|
|
||||||
if(scaleDeviceId) {
|
|
||||||
let params = {
|
|
||||||
equipmentCode: scaleDeviceId,
|
|
||||||
wifiName: ssid
|
|
||||||
};
|
|
||||||
$.ajax("weighingScale/edit/device", params, "POST").then((res) => {
|
|
||||||
this.triggerEvent('wifiEvent', {
|
|
||||||
status: true
|
|
||||||
});
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
app.globalData.ppScale.plugin.Blue.stop();
|
|
||||||
wx.showToast({
|
|
||||||
icon: "none",
|
|
||||||
title: "配网失败,错误码:" + res
|
|
||||||
})
|
|
||||||
setTimeout(() => {
|
|
||||||
this.triggerEvent('wifiEvent', {
|
|
||||||
status: false
|
|
||||||
});
|
|
||||||
}, 1500)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"component": true,
|
|
||||||
"usingComponents": {}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<view class="replaceNetwork3">
|
|
||||||
<view>
|
|
||||||
<image src="/images/configureDevice/configureDevice_3_icon.png" />
|
|
||||||
</view>
|
|
||||||
<view>设备正在配对网络中,请稍等...</view>
|
|
||||||
<view>请持续站在秤上,耐心等待</view>
|
|
||||||
</view>
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
.replaceNetwork3 {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
padding: 90rpx 62rpx 0;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.replaceNetwork3>view:nth-of-type(1) {
|
|
||||||
width: 565rpx;
|
|
||||||
height: 500rpx;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.replaceNetwork3>view:nth-of-type(2) {
|
|
||||||
color: #1385FA;
|
|
||||||
width: 100%;
|
|
||||||
height: 36rpx;
|
|
||||||
font-size: 36rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
line-height: 36rpx;
|
|
||||||
text-align: center;
|
|
||||||
margin-bottom: 28rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.replaceNetwork3>view:nth-of-type(3) {
|
|
||||||
color: #808080;
|
|
||||||
width: 100%;
|
|
||||||
height: 30rpx;
|
|
||||||
font-size: 30rpx;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 30rpx;
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
const app = getApp();
|
|
||||||
|
|
||||||
Component({
|
|
||||||
data: {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
// 生命周期方法
|
|
||||||
lifetimes: {
|
|
||||||
attached() {
|
|
||||||
|
|
||||||
},
|
|
||||||
detached() {
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 组件的方法
|
|
||||||
methods: {
|
|
||||||
replaceNetworkOk() {
|
|
||||||
wx.navigateBack({
|
|
||||||
delta: 1
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"component": true,
|
|
||||||
"usingComponents": {}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<view class="replaceNetwork4">
|
|
||||||
<view class="icon">
|
|
||||||
<view>
|
|
||||||
<image src="/images/configureDevice/configureDevice_4_icon.png" />
|
|
||||||
</view>
|
|
||||||
<view>Wi-Fi 切换成功</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="describe">随时随地同步测量数据</view>
|
|
||||||
|
|
||||||
<view class="btn" bind:tap="replaceNetworkOk">完成</view>
|
|
||||||
</view>
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
.replaceNetwork4 {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
padding: 105rpx 55rpx 0;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon {
|
|
||||||
width: 100%;
|
|
||||||
margin-bottom: 475rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon>view:first-of-type {
|
|
||||||
width: 360rpx;
|
|
||||||
height: 295rpx;
|
|
||||||
margin: 0 auto 50rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon>view:last-of-type {
|
|
||||||
color: #252535;
|
|
||||||
width: 100%;
|
|
||||||
height: 40rpx;
|
|
||||||
font-size: 40rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
line-height: 40rpx;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.describe {
|
|
||||||
color: #B6B6B6;
|
|
||||||
width: 100%;
|
|
||||||
height: 26rpx;
|
|
||||||
font-size: 28rpx;
|
|
||||||
line-height: 28rpx;
|
|
||||||
text-align: center;
|
|
||||||
margin-bottom: 46rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn {
|
|
||||||
color: #FFFFFF;
|
|
||||||
width: 100%;
|
|
||||||
height: 88rpx;
|
|
||||||
font-size: 32rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
line-height: 88rpx;
|
|
||||||
text-align: center;
|
|
||||||
border-radius: 44rpx;
|
|
||||||
background-color: #1385FA;
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 976 B |
|
Before Width: | Height: | Size: 117 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 236 KiB |
|
Before Width: | Height: | Size: 106 KiB |
|
Before Width: | Height: | Size: 86 KiB |
|
Before Width: | Height: | Size: 236 KiB |
|
Before Width: | Height: | Size: 86 KiB |
|
Before Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 976 B |
|
Before Width: | Height: | Size: 117 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1,62 @@
|
|||||||
|
{
|
||||||
|
"pages": [
|
||||||
|
"pages/login/login",
|
||||||
|
"pages/searchDevice/searchDevice",
|
||||||
|
"pages/connectedDevice/connectedDevice",
|
||||||
|
"pages/connectedWifi/connectedWifi",
|
||||||
|
"pages/supplementPersonal/supplementPersonal",
|
||||||
|
"pages/home/home",
|
||||||
|
"pages/equipment/equipment",
|
||||||
|
"pages/data/data",
|
||||||
|
"pages/my/my"
|
||||||
|
],
|
||||||
|
"window": {
|
||||||
|
"navigationBarBackgroundColor": "#ffffff",
|
||||||
|
"navigationBarTextStyle": "black",
|
||||||
|
"navigationBarTitleText": "智能体重秤"
|
||||||
|
},
|
||||||
|
"style": "v2",
|
||||||
|
"rendererOptions": {
|
||||||
|
"skyline": {
|
||||||
|
"defaultDisplayBlock": true,
|
||||||
|
"disableABTest": true,
|
||||||
|
"sdkVersionBegin": "3.0.0",
|
||||||
|
"sdkVersionEnd": "15.255.255"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"componentFramework": "glass-easel",
|
||||||
|
"sitemapLocation": "sitemap.json",
|
||||||
|
"lazyCodeLoading": "requiredComponents",
|
||||||
|
"tabBar": {
|
||||||
|
"color": "#999999",
|
||||||
|
"selectedColor": "#000000",
|
||||||
|
"backgroundColor": "#ffffff",
|
||||||
|
"borderStyle": "black",
|
||||||
|
"list": [
|
||||||
|
{
|
||||||
|
"pagePath": "pages/home/home",
|
||||||
|
"text": "首页",
|
||||||
|
"iconPath": "images/tabBar/home_default.png",
|
||||||
|
"selectedIconPath": "images/tabBar/home.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pagePath": "pages/equipment/equipment",
|
||||||
|
"text": "设备",
|
||||||
|
"iconPath": "images/tabBar/equipment_default.png",
|
||||||
|
"selectedIconPath": "images/tabBar/equipment.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pagePath": "pages/data/data",
|
||||||
|
"text": "数据",
|
||||||
|
"iconPath": "images/tabBar/data_default.png",
|
||||||
|
"selectedIconPath": "images/tabBar/data.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pagePath": "pages/my/my",
|
||||||
|
"text": "我的",
|
||||||
|
"iconPath": "images/tabBar/my_default.png",
|
||||||
|
"selectedIconPath": "images/tabBar/my.png"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/**app.wxss**/
|
||||||
|
@import "./styles/index.less";
|
||||||
|
|
||||||
|
page {
|
||||||
|
width: 100%;
|
||||||
|
height: 100vh;
|
||||||
|
overflow: hidden;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background: var(--color-bg);
|
||||||
|
/* 左右边距不加全局,避免全屏元素被挤 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 需要页面标准边距的业务容器,在 WXML 根节点使用 */
|
||||||
|
.page-container {
|
||||||
|
padding-left: var(--page-padding-x);
|
||||||
|
padding-right: var(--page-padding-x);
|
||||||
|
}
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
// app.ts
|
||||||
|
App<IAppOption>({
|
||||||
|
globalData: {},
|
||||||
|
onLaunch() {
|
||||||
|
// 展示本地存储能力
|
||||||
|
const logs = wx.getStorageSync('logs') || []
|
||||||
|
logs.unshift(Date.now())
|
||||||
|
wx.setStorageSync('logs', logs)
|
||||||
|
|
||||||
|
// 登录
|
||||||
|
wx.login({
|
||||||
|
success: res => {
|
||||||
|
console.log(res.code)
|
||||||
|
// 发送 res.code 到后台换取 openId, sessionKey, unionId
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
})
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"component": true,
|
||||||
|
"styleIsolation": "apply-shared",
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
.weui-navigation-bar {
|
||||||
|
--weui-FG-0:rgba(0,0,0,.9);
|
||||||
|
--height: 44px;
|
||||||
|
--left: 16px;
|
||||||
|
}
|
||||||
|
.weui-navigation-bar .android {
|
||||||
|
--height: 48px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.weui-navigation-bar {
|
||||||
|
overflow: hidden;
|
||||||
|
color: var(--weui-FG-0);
|
||||||
|
flex: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.weui-navigation-bar__inner {
|
||||||
|
position: relative;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
height: calc(var(--height) + env(safe-area-inset-top));
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding-top: env(safe-area-inset-top);
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.weui-navigation-bar__left {
|
||||||
|
position: relative;
|
||||||
|
padding-left: var(--left);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: flex-start;
|
||||||
|
height: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.weui-navigation-bar__btn_goback_wrapper {
|
||||||
|
padding: 11px 18px 11px 16px;
|
||||||
|
margin: -11px -18px -11px -16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.weui-navigation-bar__btn_goback_wrapper.weui-active {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.weui-navigation-bar__btn_goback {
|
||||||
|
font-size: 12px;
|
||||||
|
width: 12px;
|
||||||
|
height: 24px;
|
||||||
|
-webkit-mask: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='24' viewBox='0 0 12 24'%3E %3Cpath fill-opacity='.9' fill-rule='evenodd' d='M10 19.438L8.955 20.5l-7.666-7.79a1.02 1.02 0 0 1 0-1.42L8.955 3.5 10 4.563 2.682 12 10 19.438z'/%3E%3C/svg%3E") no-repeat 50% 50%;
|
||||||
|
mask: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='24' viewBox='0 0 12 24'%3E %3Cpath fill-opacity='.9' fill-rule='evenodd' d='M10 19.438L8.955 20.5l-7.666-7.79a1.02 1.02 0 0 1 0-1.42L8.955 3.5 10 4.563 2.682 12 10 19.438z'/%3E%3C/svg%3E") no-repeat 50% 50%;
|
||||||
|
-webkit-mask-size: cover;
|
||||||
|
mask-size: cover;
|
||||||
|
background-color: var(--weui-FG-0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.weui-navigation-bar__center {
|
||||||
|
font-size: 17px;
|
||||||
|
text-align: center;
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-weight: bold;
|
||||||
|
flex: 1;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.weui-navigation-bar__loading {
|
||||||
|
margin-right: 4px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.weui-loading {
|
||||||
|
font-size: 16px;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
display: block;
|
||||||
|
background: transparent url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg width='80px' height='80px' viewBox='0 0 80 80' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Ctitle%3Eloading%3C/title%3E%3Cdefs%3E%3ClinearGradient x1='94.0869141%25' y1='0%25' x2='94.0869141%25' y2='90.559082%25' id='linearGradient-1'%3E%3Cstop stop-color='%23606060' stop-opacity='0' offset='0%25'%3E%3C/stop%3E%3Cstop stop-color='%23606060' stop-opacity='0.3' offset='100%25'%3E%3C/stop%3E%3C/linearGradient%3E%3ClinearGradient x1='100%25' y1='8.67370605%25' x2='100%25' y2='90.6286621%25' id='linearGradient-2'%3E%3Cstop stop-color='%23606060' offset='0%25'%3E%3C/stop%3E%3Cstop stop-color='%23606060' stop-opacity='0.3' offset='100%25'%3E%3C/stop%3E%3C/linearGradient%3E%3C/defs%3E%3Cg stroke='none' stroke-width='1' fill='none' fill-rule='evenodd' opacity='0.9'%3E%3Cg%3E%3Cpath d='M40,0 C62.09139,0 80,17.90861 80,40 C80,62.09139 62.09139,80 40,80 L40,73 C58.2253967,73 73,58.2253967 73,40 C73,21.7746033 58.2253967,7 40,7 L40,0 Z' fill='url(%23linearGradient-1)'%3E%3C/path%3E%3Cpath d='M40,0 L40,7 C21.7746033,7 7,21.7746033 7,40 C7,58.2253967 21.7746033,73 40,73 L40,80 C17.90861,80 0,62.09139 0,40 C0,17.90861 17.90861,0 40,0 Z' fill='url(%23linearGradient-2)'%3E%3C/path%3E%3Ccircle id='Oval' fill='%23606060' cx='40.5' cy='3.5' r='3.5'%3E%3C/circle%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A") no-repeat;
|
||||||
|
background-size: 100%;
|
||||||
|
margin-left: 0;
|
||||||
|
animation: loading linear infinite 1s;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes loading {
|
||||||
|
from {
|
||||||
|
transform: rotate(0);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
Component({
|
||||||
|
options: {
|
||||||
|
multipleSlots: true // 在组件定义时的选项中启用多slot支持
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 组件的属性列表
|
||||||
|
*/
|
||||||
|
properties: {
|
||||||
|
extClass: {
|
||||||
|
type: String,
|
||||||
|
value: ''
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
value: ''
|
||||||
|
},
|
||||||
|
background: {
|
||||||
|
type: String,
|
||||||
|
value: ''
|
||||||
|
},
|
||||||
|
color: {
|
||||||
|
type: String,
|
||||||
|
value: ''
|
||||||
|
},
|
||||||
|
back: {
|
||||||
|
type: Boolean,
|
||||||
|
value: true
|
||||||
|
},
|
||||||
|
loading: {
|
||||||
|
type: Boolean,
|
||||||
|
value: false
|
||||||
|
},
|
||||||
|
homeButton: {
|
||||||
|
type: Boolean,
|
||||||
|
value: false,
|
||||||
|
},
|
||||||
|
animated: {
|
||||||
|
// 显示隐藏的时候opacity动画效果
|
||||||
|
type: Boolean,
|
||||||
|
value: true
|
||||||
|
},
|
||||||
|
show: {
|
||||||
|
// 显示隐藏导航,隐藏的时候navigation-bar的高度占位还在
|
||||||
|
type: Boolean,
|
||||||
|
value: true,
|
||||||
|
observer: '_showChange'
|
||||||
|
},
|
||||||
|
// back为true的时候,返回的页面深度
|
||||||
|
delta: {
|
||||||
|
type: Number,
|
||||||
|
value: 1
|
||||||
|
},
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 组件的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
displayStyle: ''
|
||||||
|
},
|
||||||
|
lifetimes: {
|
||||||
|
attached() {
|
||||||
|
const rect = wx.getMenuButtonBoundingClientRect()
|
||||||
|
wx.getSystemInfo({
|
||||||
|
success: (res) => {
|
||||||
|
const isAndroid = res.platform === 'android'
|
||||||
|
const isDevtools = res.platform === 'devtools'
|
||||||
|
this.setData({
|
||||||
|
ios: !isAndroid,
|
||||||
|
innerPaddingRight: `padding-right: ${res.windowWidth - rect.left}px`,
|
||||||
|
leftWidth: `width: ${res.windowWidth - rect.left }px`,
|
||||||
|
safeAreaTop: isDevtools || isAndroid ? `height: calc(var(--height) + ${res.safeArea.top}px); padding-top: ${res.safeArea.top}px` : ``
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 组件的方法列表
|
||||||
|
*/
|
||||||
|
methods: {
|
||||||
|
_showChange(show: boolean) {
|
||||||
|
const animated = this.data.animated
|
||||||
|
let displayStyle = ''
|
||||||
|
if (animated) {
|
||||||
|
displayStyle = `opacity: ${
|
||||||
|
show ? '1' : '0'
|
||||||
|
};transition:opacity 0.5s;`
|
||||||
|
} else {
|
||||||
|
displayStyle = `display: ${show ? '' : 'none'}`
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
displayStyle
|
||||||
|
})
|
||||||
|
},
|
||||||
|
back() {
|
||||||
|
const data = this.data
|
||||||
|
if (data.delta) {
|
||||||
|
wx.navigateBack({
|
||||||
|
delta: data.delta
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.triggerEvent('back', { delta: data.delta }, {})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
<view class="weui-navigation-bar {{extClass}}">
|
||||||
|
<view class="weui-navigation-bar__inner {{ios ? 'ios' : 'android'}}" style="color: {{color}}; background: {{background}}; {{displayStyle}}; {{innerPaddingRight}}; {{safeAreaTop}};">
|
||||||
|
|
||||||
|
<!-- 左侧按钮 -->
|
||||||
|
<view class='weui-navigation-bar__left' style="{{leftWidth}};">
|
||||||
|
<block wx:if="{{back || homeButton}}">
|
||||||
|
<!-- 返回上一页 -->
|
||||||
|
<block wx:if="{{back}}">
|
||||||
|
<view class="weui-navigation-bar__buttons weui-navigation-bar__buttons_goback">
|
||||||
|
<view
|
||||||
|
bindtap="back"
|
||||||
|
class="weui-navigation-bar__btn_goback_wrapper"
|
||||||
|
hover-class="weui-active"
|
||||||
|
hover-stay-time="100"
|
||||||
|
aria-role="button"
|
||||||
|
aria-label="返回"
|
||||||
|
>
|
||||||
|
<view class="weui-navigation-bar__button weui-navigation-bar__btn_goback"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
<!-- 返回首页 -->
|
||||||
|
<block wx:if="{{homeButton}}">
|
||||||
|
<view class="weui-navigation-bar__buttons weui-navigation-bar__buttons_home">
|
||||||
|
<view
|
||||||
|
bindtap="home"
|
||||||
|
class="weui-navigation-bar__btn_home_wrapper"
|
||||||
|
hover-class="weui-active"
|
||||||
|
aria-role="button"
|
||||||
|
aria-label="首页"
|
||||||
|
>
|
||||||
|
<view class="weui-navigation-bar__button weui-navigation-bar__btn_home"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</block>
|
||||||
|
<block wx:else>
|
||||||
|
<slot name="left"></slot>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 标题 -->
|
||||||
|
<view class='weui-navigation-bar__center'>
|
||||||
|
<view wx:if="{{loading}}" class="weui-navigation-bar__loading" aria-role="alert">
|
||||||
|
<view
|
||||||
|
class="weui-loading"
|
||||||
|
aria-role="img"
|
||||||
|
aria-label="加载中"
|
||||||
|
></view>
|
||||||
|
</view>
|
||||||
|
<block wx:if="{{title}}">
|
||||||
|
<text>{{title}}</text>
|
||||||
|
</block>
|
||||||
|
<block wx:else>
|
||||||
|
<slot name="center"></slot>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 右侧留空 -->
|
||||||
|
<view class='weui-navigation-bar__right'>
|
||||||
|
<slot name="right"></slot>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
After Width: | Height: | Size: 107 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 745 B |
|
After Width: | Height: | Size: 733 B |
|
After Width: | Height: | Size: 987 B |
|
After Width: | Height: | Size: 983 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 59 KiB |
|
After Width: | Height: | Size: 110 KiB |
|
After Width: | Height: | Size: 187 KiB |
|
After Width: | Height: | Size: 92 KiB |
|
After Width: | Height: | Size: 103 KiB |
|
After Width: | Height: | Size: 102 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 75 KiB |