@solar-taro/ui-vant 4.1.0 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index5.js CHANGED
@@ -1,30 +1,29 @@
1
- import { defineComponent as R, inject as N, useModel as A, useId as G, computed as c, ref as $, effect as q, Fragment as J, mergeModels as x, openBlock as K, createElementBlock as O, renderSlot as Q, createElementVNode as W, normalizeClass as X, toDisplayString as Z, createBlock as ee, unref as te, withModifiers as ae, createCommentVNode as ne, createVNode as re, createSlots as ie, withCtx as le, withDirectives as se } from "vue";
1
+ import { defineComponent as R, inject as B, useModel as A, useId as G, computed as c, ref as q, effect as I, Fragment as J, mergeModels as $, openBlock as K, createElementBlock as O, renderSlot as Q, createElementVNode as W, normalizeClass as X, toDisplayString as Z, createBlock as ee, unref as te, withModifiers as ae, createCommentVNode as ne, createVNode as re, createSlots as le, withCtx as ie, withDirectives as oe, createTextVNode as se } from "vue";
2
2
  import { date as g } from "@solar-taro/core";
3
- import { SUN_ITEM as oe, SUN_FIELD as ue, SunIcon as V } from "@solar-taro/ui-sun";
4
- import { linkedRef as de } from "@solar-vue/core";
5
- import ce from "./index6.js";
6
- import { vDatetimePicker as pe } from "./index13.js";
7
- const ve = Q, p = Z, l = K, d = O, me = ne, n = te, I = ae, fe = ee, D = re, M = X, s = W, ke = se, E = le, we = ie, ge = J, ye = {
3
+ import { SUN_ITEM as ue, SUN_FIELD as de, SunIcon as D, SunModal as ce, SunButton as pe } from "@solar-taro/ui-sun";
4
+ import { linkedRef as ve } from "@solar-vue/core";
5
+ import { vDatetimePicker as me } from "./index12.js";
6
+ const fe = Q, p = Z, i = K, u = O, ke = ne, a = te, E = ae, we = ee, y = re, _ = X, d = W, ge = se, T = ie, ye = oe, he = le, Ve = J, Me = {
8
7
  key: 0,
9
8
  class: "sun-date-range-picker-inner"
10
- }, he = {
9
+ }, be = {
11
10
  key: 1,
12
11
  class: "sun-date-range-picker-placeholder"
13
- }, _e = { class: "sun-date-range-picker-input-group" }, be = {
12
+ }, De = { class: "sun-date-range-picker-input-group" }, _e = {
14
13
  key: 0,
15
14
  class: "sun-date-range-picker-input-value"
16
- }, Ve = {
15
+ }, Te = {
17
16
  key: 1,
18
17
  class: "sun-date-range-picker-input-placeholder"
19
- }, De = { class: "sun-date-range-picker-input-label" }, Me = {
18
+ }, Se = { class: "sun-date-range-picker-input-label" }, xe = {
20
19
  key: 0,
21
20
  class: "date-range-picker-input-value"
22
21
  }, Ce = {
23
22
  key: 1,
24
23
  class: "sun-date-range-picker-input-placeholder"
25
- }, Te = { class: "sun-date-range-picker-input-label" }, Se = ["id", "type", "value", "min-date", "max-date"], F = " ~ ", Ee = /* @__PURE__ */ R({
24
+ }, Ne = { class: "sun-date-range-picker-input-label" }, Be = ["id", "type", "value", "min-date", "max-date"], F = " ~ ", ze = /* @__PURE__ */ R({
26
25
  __name: "index",
27
- props: /* @__PURE__ */ x({
26
+ props: /* @__PURE__ */ $({
28
27
  type: { default: "date" },
29
28
  placeholder: {},
30
29
  required: { type: Boolean },
@@ -36,42 +35,42 @@ const ve = Q, p = Z, l = K, d = O, me = ne, n = te, I = ae, fe = ee, D = re, M =
36
35
  modelValue: { required: !0 },
37
36
  modelModifiers: {}
38
37
  }),
39
- emits: /* @__PURE__ */ x(["confirm", "clear"], ["update:modelValue"]),
40
- setup(o, { emit: H }) {
41
- const v = N(oe, void 0), y = N(ue, void 0), a = o, C = H, u = A(o, "modelValue"), r = de(() => [...u.value]), U = G(), j = c(
42
- () => r.value[m.value] || S()
43
- ), f = $(!1), m = $(0), h = c(() => {
44
- const [t, e] = u.value;
38
+ emits: /* @__PURE__ */ $(["confirm", "clear"], ["update:modelValue"]),
39
+ setup(o, { emit: z }) {
40
+ const v = B(ue, void 0), h = B(de, void 0), n = o, S = z, s = A(o, "modelValue"), r = ve(() => [...s.value]), H = G(), U = c(
41
+ () => r.value[m.value] || C()
42
+ ), f = q(!1), m = q(0), V = c(() => {
43
+ const [t, e] = s.value;
45
44
  return t && e ? g(t, k.value) + F + g(e, k.value) : "";
46
- }), T = c(() => u.value.length && !a.required && !a.disabled), k = c(() => {
47
- if (a.format)
48
- return a.format;
49
- switch (a.type) {
45
+ }), x = c(() => s.value.length && !n.required && !n.disabled), k = c(() => {
46
+ if (n.format)
47
+ return n.format;
48
+ switch (n.type) {
50
49
  case "date":
51
50
  return "yyyy-MM-dd";
52
51
  case "datetime":
53
52
  return "yyyy-MM-dd HH:mm";
54
53
  }
55
- }), z = c(() => {
56
- switch (a.type) {
54
+ }), j = c(() => {
55
+ switch (n.type) {
57
56
  case "date":
58
57
  return "请选择日期";
59
58
  case "datetime":
60
59
  return "请选择时间";
61
60
  }
62
- }), _ = c(() => {
63
- if (a.placeholder)
64
- return a.placeholder;
65
- switch (a.type) {
61
+ }), M = c(() => {
62
+ if (n.placeholder)
63
+ return n.placeholder;
64
+ switch (n.type) {
66
65
  case "date":
67
66
  return ["开始日期", "结束日期"];
68
67
  case "datetime":
69
68
  return ["开始时间", "结束时间"];
70
69
  }
71
70
  });
72
- function S() {
71
+ function C() {
73
72
  const t = /* @__PURE__ */ new Date(), e = t.getMinutes();
74
- switch (a.type) {
73
+ switch (n.type) {
75
74
  case "date":
76
75
  return t.setHours(0, 0, 0, 0);
77
76
  case "datetime":
@@ -79,17 +78,17 @@ const ve = Q, p = Z, l = K, d = O, me = ne, n = te, I = ae, fe = ee, D = re, M =
79
78
  }
80
79
  }
81
80
  function b() {
82
- a.disabled || (f.value = !0, w(0));
81
+ n.disabled || (f.value = !0, w(0));
83
82
  }
84
83
  function P() {
85
84
  f.value = !1;
86
85
  }
87
- function B() {
88
- C("clear", u.value), u.value = [], r.value = [];
86
+ function N() {
87
+ S("clear", s.value), s.value = [], r.value = [];
89
88
  }
90
89
  function w(t) {
91
- var e, i;
92
- m.value = t, (i = (e = r.value)[t]) != null || (e[t] = S());
90
+ var e, l;
91
+ m.value = t, (l = (e = r.value)[t]) != null || (e[t] = C());
93
92
  }
94
93
  function Y(t) {
95
94
  r.value[m.value] = t;
@@ -98,88 +97,96 @@ const ve = Q, p = Z, l = K, d = O, me = ne, n = te, I = ae, fe = ee, D = re, M =
98
97
  const [t, e] = r.value;
99
98
  if (!t || !e)
100
99
  return w(t ? 1 : 0);
101
- u.value = [...r.value], C("confirm", u.value), P();
100
+ s.value = [...r.value], S("confirm", s.value), P();
102
101
  }
103
- return q(() => {
104
- y && (y.required.value = a.required, y.disabled.value = a.disabled);
105
- }), q(() => {
106
- v && (v.clickable.value = !a.disabled);
107
- }), v == null || v.onTap(b), (t, e) => (l(), d(ge, null, [
108
- ve(t.$slots, "default", {
102
+ return I(() => {
103
+ h && (h.required.value = n.required, h.disabled.value = n.disabled);
104
+ }), I(() => {
105
+ v && (v.clickable.value = !n.disabled);
106
+ }), v == null || v.onTap(b), (t, e) => (i(), u(Ve, null, [
107
+ fe(t.$slots, "default", {
109
108
  present: b,
110
- displayValue: h.value
109
+ displayValue: V.value
111
110
  }, () => [
112
- s("view", {
113
- class: M(["sun-date-range-picker", {
111
+ d("view", {
112
+ class: _(["sun-date-range-picker", {
114
113
  "sun-date-range-picker-required": o.required,
115
114
  "sun-date-range-picker-disabled": o.disabled
116
115
  }]),
117
- onTap: e[1] || (e[1] = (i) => b())
116
+ onTap: e[1] || (e[1] = (l) => b())
118
117
  }, [
119
- h.value ? (l(), d("view", ye, p(h.value), 1)) : (l(), d("view", he, p(_.value.join(F)), 1)),
120
- T.value ? (l(), fe(n(V), {
118
+ V.value ? (i(), u("view", Me, p(V.value), 1)) : (i(), u("view", be, p(M.value.join(F)), 1)),
119
+ x.value ? (i(), we(a(D), {
121
120
  key: 2,
122
121
  class: "sun-date-range-picker-clear-icon",
123
122
  name: "close-circle",
124
- onTap: e[0] || (e[0] = I((i) => B(), ["stop"]))
125
- })) : me("", !0),
126
- D(n(V), {
123
+ onTap: e[0] || (e[0] = E((l) => N(), ["stop"]))
124
+ })) : ke("", !0),
125
+ y(a(D), {
127
126
  class: "sun-date-range-picker-icon",
128
127
  name: "calendar-outline"
129
128
  })
130
129
  ], 34)
131
130
  ]),
132
- D(n(ce), {
131
+ y(a(ce), {
133
132
  show: f.value,
134
- "onUpdate:show": e[6] || (e[6] = (i) => f.value = i),
135
- title: z.value,
136
- "confirm-text": n(r)[0] && n(r)[1] ? "确定" : "继续",
137
- onTap: e[7] || (e[7] = I(() => {
133
+ "onUpdate:show": e[6] || (e[6] = (l) => f.value = l),
134
+ title: j.value,
135
+ "confirm-text": a(r)[0] && a(r)[1] ? "确定" : "继续",
136
+ onTap: e[7] || (e[7] = E(() => {
138
137
  }, ["stop"])),
139
- onConfirm: e[8] || (e[8] = (i) => L())
140
- }, we({
141
- default: E(() => [
142
- s("view", _e, [
143
- s("view", {
144
- class: M(["sun-date-range-picker-input", { "sun-date-range-picker-input-active": m.value === 0 }]),
145
- onTap: e[3] || (e[3] = (i) => w(0))
138
+ onConfirm: e[8] || (e[8] = (l) => L())
139
+ }, he({
140
+ default: T(() => [
141
+ d("view", De, [
142
+ d("view", {
143
+ class: _(["sun-date-range-picker-input", { "sun-date-range-picker-input-active": m.value === 0 }]),
144
+ onTap: e[3] || (e[3] = (l) => w(0))
146
145
  }, [
147
- n(r)[0] ? (l(), d("view", be, p(n(g)(n(r)[0], k.value)), 1)) : (l(), d("view", Ve, "请选择")),
148
- s("view", De, p(_.value[0]), 1)
146
+ a(r)[0] ? (i(), u("view", _e, p(a(g)(a(r)[0], k.value)), 1)) : (i(), u("view", Te, "请选择")),
147
+ d("view", Se, p(M.value[0]), 1)
149
148
  ], 34),
150
- D(n(V), {
149
+ y(a(D), {
151
150
  class: "sun-date-range-picker-input-group-icon",
152
151
  name: "arrow-forward"
153
152
  }),
154
- s("view", {
155
- class: M(["sun-date-range-picker-input", { "sun-date-range-picker-input-active": m.value === 1 }]),
156
- onTap: e[4] || (e[4] = (i) => w(1))
153
+ d("view", {
154
+ class: _(["sun-date-range-picker-input", { "sun-date-range-picker-input-active": m.value === 1 }]),
155
+ onTap: e[4] || (e[4] = (l) => w(1))
157
156
  }, [
158
- n(r)[1] ? (l(), d("view", Me, p(n(g)(n(r)[1], k.value)), 1)) : (l(), d("view", Ce, "请选择")),
159
- s("view", Te, p(_.value[1]), 1)
157
+ a(r)[1] ? (i(), u("view", xe, p(a(g)(a(r)[1], k.value)), 1)) : (i(), u("view", Ce, "请选择")),
158
+ d("view", Ne, p(M.value[1]), 1)
160
159
  ], 34)
161
160
  ]),
162
- ke(s("van-datetime-picker", {
163
- id: n(U),
161
+ ye(d("van-datetime-picker", {
162
+ id: a(H),
164
163
  type: o.type,
165
164
  "show-toolbar": !1,
166
- value: j.value,
165
+ value: U.value,
167
166
  "min-date": o.min,
168
167
  "max-date": o.max,
169
- onInput: e[5] || (e[5] = (i) => Y(i.detail))
170
- }, null, 40, Se), [
171
- [n(pe)]
168
+ onInput: e[5] || (e[5] = (l) => Y(l.detail))
169
+ }, null, 40, Be), [
170
+ [a(me)]
172
171
  ])
173
172
  ]),
174
173
  _: 2
175
174
  }, [
176
- T.value ? {
175
+ x.value ? {
177
176
  name: "extra",
178
- fn: E(() => [
179
- s("view", {
180
- class: "sun-date-range-picker-clear-btn",
181
- onTap: e[2] || (e[2] = (i) => B())
182
- }, "清除", 32)
177
+ fn: T(() => [
178
+ y(a(pe), {
179
+ size: "xsmall",
180
+ fill: "clear",
181
+ color: "medium",
182
+ shape: "round",
183
+ onTap: e[2] || (e[2] = (l) => N())
184
+ }, {
185
+ default: T(() => [...e[9] || (e[9] = [
186
+ ge("清除", -1)
187
+ ])]),
188
+ _: 1
189
+ })
183
190
  ]),
184
191
  key: "0"
185
192
  } : void 0
@@ -188,5 +195,5 @@ const ve = Q, p = Z, l = K, d = O, me = ne, n = te, I = ae, fe = ee, D = re, M =
188
195
  }
189
196
  });
190
197
  export {
191
- Ee as default
198
+ ze as default
192
199
  };
package/index6.js CHANGED
@@ -1,60 +1,287 @@
1
- import { defineComponent as h, ref as p, computed as b, watch as k, onUnmounted as w, openBlock as B, createElementBlock as y, mergeProps as g, createElementVNode as v, renderSlot as x, createBlock as C, unref as N, withCtx as V, createVNode as S, createTextVNode as _, toDisplayString as $, createCommentVNode as D } from "vue";
2
- import { SunButtonGroup as E, SunButton as T } from "@solar-taro/ui-sun";
3
- import { onKeyboardHeightChange as H, offKeyboardHeightChange as K } from "@tarojs/taro";
4
- const l = x, P = v, G = $, U = _, r = N, c = V, j = S, i = B, q = C, z = D, A = g, F = y, I = ["show", "title", "close-on-click-overlay"], J = { class: "sun-modal-extra" }, Q = /* @__PURE__ */ h({
1
+ import { defineComponent as ee, useModel as te, ref as E, computed as oe, watch as ne, onUnmounted as se, vShow as le, Fragment as ie, mergeModels as F, openBlock as re, createElementBlock as ce, createVNode as ae, unref as ue, withCtx as de, createElementVNode as pe, createTextVNode as ve, toDisplayString as me, normalizeClass as fe, withDirectives as we, createBlock as he, renderList as be, normalizeStyle as ge } from "vue";
2
+ import { isOpperDevice as ye } from "@opper/core";
3
+ import { BluetoothLowEnergeyDevice as _e } from "@opper/wx";
4
+ import { checkBluetooth as q, bluetoothService as b, vibrator as Se, overlay as r, withLoading as De } from "@solar-taro/core";
5
+ import { SunModal as ke, SunIcon as xe, SunList as Ce, SunItem as Ie, SunLabel as Be, SunButton as K } from "@solar-taro/ui-sun";
6
+ import { useDestroyed as W, useObservable as G } from "@solar-vue/core";
7
+ import { getSystemInfo as Ee, openSetting as Me } from "@tarojs/taro";
8
+ import { filter as H, switchMap as f, combineLatest as Ne, map as M, of as N, catchError as D, tap as $, timer as $e, takeUntil as L, finalize as O, from as Le } from "rxjs";
9
+ import { dialog as Oe } from "./index9.js";
10
+ const s = ue, n = pe, c = me, T = ae, Te = le, Pe = we, Re = fe, P = ve, m = re, R = ce, ze = be, Ve = ie, v = de, Ae = ge, k = he, je = { class: "sun-opper-controller" }, Ue = {
11
+ key: 0,
12
+ class: "sun-opper-controller-device"
13
+ }, Fe = { class: "sun-opper-controller-device-header" }, qe = { class: "sun-opper-controller-device-name" }, Ke = { class: "sun-opper-controller-device-infos" }, We = { class: "sun-opper-controller-device-info" }, Ge = { class: "sun-opper-controller-device-info" }, He = { class: "sun-opper-controller-device-info" }, Je = { class: "sun-opper-controller-device-info" }, Qe = { style: { marginBottom: "1px" } }, Xe = {
14
+ class: "small",
15
+ style: { color: "var(--color-secondary)" }
16
+ }, Ye = ["show"], ct = /* @__PURE__ */ ee({
5
17
  __name: "index",
6
- props: {
7
- show: { type: Boolean },
8
- title: {},
9
- showButtons: { type: Boolean, default: !0 },
10
- confirmText: { default: "确认" },
11
- confirmDisabled: { type: Boolean }
12
- },
13
- emits: ["update:show", "close", "confirm"],
14
- setup(t, { emit: d }) {
15
- const n = d, m = t, s = p(0), u = b(() => s.value === 0);
16
- function a(e) {
17
- s.value = e.height;
18
+ props: /* @__PURE__ */ F({
19
+ mac: {},
20
+ deviceId: {},
21
+ opper: {}
22
+ }, {
23
+ show: { type: Boolean, default: !1 },
24
+ showModifiers: {}
25
+ }),
26
+ emits: /* @__PURE__ */ F(["connect", "disconnect"], ["update:show"]),
27
+ setup(z, { emit: J }) {
28
+ const w = z, g = te(z, "show"), V = J, i = w.opper, A = W(), x = W(), u = E({}), d = E(!1), C = G(() => i.connected), y = E(!1), j = oe(() => Object.values(u.value)), p = G(() => i.connected.pipe(
29
+ H(Boolean),
30
+ f(() => {
31
+ const o = i.device;
32
+ return Ne({
33
+ id: N(o.id),
34
+ name: o.name,
35
+ version: o.firmwareRevision,
36
+ accuracy: i.accuracyChange,
37
+ volt: i.batteryChange.pipe(
38
+ M(([e]) => e)
39
+ ),
40
+ charging: i.batteryChange.pipe(
41
+ M(([, e]) => !!e)
42
+ ),
43
+ serialNumber: o.serialNumber
44
+ });
45
+ })
46
+ ), {}), Q = [
47
+ { id: 1, name: "断开连接" },
48
+ { id: 2, name: "断开连接并关机", color: "var(--color-danger)" }
49
+ ];
50
+ let I = !1;
51
+ function B() {
52
+ if (!q()) return;
53
+ let o = null;
54
+ d.value = !0, b.openAdapter().pipe(
55
+ D((e) => {
56
+ var t, a;
57
+ if ((a = (t = e.errMsg) == null ? void 0 : t.includes) != null && a.call(t, "already"))
58
+ return N(null);
59
+ throw e;
60
+ }),
61
+ f(
62
+ () => b.startDevicesDiscovery({
63
+ allowDuplicatesKey: !0,
64
+ powerLevel: "high"
65
+ })
66
+ ),
67
+ $(
68
+ () => $e(0, 1250).pipe(
69
+ L(x)
70
+ ).subscribe(() => Se.short())
71
+ ),
72
+ f(() => b.devicesChange),
73
+ M((e) => e.filter((t) => ye({
74
+ name: t.name
75
+ }))),
76
+ L(x),
77
+ D((e) => {
78
+ var t, a, l;
79
+ throw e.errno === 103 ? r.modal("温馨提示", "请先授予小程序蓝牙与位置权限").then(() => {
80
+ Me();
81
+ }) : (a = (t = e.errMsg) == null ? void 0 : t.includes) != null && a.call(t, "permission") ? r.tips("请先授予微信蓝牙与位置权限") : (l = e.errMsg) != null && l.includes("frequently") ? r.tips("操作频繁,请稍后再试") : r.tips(e.errMsg), h(), e;
82
+ }),
83
+ O(() => {
84
+ d.value = !1, u.value = {}, b.stopDevicesDiscovery().subscribe();
85
+ })
86
+ ).subscribe((e) => {
87
+ const t = w.mac || w.deviceId;
88
+ if (t) {
89
+ const l = t.slice(-5).replace(":", ""), S = e.find(
90
+ (U) => U.deviceId === t || // 由于 iOS 的 deviceId 不是 MAC,但是蓝牙名字上有 MAC 后四位,这里通过比对 MAC 来选择设备
91
+ U.name.endsWith(l)
92
+ );
93
+ if (S)
94
+ return _(S.deviceId);
95
+ }
96
+ if (e.length === 1) {
97
+ if (o != null || (o = Date.now()), Date.now() - o > 5e3)
98
+ return _(e[0].deviceId);
99
+ } else e.length > 1 && (o = null);
100
+ Object.keys(u.value).forEach((l) => {
101
+ u.value[l].recommended = !1, Date.now() - u.value[l].discoveryTime > 5e3 && delete u.value[l];
102
+ }), e.forEach((l) => {
103
+ u.value[l.deviceId] = l, l.discoveryTime = Date.now();
104
+ });
105
+ const a = [...Object.values(u.value)].sort((l, S) => S.RSSI - l.RSSI)[0];
106
+ a && (a.recommended = !0);
107
+ });
18
108
  }
19
- return k(() => m.show, (e) => {
20
- e || n("close");
21
- }), H(a), w(() => {
22
- K(a);
23
- }), (e, o) => (i(), F("van-action-sheet", A(e.$attrs, {
24
- class: "sun-modal",
25
- show: t.show,
26
- title: t.title,
27
- "close-on-click-overlay": u.value,
28
- onClose: o[1] || (o[1] = (f) => n("update:show", !1))
29
- }), [
30
- P("view", J, [
31
- l(e.$slots, "extra")
32
- ]),
33
- l(e.$slots, "default"),
34
- t.showButtons ? (i(), q(r(E), {
35
- key: 0,
36
- class: "sun-modal-buttons",
37
- expand: "block"
109
+ function h() {
110
+ x.next();
111
+ }
112
+ function _(o) {
113
+ I || (r.loading("正在连接"), I = !0, A.next(), i.connect(new _e(o)).pipe(
114
+ $(() => {
115
+ h(), V("connect", o), r.success("连接成功"), setTimeout(() => g.value = !1, 600);
116
+ }),
117
+ D((e) => {
118
+ throw e.errCode === 10003 ? r.tips("连接超时,请重试") : r.tips(`连接失败:${e.errCode}:${e.errMsg}`), e;
119
+ }),
120
+ O(() => I = !1),
121
+ f(() => i.connected.pipe(H((e) => !e))),
122
+ // 监听断开
123
+ L(A)
124
+ ).subscribe(() => {
125
+ V("disconnect", o), r.error("连接断开");
126
+ }));
127
+ }
128
+ function X(o) {
129
+ q() && (d.value = !0, b.openAdapter().pipe(
130
+ O(() => {
131
+ d.value = !1;
132
+ })
133
+ ).subscribe(() => {
134
+ _(o);
135
+ }));
136
+ }
137
+ function Y() {
138
+ var o;
139
+ (o = i.disconnect()) == null || o.pipe(
140
+ De("正在断开")
141
+ ).subscribe();
142
+ }
143
+ function Z({ detail: o }) {
144
+ switch (o.id) {
145
+ case 1:
146
+ Y();
147
+ break;
148
+ case 2:
149
+ Le(Oe.confirm("温馨提示", "您确定要关闭设备电源吗?")).pipe(
150
+ $(() => r.loading("正在关机")),
151
+ f(() => i.shutdown()),
152
+ D(() => N(null)),
153
+ // 关机后距离信号丢失还有一段时间,这里主动断开连接,改进用户体验
154
+ f(() => i.disconnect())
155
+ ).subscribe(() => {
156
+ r.success("设备已关机");
157
+ });
158
+ break;
159
+ }
160
+ }
161
+ return ne(() => g.value, async (o) => {
162
+ if (o) {
163
+ if (!C.value)
164
+ if (w.mac) {
165
+ const { platform: e } = await Ee();
166
+ e === "ios" ? B() : X(w.mac);
167
+ } else
168
+ B();
169
+ } else
170
+ d.value && h();
171
+ }), se(() => {
172
+ h();
173
+ }), (o, e) => (m(), R("view", je, [
174
+ T(s(ke), {
175
+ show: g.value,
176
+ "onUpdate:show": e[2] || (e[2] = (t) => g.value = t),
177
+ title: "OPPER"
38
178
  }, {
39
- default: c(() => [
40
- l(e.$slots, "buttons", {}, () => [
41
- j(r(T), {
42
- expand: "block",
43
- disabled: t.confirmDisabled,
44
- onClick: o[0] || (o[0] = (f) => n("confirm"))
45
- }, {
46
- default: c(() => [
47
- U(G(t.confirmText), 1)
179
+ actions: v(() => [
180
+ s(C) ? (m(), k(s(K), {
181
+ key: 0,
182
+ color: "danger",
183
+ expand: "block",
184
+ onTap: e[0] || (e[0] = (t) => y.value = !0)
185
+ }, {
186
+ default: v(() => [...e[11] || (e[11] = [
187
+ P("断开连接", -1)
188
+ ])]),
189
+ _: 1
190
+ })) : (m(), k(s(K), {
191
+ key: 1,
192
+ expand: "block",
193
+ onTap: e[1] || (e[1] = (t) => d.value ? h() : B())
194
+ }, {
195
+ default: v(() => [
196
+ P(c(d.value ? "停止扫描" : "扫描 OPPER 设备"), 1)
197
+ ]),
198
+ _: 1
199
+ }))
200
+ ]),
201
+ default: v(() => [
202
+ s(C) ? (m(), R("view", Ue, [
203
+ n("view", Fe, [
204
+ e[6] || (e[6] = n("view", { class: "sun-opper-controller-device-title" }, "设备已连接", -1)),
205
+ n("view", qe, [
206
+ P(c(s(p).name || "OPPER") + " ", 1),
207
+ n("view", {
208
+ class: Re(["sun-opper-controller-device-battery", { "sun-opper-controller-device-battery-active": s(p).charging }])
209
+ }, [
210
+ T(s(xe), { name: "flash" }),
211
+ Pe(n("text", null, c(s(p).volt) + "%", 513), [
212
+ [Te, s(p).volt]
213
+ ])
214
+ ], 2)
215
+ ])
216
+ ]),
217
+ n("view", Ke, [
218
+ n("view", We, [
219
+ e[7] || (e[7] = n("view", null, "设备号", -1)),
220
+ n("view", null, c(s(p).id), 1)
221
+ ]),
222
+ n("view", Ge, [
223
+ e[8] || (e[8] = n("view", null, "秤台精度", -1)),
224
+ n("view", null, c(s(p).accuracy || 1) + "克", 1)
225
+ ]),
226
+ n("view", He, [
227
+ e[9] || (e[9] = n("view", null, "固件版本", -1)),
228
+ n("view", null, c(s(p).version), 1)
48
229
  ]),
49
- _: 1
50
- }, 8, ["disabled"])
51
- ])
230
+ n("view", Je, [
231
+ e[10] || (e[10] = n("view", null, "序列号", -1)),
232
+ n("view", null, c(s(p).serialNumber), 1)
233
+ ])
234
+ ])
235
+ ])) : (m(), k(s(Ce), {
236
+ key: 1,
237
+ class: "sun-opper-controller-device-list",
238
+ refresher: !1,
239
+ data: j.value,
240
+ loading: d.value,
241
+ "loading-text": "正在扫描"
242
+ }, {
243
+ default: v(() => [
244
+ (m(!0), R(Ve, null, ze(j.value, (t) => (m(), k(s(Ie), {
245
+ key: t.deviceId,
246
+ title: t.name,
247
+ label: t.deviceId,
248
+ size: "large",
249
+ clickable: !0,
250
+ onTap: (a) => _(t.deviceId)
251
+ }, {
252
+ end: v(() => [
253
+ n("text", {
254
+ style: Ae({ color: t.recommended ? "var(--color-success)" : "inherit" })
255
+ }, c(t.RSSI) + "dBm", 5)
256
+ ]),
257
+ default: v(() => [
258
+ T(s(Be), null, {
259
+ default: v(() => [
260
+ n("view", Qe, c(t.localName || t.name), 1),
261
+ n("view", Xe, c(t.deviceId), 1)
262
+ ]),
263
+ _: 2
264
+ }, 1024)
265
+ ]),
266
+ _: 2
267
+ }, 1032, ["title", "label", "onTap"]))), 128))
268
+ ]),
269
+ _: 1
270
+ }, 8, ["data", "loading"]))
52
271
  ]),
53
- _: 3
54
- })) : z("", !0)
55
- ], 16, I));
272
+ _: 1
273
+ }, 8, ["show"]),
274
+ n("van-action-sheet", {
275
+ show: y.value,
276
+ actions: Q,
277
+ "cancel-text": "取消",
278
+ onSelect: e[3] || (e[3] = (t) => Z(t)),
279
+ onCancel: e[4] || (e[4] = (t) => y.value = !1),
280
+ onClose: e[5] || (e[5] = (t) => y.value = !1)
281
+ }, null, 40, Ye)
282
+ ]));
56
283
  }
57
284
  });
58
285
  export {
59
- Q as default
286
+ ct as default
60
287
  };