Browse Source

当前位置跳转

master
aBin 3 years ago
parent
commit
76869e270d
  1. 1
      src/components/ListPage/ListPage.vue
  2. 14
      src/components/Location/Location.vue
  3. 22
      src/views/OtherPages/Department.vue
  4. 11
      src/views/OtherPages/Information.vue

1
src/components/ListPage/ListPage.vue

@ -98,6 +98,7 @@ export default {
async getYear() { async getYear() {
try { try {
const params = { showPage: this.code }; const params = { showPage: this.code };
console.log('params: ', params);
const res = await getCondition(params); const res = await getCondition(params);
const { code, msg, data } = res.data; const { code, msg, data } = res.data;
if (code === 200) { if (code === 200) {

14
src/components/Location/Location.vue

@ -995,7 +995,21 @@ 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];
console.log('itemC: ', itemC.children);
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 (this.title === itemC.title && k !== 0) { if (this.title === itemC.title && k !== 0) {
console.log('itemC: ', itemC[k]);
this.$router.push({ this.$router.push({
path: this.tabList[i].url, path: this.tabList[i].url,
query: { code: item.children[0].code }, query: { code: item.children[0].code },

22
src/views/OtherPages/Department.vue

@ -7,7 +7,12 @@
<div class="flex-1 flex-column"> <div class="flex-1 flex-column">
<Location :title="defaultTitle" /> <Location :title="defaultTitle" />
<div class="content-detail p-4" :style="{ 'min-height': list.children.length * 56 + 'px' }"> <div class="content-detail p-4" :style="{ 'min-height': list.children.length * 56 + 'px' }">
<template v-if="code.length === 6 && (code.split('')[5] === '4' || code.split('')[5] === '6' || code.split('')[5] === '7' || code.split('')[5] === '8')"> <template
v-if="
code.length === 6 &&
(code.split('')[5] === '4' || code.split('')[5] === '6' || code.split('')[5] === '7' || code.split('')[5] === '8')
"
>
<ListPage :code="code" @changeYear="changeYear" :content="content" @getData="getNumData" /> <ListPage :code="code" @changeYear="changeYear" :content="content" @getData="getNumData" />
</template> </template>
<RichText v-else :rich-obj="content" /> <RichText v-else :rich-obj="content" />
@ -656,7 +661,13 @@ export default {
if (this.$route.path === this.list.url) { if (this.$route.path === this.list.url) {
this.code = val; this.code = val;
this.getDetault(val); this.getDetault(val);
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')) { 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); this.getContentData(this.code);
} else { } else {
this.getData(this.code); this.getData(this.code);
@ -667,7 +678,10 @@ export default {
created() { created() {
this.code = this.$route.query.code; this.code = this.$route.query.code;
this.getDetault(this.code); 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')) { 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); this.getContentData(this.code);
} else { } else {
this.getData(this.code); this.getData(this.code);
@ -713,7 +727,7 @@ export default {
pageSize: 10, pageSize: 10,
}; };
const data = await this.getContent(params); const data = await this.getContent(params);
console.log('data: ', data); this.content = data || {};
} catch (error) {} } catch (error) {}
}, },
resetData() { resetData() {

11
src/views/OtherPages/Information.vue

@ -7,10 +7,10 @@
<div class="flex-1 flex-column"> <div class="flex-1 flex-column">
<Location :title="defaultTitle" /> <Location :title="defaultTitle" />
<div class="content-detail p-4" :style="{ 'min-height': list.children.length * 56 + 'px' }"> <div class="content-detail p-4" :style="{ 'min-height': list.children.length * 56 + 'px' }">
<template v-if="code.length === 6 && (code.split('')[5] === '4' || code.split('')[5] === '6' || code.split('')[5] === '7' || code.split('')[5] === '8')"> <template v-if="code.length === 6 && (code === '060101' || code === '060503')">
<ListPage :code="code" @changeYear="changeYear" :content="content" @getData="getNumData" /> <RichText :rich-obj="content" />
</template> </template>
<RichText v-else :rich-obj="content" /> <ListPage v-else :code="code" @changeYear="changeYear" :content="content" @getData="getNumData" />
</div> </div>
</div> </div>
</div> </div>
@ -111,7 +111,7 @@ export default {
if (this.$route.path === this.list.url) { if (this.$route.path === this.list.url) {
this.code = val; this.code = val;
this.getDetault(val); this.getDetault(val);
if (this.code.length === 6 && ((this.code === '060101' || this.code === '060503'))) { if (this.code.length === 6 && (this.code === '060101' || this.code === '060503')) {
this.getData(this.code); this.getData(this.code);
} else { } else {
this.getContentData(this.code); this.getContentData(this.code);
@ -122,7 +122,7 @@ export default {
created() { created() {
this.code = this.$route.query.code; this.code = this.$route.query.code;
this.getDetault(this.code); this.getDetault(this.code);
if (this.code.length === 6 && ((this.code === '060101' || this.code === '060503'))) { if (this.code.length === 6 && (this.code === '060101' || this.code === '060503')) {
this.getContentData(this.code); this.getContentData(this.code);
} else { } else {
this.getData(this.code); this.getData(this.code);
@ -169,6 +169,7 @@ export default {
}; };
const data = await this.getContent(params); const data = await this.getContent(params);
console.log('data: ', data); console.log('data: ', data);
this.content = data || {};
} catch (error) {} } catch (error) {}
}, },
resetData() { resetData() {

Loading…
Cancel
Save