Files
admin-web/packing-acceptance.local.html
T
2026-10-14 11:43:32 +08:00

17 lines
1.1 KiB
HTML

<!doctype html><meta charset="utf-8"><title>本地合箱接口验收</title>
<h1>本地合箱接口验收</h1><p>复用当前平台会话,只调用正式业务接口。</p>
<label>请求 JSON<textarea id="request" aria-label="请求 JSON" style="display:block;width:95%;height:200px"></textarea></label>
<button id="run">执行验收请求</button><pre id="result" style="white-space:pre-wrap"></pre>
<script type="module">
import {http} from '/src/shared/api/http.ts'
import {createPinia} from 'pinia'
import {useAuthStore} from '/src/core/auth/auth.ts'
const auth=useAuthStore(createPinia()); await auth.restoreSession()
document.querySelector('#run').onclick=async()=>{
const out=document.querySelector('#result');out.textContent='执行中';
try {const requests=JSON.parse(document.querySelector('#request').value);const results=[];
for(const request of Array.isArray(requests)?requests:[requests]) results.push(await http.request(request));
out.textContent=JSON.stringify(results,null,2)}catch(e){out.textContent=JSON.stringify({error:e.message,response:e.response?.data},null,2)}
}
</script>