张延森 3 anni fa
parent
commit
3e7d8802e8

+ 6
- 0
config/index.js Vedi File

@@ -1,3 +1,5 @@
1
+const path = require('path')
2
+
1 3
 const config = {
2 4
   projectName: 'hospitalGN',
3 5
   date: '2022-5-6',
@@ -12,6 +14,10 @@ const config = {
12 14
   plugins: [],
13 15
   defineConstants: {
14 16
   },
17
+  alias: {
18
+    '@/components': path.resolve(__dirname, '..', 'src/components'),
19
+    '@/utils': path.resolve(__dirname, '..', 'src/utils'),
20
+  },
15 21
   copy: {
16 22
     patterns: [
17 23
     ],

+ 21
- 0
src/components/CountDown.jsx Vedi File

@@ -0,0 +1,21 @@
1
+import React, { useEffect, useMemo, useState } from 'react'
2
+import { View } from '@tarojs/components'
3
+import dayjs from 'dayjs'
4
+
5
+export default (props) => {
6
+  const { className, style } = props
7
+
8
+  const [dt, setDt] = useState(dayjs().format('YYYY-MM-DD HH:mm:ss'))
9
+
10
+  useEffect(() => {
11
+    const t = setInterval(() => {
12
+      setDt(dayjs().format('YYYY-MM-DD HH:mm:ss'))
13
+    }, 1000);
14
+
15
+    return () => clearInterval(t)
16
+  }, [])
17
+
18
+  return (
19
+    <View className={className} style={style}>{dt}</View>
20
+  )
21
+}

+ 15
- 0
src/components/barcode/CodeText.jsx Vedi File

@@ -0,0 +1,15 @@
1
+import React from 'react'
2
+import { View } from '@tarojs/components';
3
+import './style.less'
4
+
5
+export default (props) => {
6
+  const { code } = props;
7
+
8
+  return (
9
+    <View className='barcode-txt'>
10
+      {
11
+        code.split('').map(it => (<View key={it}>{it}</View>))
12
+      }
13
+    </View>
14
+  )
15
+}

+ 398
- 0
src/components/barcode/drawCode.js Vedi File

@@ -0,0 +1,398 @@
1
+const CHAR_TILDE = 126;
2
+const CODE_FNC1 = 102;
3
+const SET_STARTA = 103;
4
+const SET_STARTB = 104;
5
+const SET_STARTC = 105;
6
+const SET_SHIFT = 98;
7
+const SET_CODEA = 101;
8
+const SET_CODEB = 100;
9
+const SET_STOP = 106;
10
+
11
+const REPLACE_CODES = {
12
+    CHAR_TILDE: CODE_FNC1 //~ corresponds to FNC1 in GS1-128 standard
13
+}
14
+
15
+const CODESET = {
16
+    ANY: 1,
17
+    AB: 2,
18
+    A: 3,
19
+    B: 4,
20
+    C: 5
21
+};
22
+
23
+function getBytes(str) {
24
+    var bytes = [];
25
+    for (var i = 0; i < str.length; i++) {
26
+        bytes.push(str.charCodeAt(i));
27
+    }
28
+    return bytes;
29
+}
30
+
31
+export function code128(ctx, text, width, height) {
32
+
33
+    width = parseInt(width);
34
+
35
+    height = parseInt(height);
36
+
37
+    var codes = stringToCode128(text);
38
+
39
+    var g = new Graphics(ctx, width, height);
40
+
41
+    var barWeight = g.area.width / ((codes.length - 3) * 11 + 35);
42
+
43
+    var x = g.area.left;
44
+    var y = g.area.top;
45
+    for (var i = 0; i < codes.length; i++) {
46
+        var c = codes[i];
47
+        //two bars at a time: 1 black and 1 white
48
+        for (var bar = 0; bar < 8; bar += 2) {
49
+            var barW = PATTERNS[c][bar] * barWeight;
50
+            // var barH = height - y - this.border;
51
+            var barH = height - y;
52
+            var spcW = PATTERNS[c][bar + 1] * barWeight;
53
+
54
+            //no need to draw if 0 width
55
+            if (barW > 0) {
56
+                g.fillFgRect(x, y, barW, barH);
57
+            }
58
+
59
+            x += barW + spcW;
60
+        }
61
+    }
62
+}
63
+
64
+
65
+function stringToCode128(text) {
66
+
67
+    var barc = {
68
+        currcs: CODESET.C
69
+    };
70
+
71
+    var bytes = getBytes(text);
72
+    //decide starting codeset
73
+    var index = bytes[0] == CHAR_TILDE ? 1 : 0;
74
+
75
+    var csa1 = bytes.length > 0 ? codeSetAllowedFor(bytes[index++]) : CODESET.AB;
76
+    var csa2 = bytes.length > 0 ? codeSetAllowedFor(bytes[index++]) : CODESET.AB;
77
+    barc.currcs = getBestStartSet(csa1, csa2);
78
+    barc.currcs = perhapsCodeC(bytes, barc.currcs);
79
+
80
+    //if no codeset changes this will end up with bytes.length+3
81
+    //start, checksum and stop
82
+    var codes = new Array();
83
+
84
+    switch (barc.currcs) {
85
+        case CODESET.A:
86
+            codes.push(SET_STARTA);
87
+            break;
88
+        case CODESET.B:
89
+            codes.push(SET_STARTB);
90
+            break;
91
+        default:
92
+            codes.push(SET_STARTC);
93
+            break;
94
+    }
95
+
96
+
97
+    for (var i = 0; i < bytes.length; i++) {
98
+        var b1 = bytes[i]; //get the first of a pair
99
+        //should we translate/replace
100
+        if (b1 in REPLACE_CODES) {
101
+            codes.push(REPLACE_CODES[b1]);
102
+            i++ //jump to next
103
+            b1 = bytes[i];
104
+        }
105
+
106
+        //get the next in the pair if possible
107
+        var b2 = bytes.length > (i + 1) ? bytes[i + 1] : -1;
108
+
109
+        codes = codes.concat(codesForChar(b1, b2, barc.currcs));
110
+        //code C takes 2 chars each time
111
+        if (barc.currcs == CODESET.C) i++;
112
+    }
113
+
114
+    //calculate checksum according to Code 128 standards
115
+    var checksum = codes[0];
116
+    for (var weight = 1; weight < codes.length; weight++) {
117
+        checksum += (weight * codes[weight]);
118
+    }
119
+    codes.push(checksum % 103);
120
+
121
+    codes.push(SET_STOP);
122
+
123
+    //encoding should now be complete
124
+    return codes;
125
+
126
+    //chr1 is current byte
127
+    //chr2 is the next byte to process. looks ahead.
128
+    function codesForChar(chr1, chr2, currcs) {
129
+        var result = [];
130
+        var shifter = -1;
131
+
132
+        if (charCompatible(chr1, currcs)) {
133
+            if (currcs == CODESET.C) {
134
+                if (chr2 == -1) {
135
+                    shifter = SET_CODEB;
136
+                    currcs = CODESET.B;
137
+                }
138
+                else if ((chr2 != -1) && !charCompatible(chr2, currcs)) {
139
+                    //need to check ahead as well
140
+                    if (charCompatible(chr2, CODESET.A)) {
141
+                        shifter = SET_CODEA;
142
+                        currcs = CODESET.A;
143
+                    }
144
+                    else {
145
+                        shifter = SET_CODEB;
146
+                        currcs = CODESET.B;
147
+                    }
148
+                }
149
+            }
150
+        }
151
+        else {
152
+            //if there is a next char AND that next char is also not compatible
153
+            if ((chr2 != -1) && !charCompatible(chr2, currcs)) {
154
+                //need to switch code sets
155
+                switch (currcs) {
156
+                    case CODESET.A:
157
+                        shifter = SET_CODEB;
158
+                        currcs = CODESET.B;
159
+                        break;
160
+                    case CODESET.B:
161
+                        shifter = SET_CODEA;
162
+                        currcs = CODESET.A;
163
+                        break;
164
+                }
165
+            }
166
+            else {
167
+                //no need to shift code sets, a temporary SHIFT will suffice
168
+                shifter = SET_SHIFT;
169
+            }
170
+        }
171
+
172
+        //ok some type of shift is nessecary
173
+        if (shifter != -1) {
174
+            result.push(shifter);
175
+            result.push(codeValue(chr2));
176
+        }
177
+        else {
178
+            if (currcs == CODESET.C) {
179
+                //include next as well
180
+                result.push(codeValue(chr1, chr2));
181
+            }
182
+            else {
183
+                result.push(codeValue(chr1));
184
+            }
185
+        }
186
+        barc.currcs = currcs;
187
+
188
+        return result;
189
+    }
190
+}
191
+
192
+function perhapsCodeC(bytes, codeset) {
193
+    for (var i = 0; i < bytes.length; i++) {
194
+        var b = bytes[i]
195
+        if ((b < 48 || b > 57) && b != CHAR_TILDE)
196
+            return codeset;
197
+    }
198
+    return CODESET.C;
199
+}
200
+
201
+function getBestStartSet(csa1, csa2) {
202
+    //tries to figure out the best codeset
203
+    //to start with to get the most compact code
204
+    var vote = 0;
205
+    vote += csa1 == CODESET.A ? 1 : 0;
206
+    vote += csa1 == CODESET.B ? -1 : 0;
207
+    vote += csa2 == CODESET.A ? 1 : 0;
208
+    vote += csa2 == CODESET.B ? -1 : 0;
209
+    //tie goes to B due to my own predudices
210
+    return vote > 0 ? CODESET.A : CODESET.B;
211
+}
212
+
213
+//reduce the ascii code to fit into the Code128 char table
214
+function codeValue(chr1, chr2) {
215
+    if (typeof chr2 == "undefined") {
216
+        return chr1 >= 32 ? chr1 - 32 : chr1 + 64;
217
+    }
218
+    else {
219
+        return parseInt(String.fromCharCode(chr1) + String.fromCharCode(chr2));
220
+    }
221
+}
222
+
223
+function charCompatible(chr, codeset) {
224
+    var csa = codeSetAllowedFor(chr);
225
+    if (csa == CODESET.ANY) return true;
226
+    //if we need to change from current
227
+    if (csa == CODESET.AB) return true;
228
+    if (csa == CODESET.A && codeset == CODESET.A) return true;
229
+    if (csa == CODESET.B && codeset == CODESET.B) return true;
230
+    return false;
231
+}
232
+
233
+function codeSetAllowedFor(chr) {
234
+    if (chr >= 48 && chr <= 57) {
235
+        //0-9
236
+        return CODESET.ANY;
237
+    }
238
+    else if (chr >= 32 && chr <= 95) {
239
+        //0-9 A-Z
240
+        return CODESET.AB;
241
+    }
242
+    else {
243
+        //if non printable
244
+        return chr < 32 ? CODESET.A : CODESET.B;
245
+    }
246
+}
247
+
248
+var Graphics = function(ctx, width, height) {
249
+
250
+    this.width = width;
251
+    this.height = height;
252
+    this.quiet = Math.round(this.width / 40);
253
+    
254
+    this.border_size   = 0;
255
+    this.padding_width = 0;
256
+
257
+    this.area = {
258
+        width : width - this.padding_width * 2 - this.quiet * 2,
259
+        height: height - this.border_size * 2,
260
+        top   : this.border_size - 4,
261
+        left  : this.padding_width + this.quiet
262
+    };
263
+
264
+    this.ctx = ctx;
265
+    this.fg = "#000000";
266
+    this.bg = "#ffffff";
267
+
268
+    // fill background
269
+    this.fillBgRect(0,0, width, height);
270
+
271
+    // fill center to create border
272
+    this.fillBgRect(0, this.border_size, width, height - this.border_size * 2);
273
+}
274
+
275
+//use native color
276
+Graphics.prototype._fillRect = function(x, y, width, height, color) {
277
+    this.ctx.fillStyle = color
278
+    this.ctx.fillRect(x, y, width, height)
279
+}
280
+
281
+Graphics.prototype.fillFgRect = function(x,y, width, height) {
282
+    this._fillRect(x, y, width, height, this.fg);
283
+}
284
+
285
+Graphics.prototype.fillBgRect = function(x,y, width, height) {
286
+    this._fillRect(x, y, width, height, this.bg);
287
+}
288
+
289
+var PATTERNS = [
290
+    [2, 1, 2, 2, 2, 2, 0, 0],  // 0
291
+    [2, 2, 2, 1, 2, 2, 0, 0],  // 1
292
+    [2, 2, 2, 2, 2, 1, 0, 0],  // 2
293
+    [1, 2, 1, 2, 2, 3, 0, 0],  // 3
294
+    [1, 2, 1, 3, 2, 2, 0, 0],  // 4
295
+    [1, 3, 1, 2, 2, 2, 0, 0],  // 5
296
+    [1, 2, 2, 2, 1, 3, 0, 0],  // 6
297
+    [1, 2, 2, 3, 1, 2, 0, 0],  // 7
298
+    [1, 3, 2, 2, 1, 2, 0, 0],  // 8
299
+    [2, 2, 1, 2, 1, 3, 0, 0],  // 9
300
+    [2, 2, 1, 3, 1, 2, 0, 0],  // 10
301
+    [2, 3, 1, 2, 1, 2, 0, 0],  // 11
302
+    [1, 1, 2, 2, 3, 2, 0, 0],  // 12
303
+    [1, 2, 2, 1, 3, 2, 0, 0],  // 13
304
+    [1, 2, 2, 2, 3, 1, 0, 0],  // 14
305
+    [1, 1, 3, 2, 2, 2, 0, 0],  // 15
306
+    [1, 2, 3, 1, 2, 2, 0, 0],  // 16
307
+    [1, 2, 3, 2, 2, 1, 0, 0],  // 17
308
+    [2, 2, 3, 2, 1, 1, 0, 0],  // 18
309
+    [2, 2, 1, 1, 3, 2, 0, 0],  // 19
310
+    [2, 2, 1, 2, 3, 1, 0, 0],  // 20
311
+    [2, 1, 3, 2, 1, 2, 0, 0],  // 21
312
+    [2, 2, 3, 1, 1, 2, 0, 0],  // 22
313
+    [3, 1, 2, 1, 3, 1, 0, 0],  // 23
314
+    [3, 1, 1, 2, 2, 2, 0, 0],  // 24
315
+    [3, 2, 1, 1, 2, 2, 0, 0],  // 25
316
+    [3, 2, 1, 2, 2, 1, 0, 0],  // 26
317
+    [3, 1, 2, 2, 1, 2, 0, 0],  // 27
318
+    [3, 2, 2, 1, 1, 2, 0, 0],  // 28
319
+    [3, 2, 2, 2, 1, 1, 0, 0],  // 29
320
+    [2, 1, 2, 1, 2, 3, 0, 0],  // 30
321
+    [2, 1, 2, 3, 2, 1, 0, 0],  // 31
322
+    [2, 3, 2, 1, 2, 1, 0, 0],  // 32
323
+    [1, 1, 1, 3, 2, 3, 0, 0],  // 33
324
+    [1, 3, 1, 1, 2, 3, 0, 0],  // 34
325
+    [1, 3, 1, 3, 2, 1, 0, 0],  // 35
326
+    [1, 1, 2, 3, 1, 3, 0, 0],  // 36
327
+    [1, 3, 2, 1, 1, 3, 0, 0],  // 37
328
+    [1, 3, 2, 3, 1, 1, 0, 0],  // 38
329
+    [2, 1, 1, 3, 1, 3, 0, 0],  // 39
330
+    [2, 3, 1, 1, 1, 3, 0, 0],  // 40
331
+    [2, 3, 1, 3, 1, 1, 0, 0],  // 41
332
+    [1, 1, 2, 1, 3, 3, 0, 0],  // 42
333
+    [1, 1, 2, 3, 3, 1, 0, 0],  // 43
334
+    [1, 3, 2, 1, 3, 1, 0, 0],  // 44
335
+    [1, 1, 3, 1, 2, 3, 0, 0],  // 45
336
+    [1, 1, 3, 3, 2, 1, 0, 0],  // 46
337
+    [1, 3, 3, 1, 2, 1, 0, 0],  // 47
338
+    [3, 1, 3, 1, 2, 1, 0, 0],  // 48
339
+    [2, 1, 1, 3, 3, 1, 0, 0],  // 49
340
+    [2, 3, 1, 1, 3, 1, 0, 0],  // 50
341
+    [2, 1, 3, 1, 1, 3, 0, 0],  // 51
342
+    [2, 1, 3, 3, 1, 1, 0, 0],  // 52
343
+    [2, 1, 3, 1, 3, 1, 0, 0],  // 53
344
+    [3, 1, 1, 1, 2, 3, 0, 0],  // 54
345
+    [3, 1, 1, 3, 2, 1, 0, 0],  // 55
346
+    [3, 3, 1, 1, 2, 1, 0, 0],  // 56
347
+    [3, 1, 2, 1, 1, 3, 0, 0],  // 57
348
+    [3, 1, 2, 3, 1, 1, 0, 0],  // 58
349
+    [3, 3, 2, 1, 1, 1, 0, 0],  // 59
350
+    [3, 1, 4, 1, 1, 1, 0, 0],  // 60
351
+    [2, 2, 1, 4, 1, 1, 0, 0],  // 61
352
+    [4, 3, 1, 1, 1, 1, 0, 0],  // 62
353
+    [1, 1, 1, 2, 2, 4, 0, 0],  // 63
354
+    [1, 1, 1, 4, 2, 2, 0, 0],  // 64
355
+    [1, 2, 1, 1, 2, 4, 0, 0],  // 65
356
+    [1, 2, 1, 4, 2, 1, 0, 0],  // 66
357
+    [1, 4, 1, 1, 2, 2, 0, 0],  // 67
358
+    [1, 4, 1, 2, 2, 1, 0, 0],  // 68
359
+    [1, 1, 2, 2, 1, 4, 0, 0],  // 69
360
+    [1, 1, 2, 4, 1, 2, 0, 0],  // 70
361
+    [1, 2, 2, 1, 1, 4, 0, 0],  // 71
362
+    [1, 2, 2, 4, 1, 1, 0, 0],  // 72
363
+    [1, 4, 2, 1, 1, 2, 0, 0],  // 73
364
+    [1, 4, 2, 2, 1, 1, 0, 0],  // 74
365
+    [2, 4, 1, 2, 1, 1, 0, 0],  // 75
366
+    [2, 2, 1, 1, 1, 4, 0, 0],  // 76
367
+    [4, 1, 3, 1, 1, 1, 0, 0],  // 77
368
+    [2, 4, 1, 1, 1, 2, 0, 0],  // 78
369
+    [1, 3, 4, 1, 1, 1, 0, 0],  // 79
370
+    [1, 1, 1, 2, 4, 2, 0, 0],  // 80
371
+    [1, 2, 1, 1, 4, 2, 0, 0],  // 81
372
+    [1, 2, 1, 2, 4, 1, 0, 0],  // 82
373
+    [1, 1, 4, 2, 1, 2, 0, 0],  // 83
374
+    [1, 2, 4, 1, 1, 2, 0, 0],  // 84
375
+    [1, 2, 4, 2, 1, 1, 0, 0],  // 85
376
+    [4, 1, 1, 2, 1, 2, 0, 0],  // 86
377
+    [4, 2, 1, 1, 1, 2, 0, 0],  // 87
378
+    [4, 2, 1, 2, 1, 1, 0, 0],  // 88
379
+    [2, 1, 2, 1, 4, 1, 0, 0],  // 89
380
+    [2, 1, 4, 1, 2, 1, 0, 0],  // 90
381
+    [4, 1, 2, 1, 2, 1, 0, 0],  // 91
382
+    [1, 1, 1, 1, 4, 3, 0, 0],  // 92
383
+    [1, 1, 1, 3, 4, 1, 0, 0],  // 93
384
+    [1, 3, 1, 1, 4, 1, 0, 0],  // 94
385
+    [1, 1, 4, 1, 1, 3, 0, 0],  // 95
386
+    [1, 1, 4, 3, 1, 1, 0, 0],  // 96
387
+    [4, 1, 1, 1, 1, 3, 0, 0],  // 97
388
+    [4, 1, 1, 3, 1, 1, 0, 0],  // 98
389
+    [1, 1, 3, 1, 4, 1, 0, 0],  // 99
390
+    [1, 1, 4, 1, 3, 1, 0, 0],  // 100
391
+    [3, 1, 1, 1, 4, 1, 0, 0],  // 101
392
+    [4, 1, 1, 1, 3, 1, 0, 0],  // 102
393
+    [2, 1, 1, 4, 1, 2, 0, 0],  // 103
394
+    [2, 1, 1, 2, 1, 4, 0, 0],  // 104
395
+    [2, 1, 1, 2, 3, 2, 0, 0],  // 105
396
+    [2, 3, 3, 1, 1, 1, 2, 0]   // 106
397
+]
398
+

+ 48
- 0
src/components/barcode/index.jsx Vedi File

@@ -0,0 +1,48 @@
1
+import React, { useEffect, useMemo, useRef } from 'react'
2
+import Taro from '@tarojs/taro'
3
+import { View, Canvas } from '@tarojs/components'
4
+import CodeText from './CodeText'
5
+import { code128 } from './drawCode'
6
+import './style.less'
7
+
8
+export default (props) => {
9
+
10
+  const { width, height, code } = props
11
+
12
+  const canvasRef = useRef()
13
+  const ctxRef = useRef()
14
+
15
+  console.log('---------------->', Taro.getSystemInfoSync().pixelRatio)
16
+
17
+  const dpr = useMemo(() => Taro.getSystemInfoSync().pixelRatio, [])
18
+  const size = useMemo(() => ({ width: width * dpr, height: height * dpr }), [width, height, dpr])
19
+
20
+  const style = useMemo(() => ({ width: `${size.width}rpx`, height: `${size.height}rpx` }), [size])
21
+
22
+  useEffect(() => {
23
+    Taro.nextTick(() => {
24
+      const query = Taro.createSelectorQuery()
25
+      query.select('#barCodeCanvas').fields({ node: true }).exec((res) => {
26
+        const canvas = res[0].node
27
+        const ctx = canvas.getContext('2d')
28
+        canvas.width = size.width
29
+        canvas.height = size.height
30
+        ctx.scale(dpr, dpr)
31
+
32
+        canvasRef.current = canvas;
33
+        ctxRef.current = ctx;
34
+
35
+        if (code) {
36
+          code128(ctx, code, size.width, size.height);
37
+        }
38
+      })
39
+    })
40
+  }, [code, size, dpr])
41
+
42
+  return (
43
+    <View className='barcode-box' style={style}>
44
+      <Canvas style={style} type='2d' id='barCodeCanvas'></Canvas>
45
+      <CodeText code={code}/>
46
+    </View>
47
+  )
48
+}

+ 15
- 0
src/components/barcode/style.less Vedi File

@@ -0,0 +1,15 @@
1
+.barcode-box {
2
+  .barcode-txt {
3
+    display: flex;
4
+    justify-content: space-between;
5
+    align-items: center;
6
+    font-size: 32px;
7
+    font-weight: bold;
8
+    line-height: 3em;
9
+    text-align: center;
10
+
11
+    & > view {
12
+      flex: 1;
13
+    }
14
+  }
15
+}

+ 5
- 22
src/pages/index/index.jsx Vedi File

@@ -3,6 +3,8 @@ import { useEffect, useRef, useState } from 'react'
3 3
 import dayjs from 'dayjs'
4 4
 import { Icon } from "@antmjs/vantui";
5 5
 import Taro from '@tarojs/taro';
6
+import BarCode from '@/components/barcode'
7
+import CountDown from '@/components/CountDown'
6 8
 // import userBck from '../../assets/userBck.png'
7 9
 import barcodeimg from '../../assets/barcodeimg.png'
8 10
 
@@ -12,24 +14,9 @@ import './style.less'
12 14
 
13 15
 
14 16
 export default (props) => {
15
-
16
-  const [showTime, setShowTime] = useState("")
17
-  const timer = useRef();
18 17
   const userId = '320888800110023011';
19
-  useEffect(() => {
20
-    setInterval(() => {
21
-      const times = dayjs(new Date().getTime()).format('YYYY-MM-DD HH:mm:ss');
22
-
23
-      setShowTime(times)
24
-    }, 1000)
25
-    return () => {
26
-      clearInterval(timer.current);
27
-    };
28
-
29
-  }, [])
30
-
18
+  
31 19
   const goUserInfo = () => {
32
-
33 20
     // 跳转到目的页面,在当前页面打开
34 21
     Taro.redirectTo({
35 22
       url: '/pages/setUserInfo/index'
@@ -37,8 +24,6 @@ export default (props) => {
37 24
 
38 25
   }
39 26
 
40
-
41
-
42 27
   return (
43 28
     <View className='index-UserQRcode'>
44 29
       {/* <Text>Hello world!</Text> */}
@@ -51,11 +36,9 @@ export default (props) => {
51 36
         <View className='index-UserQRcode-headerInfo-UserID'>身份证:{userId.replace(/^(\d{6})\d+(\d{4})$/, "$1******$2")}</View>
52 37
       </View>
53 38
       <View className='index-UserQRcode-cententQR'>
54
-        <View className='index-UserQRcode-cententQR-Times'>
55
-          {showTime}
56
-        </View>
39
+        <CountDown className='index-UserQRcode-cententQR-Times' />
57 40
         <View className='index-UserQRcode-cententQR-Barcode'>
58
-          <Image src={barcodeimg} />
41
+          <BarCode width={300} height={100} code='322050442037' />
59 42
         </View>
60 43
       </View>
61 44
     </View>

+ 3
- 0
src/pages/index/style.less Vedi File

@@ -32,6 +32,7 @@
32 32
   }
33 33
 
34 34
   &-cententQR {
35
+    box-sizing: border-box;
35 36
     width: 95%;
36 37
     height: 65vh;
37 38
     // box-shadow: 0px 8px 38px 0px rgba(0, 0, 0, 0.12);
@@ -40,6 +41,8 @@
40 41
     margin: 0 auto;
41 42
     position: relative;
42 43
     top: -15vh;
44
+    padding: 2em;
45
+
43 46
     &-Times {
44 47
       padding-top: 3vh;
45 48
       text-align: center;