|
@@ -4,31 +4,29 @@
|
|
|
<div class="button-close-div" id="button-close-div">
|
|
|
<img id="close-button" class="close-button" src="../../static/img/close.svg" alt="" @click="closeCard()">
|
|
|
</div>
|
|
|
-
|
|
|
- <!-- <el-carousel trigger="click" id="el-carousel">
|
|
|
- <el-carousel-item v-for="imgUrl in imgArr" :key="imgUrl"> -->
|
|
|
- <div id="el-carousel">
|
|
|
- <img v-bind:src="imgURL" class="image" id="img">
|
|
|
- </div>
|
|
|
- <!-- </el-carousel-item>
|
|
|
- </el-carousel> -->
|
|
|
+ <el-carousel trigger="click" id="el-carousel">
|
|
|
+ <el-carousel-item v-for="imgUrl in imgArr" :key="imgUrl">
|
|
|
+ <img v-bind:src="imgUrl" class="image" id="img">
|
|
|
+ </el-carousel-item>
|
|
|
+ </el-carousel>
|
|
|
<div class="background">
|
|
|
<div class="title" id="title">{{ title | ellipsis_title}}</div>
|
|
|
- <div class="bottom clearfix">
|
|
|
+<!-- <div class="bottom clearfix">-->
|
|
|
<div class="info" id="info">{{ info | ellipsis_info}}</div>
|
|
|
- </div>
|
|
|
- <a
|
|
|
- :href="url"
|
|
|
- target='_blank'
|
|
|
- >
|
|
|
- <button
|
|
|
- v-show="url !== null"
|
|
|
- id="button-show-all"
|
|
|
- class="button-show-all"
|
|
|
- >
|
|
|
- {{ '阅读全文' }}
|
|
|
- </button>
|
|
|
- </a>
|
|
|
+<!-- </div>-->
|
|
|
+ <!-- <button id="button-show-all" class="button-show-all" onclick="">{{ '阅读全文' }}</button> -->
|
|
|
+ <a
|
|
|
+ :href="url"
|
|
|
+ target='_blank'
|
|
|
+ >
|
|
|
+ <button
|
|
|
+ v-show="url !== null"
|
|
|
+ id="button-show-all"
|
|
|
+ class="button-show-all"
|
|
|
+ >
|
|
|
+ {{ '阅读全文' }}
|
|
|
+ </button>
|
|
|
+ </a>
|
|
|
</div>
|
|
|
</el-card>
|
|
|
</div>
|
|
@@ -40,27 +38,24 @@ export default {
|
|
|
props: {
|
|
|
title: {
|
|
|
type: String,
|
|
|
- default: 'This is title'
|
|
|
- },
|
|
|
- time: {
|
|
|
- type: String,
|
|
|
- default: '2021-01-21'
|
|
|
+ default: '我是标题我是标题我是标题我是标题我是标题我是标题'
|
|
|
},
|
|
|
info: {
|
|
|
type: String,
|
|
|
- default: 'This is info.'
|
|
|
+ default: '我是消息我是消息我是消息我是消息我是消息我是消息我是消息我是消息我是消息我是消息我是消息我是消息我是消息我是消息我是消息我是消息'
|
|
|
},
|
|
|
url: {
|
|
|
type: String,
|
|
|
default: null
|
|
|
},
|
|
|
- img: {
|
|
|
- type: String,
|
|
|
- default: '../../static/img/card-img.png'
|
|
|
- },
|
|
|
isMobile: {
|
|
|
type: Boolean,
|
|
|
default: false
|
|
|
+ },
|
|
|
+ // 图片链接
|
|
|
+ img: {
|
|
|
+ type: String,
|
|
|
+ default: '../../static/img/card-img.png'
|
|
|
}
|
|
|
},
|
|
|
name: 'phoneCard',
|
|
@@ -68,36 +63,19 @@ export default {
|
|
|
return {
|
|
|
button: '',
|
|
|
flag: '',
|
|
|
- imgURL: '../../static/img/card-img.png',
|
|
|
+ imgArr: ['../../static/img/card-img.png'],
|
|
|
showMore: false,
|
|
|
screenSize: window.screen.width
|
|
|
}
|
|
|
},
|
|
|
- created () {
|
|
|
- // this.sliceText()
|
|
|
- },
|
|
|
mounted () {
|
|
|
/**
|
|
|
* @description: 当页面为pc端时就切换成pc端的样式
|
|
|
*/
|
|
|
- if (window.screen.width < 480) {
|
|
|
- this.setCardSize()
|
|
|
+ if (this.isMobile) {
|
|
|
+ this.setMobileCardSize()
|
|
|
} else {
|
|
|
- let card = document.getElementById('el-card-div')
|
|
|
- let elCard = document.getElementById('el-card')
|
|
|
- let cardBody = document.getElementsByClassName('el-card__body')
|
|
|
- card.style.cssText = ' -webkit-transform: translate(-50%, -50%);\n' +
|
|
|
- '-moz-transform: translate(-50%, -50%);\n' +
|
|
|
- '-ms-transform: translate(-50%, -50%);\n' +
|
|
|
- '-o-transform: translate(-50%, -50%);\n' +
|
|
|
- 'transform: translate(-50%, -50%);\n' +
|
|
|
- 'top: 50%;\n' +
|
|
|
- 'left: 50%;\n' +
|
|
|
- 'position: absolute'
|
|
|
- elCard.style.cssText = 'width:240px;height:336px;'
|
|
|
- cardBody[0].style.cssText = 'width:240px;height:336px;padding:0'
|
|
|
- // 240, 336
|
|
|
- this.setCardSize()
|
|
|
+ this.setPcCardSize()
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -106,14 +84,17 @@ export default {
|
|
|
*/
|
|
|
closeCard () {
|
|
|
bus.$emit('closePopup')
|
|
|
+ // let card = document.getElementById('el-card-div')
|
|
|
+ // card.style.display = 'none'
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
- * @description:根据设备动态设置内部尺寸
|
|
|
- */
|
|
|
- setCardSize () {
|
|
|
- let div = document.getElementById('el-card-div')
|
|
|
- let cardDiv = document.getElementById('el-card')
|
|
|
+ * @description:根据设备动态设置内部尺寸(移动端)
|
|
|
+ */
|
|
|
+ setMobileCardSize () {
|
|
|
+ let card = document.getElementById('el-card')
|
|
|
+ // let cardDiv = document.getElementById('el-card-div')
|
|
|
+
|
|
|
let title = document.getElementById('title')
|
|
|
let elcarousel = document.getElementById('el-carousel')
|
|
|
let info = document.getElementById('info')
|
|
@@ -121,22 +102,16 @@ export default {
|
|
|
let buttonclose = document.getElementById('button-close-div')
|
|
|
let buttoncloseImg = document.getElementById('close-button')
|
|
|
|
|
|
- var cardWidth, cardHeight
|
|
|
- cardWidth = window.screen.width - 64
|
|
|
- cardHeight = parseInt(cardWidth * 1.414)
|
|
|
- if (this.isMobile === true) {
|
|
|
- cardWidth = window.screen.width - 64
|
|
|
- cardHeight = parseInt(cardWidth * 1.414)
|
|
|
- } else {
|
|
|
- cardWidth = 240
|
|
|
- cardHeight = 350
|
|
|
- }
|
|
|
- div.style.top = '50%'
|
|
|
- div.style.transform = 'translateY(-50%)'
|
|
|
+ var cardWidth = window.screen.width - 64
|
|
|
+ var cardHeight = parseInt(cardWidth * 1.414)
|
|
|
|
|
|
+ card.style.width = cardWidth + 'px'
|
|
|
+ card.style.height = cardHeight + 'px'
|
|
|
+ // cardDiv.style.marginLeft = '-' + cardWidth / 2 + 'px'
|
|
|
+ // cardDiv.style.marginTop = '-' + cardHeight / 2 + 'px'
|
|
|
// cardDiv.style.top = '50%'
|
|
|
- cardDiv.style.width = cardWidth + 'px'
|
|
|
- cardDiv.style.height = cardHeight + 'px'
|
|
|
+ // cardDiv.style.transform = 'translate(-50%, -50%)'
|
|
|
+
|
|
|
elcarousel.style.height = cardHeight * 0.43 + 'px'
|
|
|
elcarousel.style.width = cardWidth + 'px'
|
|
|
|
|
@@ -164,30 +139,29 @@ export default {
|
|
|
buttonclose.style.width = cardWidth * 0.05 + 'px'
|
|
|
buttonclose.style.right = cardWidth * 0.05 + 'px'
|
|
|
buttonclose.style.marginTop = cardWidth * 0.05 + 'px'
|
|
|
- // buttonclose.style.marginTop = cardHeight * 0.0357 + 'px'
|
|
|
|
|
|
buttoncloseImg.style.height = cardWidth * 0.05 + 'px'
|
|
|
buttoncloseImg.style.width = cardWidth * 0.05 + 'px'
|
|
|
- }
|
|
|
+ },
|
|
|
+
|
|
|
/**
|
|
|
- * @description:修改显示的info和title的字数
|
|
|
- */
|
|
|
- // sliceText () {
|
|
|
- // if (this.title) {
|
|
|
- // if (this.title.length > 22) {
|
|
|
- // this.title = this.title.slice(0, 22) + '......'
|
|
|
- // }
|
|
|
- // }
|
|
|
- // if (this.info) {
|
|
|
- // if (this.info.length > 60) {
|
|
|
- // this.info = this.info.slice(0, 60) + '......'
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
+ * @description:根据设备动态设置内部尺寸(PC端)
|
|
|
+ */
|
|
|
+ setPcCardSize () {
|
|
|
+ let card = document.getElementById('el-card-div')
|
|
|
+ card.style.cssText = ' -webkit-transform: translate(60%);\n' +
|
|
|
+ '-moz-transform: translate(60%);\n' +
|
|
|
+ '-ms-transform: translate(60%);\n' +
|
|
|
+ '-o-transform: translate(60%);\n' +
|
|
|
+ 'transform: translate(60%);\n' +
|
|
|
+ 'top: 50%;\n' +
|
|
|
+ 'left: 50%;\n' +
|
|
|
+ 'position: absolute'
|
|
|
+ }
|
|
|
},
|
|
|
watch: {
|
|
|
screenSize: function () {
|
|
|
- this.setCardSize()
|
|
|
+ this.Mobile()
|
|
|
},
|
|
|
|
|
|
img (val) {
|
|
@@ -196,10 +170,9 @@ export default {
|
|
|
}
|
|
|
|
|
|
if (val !== null && val !== '') {
|
|
|
- this.imgURL = val
|
|
|
- console.log(val)
|
|
|
+ this.imgArr = [val]
|
|
|
} else {
|
|
|
- this.imgURL = '../../static/img/card-img.png'
|
|
|
+ this.imgArr = ['../../static/img/card-img.png']
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -230,129 +203,184 @@ export default {
|
|
|
</script>
|
|
|
|
|
|
<style>
|
|
|
-/deep/ .el-card__body {
|
|
|
- margin-left: 32px !important;
|
|
|
- margin-right: 32px;
|
|
|
-}
|
|
|
-
|
|
|
-#el-carousel {
|
|
|
- overflow: hidden;
|
|
|
- height:292px;
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-.el-card-div {
|
|
|
- border-radius: 24px;
|
|
|
- text-align: center;
|
|
|
- margin-left: 32px;
|
|
|
- margin-right: 32px;
|
|
|
- position: absolute;
|
|
|
-}
|
|
|
+@media all {
|
|
|
+ /deep/ .el-card__body {
|
|
|
+ margin-left: 16px !important;
|
|
|
+ margin-right: 16px;
|
|
|
+ }
|
|
|
|
|
|
-/*卡片设置*/
|
|
|
-.el-card {
|
|
|
- border-radius: 24px;
|
|
|
- border: none;
|
|
|
- filter: drop-shadow(0px 16px 16px #475837);
|
|
|
- position: center;
|
|
|
- right: 32px;
|
|
|
- left: 32px;
|
|
|
- background: url("../../static/img/card-background.png");
|
|
|
- background-size: cover;
|
|
|
+ #el-carousel {
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
|
|
|
-}
|
|
|
+ .el-card-div {
|
|
|
+ border-radius: 24px;
|
|
|
+ text-align: center;
|
|
|
+
|
|
|
+ position: absolute;
|
|
|
+ top: 50%;
|
|
|
+ left: 50%;
|
|
|
+ transform: translate(-50%, -50%);
|
|
|
+ -webkit-transform: translate(-50%, -50%);
|
|
|
+ -moz-transform: translate(-50%, -50%);
|
|
|
+ -ms-transform: translate(-50%, -50%);
|
|
|
+ -o-transform: translate(-50%, -50%);
|
|
|
+ z-index: 70;
|
|
|
+ }
|
|
|
+ /*卡片设置*/
|
|
|
+ .el-card {
|
|
|
+ border-radius: 24px;
|
|
|
+ border: none;
|
|
|
+ filter: drop-shadow(0px 16px 16px #475837);
|
|
|
+ position: center;
|
|
|
+ background: url("../../static/img/card-background.png");
|
|
|
+ background-size: cover;
|
|
|
|
|
|
-.image {
|
|
|
- width: inherit;
|
|
|
- position: center;
|
|
|
-}
|
|
|
+ }
|
|
|
|
|
|
-.title {
|
|
|
- font-size: 36px;
|
|
|
- line-height: 150%;
|
|
|
- text-align: left;
|
|
|
- margin-top: 8px;
|
|
|
- margin-right: 24px;
|
|
|
- margin-left: 24px;
|
|
|
- font-family: "Noto Sans SC";
|
|
|
- font-weight: 500;
|
|
|
- color: black;
|
|
|
- vertical-align: top;
|
|
|
- z-index: 70;
|
|
|
- width: 432px;
|
|
|
- height: 104px;
|
|
|
- overflow: hidden;
|
|
|
-}
|
|
|
+ .image {
|
|
|
+ width: inherit;
|
|
|
+ position: center;
|
|
|
+ }
|
|
|
|
|
|
-.bottom {
|
|
|
- line-height: 12px;
|
|
|
-}
|
|
|
+ .title {
|
|
|
+ line-height: 150%;
|
|
|
+ text-align: left;
|
|
|
+ font-family: "Noto Sans SC";
|
|
|
+ font-weight: 500;
|
|
|
+ color: black;
|
|
|
+ vertical-align: top;
|
|
|
+ z-index: 70;
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
|
|
|
-.info {
|
|
|
- font-size: 22px;
|
|
|
- line-height: 150%;
|
|
|
- margin-top: 8px;
|
|
|
- margin-right: 24px;
|
|
|
- margin-left: 24px;
|
|
|
- text-indent: 30px;
|
|
|
- text-align: left;
|
|
|
- /* font-family: "Source Han Sans CN" !important; */
|
|
|
- font-family: 'Noto Sans SC' !important;
|
|
|
- font-weight: 300;
|
|
|
- color: black;
|
|
|
- width: 432px;
|
|
|
- height: 132px;
|
|
|
- vertical-align: top;
|
|
|
- overflow: hidden;
|
|
|
+ /*.bottom {*/
|
|
|
+ /* line-height: 12px;*/
|
|
|
+ /*}*/
|
|
|
+
|
|
|
+ .info {
|
|
|
+ line-height: 150%;
|
|
|
+ text-align: left;
|
|
|
+ font-family: "Noto Sans SC";
|
|
|
+ font-weight: 300;
|
|
|
+ color: black;
|
|
|
+ vertical-align: top;
|
|
|
+ overflow: hidden;
|
|
|
+ text-indent: 30px;
|
|
|
+ }
|
|
|
|
|
|
-}
|
|
|
+ .button-close-div {
|
|
|
+ cursor: pointer;
|
|
|
+ position: absolute;
|
|
|
+ z-index: 999;
|
|
|
+ }
|
|
|
|
|
|
-.button-close-div {
|
|
|
- height: 24px;
|
|
|
- width: 24px;
|
|
|
- margin-top: 24px;
|
|
|
- right: 24px;
|
|
|
- cursor: pointer;
|
|
|
- position: absolute;
|
|
|
- z-index: 71;
|
|
|
-}
|
|
|
+ .button-show-all {
|
|
|
+ position: center;
|
|
|
+ background-color: #87BF96;
|
|
|
+ color: black;
|
|
|
+ border-radius: 30px;
|
|
|
+ filter: drop-shadow(0px 10px 10px #797979);
|
|
|
+ font-family: "Noto Sans SC";
|
|
|
+ border: none;
|
|
|
+ padding: 0;
|
|
|
+ }
|
|
|
|
|
|
-.close-button {
|
|
|
- height: 24px;
|
|
|
- width: 24px;
|
|
|
-}
|
|
|
+ .clearfix:before,
|
|
|
+ .clearfix:after {
|
|
|
+ display: table;
|
|
|
+ content: "";
|
|
|
+ }
|
|
|
|
|
|
-.button-show-all {
|
|
|
- font-size: 22px;
|
|
|
- position: center;
|
|
|
- background-color: #87BF96;
|
|
|
- color: black;
|
|
|
- width: 352px;
|
|
|
- height: 60px;
|
|
|
- margin-top: 32px;
|
|
|
- margin-bottom: 32px;
|
|
|
- border-radius: 30px;
|
|
|
- filter: drop-shadow(0px 10px 10px #797979);
|
|
|
- /* font-family: "Source Han Sans CN"; */
|
|
|
- font-family: 'Noto Sans SC';
|
|
|
- border: none;
|
|
|
+ .clearfix:after {
|
|
|
+ clear: both
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-/* .el-card-div {
|
|
|
- position: relative;
|
|
|
- z-index: 70;
|
|
|
- top: 32px;
|
|
|
-
|
|
|
-} */
|
|
|
+@media screen and (min-width: 480px) {
|
|
|
+ .el-card-div {
|
|
|
+ top: 50%;
|
|
|
+ left: 50%;
|
|
|
+ margin-left: -120px;
|
|
|
+ margin-top: -168px;
|
|
|
+ /*-webkit-transform: translate(-50%, -50%);*/
|
|
|
+ /*-moz-transform: translate(-50%, -50%);*/
|
|
|
+ /*-ms-transform: translate(-50%, -50%);*/
|
|
|
+ /*-o-transform: translate(-50%, -50%);*/
|
|
|
+ /*transform: translate(-50%, -50%);*/
|
|
|
+ position: absolute
|
|
|
+ }
|
|
|
+ .el-card {
|
|
|
+ width:240px;
|
|
|
+ height:336px;
|
|
|
+ filter: drop-shadow(0px 8px 8px #475837);
|
|
|
|
|
|
-.clearfix:before,
|
|
|
-.clearfix:after {
|
|
|
- display: table;
|
|
|
- content: "";
|
|
|
-}
|
|
|
+ }
|
|
|
+ .el-card__body {
|
|
|
+ width:240px;
|
|
|
+ height:336px;
|
|
|
+ padding:0
|
|
|
+ }
|
|
|
+ .el-carousel__arrow{
|
|
|
+ height:18px !important;
|
|
|
+ width:18px !important;
|
|
|
+ top:38%;
|
|
|
+ font-size: 6px;
|
|
|
+ }
|
|
|
+ .el-icon-arrow-left:before,.el-icon-arrow-right:before{
|
|
|
+ height:6px !important;
|
|
|
+ width:6px !important;
|
|
|
+ }
|
|
|
+ .el-carousel__arrow--left{
|
|
|
+ left:16px;
|
|
|
+ }
|
|
|
+ .el-carousel__arrow--right{
|
|
|
+ right:16px;
|
|
|
+ }
|
|
|
+ .el-carousel__button{
|
|
|
+ width: 15px;
|
|
|
+ height: 1px;
|
|
|
+ }
|
|
|
+ #el-carousel {
|
|
|
+ overflow: hidden;
|
|
|
+ height:146px;
|
|
|
+ }
|
|
|
+ .title{
|
|
|
+ font-size: 18px;
|
|
|
+ width: 216px;
|
|
|
+ height: 52px;
|
|
|
+ margin-top: 4px;
|
|
|
+ margin-right: 12px;
|
|
|
+ margin-left: 12px;
|
|
|
+ }
|
|
|
+ .info {
|
|
|
+ margin-top: 4px;
|
|
|
+ margin-right: 12px;
|
|
|
+ margin-left: 12px;
|
|
|
+ text-indent: 15px;
|
|
|
+ width: 216px;
|
|
|
+ height: 68px;
|
|
|
+ font-size: 11px;
|
|
|
+ }
|
|
|
+ .button-close-div {
|
|
|
+ height: 12px;
|
|
|
+ width: 12px;
|
|
|
+ margin-top: 12px;
|
|
|
+ right: 12px;
|
|
|
+ }
|
|
|
+ .close-button {
|
|
|
+ height: 12px;
|
|
|
+ width: 12px;
|
|
|
+ }
|
|
|
+ .button-show-all {
|
|
|
+ width: 176px;
|
|
|
+ height: 30px;
|
|
|
+ font-size: 11px;
|
|
|
+ margin-top: 16px;
|
|
|
+ margin-bottom: 16px;
|
|
|
+ filter: drop-shadow(0px 5px 5px #797979);
|
|
|
|
|
|
-.clearfix:after {
|
|
|
- clear: both
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
</style>
|