c5_labsci/web/admin/demo/dyn/callapi.html
2026-01-27 00:52:00 +08:00

61 lines
2.2 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<link href="/jscss/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8" src="/jscss/theme.js"></script>
<style>
.container>div {
padding: 1em;
background: var(--bg1);
margin-bottom: 1em;
border: 1px solid var(--bg5);
}
</style>
</head>
<body>
<div class="container">
<blockquote>获取token</blockquote>
<div>
APIID:
<input type="text" name="apiid" style="width:6em;" value="215698" />
APIKey:
<input type="text" name="apikey" style="width:16em;" value="1nab1AEZvbbOP05dBQfE" />
<button class='btn' onclick="gettoken()">获取token</button>
<input type="text" name="token" style="width:100%;" value="" />
</div>
<blockquote>业务调用</blockquote>
<div>
<br /><button class='btn' onclick="call1()">调用1</button>
<br /><textarea id="result1" style="width: 100%; height: 50vh;"></textarea>
</div>
</div>
<script type="text/javascript" src="/jscss/ciy.js"></script>
<script type="text/javascript">
'use strict';
async function gettoken() {
var postparam = {};
postparam.apiid = document.getElementsByName("apiid")[0].value;
postparam.apikey = document.getElementsByName("apikey")[0].value;
ciyfn.callfunc("gettoken", postparam, function (json) {
document.getElementsByName("token")[0].value = json.token;
});
}
async function call1() {
var postparam = {};
postparam.token = document.getElementsByName("token")[0].value;
ciyfn.callfunc("call1", postparam, function (json) {
document.getElementById("result1").value = JSON.stringify(json, null, 2);
});
}
</script>
</body>
</html>