<template>
	<page-meta :root-font-size="fontsize+'px'" style="display: block;">
	<view style="position: relative;" v-if="isPc">
		<Headers></Headers>
		
		<image class="top-bg" src="/static/images/certificate_top_bg.png" mode="widthFix"></image>
		
		<view class="content-box ddflex">
			<view>
				<view class="ddflex re-item">
					<view class="re-label">姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名</view>
					<view class="re-li dflex">
						<input v-model="name" placeholder="姓名" maxlength="-1" placeholder-class="placeholder" class="re-ipt flex" />
					</view>
				</view>
				<view class="ddflex re-item">
					<view class="re-label">身份证号</view>
					<view class="re-li dflex">
						<input v-model="idNumber" placeholder="身份证号" maxlength="-1" placeholder-class="placeholder" class="re-ipt flex" />
					</view>
				</view>
				<view class="ddflex re-item">
					<view class="re-label">证书编号</view>
					<view class="re-li dflex">
						<input v-model="certificateNo" placeholder="证书编号" maxlength="-1" placeholder-class="placeholder" class="re-ipt flex" />
					</view>
				</view>
				<view class="note ddflex">
					<image src="/static/images/note.png"></image>
					<text>任意输入以上两项内容即可查询</text>
				</view>
				<view class="query-btn" @click="query">
					立即查询
				</view>
			</view>
		</view>
		
		<view class="ddflex" style="z-index: 1;position: relative;justify-content: center;text-align: center;margin-bottom: 0.6rem;padding: 0.3rem;">
			<view>
				<view style="font-size: 0.18rem;">
					第三方证书查询平台
				</view>
				<view class="ddflex" style="justify-content: center;margin-top: 0.18rem">
					<view class="link-btn" v-for="item in otherLink" @click="jumpLink(item.link)">{{item.title}}</view>
				</view>
			</view>
		</view>
		<image class="bottom_bg" src="/static/images/certificate_bottom_bg.png" mode="widthFix"></image>
		<Foot></Foot>
	</view>
	
	<!-- 移动端 -->
	<view v-else style="font-size: 28rpx;">
		<image class="top-bg" src="/static/images/certificate_top_bg.png" mode="widthFix"></image>
		<view class="m-content-box ddflex">
			<view>
				<view class="ddflex m-re-item">
					<view class="m-re-label">姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名</view>
					<view class="m-re-li dflex">
						<input v-model="name" placeholder="姓名" maxlength="-1" placeholder-class="m-placeholder" class="m-re-ipt flex" />
					</view>
				</view>
				<view class="ddflex m-re-item">
					<view class="m-re-label">身份证号</view>
					<view class="m-re-li dflex">
						<input v-model="idNumber" placeholder="身份证号" maxlength="-1" placeholder-class="m-placeholder" class="m-re-ipt flex" />
					</view>
				</view>
				<view class="ddflex m-re-item">
					<view class="m-re-label">证书编号</view>
					<view class="m-re-li dflex">
						<input v-model="certificateNo" placeholder="证书编号" maxlength="-1" placeholder-class="m-placeholder" class="m-re-ipt flex" />
					</view>
				</view>
				<view class="m-note ddflex">
					<image src="/static/images/note.png"></image>
					<text>任意输入以上两项内容即可查询</text>
				</view>
				<view class="m-query-btn" @click="query">
					立即查询
				</view>
			</view>
		</view>
		
		<view style="padding: 20rpx;border-top: 1px solid #1AA1E6;font-size: 30rpx;">
			<view style="text-align: center;">
				第三方证书查询平台
			</view>
			<view class="ddflex" style="justify-content: center;margin-top: 18rpx;flex-wrap: wrap;">
				<view style="line-height: 2;width: calc(50% - 30rpx);background-color: #fff;padding: 10rpx;box-sizing: border-box;margin: 15rpx"  v-for="item in otherLink" @click="jumpLink(item.link)">{{item.title}}</view>
			</view>
		</view>
	</view>
	</page-meta>
</template>

<script>
	const app = getApp();
	const req = require('../../utils/request.js');
	const utils = require('../../utils/util.js');
	const api = require('../../utils/api.js')
	export default {
		data() {
			return {
				name:'',
				idNumber:'',
				certificateNo:'',
				
				otherLink:[{
					title:'国家职业资格证书查询',
					link:'http://zscx.osta.org.cn/'
				},{
					title:'职业技能等级证书查询',
					link:'http://zscx.osta.org.cn/'
				},{
					title:'全联汽车商会证书查询',
					link:'http://www.cadcc.com.cn/certificate_query.html'
				},{
					title:'供销专业技术证书查询',
					link:'http://www.china-gxjd.org.cn/web/certificate.html'
				},{
					title:'工信专项技术证书查询',
					link:'https://www.miiteec.org.cn/plus/list.php?tid=247'
				},{
					title:'专业技术资格证书查询',
					link:'https://jdcjcwx.jtzyzg.org.cn/JDCJCWX/LEAP/jdcjcwx/html/publicQuery.html#cer'
				}],
				
				systemInfo:{},
				fontsize:'100px'
			}
		},
		onLoad() {
			let srceenNunber = 19.2; //因设计图是1920所有把设计图分为19.2份，所以html字体大小为100px
			    let that = this;
			
			    //窗体改变大小触发事件
			    uni.onWindowResize((res) => {
			        console.log('变化后的窗口宽度=', res.size.windowWidth);
			        that.fontsize = parseFloat(res.size.windowWidth) / srceenNunber;
			    })
			
			    //打开获取屏幕大小
			    uni.getSystemInfo({
			        success(res) {
			            console.log('设备信息：', res);
			            that.fontsize = res.screenWidth / srceenNunber;
			            console.log('字体大小：', that.fontsize);
			        }
			    })
			
			this.systemInfo = uni.getSystemInfoSync()
			this.isPc = this.IsPC()
		},
		methods: {
			IsPC() {
			    var userAgentInfo = navigator.userAgent;
			    var Agents = ["Android", "iPhone",
			                "SymbianOS", "Windows Phone",
			                "iPad", "iPod"];
			    var flag = true;
			    for (var v = 0; v < Agents.length; v++) {
			        if (userAgentInfo.indexOf(Agents[v]) > 0) {
			            flag = false;
			            break;
			        }
			    }
			    return flag;
			},
			query(){
				let ql = [this.name,this.idNumber,this.certificateNo]
				if(ql.filter(item=>{return item}).length<2) return req.msg('请填写两项内容查询')
				
				req.getRequest('/api/v3/exam/user/manager/certificate',{name:this.name,idNumber:this.idNumber,certificateNo:this.certificateNo},res=>{
					req.setStorage('options',{name:this.name,idNumber:this.idNumber,certificateNo:this.certificateNo})
					uni.navigateTo({
						url:'/pages/certificateDetail/certificateDetail'
					})
				})
			},
			jumpLink(link){
				window.open(link)
			}
		}
	}
</script>

<style>
	@import url('./certificateQuery.css');
</style>