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; childCode = item.children[0].code;
} }
if (!url) { 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) { 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.$emit('changeCode', code);
this.childCode = code; this.childCode = code;
} else if (code === this.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 { } else {
if (url === '/') { if (url === '/') {

53
src/components/Location/Location.vue

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

6
src/views/CompanyProfile/CompanyProfile.vue

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

15
src/views/NewPages/NewPages.vue

@ -125,6 +125,20 @@ export default {
this.introContent = {}; 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() { created() {
this.code = this.$route.query.code; this.code = this.$route.query.code;
@ -194,6 +208,7 @@ export default {
} }
} else { } else {
data = await this.getContent(param); data = await this.getContent(param);
this.introId = '';
this.showLoading = false; this.showLoading = false;
this.content = data; this.content = data;
} }

18
src/views/OtherPages/Department.vue

@ -677,6 +677,23 @@ export default {
this.content = {}; 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() { created() {
this.code = this.$route.query.code; this.code = this.$route.query.code;
@ -755,6 +772,7 @@ export default {
pageSize: 10, pageSize: 10,
}; };
const data = await this.getContent(params); const data = await this.getContent(params);
this.introId = '';
this.content = data || {}; this.content = data || {};
} catch (error) {} } catch (error) {}
}, },

11
src/views/OtherPages/Information.vue

@ -120,6 +120,17 @@ export default {
this.content = {}; 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() { created() {
this.code = this.$route.query.code; this.code = this.$route.query.code;

8
src/views/OtherPages/NoticeNotice.vue

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

8
src/views/OtherPages/PartyBuilding.vue

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

8
src/views/OtherPages/PilePages.vue

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

8
src/views/OtherPages/SafeProduction.vue

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

1
src/views/OtherPages/Search.vue

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

8
src/views/OtherPages/System.vue

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

Loading…
Cancel
Save