wangzhibo
2025-10-23 cad64c1de2c45856b0774933c5801b05b64984e8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
"use strict";
const common_vendor = require("../../common/vendor.js");
const _sfc_main = {
  methods: {
    copyWifiPassword() {
      const password = "jmyby88888888";
      common_vendor.index.setClipboardData({
        data: password,
        success: () => {
          common_vendor.index.showToast({
            title: "密码已复制",
            icon: "none",
            duration: 1500
          });
        },
        fail: () => {
          common_vendor.index.showToast({
            title: "复制失败",
            icon: "error"
          });
        }
      });
    },
    connectWifi() {
      const SSID = "JMYBY";
      const PASSWORD = "jmyby88888888";
      if (common_vendor.index.getSystemInfoSync().platform !== "android") {
        common_vendor.index.showToast({
          title: "仅支持安卓手机自动连接",
          icon: "none"
        });
        return;
      }
      common_vendor.index.startWifi({
        success: () => {
          common_vendor.index.connectWifi({
            SSID,
            password: PASSWORD,
            success: () => {
              common_vendor.index.showToast({
                title: "WiFi连接成功",
                icon: "none"
              });
            },
            fail: (err) => {
              common_vendor.index.__f__("log", "at pages/index/wifi.vue:84", "连接失败:", err);
              common_vendor.index.showToast({
                title: "连接失败,请手动连接",
                icon: "none"
              });
            }
          });
        },
        fail: (err) => {
          common_vendor.index.__f__("log", "at pages/index/wifi.vue:93", "启动WiFi模块失败:", err);
          common_vendor.index.showToast({
            title: "无法启动WiFi模块",
            icon: "none"
          });
        }
      });
    }
  }
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  return {
    a: common_vendor.o((...args) => $options.copyWifiPassword && $options.copyWifiPassword(...args)),
    b: common_vendor.o((...args) => $options.connectWifi && $options.connectWifi(...args))
  };
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/index/wifi.js.map