(function(vue) { "use strict"; const _sfc_main$2 = vue.defineComponent({ data() { return { foundDevices: [], isScanning: false, bluetoothEnabled: false, connectedDeviceId: "" }; }, onLoad() { this.initBluetooth(); }, onUnload() { this.stopScan(); uni.closeBluetoothAdapter(); uni.offBluetoothDeviceFound(this.onDeviceFound); }, methods: { // 初始化蓝牙适配器 initBluetooth() { uni.openBluetoothAdapter(new UTSJSONObject({ success: () => { this.bluetoothEnabled = true; }, fail: (err = null) => { this.bluetoothEnabled = false; uni.showModal(new UTSJSONObject({ title: "蓝牙开启失败", content: "请检查设备蓝牙是否开启", showCancel: false })); uni.__log__("error", "at pages/index/index.uvue:88", "蓝牙初始化失败:", err); } })); }, // 切换扫描状态(开始/停止) toggleScan() { if (!this.bluetoothEnabled) { this.initBluetooth(); return null; } if (this.isScanning) { this.stopScan(); } else { this.startScan(); } }, // 开始扫描设备 startScan() { this.isScanning = true; this.foundDevices = []; uni.startBluetoothDevicesDiscovery(new UTSJSONObject({ services: [], allowDuplicatesKey: false, success: () => { uni.showToast({ title: "开始扫描", icon: "none" }); uni.onBluetoothDeviceFound(this.onDeviceFound); }, fail: (err = null) => { this.isScanning = false; uni.showToast({ title: "扫描失败", icon: "none" }); uni.__log__("error", "at pages/index/index.uvue:124", "扫描失败:", err); } })); setTimeout(() => { if (this.isScanning) this.stopScan(); }, 5e3); }, // 停止扫描 stopScan() { if (!this.isScanning) return null; uni.stopBluetoothDevicesDiscovery(new UTSJSONObject({ success: () => { this.isScanning = false; if (this.foundDevices.length == 0) { uni.showToast({ title: "暂未扫描到任何设备", icon: "none" }); return null; } uni.showToast({ title: "扫描完成,发现".concat(this.foundDevices.length, "台设备"), icon: "none" }); }, fail: (err = null) => { uni.__log__("error", "at pages/index/index.uvue:154", "停止扫描失败:", err); } })); }, // 设备发现回调(处理去重和数据格式化) onDeviceFound(res = null) { const devices = res.devices || []; devices.forEach((device = null) => { if (!device.deviceId) return null; const isExist = this.foundDevices.some((d) => { return d.deviceId === device.deviceId; }); if (isExist) return null; var is_bj = false; const advData = new Uint8Array(device.advertisData); const devicenameData = advData.slice(2, 6); const devicename = String.fromCharCode(...devicenameData); if (devicename == "dzbj") is_bj = true; this.foundDevices.push({ is_bj, name: device.name || "未知设备", deviceId: device.deviceId, rssi: device.RSSI, connected: device.deviceId === this.connectedDeviceId }); }); }, // 计算信号强度条宽度(-100dBm为0%,-30dBm为100%) getRssiWidth(rssi = null) { const minRssi = -100; const maxRssi = -30; let ratio = (rssi - minRssi) / (maxRssi - minRssi); ratio = Math.max(0, Math.min(1, ratio)); return "".concat(ratio * 100, "%"); }, connectDevice(device = null) { var that = this; this.stopScan(); uni.showLoading({ title: "连接中..." }); uni.createBLEConnection(new UTSJSONObject({ deviceId: device.deviceId, success(res = null) { that.foundDevices = that.foundDevices.map((d) => { return Object.assign(Object.assign({}, d), { connected: d.deviceId === device.deviceId }); }); uni.hideLoading(); uni.showToast({ title: "已连接".concat(device.name), icon: "none" }); uni.navigateTo({ url: "../connect/connect?deviceId=" + device.deviceId, fail: (err) => { uni.showToast({ title: "连接失败,请稍后重试", icon: "error" }); uni.closeBLEConnection(new UTSJSONObject({ deviceId: device.deviceId, success() { console("断开连接成功"); } })); } }); }, fail() { uni.hideLoading(); uni.showToast({ title: "连接失败", icon: "error" }); } })); } } }); const _style_0$2 = { "container": { "": { "paddingTop": "16rpx", "paddingRight": "16rpx", "paddingBottom": "16rpx", "paddingLeft": "16rpx", "backgroundColor": "#f5f5f5" } }, "title-bar": { "": { "display": "flex", "justifyContent": "space-between", "alignItems": "center", "paddingTop": "20rpx", "paddingRight": 0, "paddingBottom": "20rpx", "paddingLeft": 0, "borderBottomWidth": 1, "borderBottomStyle": "solid", "borderBottomColor": "#eeeeee", "marginBottom": "20rpx", "marginTop": "80rpx" } }, "title": { "": { "fontSize": "36rpx", "fontWeight": "bold", "color": "#333333" } }, "scan-btn": { "": { "backgroundColor": "#00c900", "color": "#FFFFFF", "paddingTop": "0rpx", "paddingRight": "24rpx", "paddingBottom": "0rpx", "paddingLeft": "24rpx", "borderTopLeftRadius": "8rpx", "borderTopRightRadius": "8rpx", "borderBottomRightRadius": "8rpx", "borderBottomLeftRadius": "8rpx", "fontSize": "28rpx", "marginRight": "5%", "backgroundColor:disabled": "#cccccc" } }, "status-tip": { "": { "textAlign": "center", "paddingTop": "40rpx", "paddingRight": 0, "paddingBottom": "40rpx", "paddingLeft": 0, "color": "#666666", "fontSize": "28rpx" } }, "loading": { "": { "width": "30rpx", "height": "30rpx", "borderTopWidth": "3rpx", "borderRightWidth": "3rpx", "borderBottomWidth": "3rpx", "borderLeftWidth": "3rpx", "borderTopStyle": "solid", "borderRightStyle": "solid", "borderBottomStyle": "solid", "borderLeftStyle": "solid", "borderTopColor": "rgba(0,0,0,0)", "borderRightColor": "#007aff", "borderBottomColor": "#007aff", "borderLeftColor": "#007aff", "marginTop": "20rpx", "marginRight": "auto", "marginBottom": "20rpx", "marginLeft": "auto", "animation": "spin 1s linear infinite" } }, "device-list": { "": { "display": "flex", "flexDirection": "column", "gap": "16rpx" } }, "device-item": { "": { "backgroundColor": "#FFFFFF", "borderTopLeftRadius": "12rpx", "borderTopRightRadius": "12rpx", "borderBottomRightRadius": "12rpx", "borderBottomLeftRadius": "12rpx", "paddingTop": "24rpx", "paddingRight": "24rpx", "paddingBottom": "24rpx", "paddingLeft": "24rpx", "boxShadow": "0 2rpx 8rpx rgba(0,0,0,0.1)", "cursor": "pointer" } }, "device-name": { "": { "display": "flex", "justifyContent": "space-between", "marginBottom": "16rpx" } }, "is_bj": { "": { "paddingTop": 3, "paddingRight": 8, "paddingBottom": 3, "paddingLeft": 8, "borderTopLeftRadius": 5, "borderTopRightRadius": 5, "borderBottomRightRadius": 5, "borderBottomLeftRadius": 5, "color": "#FFFFFF", "backgroundColor": "rgba(30,228,156,0.4)", "position": "relative", "right": 30 } }, "device-id": { "": { "fontSize": "24rpx", "color": "#999999" } }, "device-rssi": { "": { "display": "flex", "flexDirection": "column", "gap": "8rpx" } }, "rssi-bar": { "": { "height": "8rpx", "backgroundColor": "#eeeeee", "borderTopLeftRadius": "4rpx", "borderTopRightRadius": "4rpx", "borderBottomRightRadius": "4rpx", "borderBottomLeftRadius": "4rpx", "overflow": "hidden", "content::after": "''", "height::after": "100%", "backgroundImage::after": "linear-gradient(to right, #ff4d4f, #faad14, #52c41a)", "backgroundColor::after": "rgba(0,0,0,0)" } }, "device-status": { "": { "marginTop": "16rpx", "textAlign": "right" } }, "connected": { "": { "fontSize": "26rpx", "color": "#07c160", "backgroundColor": "#f0fff4", "paddingTop": "4rpx", "paddingRight": "16rpx", "paddingBottom": "4rpx", "paddingLeft": "16rpx", "borderTopLeftRadius": "12rpx", "borderTopRightRadius": "12rpx", "borderBottomRightRadius": "12rpx", "borderBottomLeftRadius": "12rpx" } }, "@FONT-FACE": [{}] }; const _export_sfc = (sfc, props) => { const target = sfc.__vccOpts || sfc; for (const [key, val] of props) { target[key] = val; } return target; }; function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) { return vue.openBlock(), vue.createElementBlock("view", { class: "container" }, [ vue.createElementVNode("view", { class: "title-bar" }, [ vue.createElementVNode("text", { class: "title" }, "连接设备"), vue.createElementVNode("button", { class: "scan-btn", disabled: $data.isScanning, onClick: _cache[0] || (_cache[0] = (...args) => $options.toggleScan && $options.toggleScan(...args)) }, vue.toDisplayString($data.isScanning ? "停止扫描" : "开始扫描"), 9, ["disabled"]) ]), $data.isScanning ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "status-tip" }, [ vue.createElementVNode("text", null, "正在扫描设备..."), vue.createElementVNode("view", { class: "loading" }) ])) : $data.foundDevices.length === 0 ? (vue.openBlock(), vue.createElementBlock("view", { key: 1, class: "status-tip" }, [ vue.createElementVNode("text", null, '未发现设备,请点击"开始扫描"') ])) : vue.createCommentVNode("", true), vue.createElementVNode("view", { class: "device-list" }, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($data.foundDevices, (device, index) => { return vue.openBlock(), vue.createElementBlock("view", { class: "device-item", key: device.deviceId, onClick: ($event) => $options.connectDevice(device) }, [ vue.createElementVNode("view", { class: "device-name" }, [ vue.createElementVNode("text", null, vue.toDisplayString(device.name || "未知设备"), 1), device.is_bj ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "is_bj" }, "吧唧")) : vue.createCommentVNode("", true), vue.createElementVNode("text", { class: "device-id" }, vue.toDisplayString(device.deviceId), 1) ]), vue.createElementVNode("view", { class: "device-rssi" }, [ vue.createElementVNode("text", null, "信号: " + vue.toDisplayString(device.rssi) + " dBm", 1), vue.createElementVNode("view", { class: "rssi-bar", style: vue.normalizeStyle({ width: $options.getRssiWidth(device.rssi) }) }, null, 4) ]), device.connected ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "device-status" }, [ vue.createElementVNode("text", { class: "connected" }, "已连接") ])) : vue.createCommentVNode("", true) ], 8, ["onClick"]); }), 128)) ]) ]); } const PagesIndexIndex = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1], ["styles", [_style_0$2]]]); const _sfc_main$1 = vue.defineComponent({ data() { return { // 图片相关 uploadedImages: [], currentImageUrl: "", currentImageIndex: -1, imageDir: "", // BLE设备数据 isConnected: true, isScanning: false, batteryLevel: 0, temperature: 0, humidity: 0, faceStatus: 0, // statusPotColor:'Green', deviceId: "", imageServiceuuid: "", imageWriteuuid: "", // 模拟数据定时器 dataTimer: null }; }, computed: { // 表盘状态文本 faceStatusText() { switch (this.faceStatus) { case 0: return "正常"; case 1: return "更新中"; case 2: return "异常"; default: return "未知"; } }, // 电池颜色(根据电量变化) batteryColor() { if (this.batteryLevel > 70) return "#52c41a"; if (this.batteryLevel > 30) return "#faad14"; return "#ff4d4f"; } }, onLoad(options) { this.deviceId = options.deviceId; this.initImageDir(); this.loadSavedImages(); this.setBleMtu(); }, onUnload() { this.stopDataSimulation(); if (this.isConnected) { this.disconnectDevice(); } }, methods: { writeBleImage() { }, getBleService() { var that = this; uni.getBLEDeviceServices(new UTSJSONObject({ deviceId: that.deviceId, success(services = null) { that.imageServiceuuid = services.services[2].uuid; that.getBleChar(); }, fail() { uni.__log__("log", "at pages/connect/connect.uvue:224", "获取服务Id失败"); } })); }, getBleChar() { var that = this; uni.getBLEDeviceCharacteristics(new UTSJSONObject({ deviceId: that.deviceId, serviceId: that.imageServiceuuid, success(res = null) { that.imageWriteuuid = res.characteristics[0].uuid; }, fail() { uni.__log__("log", "at pages/connect/connect.uvue:237", "获取特征Id失败"); } })); }, setBleMtu() { var that = this; uni.setBLEMTU(new UTSJSONObject({ deviceId: that.deviceId, mtu: 512, success() { that.isConnected = true; uni.__log__("log", "at pages/connect/connect.uvue:249", "MTU设置成功"); that.getBleService(); }, fail() { uni.__log__("log", "at pages/connect/connect.uvue:253", "MTU设置失败"); } })); }, // 初始化图片保存目录 initImageDir() { this.imageDir = "watch_faces/"; }, loadSavedImages() { const savedImages = uni.getStorageSync("watch_face_images") || []; this.uploadedImages = savedImages; if (savedImages.length > 0) { this.currentImageUrl = savedImages[0].url; this.currentImageIndex = 0; } }, // 判断是否为图片文件 isImageFile(filename = null) { const ext = filename.toLowerCase().split(".").pop(); return ["jpg", "jpeg", "png", "gif", "bmp"].includes(ext); }, // 选择图片 chooseImage() { uni.chooseImage(new UTSJSONObject({ count: 1, sizeType: ["compressed"], sourceType: ["album", "camera"], success: (res) => { uni.__log__("log", "at pages/connect/connect.uvue:329", res); const tempFilePath = res.tempFilePaths[0]; const fs = uni.getFileSystemManager(); fs.readFile({ filePath: tempFilePath, encoding: "binary", success: (res2) => { this.imageBuffer = res2.data; this.log = "图片读取成功,大小:" + this.imageBuffer.byteLength + "字节"; } }); this.saveImageToLocal(tempFilePath); }, fail: (err) => { uni.__log__("error", "at pages/connect/connect.uvue:343", "选择图片失败:", err); uni.showToast({ title: "选择图片失败", icon: "none" }); } })); }, // 保存图片到本地目录 saveImageToLocal(tempPath = null) { const fileName = "face_".concat(Date.now(), ".png"); this.uploadedImages.push({ name: fileName, url: tempPath }); uni.setStorageSync("watch_face_images", this.uploadedImages); this.currentImageIndex = this.uploadedImages.length - 1; this.currentImageUrl = tempPath; uni.showToast({ title: "图片保存成功", icon: "success" }); }, // 选择轮播中的图片 selectImage(index = null) { this.currentImageIndex = index; this.currentImageUrl = this.uploadedImages[index].url; }, // 轮播图变化时触发 handleCarouselChange(e = null) { const index = e.detail.current; this.currentImageIndex = index; this.currentImageUrl = this.uploadedImages[index].url; }, // 设置为当前表盘 setAsCurrentFace() { this.faceStatus = 1; setTimeout(() => { this.faceStatus = 0; uni.showToast({ title: "表盘已更新", icon: "success" }); uni.setStorageSync("current_watch_face", this.currentImageUrl); }, 1500); }, // 切换设备连接状态 toggleConnection() { if (this.isConnected) { this.disconnectDevice(); } else { this.connectDevice(); } }, // 连接设备 connectDevice() { var that = this; this.isScanning = true; uni.showToast({ title: "正在连接设备...", icon: "none" }); uni.createBLEConnection(new UTSJSONObject({ deviceId: that.deviceId, success() { that.isScanning = false; that.isConnected = true; uni.showToast({ title: "设备连接成功", icon: "success" }); that.setBleMtu(); that.startDataSimulation(); } })); }, // 断开连接 disconnectDevice() { var that = this; uni.closeBLEConnection(new UTSJSONObject({ deviceId: that.deviceId, success() { that.isConnected = false; that.statusPotColor = "red"; uni.showToast({ title: "已断开连接", icon: "none" }); that.stopDataSimulation(); }, fail(res = null) { if (res == 1e4) { uni.openBluetoothAdapter(new UTSJSONObject({ success() { that.isConnected = false; }, fail() { uni.__log__("log", "at pages/connect/connect.uvue:464", "初始化失败"); } })); } } })); }, // 开始模拟数据更新 startDataSimulation() { if (this.dataTimer) { clearInterval(this.dataTimer); } this.batteryLevel = Math.floor(Math.random() * 30) + 70; this.temperature = Math.floor(Math.random() * 10) + 20; this.humidity = Math.floor(Math.random() * 30) + 40; this.dataTimer = setInterval(() => { if (this.batteryLevel > 1) { this.batteryLevel = Math.max(1, this.batteryLevel - Math.random() * 2); } this.temperature = Math.max(15, Math.min(35, this.temperature + (Math.random() * 2 - 1))); this.humidity = Math.max(30, Math.min(80, this.humidity + (Math.random() * 4 - 2))); }, 5e3); }, // 停止数据模拟 stopDataSimulation() { if (this.dataTimer) { clearInterval(this.dataTimer); this.dataTimer = null; } } } }); const _style_0$1 = { "status-pot": { "": { "width": 16, "height": 16 } }, "container": { "": { "backgroundColor": "#f5f5f7" } }, "nav-bar": { "": { "display": "flex", "justifyContent": "space-between", "alignItems": "center", "paddingTop": "20rpx", "paddingRight": "30rpx", "paddingBottom": "20rpx", "paddingLeft": "30rpx", "backgroundColor": "#ffffff" } }, "nav-title": { "": { "color": "#FFFFFF", "fontSize": "36rpx" } }, "upload-btn": { "": { "alignItems": "center", "gap": "8rpx", "backgroundColor": "#28d50e", "color": "#FFFFFF", "width": "35%", "marginTop": 10, "paddingTop": "14rpx", "paddingRight": "0rpx", "paddingBottom": "14rpx", "paddingLeft": "0rpx", "borderTopLeftRadius": "8rpx", "borderTopRightRadius": "8rpx", "borderBottomRightRadius": "8rpx", "borderBottomLeftRadius": "8rpx", "fontSize": "26rpx" } }, "content": { "": { "paddingTop": "30rpx", "paddingRight": "30rpx", "paddingBottom": "30rpx", "paddingLeft": "30rpx" } }, "section-title": { "": { "fontSize": "32rpx", "color": "#333333", "marginTop": "30rpx", "marginRight": 0, "marginBottom": "20rpx", "marginLeft": 0 } }, "preview-container": { "": { "display": "flex", "flexDirection": "column", "alignItems": "center", "marginBottom": "20rpx" } }, "preview-frame": { "": { "width": "480rpx", "height": "480rpx", "backgroundColor": "#ffffff", "boxShadow": "0 4rpx 12rpx rgba(0, 0, 0, 0.1)", "display": "flex", "justifyContent": "center", "alignItems": "center", "overflow": "hidden", "position": "relative" } }, "preview-image": { "": { "width": "100%", "height": "100%" } }, "empty-preview": { "": { "display": "flex", "flexDirection": "column", "alignItems": "center", "color": "#cccccc" } }, "set-btn": { "": { "marginTop": "20rpx", "backgroundColor": "#3cbb19", "color": "#FFFFFF", "width": "35%", "paddingTop": "15rpx", "paddingRight": "0rpx", "paddingBottom": "15rpx", "paddingLeft": "0rpx", "borderTopLeftRadius": "8rpx", "borderTopRightRadius": "8rpx", "borderBottomRightRadius": "8rpx", "borderBottomLeftRadius": "8rpx", "fontSize": "28rpx" } }, "carousel-section": { "": { "marginBottom": "30rpx" } }, "carousel-container": { "": { "backgroundColor": "#FFFFFF", "borderTopLeftRadius": "16rpx", "borderTopRightRadius": "16rpx", "borderBottomRightRadius": "16rpx", "borderBottomLeftRadius": "16rpx", "paddingTop": "20rpx", "paddingRight": 0, "paddingBottom": "20rpx", "paddingLeft": 0, "boxShadow": "0 2rpx 8rpx rgba(0, 0, 0, 0.05)", "overflow": "hidden" } }, "card-swiper": { "": { "width": "100%", "height": "240rpx" } }, "swiper-item": { ".card-swiper ": { "display": "flex", "justifyContent": "center", "alignItems": "center", "transitionProperty": "all", "transitionDuration": "0.3s", "transitionTimingFunction": "ease" } }, "card-item": { "": { "width": "240rpx", "height": "240rpx" } }, "card-frame": { "": { "width": "240rpx", "height": "100%", "overflow": "hidden", "boxShadow": "0 6rpx 16rpx rgba(0, 0, 0, 0.15)", "position": "relative" } }, "card-image": { "": { "width": "240rpx", "height": "100%" } }, "card-overlay": { "": { "position": "absolute", "top": 0, "left": 0, "width": "240rpx", "height": "100%", "backgroundColor": "rgba(0,0,0,0.3)", "display": "flex", "justifyContent": "center", "alignItems": "center" } }, "swiper-item-active": { ".card-swiper ": { "transform": "scale(1)", "zIndex": 2 } }, "carousel-hint": { "": { "height": "200rpx", "display": "flex", "justifyContent": "center", "alignItems": "center", "color": "#999999", "fontSize": "26rpx", "textAlign": "center" } }, "data-section": { "": { "backgroundColor": "#FFFFFF", "borderTopLeftRadius": "16rpx", "borderTopRightRadius": "16rpx", "borderBottomRightRadius": "16rpx", "borderBottomLeftRadius": "16rpx", "paddingTop": "20rpx", "paddingRight": "30rpx", "paddingBottom": "20rpx", "paddingLeft": "30rpx", "boxShadow": "0 2rpx 8rpx rgba(0, 0, 0, 0.05)" } }, "data-grid": { "": { "gridTemplateColumns": "1fr 1fr", "gap": "20rpx", "marginBottom": "30rpx" } }, "data-card": { "": { "backgroundColor": "#f9f9f9", "borderTopLeftRadius": "12rpx", "borderTopRightRadius": "12rpx", "borderBottomRightRadius": "12rpx", "borderBottomLeftRadius": "12rpx", "paddingTop": "20rpx", "paddingRight": "20rpx", "paddingBottom": "20rpx", "paddingLeft": "20rpx", "display": "flex", "alignItems": "center", "gap": "20rpx" } }, "data-icon": { "": { "width": "60rpx", "height": "60rpx", "borderTopLeftRadius": "12rpx", "borderTopRightRadius": "12rpx", "borderBottomRightRadius": "12rpx", "borderBottomLeftRadius": "12rpx", "display": "flex", "justifyContent": "center", "alignItems": "center" } }, "battery-icon": { "": { "backgroundColor": "#f6ffed" } }, "temp-icon": { "": { "backgroundColor": "#fff7e6" } }, "humidity-icon": { "": { "backgroundColor": "#e6f7ff" } }, "status-icon": { "": { "backgroundColor": "#f0f9ff" } }, "data-info": { "": { "flex": 1 } }, "data-value": { "": { "fontSize": "32rpx", "fontWeight": "bold", "color": "#333333" } }, "data-label": { "": { "fontSize": "24rpx", "color": "#666666" } }, "connection-status": { "": { "display": "flex", "justifyContent": "space-between", "alignItems": "center", "paddingTop": "15rpx", "paddingRight": 0, "paddingBottom": "15rpx", "paddingLeft": 0, "borderTopWidth": "1rpx", "borderTopStyle": "solid", "borderTopColor": "#f0f0f0" } }, "status-text": { "": { "flex": 1, "marginTop": 0, "marginRight": "15rpx", "marginBottom": 0, "marginLeft": "15rpx", "fontSize": "28rpx", "color": "#333333" } }, "connect-btn": { "": { "paddingTop": "12rpx", "paddingRight": "24rpx", "paddingBottom": "12rpx", "paddingLeft": "24rpx", "borderTopLeftRadius": "8rpx", "borderTopRightRadius": "8rpx", "borderBottomRightRadius": "8rpx", "borderBottomLeftRadius": "8rpx", "fontSize": "26rpx", "backgroundColor": "#007aff", "color": "#FFFFFF", "backgroundColor:disabled": "#cccccc" } }, "@TRANSITION": { "swiper-item": { "property": "all", "duration": "0.3s", "timingFunction": "ease" } } }; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { const _component_uni_icons = vue.resolveComponent("uni-icons"); return vue.openBlock(), vue.createElementBlock("view", { class: "container" }, [ vue.createElementVNode("view", { class: "nav-bar" }, [ vue.createElementVNode("text", { class: "nav-title" }, "表盘管理器") ]), vue.createElementVNode("view", { class: "content" }, [ vue.createElementVNode("view", { class: "preview-container" }, [ vue.createElementVNode("view", { class: "preview-frame" }, [ $data.currentImageUrl ? (vue.openBlock(), vue.createElementBlock("image", { key: 0, src: $data.currentImageUrl, class: "preview-image", mode: "aspectFill" }, null, 8, ["src"])) : (vue.openBlock(), vue.createElementBlock("view", { key: 1, class: "empty-preview" }, [ vue.createVNode(_component_uni_icons, { type: "image", size: "60", color: "#ccc" }), vue.createElementVNode("text", null, "请选择表盘图片") ])) ]), $data.currentImageUrl ? (vue.openBlock(), vue.createElementBlock("button", { key: 0, class: "set-btn", onClick: _cache[0] || (_cache[0] = (...args) => $options.setAsCurrentFace && $options.setAsCurrentFace(...args)) }, " 设置为当前表盘 ")) : vue.createCommentVNode("", true), vue.createElementVNode("button", { class: "upload-btn", onClick: _cache[1] || (_cache[1] = (...args) => $options.chooseImage && $options.chooseImage(...args)) }, [ vue.createVNode(_component_uni_icons, { type: "camera", size: "24", color: "#fff" }), vue.createElementVNode("text", null, "上传图片") ]) ]), vue.createElementVNode("view", { class: "carousel-section" }, [ vue.createElementVNode("text", { class: "section-title" }, "已上传表盘"), vue.createElementVNode("view", { class: "carousel-container" }, [ vue.createElementVNode("swiper", { class: "card-swiper", circular: "", "previous-margin": "200rpx", "next-margin": "200rpx", onChange: _cache[2] || (_cache[2] = (...args) => $options.handleCarouselChange && $options.handleCarouselChange(...args)) }, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($data.uploadedImages, (img, index) => { return vue.openBlock(), vue.createElementBlock("swiper-item", { key: index }, [ vue.createElementVNode("view", { class: "card-item", onClick: ($event) => $options.selectImage(index) }, [ vue.createElementVNode("view", { class: "card-frame" }, [ vue.createElementVNode("image", { src: img.url, class: "card-image", mode: "aspectFill" }, null, 8, ["src"]), $data.currentImageIndex === index ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "card-overlay" }, [ vue.createVNode(_component_uni_icons, { type: "checkmark", size: "30", color: "#007aff" }) ])) : vue.createCommentVNode("", true) ]) ], 8, ["onClick"]) ]); }), 128)) ], 32), $data.uploadedImages.length === 0 ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "carousel-hint" }, [ vue.createElementVNode("text", null, "暂无上传图片,请点击上方上传按钮添加") ])) : vue.createCommentVNode("", true) ]) ]), vue.createElementVNode("view", { class: "data-section" }, [ vue.createElementVNode("text", { class: "section-title" }, "设备状态"), vue.createElementVNode("view", { class: "data-grid" }, [ vue.createElementVNode("view", { class: "data-card" }, [ vue.createElementVNode("view", { class: "data-icon battery-icon" }, [ vue.createVNode(_component_uni_icons, { type: "battery", size: "36", color: $options.batteryColor }, null, 8, ["color"]) ]), vue.createElementVNode("view", { class: "data-info" }, [ vue.createElementVNode("text", { class: "data-value" }, vue.toDisplayString($data.batteryLevel) + "%", 1), vue.createElementVNode("text", { class: "data-label" }, "电量") ]) ]), vue.createElementVNode("view", { class: "data-card" }, [ vue.createElementVNode("view", { class: "data-icon temp-icon" }, [ vue.createVNode(_component_uni_icons, { type: "thermometer", size: "36", color: "#ff7a45" }) ]), vue.createElementVNode("view", { class: "data-info" }, [ vue.createElementVNode("text", { class: "data-value" }, vue.toDisplayString($data.temperature) + "°C", 1), vue.createElementVNode("text", { class: "data-label" }, "温度") ]) ]), vue.createElementVNode("view", { class: "data-card" }, [ vue.createElementVNode("view", { class: "data-icon humidity-icon" }, [ vue.createVNode(_component_uni_icons, { type: "water", size: "36", color: "#40a9ff" }) ]), vue.createElementVNode("view", { class: "data-info" }, [ vue.createElementVNode("text", { class: "data-value" }, vue.toDisplayString($data.humidity) + "%", 1), vue.createElementVNode("text", { class: "data-label" }, "湿度") ]) ]), vue.createElementVNode("view", { class: "data-card" }, [ vue.createElementVNode("view", { class: "data-icon status-icon" }, [ vue.createVNode(_component_uni_icons, { type: "watch", size: "36", color: "#52c41a" }) ]), vue.createElementVNode("view", { class: "data-info" }, [ vue.createElementVNode("text", { class: "data-value" }, vue.toDisplayString($options.faceStatusText), 1), vue.createElementVNode("text", { class: "data-label" }, "表盘状态") ]) ]) ]), vue.createElementVNode("view", { class: "connection-status" }, [ vue.createVNode(_component_uni_icons, { type: "bluetooth", size: "24", color: $data.isConnected ? "#52c41a" : "#ff4d4f", animation: $data.isScanning ? "spin" : "" }, null, 8, ["color", "animation"]), vue.createElementVNode("view", { class: "status-pot", style: vue.normalizeStyle({ backgroundColor: $data.isConnected ? "Green" : "red" }) }, null, 4), vue.createElementVNode("text", { class: "status-text" }, vue.toDisplayString($data.isConnected ? "已连接设备" : $data.isScanning ? "正在搜索设备..." : "未连接设备"), 1), vue.createElementVNode("button", { class: "connect-btn", onClick: _cache[3] || (_cache[3] = (...args) => $options.toggleConnection && $options.toggleConnection(...args)), disabled: $data.isScanning }, vue.toDisplayString($data.isConnected ? "断开连接" : "连接设备"), 9, ["disabled"]) ]) ]) ]) ]); } const PagesConnectConnect = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["styles", [_style_0$1]]]); __definePage("pages/index/index", PagesIndexIndex); __definePage("pages/connect/connect", PagesConnectConnect); const _sfc_main = vue.defineComponent(new UTSJSONObject({ onLaunch: function() { uni.__log__("log", "at App.uvue:7", "App Launch"); }, onShow: function() { uni.__log__("log", "at App.uvue:10", "App Show"); }, onHide: function() { uni.__log__("log", "at App.uvue:13", "App Hide"); }, onExit: function() { uni.__log__("log", "at App.uvue:34", "App Exit"); } })); const _style_0 = { "uni-row": { "": { "flexDirection": "row" } }, "uni-column": { "": { "flexDirection": "column" } } }; const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["styles", [_style_0]]]); const __global__ = typeof globalThis === "undefined" ? Function("return this")() : globalThis; __global__.__uniX = true; function createApp() { const app = vue.createSSRApp(App); return { app }; } createApp().app.mount("#app"); })(Vue);