Browse Source

左侧栏和当前位置栏跳转问题

master
aBin 3 years ago
parent
commit
93908c0542
  1. BIN
      dist.zip
  2. 15
      src/components/LeftNav/LeftNav.vue
  3. 53
      src/components/Location/Location.vue
  4. 6
      src/views/CompanyProfile/CompanyProfile.vue
  5. 15
      src/views/NewPages/NewPages.vue
  6. 18
      src/views/OtherPages/Department.vue
  7. 11
      src/views/OtherPages/Information.vue
  8. 8
      src/views/OtherPages/NoticeNotice.vue
  9. 8
      src/views/OtherPages/PartyBuilding.vue
  10. 8
      src/views/OtherPages/PilePages.vue
  11. 8
      src/views/OtherPages/SafeProduction.vue
  12. 1
      src/views/OtherPages/Search.vue
  13. 8
      src/views/OtherPages/System.vue

BIN
dist.zip

Binary file not shown.

15
src/components/LeftNav/LeftNav.vue

@ -63,13 +63,22 @@ export default {
childCode = item.children[0].code;
}
if (!url) {
const path = window.location.href.split('?');
// const path = window.location.href.split('?');
const path = this.$route.path;
if (this.code && code !== this.code) {
window.location.href = path[0] + `?code=${childCode}`;
// window.location.href = path[0] + `?code=${childCode}`;
this.$router.push({
path: path,
query: { code: childCode },
});
this.$emit('changeCode', code);
this.childCode = code;
} else if (code === this.code) {
window.location.href = path[0] + `?code=${code}`;
// window.location.href = path[0] + `?code=${code}`;
this.$router.push({
path: path,
query: { code },
});
}
} else {
if (url === '/') {

53
src/components/Location/Location.vue

@ -8,8 +8,8 @@
您当前位置:
<span class="title-name ml-4" @click="backFirst"> 首页 </span>
<template v-if="title !== '关键词'">
<span class="title-name" @click="backTitle"> > {{ titleName }} </span>
<span v-if="titleTwo" class="title-name" :class="titleThree ? '' : 'acitve'"> > {{ titleTwo }} </span>
<span class="title-name" @click="backTitleOne"> > {{ titleName }} </span>
<span v-if="titleTwo" class="title-name" @click="backTitle" :class="titleThree ? '' : 'acitve'"> > {{ titleTwo }} </span>
<span v-if="titleThree" class="title-name acitve"> > {{ titleThree }} </span>
</template>
<template v-else>
@ -948,15 +948,18 @@ export default {
titleName: '',
titleTwo: '',
titleThree: '',
code: '',
};
},
watch: {
'$route.query.code'() {
this.code = this.$route.query.code;
this.getLocal();
},
},
created() {
this.getLocal();
this.code = this.$route.query.code;
},
methods: {
getLocal() {
@ -995,29 +998,49 @@ export default {
if (item.children && item.children.length) {
for (let k = 0; k < item.children.length; k++) {
const itemC = item.children[k];
if (itemC.children && itemC.children.length) {
for (let m = 0; m < itemC.children.length; m++) {
const itemD = itemC.children[m];
if (this.title === itemD.title && m !== 0) {
const path = window.location.href.split('?');
window.location.href = path[0] + `?code=${itemC.children[0].code}`;
return;
if (itemD.code === this.code && m !== 0) {
console.log('itemC: ', itemC);
this.$router.push({
path: item.url,
query: { code: itemC.children[0].code },
});
}
}
}
if (this.title === itemC.title && k !== 0) {
this.$router.push({
path: this.tabList[i].url,
query: { code: item.children[0].code },
});
return;
}
}
}
}
},
backTitleOne() {
const path = this.$route.path;
let titleObj = {};
let lists = [];
for (let i = 0; i < this.tabList.length; i++) {
console.log('111111111');
if (this.tabList[i].url === path) {
titleObj = { ...this.tabList[i] };
lists = [...this.tabList[i].children];
}
}
if (lists[0].children && lists[0].children.length) {
console.log('2222222222');
this.$router.push({
path: titleObj.url,
query: { code: lists[0].children[0].code },
});
// this.code = lists[0].children[0].code;
} else {
console.log('333333333333');
this.$router.push({
path: titleObj.url,
query: { code: lists[0].code },
});
// this.code = lists[0].code;
}
},
},
};
</script>

6
src/views/CompanyProfile/CompanyProfile.vue

@ -67,6 +67,12 @@ export default {
this.getData(this.code);
}
},
'$route.query.introId'() {
if (this.$route.path === this.list.url) {
this.getDefaultTitle(this.code);
this.getData(this.code);
}
},
},
created() {
this.code = this.$route.query.code;

15
src/views/NewPages/NewPages.vue

@ -125,6 +125,20 @@ export default {
this.introContent = {};
}
},
'$route.query.introId'() {
if (this.$route.path === this.list.url) {
this.getType(this.code);
this.getDetault(this.code);
if (this.code === '0204') {
this.getContentData('0201');
this.getContentData('0202');
this.getContentData('0203');
} else {
this.getContentData();
}
this.introContent = {};
}
},
},
created() {
this.code = this.$route.query.code;
@ -194,6 +208,7 @@ export default {
}
} else {
data = await this.getContent(param);
this.introId = '';
this.showLoading = false;
this.content = data;
}

18
src/views/OtherPages/Department.vue

@ -677,6 +677,23 @@ export default {
this.content = {};
}
},
'$route.query.introId'() {
if (this.$route.path === this.list.url) {
this.getDetault(this.code);
if (
this.code.length === 6 &&
(this.code.split('')[5] === '4' ||
this.code.split('')[5] === '6' ||
this.code.split('')[5] === '7' ||
this.code.split('')[5] === '8')
) {
this.getContentData(this.code);
} else {
this.getData(this.code);
}
this.content = {};
}
},
},
created() {
this.code = this.$route.query.code;
@ -755,6 +772,7 @@ export default {
pageSize: 10,
};
const data = await this.getContent(params);
this.introId = '';
this.content = data || {};
} catch (error) {}
},

11
src/views/OtherPages/Information.vue

@ -120,6 +120,17 @@ export default {
this.content = {};
}
},
'$route.query.introId'() {
if (this.$route.path === this.list.url) {
this.getDetault(this.code);
if (this.code.length === 6 && (this.code === '060101' || this.code === '060503')) {
this.getData(this.code);
} else {
this.getContentData(this.code);
}
this.content = {};
}
},
},
created() {
this.code = this.$route.query.code;

8
src/views/OtherPages/NoticeNotice.vue

@ -75,6 +75,13 @@ export default {
this.introContent = {};
}
},
'$route.query.introId'() {
if (this.$route.path === this.list.url) {
this.getDetault(this.code);
this.getContentData();
this.introContent = {};
}
},
},
created() {
this.code = this.$route.query.code;
@ -106,6 +113,7 @@ export default {
pageSize: 10,
};
const data = await this.getContent(param);
this.introId = '';
this.content = data;
} catch (error) {}
},

8
src/views/OtherPages/PartyBuilding.vue

@ -79,6 +79,13 @@ export default {
this.introContent = {};
}
},
'$route.query.introId'() {
if (this.$route.path === this.list.url) {
this.getDetault(this.code);
this.getContentData();
this.introContent = {};
}
},
},
created() {
this.code = this.$route.query.code;
@ -110,6 +117,7 @@ export default {
pageSize: 10,
};
const data = await this.getContent(param);
this.introId = '';
this.content = data;
} catch (error) {}
},

8
src/views/OtherPages/PilePages.vue

@ -63,6 +63,13 @@ export default {
this.introContent = {};
}
},
'$route.query.introId'() {
if (this.$route.path === this.list.url) {
this.getDetault(this.code);
this.getContentData();
this.introContent = {};
}
},
},
created() {
this.code = this.$route.query.code;
@ -94,6 +101,7 @@ export default {
pageSize: 10,
};
const data = await this.getContent(param);
this.introId = '';
this.content = data;
} catch (error) {}
},

8
src/views/OtherPages/SafeProduction.vue

@ -75,6 +75,13 @@ export default {
this.introContent = {};
}
},
'$route.query.introId'() {
if (this.$route.path === this.list.url) {
this.getDetault(this.code);
this.getContentData();
this.introContent = {};
}
},
},
created() {
this.code = this.$route.query.code;
@ -106,6 +113,7 @@ export default {
pageSize: 10,
};
const data = await this.getContent(param);
this.introId = '';
this.content = data;
} catch (error) {}
},

1
src/views/OtherPages/Search.vue

@ -110,6 +110,7 @@ export default {
title: this.title || '',
};
const res = await this.getContent(param);
this.introId = '';
this.content = res;
} catch (error) {}
},

8
src/views/OtherPages/System.vue

@ -87,6 +87,13 @@ export default {
this.introContent = {};
}
},
'$route.query.introId'() {
if (this.$route.path === this.list.url) {
this.getDetault(this.code);
this.getContentData(this.code);
this.introContent = {};
}
},
},
created() {
this.code = this.$route.query.code;
@ -135,6 +142,7 @@ export default {
pageSize: 10,
};
const data = await this.getContent(param);
this.introId = '';
this.content = data;
} catch (error) {}
},

Loading…
Cancel
Save