tzqdn/wh/list.html
2024-02-28 15:42:52 +08:00

116 lines
3.8 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>投资黔东南</title>
<link rel="stylesheet" href="../css/01.css">
<link rel="stylesheet" href="../css/bootstrap.min.css">
</head>
<body>
<div class="container-01">
<div class="Background">
<!--返回箭头-->
<div class="column_01 text-center">
<div class="return_Arrow">
<a href="../index.html">
<img src="../image/zuojiantou.png">
</a>
</div>
文化旅游康养
</div>
<!--输入框-->
<div class="input_01">
<div class="input-group input-group-sm">
<input type="text" id="categories" class="form-control" value="" placeholder="请输入项目名或地址">
</div>
</div>
<!--内容框-->
<div class="container-02" style="width: 100%;height: 88%;">
<div style="height: 100%;overflow-y:scroll;">
<table id="details" class="table table-hover">
<tbody>
</tbody>
</table>
<div id="pagination"></div>
</div>
</div>
</div>
</div>
</div>
<script src="../js/bootstrap.bundle.min.js"></script>
<script src="../js/jquery.js"></script>
<script>
$('#categories').bind('input propertychange', function() {
var insertVal = $(this).val();//手动输入的字符串;
$("#details tr").each(function(){
var paraStr = $(this).children().children().html();
if(paraStr.indexOf(insertVal)<0){//不包含
$(this).hide();
}else{//包含
$(this).show();
}
})
});
</script>
<script>
//获取token
// 定义一个全局变量用于存储 token
var token = '';
$.ajax({
url: 'https://qdngz.guizhoujc.com/seeyon/rest/token/test/6fc1c885-3aac-4489-95f0-7b6923622743',
dataType: 'xml',
success: function(data) {
//console.log(data); // 查看响应数据
$(data).find('UserToken').each(function() {
var id = $(this).find('id').text();
//console.log(id);
// 将获取到的 token 存储到全局变量中
token = id;
});
console.log(token + ' 获取到token')
},
error: function() {
console.log('Error loading XML document');
}
}).done(function() {
if (token !== '') {
// 获取数据的 ajax 请求,将 token 作为查询参数传递
$.ajax({
url: 'https://qdngz.guizhoujc.com/seeyon/rest/dee/task/getCulture',
dataType: 'xml',
data: {token: token},
success: function(data) {
// 处理获取到的数据
console.log(data)
$(data).find('row').each(function() {
var xiangmumingchen = $(this).find('FIELD0001').text();
var ID = $(this).find('ID').text();
var row = `<tr data-id="${ID}">
<td data-label="项目名称">${xiangmumingchen}</td>
</tr>`;
$('#details').append(row);
});
// 为每一行表格添加点击事件处理函数
$('#details tr').on('click', function() {
// 从当前点击行中获取 data-id 属性值
var id = $(this).data('id');
//console.log(id);
// 拼接 URL 并进行页面跳转
window.document.location = 'show-wh.html?id=' + id;
});
},
error: function(xhr, textStatus, errorThrown) {
// 处理 AJAX 请求失败的情况
console.error(xhr.status + ": " + errorThrown);
}
});
}
});
</script>
</body>
</html>