feat: 增加证书查询html

This commit is contained in:
caoqianming 2023-08-29 12:08:32 +08:00
parent 03707b94d9
commit c0c8a684bb
2 changed files with 218 additions and 1 deletions

4
.gitignore vendored
View File

@ -3,6 +3,7 @@
.vs/
venv/
media/
temp/
*.log
static/
@ -12,7 +13,8 @@ __pycache__/
# client
node_modules/
dist/
dist/*
!dist/index_zs.html
npm-debug.log*
yarn-debug.log*
yarn-error.log*

215
server/dist/index_zs.html vendored Normal file
View File

@ -0,0 +1,215 @@
<!-- width=device-width: 自适应手机屏幕的尺寸宽度
maximum-scale: 缩放比例的最大值
minimum-scale: 缩放比例的最小值
inital-scale: 缩放的初始化
user-scalable: 用户是否能缩放页面 -->
<!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, user-scalable=no,initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<title>证书查询</title>
<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head>
<style>
body,html{
padding: 0;
margin: 0;
}
.active{
color: #2698f0;
}
.search-dialog{
width: 50%;
margin: auto;
text-align: center;
}
.typeWrap {
width: 200px;
text-align: center;
margin: auto;
border-radius: 7px;
display: flex;
font-size: 15px;
border: 1px solid #2698f0;
}
.search_item{
width: 50%;
text-align: center;
height: 40px;
line-height: 40px;
color: #2698f0;
box-sizing: border-box;
background: #ffffff;
border-radius:5px;
}
.active{
color: #ffffff;;
background: #2698f0;
border-radius: 5px;
border-bottom: 1px solid #2698f0;
}
.row{
width: 50vw;
margin: 10px 0;
box-sizing: border-box;
padding-left: 70px;
position: relative;
border: 2px solid #2698f0;
border-radius: 5px;
}
.searchInput{
width: 98%;
height: 40px;
line-height: 40px;
border: none;
}
input:focus-visible {
outline: none;
border: none;
}
.label{
display: inline-block;
height: 35px;
line-height: 35px;
position: absolute;
left: 0;
width: 70px;
margin-top: 3px;
border-right: 1px solid #2698f0;
}
.redStar{
color: red;
}
.searchBtn{
width: 100px;
height: 35px;
line-height: 35px;
text-align: center;
color: #ffffff;
background: #2698f0;
border-radius: 5px;
margin: auto;
margin: 0 auto 10px auto;
}
.imgs{
width: 100%;
}
@media screen and (max-width: 992px){
.search-dialog{
width: 96%;
}
.typeWrap {
width: 200px;
text-align: center;
margin: auto;
border-radius: 7px;
display: flex;
border: 1px solid #2698f0;
}
.search_item{
width: 50%;
text-align: center;
height: 35px;
line-height: 35px;
color: #2698f0;
box-sizing: border-box;
background: #ffffff;
border-radius:5px;
}
.active{
color: #ffffff;
background: #2698f0;
}
.row{
width: 96vw;
}
}
</style>
<body>
<div id="container">
<!-- 证书查询 -->
<div class="search-dialog">
<h3>培训证书查询</h3>
<div class="typeSelect">
<div class="typeWrap">
<div :class="[type==0 ? 'active' : '','search_item']" @click="typeChange(0)">证书号</div>
<div :class="[type==1 ? 'active' : '','search_item']" @click="typeChange(1)">姓名</div>
</div>
</div>
<div v-if="type==0">
<div class="row">
<span class="label"><span class="redStar">*</span>证书号</span>
<input class="searchInput" type="text" id="username" v-model="form.number">
</div>
<div class="searchBtn" @click="searchClick(0)">查询</div>
</div>
<div v-else>
<div class="row">
<span class="label"><span class="redStar">*</span>姓名</span>
<input class="searchInput" type="text" id="username" v-model="form.name">
</div>
<div class="row">
<span class="label"><span class="redStar">*</span>单位</span>
<input class="searchInput" type="password" id="password" v-model="form.deptName">
</div>
<div class="searchBtn" @click="searchClick(1)">查询</div>
</div>
<div>
<img class="imgs" :src="imgSrc">
</div>
</div>
</div>
<script>
var test = new Vue({
el: "#container",
data: {
type:0,
form: {
number: '',
name: '',
deptName: ''
},
imgSrc:''
},
methods: {
typeChange(index){
this.type = index;
},
searchClick(type){
axios.get('https://testsearch.ctc.ac.cn/api/edu/certificate/',{params:{证书编号:this.form.number}})
.then(res => {
let data = res.data.data[0];
if(data.证书地址!==null){
this.imgSrc = 'https://testsearch.ctc.ac.cn'+data.证书地址;
}else{
axios.get(`https://testsearch.ctc.ac.cn/api/edu/certificate/${data.id}/`).then(res1=>{
if(res.data){
debugger;
console.log('res1.data:')
console.log(res1.data.data)
console.log(res1.data.data.证书地址)
let data1 = res1.data.data;
this.imgSrc = 'https://testsearch.ctc.ac.cn'+data1.证书地址;
console.log(this.imgSrc)
}
})
}
})
},
},
mounted: function () {
var that = this;
that.msg = "hello vue";
}
})
</script>
</body>
</html>