clay commit : 新闻中心对接完成

This commit is contained in:
clay
2022-10-05 23:35:21 +08:00
parent 256e4ab2ea
commit fe4dd98a58
12 changed files with 648 additions and 286 deletions

View File

@@ -33,9 +33,11 @@
<el-row>
<el-col>
<Introduction :introduction="contextData" v-if="type === 1"/>
<List :list="contextData" v-if="type === 2"/>
<List :list="contextData" v-if="type === 2 && listDataType == 0"/>
<SimpleList :list="contextData" v-if="type === 2 && listDataType == 1"/>
<FileList :value="contextData" v-if="type === 4"/>
<DireData :value="contextData" v-if="type === 3"/>
<DireData :value="contextData" v-if="type === 3 && dreDataType == '1'"/>
<DireDataTow :value="contextData" v-if="type === 3 && dreDataType == '2'"/>
<Details :value="detailsData" v-if="type == null"/>
</el-col>
</el-row>
@@ -53,11 +55,13 @@
import {getNode, crumbs, article} from "@/api";
import Introduction from '@/views/content/components/Introduction.vue'
import List from '@/views/content/components/list.vue'
import SimpleList from '@/views/content/components/simple_list.vue'
import DireData from '@/views/content/components/dire_data.vue'
import DireDataTow from '@/views/content/components/dire_data_tow.vue'
import Details from '@/views/content/components/details.vue'
import FileList from '@/views/content/components/file_list.vue'
import {handleTree} from "@/utils/ebts";
import {getParentNode, setLanguage} from "@/utils/sist";
import {getParentNode, setLanguage, getNodeMenu} from "@/utils/sist";
export default {
name: "index",
@@ -66,12 +70,16 @@ export default {
List,
DireData,
Details,
FileList
FileList,
DireDataTow,
SimpleList,
},
data() {
return {
width: document.documentElement.clientWidth,
navId: null,
dreDataType: "1",
listDataType: 0,
navList: [],
showIndex: 0,
contextData: {},
@@ -90,28 +98,56 @@ export default {
}
},
watch: {
// $route(to, from) {
// console.log(to, "路由跳转")
// this.secondId = this.$route.params && this.$route.params.secondId;
// this.navId = this.$route.params && this.$route.params.navId;
// let arcId = this.$route.query && this.$route.query.id
// this.type = this.$route.query && this.$route.query.type
// this.getCrumbs()
// if (this.type != null&&this.type!=0){
// console.log(111,this.navId)
// let info = getNodeMenu(this.navId);
// if (arcId != undefined) {
// this.getContext(arcId)
// } else {
// this.getContent(info)
// }
// return
// }
// if (arcId != undefined) {
// this.getContext(arcId)
// } else {
// this.menuData = getParentNode(this.navId)
// console.log(this.menuData, "menuData")
// this.getContent(this.menuData.three)
// }
// }
$route(to, from) {
console.log(to)
console.log(to, "路由跳转")
this.secondId = this.$route.params && this.$route.params.secondId;
this.navId = this.$route.params && this.$route.params.navId;
let arcId = this.$route.query && this.$route.query.id
this.type = this.$route.query && this.$route.query.type
if (this.type != null&&this.type!=0){
let info = getParentNode(this.secondId);
this.getCrumbs()
if (this.type != null && this.type != 0) {
//当三级菜单id没有是,使用二级
if (arcId != undefined) {
console.log("getContext")
this.getContext(arcId)
} else {
this.getContent(info.second)
return;
}
let info = null;
if (this.navId == null) {
console.log("1")
info = getParentNode(this.secondId);
this.getContent(info.second)
} else {
console.log("2")
info = getParentNode(this.navId)
this.getContent(info.three)
}
return
}
if (arcId != undefined) {
this.getContext(arcId)
} else {
this.menuData = getParentNode(this.navId)
console.log(this.menuData,"menuData")
this.getContent(this.menuData.three)
}
}
},
@@ -125,34 +161,55 @@ export default {
}, 200);
},
methods: {
init(){
console.log(this.navId)
this.menuData = getParentNode(this.navId)
init() {
let arcId = this.$route.params && this.$route.query.id
this.getCrumbs()
if (this.type != null && this.type != 0) {
//当三级菜单id没有是,使用二级
if (arcId != undefined) {
console.log("getContext")
this.getContext(arcId)
return;
}
let info = null;
if (this.navId == null) {
console.log("1")
info = getParentNode(this.secondId);
this.getContent(info.second)
} else {
console.log("2")
info = getParentNode(this.navId)
this.getContent(info.three)
}
//this.showSecond = false
// let info = null
// info = getParentNode(this.secondId);
// if (info == null) {
// location.reload();
// }
// let arcId = this.$route.query && this.$route.query.id
// if (arcId != undefined) {
// this.getContext(arcId)
// } else {
// this.getContent(this.menuData.three)
// }
// return
}
// let arcId = this.$route.params && this.$route.query.id
// if (arcId != undefined) {
// this.getContext(arcId)
// } else {
// console.log(this.menuData, "menuData")
// this.getContent(this.menuData.three)
// }
},
/**
* 获得面包屑导航
*/
getCrumbs() {
crumbs(this.secondId).then(res => {
this.crumbs = res.data
})
if (this.type != null&&this.type!=0){
//this.showSecond = false
let info =null
info = getParentNode(this.secondId);
if (info == null){
location.reload();
}
let arcId = this.$route.query && this.$route.query.id
if (arcId != undefined) {
this.getContext(arcId)
} else {
this.getContent(info.second)
}
return
}
let arcId = this.$route.params && this.$route.query.id
if (arcId != undefined) {
this.getContext(arcId)
} else {
console.log(this.menuData,"menuData")
this.getContent(this.menuData.three)
}
},
getContext(arcId) {
@@ -169,14 +226,16 @@ export default {
this.contextData = null
this.bgImage = menu.link
let data = null
if (this.type === 2||this.type === 4) {
if (this.type === 2 || this.type === 4) {
data = {
id: menu.encodeId,
pageNum: 1,
pageSize: 5
}
if (this.type === 4){
data.pageSize=10
this.listDataType = 0
if (this.type === 4||menu.isSimple == 1) {
data.pageSize = 20
this.listDataType = 1
}
} else {
data = {
@@ -184,7 +243,7 @@ export default {
}
}
getNode(data).then(res => {
if (this.type === 2||this.type === 4) {
if (this.type === 2 || this.type === 4) {
this.contextData = {
data: res.rows,
total: res.total,
@@ -196,6 +255,11 @@ export default {
} else if (this.type == 1) {
this.contextData = res.data
} else if (this.type == 3) {
if (res.additional == "") {
this.dreDataType = "1"
} else {
this.dreDataType = res.additional
}
this.contextData = handleTree(res.data, "id", "pid", null, null)
}
})