自动化样式
This commit is contained in:
@@ -771,6 +771,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import bus from '../common/bus'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -1188,6 +1189,43 @@ export default {
|
||||
this.getjour();
|
||||
},
|
||||
methods: {
|
||||
readPromotionFactoryJumpJournalId() {
|
||||
try {
|
||||
const raw = sessionStorage.getItem('promotionFactoryJump');
|
||||
if (!raw) return '';
|
||||
const obj = JSON.parse(raw || '{}');
|
||||
if (!obj || obj.from !== 'promotionFactory') return '';
|
||||
if (obj.targetPath && String(obj.targetPath) !== String(this.$route.path)) return '';
|
||||
const id = obj.journal_id != null ? String(obj.journal_id) : '';
|
||||
sessionStorage.removeItem('promotionFactoryJump');
|
||||
return id;
|
||||
} catch (e) {
|
||||
try {
|
||||
sessionStorage.removeItem('promotionFactoryJump');
|
||||
} catch (e2) {}
|
||||
return '';
|
||||
}
|
||||
},
|
||||
forceClearJumpQuery() {
|
||||
const q = (this.$route && this.$route.query) || {};
|
||||
const has = q && (q._ap_from || q.journal_id || q.journalId || q.journalIdd);
|
||||
if (!has) return;
|
||||
const oldFullPath = this.$route && this.$route.fullPath ? this.$route.fullPath : '';
|
||||
const nextQuery = Object.assign({}, q);
|
||||
delete nextQuery._ap_from;
|
||||
delete nextQuery.journal_id;
|
||||
delete nextQuery.journalId;
|
||||
delete nextQuery.journalIdd;
|
||||
// 关闭“中间态 fullPath”对应的标签页,避免残留在顶部 Tags
|
||||
if (oldFullPath) {
|
||||
bus.$emit('close_tag_by_path', { path: oldFullPath, silent: true });
|
||||
}
|
||||
this.$router.replace({ path: this.$route.path, query: nextQuery }).catch(() => {});
|
||||
try {
|
||||
const cleanUrl = window.location.origin + this.$route.path;
|
||||
window.history.replaceState({}, '', cleanUrl);
|
||||
} catch (e) {}
|
||||
},
|
||||
unplIcon() {
|
||||
this.$refs['upIconIMg'].$refs['upload-inner'].handleClick();
|
||||
},
|
||||
@@ -1314,9 +1352,28 @@ export default {
|
||||
if (res.code == 0) {
|
||||
this.df_jour = res.data.journals;
|
||||
this.add_jour = res.data.journals;
|
||||
this.query.journal_id = this.df_jour[0].journal_id;
|
||||
this.query.journal_title = this.df_jour[0].title;
|
||||
const fromQueryId = this.$route && this.$route.query ? this.$route.query.journal_id : '';
|
||||
const fromSessionId = this.readPromotionFactoryJumpJournalId();
|
||||
const pickedId = fromQueryId || fromSessionId;
|
||||
const matched = pickedId ? this.df_jour.find((j) => String(j.journal_id) === String(pickedId)) : null;
|
||||
const first = this.df_jour[0];
|
||||
const picked = matched || first;
|
||||
this.query.journal_id = picked ? picked.journal_id : 0;
|
||||
this.query.journal_title = picked ? picked.title : '';
|
||||
this.getgroup();
|
||||
|
||||
// 仅首次接收参数:应用后立刻清掉 URL,避免刷新仍然固定某一本期刊
|
||||
if (fromQueryId) {
|
||||
const nextQuery = Object.assign({}, (this.$route && this.$route.query) || {});
|
||||
delete nextQuery.journal_id;
|
||||
delete nextQuery.journalId;
|
||||
delete nextQuery._ap_from;
|
||||
this.$router.replace({ path: this.$route.path, query: nextQuery }).catch(() => {});
|
||||
// 双保险:路由稳定后再强制清参一次,避免地址栏残留“中间态”
|
||||
setTimeout(() => {
|
||||
this.forceClearJumpQuery();
|
||||
}, 0);
|
||||
}
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user