309 lines
9.5 KiB
HTML
309 lines
9.5 KiB
HTML
<!-- 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 type="text/javascript" src="https://cdn.jsdelivr.net/npm/vue@2"></script>
|
|
<!-- <script src="https://unpkg.com/axios/dist/axios.min.js"></script> -->
|
|
<script type="text/javascript" src="https://cdn.bootcss.com/axios/0.19.0-beta.1/axios.js"></script>
|
|
</head>
|
|
<style>
|
|
body,html{
|
|
padding: 0;
|
|
margin: 0;
|
|
}
|
|
.container{
|
|
padding-bottom: 20px;
|
|
}
|
|
.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;
|
|
}
|
|
.listItem{
|
|
width: 100%;
|
|
padding: 10px;
|
|
box-sizing: border-box;
|
|
border: 1px dashed #2698f0;
|
|
border-radius: 5px;
|
|
position: relative;
|
|
}
|
|
.imgs{
|
|
width: 100%;
|
|
}
|
|
.neishen{
|
|
display: inline-block;
|
|
border: 1px solid orange;
|
|
border-radius: 3px;
|
|
padding: 0 3px;
|
|
position: absolute;
|
|
top: 5px;
|
|
left: 5px;
|
|
color: orange;
|
|
font-size: 14px;
|
|
}
|
|
.info{
|
|
padding: 5px 20px;
|
|
color: #ffffff;
|
|
position: fixed;
|
|
z-index: 10;
|
|
width: fit-content;
|
|
top: 40%;
|
|
left: 50%;
|
|
transform: translateX(-50%);
|
|
background: rgba(0,0,0,.5);
|
|
border-radius: 5px;
|
|
}
|
|
@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="number" 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="name" v-model="form.name">
|
|
</div>
|
|
<div class="row">
|
|
<span class="label"><span class="redStar">*</span>单位</span>
|
|
<input class="searchInput" type="text" id="deptName" v-model="form.deptName">
|
|
</div>
|
|
<div class="searchBtn" @click="searchClick(1)">查询</div>
|
|
</div>
|
|
<div v-if="showImg">
|
|
<img class="imgs" :src="imgSrc">
|
|
</div>
|
|
<div class="lists" v-if="dataList.length>0">
|
|
<div v-for="item in dataList" class="listItem" @click="showImage(item)">
|
|
<div>姓名:{{item.姓名}}</div>
|
|
<div>证书编号:{{item.证书编号}}</div>
|
|
<div>所属单位:{{item.所属单位}}</div>
|
|
<div v-if="item.职务!==null&&item.职务!=='/'">职务:{{item.职务}}</div>
|
|
<div class="neishen" v-if="item.内审员">内审员</div>
|
|
</div>
|
|
</div>
|
|
<div v-else>
|
|
<p>暂未查询到您的相关证书!</p>
|
|
</div>
|
|
</div>
|
|
<div v-if="showErr" class="info">
|
|
{{errMsg}}
|
|
</div>
|
|
</div>
|
|
<script>
|
|
var test = new Vue({
|
|
el: "#container",
|
|
data: {
|
|
type:0,
|
|
form: {
|
|
number: '',
|
|
name: '',
|
|
deptName: ''
|
|
},
|
|
imgSrc:'',
|
|
showImg:false,
|
|
dataList:[],
|
|
showErr:false,
|
|
errMsg:''
|
|
},
|
|
methods: {
|
|
typeChange(index){
|
|
let that = this;
|
|
that.dataList = [];
|
|
this.type = index;
|
|
that.showImg = false;
|
|
},
|
|
searchClick(type){
|
|
let that = this;
|
|
that.dataList = [];
|
|
if(that.type==0){
|
|
if(that.form.number!==''){
|
|
axios.get('https://testsearch.ctc.ac.cn/api/edu/certificate/',{params:{证书编号:that.form.number}})
|
|
.then(res => {
|
|
if(res.data.data.length>0){
|
|
that.dataList = res.data.data;
|
|
}
|
|
})
|
|
}else{
|
|
that.errMsg = '请输入证书编号';
|
|
that.showErr = true;
|
|
setTimeout(()=>{
|
|
that.showErr = false;
|
|
},1500)
|
|
}
|
|
}else{
|
|
if(that.form.name!==''){
|
|
if(that.form.deptName!==''){
|
|
axios.get('https://testsearch.ctc.ac.cn/api/edu/certificate/',{params:{姓名:that.form.name,所属单位:that.form.deptName}})
|
|
.then(res => {
|
|
if(res.data.data.length>0){
|
|
that.dataList = res.data.data;
|
|
}
|
|
})
|
|
}else{
|
|
that.errMsg = '请输入所属单位';
|
|
that.showErr = true;
|
|
setTimeout(()=>{
|
|
that.showErr = false;
|
|
},1500)
|
|
}
|
|
}else{
|
|
that.errMsg = '请输入姓名';
|
|
that.showErr = true;
|
|
setTimeout(()=>{
|
|
that.showErr = false;
|
|
},1500)
|
|
}
|
|
}
|
|
},
|
|
showImage(data){
|
|
let that = this;
|
|
if(data.证书地址!==null){
|
|
that.imgSrc = 'https://testsearch.ctc.ac.cn'+data.证书地址;
|
|
that.showImg = true;
|
|
}else{
|
|
axios.get(`https://testsearch.ctc.ac.cn/api/edu/certificate/${data.id}/`).then(res=>{
|
|
if(res.data){
|
|
let data1 = res.data.data;
|
|
that.imgSrc = 'https://testsearch.ctc.ac.cn'+data1.证书地址;
|
|
that.showImg = true;
|
|
}
|
|
})
|
|
}
|
|
},
|
|
},
|
|
mounted: function () {
|
|
var that = this;
|
|
that.msg = "hello vue";
|
|
}
|
|
})
|
|
</script>
|
|
</body>
|
|
</html>
|