This commit is contained in:
clay
2022-01-18 21:38:10 +08:00
parent fa8bc05879
commit 74a0130727
9 changed files with 334 additions and 155 deletions

View File

@@ -1,6 +1,20 @@
<template>
<div class="list">
<!--{{value}}-->
<div class="query">
<el-row>
<el-col :xs="14" :sm="14" :md="14" :lg="20" :xl="20">
<!--<div style="width: 95%;">-->
<div>
<!--<input class="query_input" v-model="query"/>-->
<el-input class="query_input" v-model="query" size="small" placeholder="请输入内容"></el-input>
</div>
</el-col>
<el-col :xs="10" :sm="10" :md="10" :lg="4" :xl="4" style="float: right">
<el-button class="query_button" type="primary" size="small" icon="el-icon-search" @click="handleCurrentChange(-1)">搜索</el-button>
</el-col>
</el-row>
</div>
<div>
<el-row>
<!--正文内容-->
@@ -43,7 +57,7 @@
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page.sync="value.pageNum"
:page-size="value.data.length"
:page-size="4"
layout="prev, pager, next, jumper"
:total="value.total">
</el-pagination>
@@ -74,27 +88,42 @@ export default {
data() {
return {
width: document.documentElement.clientWidth,
small:document.documentElement.clientWidth<=992
small:document.documentElement.clientWidth<=992,
query:'',
}
},
methods: {
getContext(context){
if (this.width <=992){
this.$router.push("/mobile/" + this.value.secondId +"/" +this.value.navId+"?id="+context.id);
let type = this.$route.query && this.$route.query.type
let router = ''
if (type!=null){
router = "?id="+context.id+'&type='+type
}else {
this.$router.push("/pc/" + this.value.secondId +"/" +this.value.navId+"?id="+context.id);
router="/" +this.value.navId+"?id="+context.id
}
if (this.width <=992){
this.$router.push("/mobile/" + this.value.secondId +router);
}else {
this.$router.push("/pc/" + this.value.secondId +router);
}
},
handleSizeChange(val) {
console.log(`每页 ${val}`);
},
handleCurrentChange(val) {
this.value.pageNum = val
if (val != -1){
this.value.pageNum = val
}
let data = {
title:this.query,
id: this.value.navId,
pageNum: val,
pageSize: 4
}
this.type = this.$route.query && this.$route.query.type
if (this.type != null&&this.type!=0){
data.id = this.value.secondId
}
getNode(data).then(res => {
this.value.data = res.rows
this.value.total = res.total
@@ -111,9 +140,31 @@ export default {
}
}
</script>
<style>
.el-input__inner{
border-color: #1956BC !important;
border-radius: 0 !important;
/*line-height: 3.5rem !important;*/
/*height: 3.5rem !important;*/
}
</style>
<style scoped lang="scss">
.query_input{
border-color: #1956BC !important;
border-radius: 0 !important;
}
.query_button{
//height: 3.5rem;
border-radius: 0rem 1rem 1rem 0rem;
background-color: #1956BC;
border-color: #1956BC !important;
}
.context {
margin: 3rem 2rem;
padding-bottom: 3rem;
@@ -165,10 +216,13 @@ export default {
text-overflow: ellipsis; //溢出用省略号显示
white-space: nowrap; //溢出不换行
font-size: 2rem;
font-weight: 600;
font-weight: bold;
padding-right: 2rem;
}
//.tw_context_title:hover{
// font-weight: bolder;
//}
.tw_context_text {
margin-top: .8rem;
@@ -205,4 +259,22 @@ export default {
float: none;
}
}
.query{
//margin: 1rem 0;
z-index: 999;
width: 30%;
position: absolute;
right: 0;
//float: right;
}
@media screen and (min-width: 1100px) and (max-width: 1400px) {
.query {
width: 40% !important;
}
}
@media screen and (max-width: 1100px){
.query {
width: 80% !important;
}
}
</style>

View File

@@ -14,7 +14,7 @@
</el-col>
</el-row>
<el-row>
<el-row v-show="showSecond">
<el-col :xs="2" :sm="2" :md="1.5" :lg="2" :xl="4">
<div class="grid-content"></div>
</el-col>
@@ -67,6 +67,35 @@
<div class="grid-content"></div>
</el-col>
</el-row>
<el-row v-show="!showSecond">
<el-col :xs="2" :sm="2" :md="2" :lg="4" :xl="5">
<div class="grid-content"></div>
</el-col>
<el-col :xs="20" :sm="20" :md="20" :lg="16" :xl="14">
<el-row>
<el-col>
<div class="tab">
<router-link to="/">首页</router-link>
<span> > </span>
<router-link to="">{{ crumbs.one.title }}</router-link>
<span> > </span>
<span style="color: #1956BC;font-size: 1.4rem">{{ crumbs.two.title }}</span>
</div>
</el-col>
</el-row>
<el-row>
<el-col>
<Introduction :value="contextData" v-if="type == 1"/>
<List :value="contextData" v-if="type == 2"/>
<DireData :value="contextData" v-if="type == 3"/>
<Details :value="detailsData" v-if="type == null"/>
</el-col>
</el-row>
</el-col>
<el-col :xs="2" :sm="2" :md="2" :lg="4" :xl="5">
<div class="grid-content"></div>
</el-col>
</el-row>
</div>
@@ -79,6 +108,7 @@ import List from './components/list.vue'
import DireData from './components/dire_data.vue'
import Details from './components/details.vue'
import {handleTree} from "@/utils/ebts";
import {getParentNode} from "@/utils/sist";
export default {
name: "index",
@@ -95,6 +125,7 @@ export default {
navId: null,
navList: [],
showIndex: 0,
showSecond: true,
contextData: {},
type: 2,
bgImage: null, crumbs: {
@@ -112,12 +143,22 @@ export default {
$route(to, from) {
console.log("触发了 $route")
let arcId = this.$route.params && this.$route.query.id
console.log(arcId)
this.navId = this.$route.params && this.$route.params.navId;
this.secondId = this.$route.params && this.$route.params.secondId;
this.type = this.$route.query && this.$route.query.type
if (this.type != null&&this.type!=0){
let info = getParentNode(this.secondId);
if (arcId != undefined) {
this.getContext(arcId)
} else {
this.getContent(info.second)
}
return
}
if (arcId != undefined) {
this.getContext(arcId)
}
let id = this.$route.params && this.$route.params.secondId
this.navId = this.$route.params && this.$route.params.navId;
try {
this.$refs.lab.style.height = this.navList.length * 8 + 10 + 'rem'
} catch (e) {
@@ -149,9 +190,22 @@ export default {
})
},
getNav() {
console.log("触发了 getNav")
this.secondId = this.$route.params && this.$route.params.secondId;
this.navId = this.$route.params && this.$route.params.navId;
this.type = this.$route.query && this.$route.query.type
if (this.type != null&&this.type!=0){
this.showSecond = false
let info = getParentNode(this.secondId);
let arcId = this.$route.query && this.$route.query.id
if (arcId != undefined) {
this.getContext(arcId)
} else {
this.getContent(info.second)
}
return
}else {
this.showSecond = true
}
this.navList = []
getNode({id: this.secondId}).then(res => {
this.navList = res.data
@@ -167,7 +221,7 @@ export default {
this.showIndex = i
}
}
let arcId = this.$route.params && this.$route.query.id
let arcId = this.$route.query && this.$route.query.id
if (arcId != undefined) {
this.getContext(arcId)
} else {
@@ -352,7 +406,6 @@ export default {
margin-left: 1.5rem;
}
}
}
}
}