This commit is contained in:
clay
2022-01-16 21:14:30 +08:00
parent 8e9cf7b833
commit b7897ba20e
18 changed files with 799 additions and 269 deletions

View File

@@ -0,0 +1,86 @@
<template>
<div class="details">
<el-row>
<el-col>
<div class="context">
<div class="title">{{ value.title }}</div>
<div class="details_title">测试</div>
<div class="text" v-html="value.content"></div>
</div>
</el-col>
</el-row>
</div>
</template>
<script>
export default {
name: "Introduction",
props: {
value: {
type: Object,
default: {
title: "12",
content: "12"
},
},
},
data() {
return {}
}
}
</script>
<style scoped lang="scss">
.details {
width: 100%;
}
.details_title{
font-size: 1.2rem;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #B4B4B4;
line-height: 1.7rem;
}
.tab {
margin-left: 1.9rem;
margin-top: 1.5rem;
font-weight: 400;
font-size: 1.4rem !important;
}
.context {
margin: 3rem 4rem;
.title {
font-size: 2.4rem;
font-weight: 500;
color: #1956BC;
text-align: center;
}
.text {
width: 100%;
margin-top: 2rem;
font-size: 1.2rem;
font-weight: 400;
color: #3C3C3C;
word-break: break-word; /* 文本行的任意字内断开 */
word-wrap: break-word; /* IE */
white-space: -moz-pre-wrap; /* Mozilla */
white-space: -hp-pre-wrap; /* HP printers */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: pre; /* CSS2 */
white-space: pre-wrap; /* CSS 2.1 */
white-space: pre-line; /* CSS 3 (and 2.1 as well, actually) */
pre {
width: 100%;
}
}
}
</style>

View File

@@ -1,50 +1,68 @@
<template>
<div class="list">
<!--{{value}}-->
<el-row>
<!--正文内容-->
<el-col class="context">
<div v-for="(item,index) in value.data" class="tw">
<el-row>
<el-col :xs="6" :sm="6" :md="5" :lg="4" :xl="4">
<div class="tw_time">
<div class="tw_top">
{{getDay(item.publishTime)}}
<!--{{value}}-->
<div>
<el-row>
<!--正文内容-->
<el-col class="context">
<div v-for="(item,index) in value.data" class="tw">
<el-row>
<el-col :xs="6" :sm="6" :md="5" :lg="4" :xl="4">
<div class="tw_time">
<div class="tw_top">
{{ getDay(item.publishTime) }}
</div>
<div class="tw_bottoms">
{{ getTime(item.publishTime) }}
</div>
</div>
<div class="tw_bottoms">
{{getTime(item.publishTime)}}
</el-col>
<el-col :xs="18" :sm="18" :md="18" :lg="16" :xl="17">
<div class="tw_context">
<div class="tw_context_title" @click="getContext(item)">
{{ item.title }}
</div>
<div class="tw_context_text" v-html="item.content"></div>
</div>
</div>
</el-col>
<el-col :xs="18" :sm="18" :md="18" :lg="16" :xl="17">
<div class="tw_context">
<div class="tw_context_title">
{{item.title}}
</el-col>
<el-col v-show="width>992" :xs="1" :sm="1" :md="3" :lg="4" :xl="3">
<div class="tw_img">
<img :src="item.imgurl" alt="">
</div>
<div class="tw_context_text" v-html="item.content"></div>
</div>
</el-col>
<el-col v-show="width>=992" :xs="1" :sm="1" :md="3" :lg="4" :xl="3">
<div class="tw_img">
<img :src="item.imgurl" alt="">
</div>
</el-col>
</el-row>
<hr v-if="index != value.data.length-1" style="border: 0.1rem solid #E6E6E6;" class="hr">
</div>
</el-col>
</el-row>
</el-col>
</el-row>
<hr v-if="index != value.data.length-1" style="border: 0.1rem solid #E6E6E6;" class="hr">
</div>
</el-col>
</el-row>
<el-row>
<el-col class="pagination_p">
<el-pagination class="pagination"
:small="small"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page.sync="value.pageNum"
:page-size="value.data.length"
layout="prev, pager, next, jumper"
:total="value.total">
</el-pagination>
</el-col>
</el-row>
</div>
</div>
</template>
<script>
import {getNode} from "@/api";
export default {
name: "list",
props:{
props: {
value: {
type: Array,
type: Object,
default: {
data:[{
data: [{
content: "",
title: "",
publishTime: "2022-01-15 17:02:13",
@@ -55,17 +73,40 @@ export default {
},
data() {
return {
width: document.documentElement.clientWidth
width: document.documentElement.clientWidth,
small:document.documentElement.clientWidth<=992
}
},
methods:{
getDay(time){
methods: {
getContext(context){
if (this.width <=992){
this.$router.push("/mobile/" + this.value.secondId +"/" +this.value.navId+"?id="+context.id);
}else {
this.$router.push("/pc/" + this.value.secondId +"/" +this.value.navId+"?id="+context.id);
}
},
handleSizeChange(val) {
console.log(`每页 ${val}`);
},
handleCurrentChange(val) {
this.value.pageNum = val
let data = {
id: this.value.navId,
pageNum: val,
pageSize: 4
}
getNode(data).then(res => {
this.value.data = res.rows
this.value.total = res.total
})
},
getDay(time) {
let day = new Date(time).getDate();
return day
},
getTime(time){
getTime(time) {
let date = new Date(time);
return date.getFullYear() +"-" + date.getMonth()+1
return date.getFullYear() + "-" + date.getMonth() + 1
}
}
}
@@ -83,13 +124,15 @@ export default {
margin-top: 4rem;
}
.tw_img{
.tw_img {
width: 100%;
text-align: left;
img{
img {
width: 90%;
}
}
.tw_time {
border-right: .1rem solid #D5D5D5;
height: 10rem;
@@ -112,15 +155,15 @@ export default {
}
.tw_context {
cursor: pointer;
font-family: PingFangSC-Medium, PingFang SC;
color: #161616;
.tw_context_title {
overflow:hidden; //超出的文本隐藏
text-overflow:ellipsis; //溢出用省略号显示
white-space:nowrap; //溢出不换行
overflow: hidden; //超出的文本隐藏
text-overflow: ellipsis; //溢出用省略号显示
white-space: nowrap; //溢出不换行
font-size: 2rem;
font-weight: 600;
padding-right: 2rem;
@@ -133,9 +176,9 @@ export default {
font-weight: 400;
overflow: hidden;
text-overflow: ellipsis;
display:-webkit-box; //作为弹性伸缩盒子模型显示。
-webkit-box-orient:vertical; //设置伸缩盒子的子元素排列方式--从上到下垂直排列
-webkit-line-clamp:3; //显示的行
display: -webkit-box; //作为弹性伸缩盒子模型显示。
-webkit-box-orient: vertical; //设置伸缩盒子的子元素排列方式--从上到下垂直排列
-webkit-line-clamp: 3; //显示的行
}
}
@@ -153,4 +196,13 @@ export default {
color: #3C3C3C;
}
}
.pagination_p{
text-align: center;
margin-bottom: 2rem;
.pagination{
display: inline-block;
float: none;
}
}
</style>

View File

@@ -1,13 +0,0 @@
<template>
</template>
<script>
export default {
name: "new_list"
}
</script>
<style scoped>
</style>