完成奖励证书的模态框处理和名字提交
<template>
<div class="modal" v-if="!showModal">
<div class="mask"></div>
<div class="modal-dialog">
<span class="icon-close" @click="closeModal">X</span>
<div class="modal-container">
<div class="modal-header">
<p>恭喜您完成了</p>
<p>Excel实战训练营阶段一的课程</p>
<p>你有一张妙可官方颁布的阶段学习证书待领取</p>
</div>
<div class="modal-body">
<div class="input-wrapper" v-if="showInput">
<input type="text" placeholder="请输入你的名字" v-model="keyword" maxlength="6">
<a @click="commit">提交</a>
</div>
<div class="or-cade" v-if="showCode">
<img src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.haichaninfo.com%2Fapi%2Fqrcode.png.php%3Fauth%3Dhttp%3A%2F%2Fwww.haichaninfo.com%2Fxinwen%2Fshow-8401.html&refer=http%3A%2F%2Fwww.haichaninfo.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1611912776&t=3c91cef081336290cd8d094eda4e8731" alt="">
<p>手机微信扫码领取</p>
</div>
<div class="certificate" v-if="!showGroupCode">
<p>凭证书到群里找老师可领取————</p>
<img src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.haichaninfo.com%2Fapi%2Fqrcode.png.php%3Fauth%3Dhttp%3A%2F%2Fwww.haichaninfo.com%2Fxinwen%2Fshow-8401.html&refer=http%3A%2F%2Fwww.haichaninfo.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1611912776&t=3c91cef081336290cd8d094eda4e8731" alt="">
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'Modal',
data () {
return {
keyword: ''
}
},
props: {
showModal: Boolean,
showGroupCode: Boolean,
showInput: Boolean,
showCode: Boolean
},
methods: {
closeModal () {
this.showModal = true
},
commit () {
this.$emit('commitName', this.keyword)
}
}
}
</script>
<style>
.modal {
position: fixed;
top: 0;
left: 0;
height: 100%;
width: 100%;
z-index: 8888;
}
.mask {
position: fixed;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-color: #000000;
opacity: 0.5;
}
.modal-dialog {
width: 700px;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
background: #fff;
box-shadow: 2px 2px 2px #ccc, -2px -2px 2px #ccc;
border-radius: 9px;
}
.icon-close {
height: 13px;
width: 13px;
position: absolute;
top: 2px;
right: 8px;
opacity: 0.6;
cursor: pointer;
}
.modal-container {
width: 700px;
padding-top: 30px;
}
.modal-header p {
text-align: center;
}
.modal-body {
display: flex;
justify-content: center;
align-items: center;
text-align: center;
flex-direction: column;
}
.input-wrapper {
margin-top: 5px;
box-sizing: content-box;
height: 30px;
width: 260px;
display: flex;
border: 1px solid #E0E0E0;
border-right: none;
}
.input-wrapper input{
height: 30px;
width: 200px;
padding-left: 8px;
outline: none;
border: none;
box-sizing: border-box;
}
.input-wrapper a {
display: inline-block;
border: 1px solid burlywood;
width: 60px;
height: 30px;
line-height: 30px;
text-align: center;
background: burlywood;
color: #fff;
cursor: pointer;
box-sizing: border-box;
}
.or-cade {
padding-top: 26px;
margin-top: 8px;
}
.or-cade p {
font-size: 14px;
color: #ccc;
}
.or-cade img {
width: 120px;
height: 120px;
}
.certificate {
height: 160px;
width: 100%;
margin-top: 20px;
display: flex;
align-items: center;
justify-content: space-around;
background: #ddd;
border-bottom-right-radius: 9px;
border-bottom-left-radius: 9px;
box-sizing: border-box;
}
.certificate p {
font-size: 16px;
color: #aaaaaa;
}
.certificate img {
height: 140px;
width: 140px;
}
</style>