42 lines
1.1 KiB
JavaScript
42 lines
1.1 KiB
JavaScript
const app = getApp();
|
|
import $ from "../../utils/request";
|
|
|
|
Page({
|
|
onLoad(options) {
|
|
let ssid = options.ssid;
|
|
let password = options.password;
|
|
app.globalData.ppScale.activeProtocol.dataConfigNetWork({
|
|
domain: app.globalData.ppScale.domain,
|
|
ssid: options.ssid,
|
|
password: options.password
|
|
}, (res) => {
|
|
app.globalData.ppScale.wifi.ssid = ssid;
|
|
app.globalData.ppScale.wifi.password = password;
|
|
|
|
let scaleDeviceId = app.globalData.ppScale.device.mac.replace(/:/g, '');
|
|
let params = {
|
|
equipmentName: app.globalData.ppScale.device.name,
|
|
scaleDeviceId: scaleDeviceId,
|
|
};
|
|
$.ajax("weighingScale/binding/device", params, "POST").then(res => {
|
|
app.globalData.ppScale.activeProtocol.codeSetBindingState((res) => {
|
|
console.log("setNetwork.js codeSetBindingState", res);
|
|
|
|
wx.navigateTo({
|
|
url: "/pages/setNetworkSuccessful/setNetworkSuccessful"
|
|
})
|
|
})
|
|
}).catch(err => {
|
|
wx.showToast({
|
|
icon: "none",
|
|
title: err.message
|
|
})
|
|
setTimeout(() => {
|
|
wx.switchTab({
|
|
url: "/pages/home/home"
|
|
})
|
|
}, 1500)
|
|
})
|
|
})
|
|
}
|
|
}) |