diff --git a/src/components/TypeNav.vue b/src/components/TypeNav.vue new file mode 100644 index 00000000..5fad6198 --- /dev/null +++ b/src/components/TypeNav.vue @@ -0,0 +1,145 @@ + + + diff --git a/src/views/portal/case/Index.vue b/src/views/portal/case/Index.vue index 6d975239..9e6062c4 100644 --- a/src/views/portal/case/Index.vue +++ b/src/views/portal/case/Index.vue @@ -4,6 +4,7 @@
+
@@ -211,7 +212,7 @@
-
+ - - -
-
+
-->
@@ -349,6 +346,7 @@ import apiDict from "@/api/modules/dict.js"; import apiType from "@/api/modules/type.js"; import { cutFullName } from "@/utils/tools.js"; import apiPlace from "@/api/phase2/place.js" +import TypeNav from "../../../components/TypeNav.vue"; export default { name: "index", components: { @@ -357,10 +355,12 @@ export default { portalFloatTools, interactBar, timeShow, - author + author, + TypeNav }, data() { return { + treeList:[], caseType:process.env.VUE_APP_CASE_TYPE,//类型 caseYears:[], refId: '',//消息跳转案例的id @@ -626,10 +626,11 @@ export default { if (this.refId) { this.queryCondition.type = 'recommend' } + this.loadTypeData();//加载分类 this.getAnkingData(); - this.getPopularity(); this.searchterm(); - this.getPositive(); + // this.getPopularity(); + // this.getPositive(); this.couresreso(); // window.addEventListener("scroll", this.handleScroll); // 获取年 @@ -642,6 +643,39 @@ export default { }, methods: { + handleOptionClick(treeItem){ + console.log(treeItem); + this.treeList.forEach(one => { + one.checked = false; + if (one.id == treeItem.id) { + one.checked = true; + } + one.children && one.children.forEach(two => { + two.checked = false; + if (two.id == treeItem.id) { + two.checked = true + } + two.children && two.children.forEach(three => { + three.checked = false; + if (three.id == treeItem.id) { + three.checked = true + } + }) + }) + }) + }, + // 加载分类 + async loadTypeData() { + try { + const { result, status } = await apiType.tree(1); + if (status === 200) { + console.log(result,'三级'); + this.treeList = result + } + } catch (error) { + console.log(error); + } + }, getYears() { apiCase.caseYears().then(res => { if (res.status == 200) {