123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <template>
- <view>
- <form ref="form" @submit="handleSubmit">
- <view class="login-panel">
- <view>
- <input class="input-cube" ref="ssid" v-model="ssid" type="text" maxlength="32"
- placeholder="请输入路由器名称" name="ssid" />
- <input class="input-cube" maxlength="20" type="text" v-model="password" placeholder="请输入密码"
- name="password" />
- <button class="input-btn" form-type="submit" :disabled="startDisabled">开始配网</button>
- </view>
- </view>
- <view class="message">1. 请确保手机WiFi连接到2.4GHz频段路由器</view>
- <view class="message">2. 设备仅支持2.4GHz网络</view>
- </form>
- </view>
- </template>
-
- <script>
- export default {
- data() {
- return {
- ssid:'',
- password:'',
- }
- },
- onLoad() {
- const _this = this
- wx.startWifi({
- success(res) {
- _this.getWifiInfo();
- },
- fail: function (res) {
- console.log('获取网络fail',res);
- // _this.showPopIs5G();
- // uni.showToast({
- // title: "请连接路由器",
- // duration: 2000,
- // });
- },
- });
- },
- methods: {
- handleSubmit(){
-
- },
- getWifiInfo(){
- wx.getConnectedWifi({
- success(res){
- console.log('连接网络成功',res)
- if ("getConnectedWifi:ok" === res.errMsg) {
- this.ssid = res.wifi.SSID
- }
- },
- fail(res){
- console.log('连接的网络失败',res);
- }
- })
- }
- }
- }
- </script>
-
- <style lang="scss" scoped>
- .login-panel {
- margin: 60rpx;
- }
- .input-cube {
- border: solid 3rpx #65ceac;
- border-radius: 40rpx;
- margin: 30rpx 0;
- height: 80rpx;
- padding: 0 40rpx;
- font-size: 30rpx;
- }
- .input-btn {
- border-radius: 40rpx;
- height: 80rpx;
- background-color: #65ceac;
- color: white;
- font-size: 30rpx;
- }
- </style>
|