w-ui-v1 1.0.56 → 1.0.58

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/utils/nfc.ts +24 -14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "w-ui-v1",
3
- "version": "1.0.56",
3
+ "version": "1.0.58",
4
4
  "description": "w-ui",
5
5
  "author": "wgxshh",
6
6
  "license": "ISC",
package/utils/nfc.ts CHANGED
@@ -174,7 +174,7 @@ function __read(intent) {
174
174
  tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
175
175
  var bytesId = intent.getByteArrayExtra(NfcAdapter.EXTRA_ID);
176
176
  waiting.close();
177
- var tagid = bytesToHexString(tag.getId())
177
+ var tagid = bytesToDecimalString(tag.getId())
178
178
  if (typeof _getCardNo === 'function') {
179
179
  _getCardNo(tagid);
180
180
  }
@@ -186,20 +186,30 @@ function __read(intent) {
186
186
  }
187
187
  }
188
188
 
189
- function bytesToHexString(inarray) {
190
- var i, j, x;
191
- var hex = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A",
192
- "B", "C", "D", "E", "F"
193
- ];
194
- var out = "";
195
- for (j = 0; j < inarray.length; ++j) {
196
- x = parseInt(inarray[j]) & 0xff;
197
- i = (x >> 4) & 0x0f;
198
- out += hex[i];
199
- i = x & 0x0f;
200
- out += hex[i];
189
+ // function bytesToHexString(inarray) {
190
+ // var i, j, x;
191
+ // var hex = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A",
192
+ // "B", "C", "D", "E", "F"
193
+ // ];
194
+ // var out = "";
195
+ // for (j = 0; j < inarray.length; ++j) {
196
+ // x = parseInt(inarray[j]) & 0xff;
197
+ // i = (x >> 4) & 0x0f;
198
+ // out += hex[i];
199
+ // i = x & 0x0f;
200
+ // out += hex[i];
201
+ // }
202
+ // return out;
203
+ // }
204
+ function bytesToDecimalString(inarray) {
205
+ let result = BigInt(0);
206
+ // 反转数组以适配大端序
207
+ const reversed = [...inarray].reverse();
208
+ for (let j = 0; j < reversed.length; j++) {
209
+ const byte = BigInt(parseInt(reversed[j])) & BigInt(0xff);
210
+ result = (result << BigInt(8)) | byte;
201
211
  }
202
- return out;
212
+ return result.toString();
203
213
  }
204
214
 
205
215
  function reverseTwo(str) {