This commit is contained in:
TonyChyi
2024-12-27 22:44:32 +08:00
commit 0de9992474
23 changed files with 362 additions and 0 deletions

View File

@@ -0,0 +1,84 @@
// pages/connect-wifi/connect-wifi.js
Page({
/**
* 页面的初始数据
*/
data: {
wifiInfo: {
SSID: 'test',
password: ''
},
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const scene = decodeURIComponent(options.scene);
this.data.wifiInfo = JSON.parse(scene)
this.connectWifi(this.data.wifiInfo)
},
connectWifi(wifiInfo) {
wx.connectWifi({
...wifiInfo,
manual: true,
success: () => {
wx.navigateTo({
url: '/pages/success/success',
})
},
fail: (err)=> {}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@@ -0,0 +1,4 @@
<!--pages/connect-wifi/connect-wifi.wxml-->
<view class="container">
<text>你将连接到 {{wifiInfo.SSID}}</text>
</view>

View File

@@ -0,0 +1 @@
/* pages/connect-wifi/connect-wifi.wxss */

66
pages/fail/fail.js Normal file
View File

@@ -0,0 +1,66 @@
// pages/fail/fail.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

3
pages/fail/fail.json Normal file
View File

@@ -0,0 +1,3 @@
{
"usingComponents": {}
}

4
pages/fail/fail.wxml Normal file
View File

@@ -0,0 +1,4 @@
<!--pages/fail/fail.wxml-->
<view class="container">
<text>连接失败,请退出小程序重新扫码</text>
</view>

1
pages/fail/fail.wxss Normal file
View File

@@ -0,0 +1 @@
/* pages/fail/fail.wxss */

2
pages/index/index.js Normal file
View File

@@ -0,0 +1,2 @@
// index.js
Page({})

1
pages/index/index.json Normal file
View File

@@ -0,0 +1 @@
{}

6
pages/index/index.wxml Normal file
View File

@@ -0,0 +1,6 @@
<!--index.wxml-->
<scroll-view class="scrollarea" scroll-y type="list">
<view class="container">
Weixin
</view>
</scroll-view>

10
pages/index/index.wxss Normal file
View File

@@ -0,0 +1,10 @@
/**index.wxss**/
page {
height: 100vh;
display: flex;
flex-direction: column;
}
.scrollarea {
flex: 1;
overflow-y: hidden;
}

66
pages/success/success.js Normal file
View File

@@ -0,0 +1,66 @@
// pages/success/success.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@@ -0,0 +1,4 @@
<!--pages/success/success.wxml-->
<view class="container">
<text>连接成功了</text>
</view>

View File

@@ -0,0 +1 @@
/* pages/success/success.wxss */