feat: 🐶 删除多余页面

This commit is contained in:
niushuai233 2024-11-18 16:25:16 +08:00
parent 30caf7d91a
commit 19bf7f5a2c

View File

@ -1,163 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="${request.contextPath}/bootstrap-3.4.1/bootstrap.min.css">
<script src="${request.contextPath}/jquery-3.7.1/jquery.min.js"></script>
<script src="${request.contextPath}/bootstrap-3.4.1/bootstrap.min.js"></script>
<link rel="stylesheet" href="${request.contextPath}/bootstrap-table-1.22.5/bootstrap-table.min.css">
<link rel="stylesheet" href="${request.contextPath}/bootstrap-table-1.22.5/bootstrap-table-fixed-columns.min.css">
<script src="${request.contextPath}/bootstrap-table-1.22.5/bootstrap-table.min.js"></script>
<script src="${request.contextPath}/bootstrap-table-1.22.5/bootstrap-table-fixed-columns.min.js"></script>
<script src="${request.contextPath}/index/main.js"></script>
<style>
.container {
width: 85%;
}
</style>
</head>
<body>
<div class="container">
<h2>车系配置数据提取器 v1.0</h2>
<p style="align-self: end">数据来源: <a href="https://dongchedi.com">懂车帝</a></p>
<div class="row">
<div class="col-lg-12">
<div class="input-group">
<input id="dcdUrl" type="text" class="form-control"
placeholder="懂车帝url点击提取, eg: https://www.dongchedi.com/auto/series/8808, 输入其他点搜索, 可搜索内容包括: 品牌,系列">
<span class="input-group-btn">
<button id="search" class="btn btn-primary" type="button" style="min-width: 150px">搜索</button>
<button id="go" class="btn btn-danger" type="button" style="min-width: 150px">提取</button>
</span>
</div><!-- /input-group -->
</div><!-- /.col-lg-6 -->
</div><!-- /.row -->
<br/>
<#--<div class="progress">
<div id="progressBar" class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="0"
aria-valuemin="0" aria-valuemax="100" style="width: 2%">
0%
</div>
</div>-->
<br/>
<button id="saveTableHead" class="btn btn-primary">保存展示表头配置</button>
<table id="table"/>
</div>
</body>
<script>
var $table = $('#table')
var contextPath = "${request.contextPath}/";
$("#go").click(function () {
var url = $("#dcdUrl").val();
$.post(contextPath + "index/analyze", {"dcdUrl": url}, function (data) {
console.log("...ax", data);
buildTable($table, data);
});
});
$("#search").click(function () {
var url = $("#dcdUrl").val();
$.post(contextPath + "index/search", {}, function (data) {
console.log("...search", data);
buildTable($table, data);
});
});
$("#saveTableHead").click(function () {
var fields = $table.bootstrapTable('getHiddenColumns');
console.log(fields);
var str = "";
fields.forEach(item => {
str += item.field + ",";
})
var newRows = []
table_headers.forEach(item => {
if (str.indexOf(item.field) != -1) {
newRows.push(item);
}
})
localStorage.setItem("hiddenColumns", JSON.stringify(newRows))
})
function buildTable($el, rows) {
console.log("buildTable", rows);
var columns = []
for (i = 0; i < table_headers.length; i++) {
var header = table_headers[i];
columns.push({
field: header.field,
title: header.title,
sortable: true,
valign: 'left',
formatter: function (val) {
var width = 100;
if (header && header.width) {
width = header.width;
}
// return '<div class="item_header" style="width: ' + width + 'px">' + val + '</div>'
return val;
},
// events: {
// 'click .item': function (item) {
// console.log('click', item)
// }
// }
})
}
var datas = []
for (i = 0; i < rows.length; i++) {
datas.push(rows[i])
}
$el.bootstrapTable('destroy').bootstrapTable({
height: 600,
columns: columns,
data: datas,
cache: false,
search: true,
showColumns: true,
showToggle: false,
cardView: false,
striped: false, //是否显示行间隔色
pagination: true,
clickToSelect: true,
fixedColumns: true,
fixedNumber: 4,
fixedRightNumber: 0
})
hideColumns();
}
function hideColumns() {
var hiddenColumns = localStorage.getItem("hiddenColumns");
var fields = JSON.parse(hiddenColumns);
fields.forEach(item => {
$table.bootstrapTable('hideColumn', item.field);
})
}
$(function () {
// buildTable($table, [])
})
</script>
</html>