Gabriel00A commited on
Commit
960f23e
·
verified ·
1 Parent(s): 56162be

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +25 -64
templates/index.html CHANGED
@@ -4,76 +4,37 @@
4
  <meta charset="UTF-8">
5
  <title>采购执行表上传</title>
6
  <style>
7
- body {
8
- font-family: Arial, sans-serif;
9
- background: #f7f7f7;
10
- display: flex;
11
- flex-direction: column;
12
- align-items: center;
13
- justify-content: center;
14
- height: 100vh;
15
- margin: 0;
16
- }
17
- .container {
18
- background: #fff;
19
- padding: 30px;
20
- border-radius: 12px;
21
- box-shadow: 0 4px 12px rgba(0,0,0,0.1);
22
- text-align: center;
23
- }
24
- input[type="file"] {
25
- margin: 15px 0;
26
- }
27
- button {
28
- padding: 10px 20px;
29
- background: #007bff;
30
- border: none;
31
- border-radius: 6px;
32
- color: #fff;
33
- font-size: 16px;
34
- cursor: pointer;
35
- }
36
- button:hover {
37
- background: #0056b3;
38
- }
39
- .result {
40
- margin-top: 20px;
41
- font-size: 14px;
42
- color: #333;
43
- word-break: break-all;
44
- }
45
  </style>
46
  </head>
47
  <body>
48
- <div class="container">
49
- <h2>上传采购执行表</h2>
50
- <input type="file" id="fileInput" />
51
- <br>
52
- <button onclick="uploadFile()">上传</button>
53
- <div class="result" id="result"></div>
54
  </div>
55
-
56
  <script>
57
- async function uploadFile() {
58
- const fileInput = document.getElementById('fileInput');
59
- const resultDiv = document.getElementById('result');
60
- if (!fileInput.files.length) {
61
- resultDiv.innerText = "请先选择一个文件";
62
- return;
63
- }
64
- const formData = new FormData();
65
- formData.append("file", fileInput.files[0]);
66
- try {
67
- const response = await fetch("/upload", {
68
- method: "POST",
69
- body: formData
70
- });
71
- const data = await response.json();
72
- resultDiv.innerText = "上传结果: " + JSON.stringify(data);
73
- } catch (error) {
74
- resultDiv.innerText = "上传失败: " + error;
75
  }
76
  }
77
  </script>
78
  </body>
79
- </html>
 
4
  <meta charset="UTF-8">
5
  <title>采购执行表上传</title>
6
  <style>
7
+ body { font-family: Arial, sans-serif; background:#f7f7f7; display:flex; align-items:center; justify-content:center; height:100vh; margin:0;}
8
+ .box { background:#fff; padding:28px; border-radius:12px; box-shadow:0 4px 12px rgba(0,0,0,.08); width: 420px; }
9
+ h2 { margin: 0 0 12px 0; font-weight: 600; }
10
+ input[type=file]{ margin: 12px 0 16px 0; width:100%; }
11
+ button{ padding:10px 16px; border:none; border-radius:8px; background:#0a66ef; color:#fff; cursor:pointer; width:100%;}
12
+ .res{ margin-top:12px; font-size: 13px; word-break: break-all; color:#333;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  </style>
14
  </head>
15
  <body>
16
+ <div class="box">
17
+ <h2>上传“系统导出格式”Excel</h2>
18
+ <input id="f" type="file" />
19
+ <button onclick="up()">上传并发送邮件</button>
20
+ <div class="res" id="res"></div>
 
21
  </div>
 
22
  <script>
23
+ async function up(){
24
+ const f = document.getElementById('f').files[0];
25
+ const resDiv = document.getElementById('res');
26
+ if(!f){ resDiv.innerText = "请先选择文件"; return; }
27
+
28
+ const fd = new FormData();
29
+ fd.append("file", f);
30
+ try{
31
+ const r = await fetch("/upload", { method: "POST", body: fd });
32
+ const j = await r.json();
33
+ resDiv.innerText = JSON.stringify(j, null, 2);
34
+ }catch(e){
35
+ resDiv.innerText = "上传失败:" + e;
 
 
 
 
 
36
  }
37
  }
38
  </script>
39
  </body>
40
+ </html>