| 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
74
75
76
77
78
79
80
81
 | | <!DOCTYPE html> |  | <html lang="en"> |  | <head> |  |     <meta charset="UTF-8"> |  |     <title>条码器</title> |  |     <script type="text/javascript" src="../static/js/jquery/jquery-3.3.1.min.js"></script> |  |     <script type="text/javascript" src="../static/js/common.js"></script> |  |     <script type="text/javascript" src="../static/vue/js/vue.min.js"></script> |  |     <script type="text/javascript" src="../static/vue/element/element.js"></script> |  |     <style> |  |         .barcodeBox { |  |             display: flex; |  |             justify-content: flex-start; |  |         } |  |   |  |         .barcodeItem { |  |             margin-right: 50px; |  |         } |  |   |  |         .barcodeItem div{ |  |             margin-top: 10px; |  |         } |  |     </style> |  | </head> |  | <body> |  | <div id="app"> |  |     <div class="barcodeBox"> |  |         <div class="barcodeItem" v-for="(item,index) in codeList" :key="index"> |  |             <div>{{item.id}}号扫码器</div> |  |             <div>{{item.barcode}}</div> |  |         </div> |  |     </div> |  | </div> |  |   |  | <script> |  |     var app = new Vue({ |  |         el: '#app', |  |         data: { |  |             codeList: [],//条码List |  |         }, |  |         created() { |  |             this.init() |  |         }, |  |         watch: { |  |   |  |         }, |  |         methods: { |  |             init() { |  |                 this.getBarcodeList() //获取条码 |  |                 this.consoleInterval = setInterval(() => { |  |                     this.getBarcodeList() //获取条码 |  |                 }, 1000) |  |             }, |  |             getBarcodeList() { |  |                 // 获取条码 |  |                 let that = this |  |                 $.ajax({ |  |                     url: baseUrl + "/console/barcode/list", |  |                     headers: { |  |                         'token': localStorage.getItem('token') |  |                     }, |  |                     method: 'GET', |  |                     success: function(res) { |  |                         if (res.code === 200) { |  |                             that.codeList = res.data; |  |                         } else if (res.code === 403) { |  |                             parent.location.href = baseUrl + "/login"; |  |                         } else { |  |                             that.$message({ |  |                                 message: res.msg, |  |                                 type: 'error' |  |                             }); |  |                         } |  |                     } |  |                 }); |  |             }, |  |         } |  |     }) |  | </script> |  | </body> |  | </html> | 
 |