官网跳转期刊

This commit is contained in:
2024-10-14 11:08:17 +08:00
parent f343547181
commit bb55ac555b

View File

@@ -6,18 +6,49 @@
<script> <script>
export default { export default {
data(){ data() {
return { return {
journal:this.$route.query.journal, journal: this.$route.query.journal,
abbr: this.$route.query.abbr
}; };
}, },
created() { async created() {
this.$api.post('api/Article/getJournalByAlias',{alias:this.journal}) var journal_id;
.then(res=>{ var journal_id_abbr;
localStorage.setItem('ms_journal_alias',res.journal_id); if (this.abbr) {
journal_id_abbr = await this.getJournalByAbbr();
}
if (this.journal) {
journal_id = await this.getJournalByAlias();
}
setTimeout(() => {
if (journal_id_abbr) {
localStorage.setItem('ms_journal_alias', journal_id_abbr);
} else if (journal_id) {
localStorage.setItem('ms_journal_alias', journal_id);
}
this.$router.push('/'); this.$router.push('/');
}); }, 1000);
},
methods: {
async getJournalByAlias() {
var data;
await this.$api.post('api/Article/getJournalByAlias', { alias: this.journal }).then((res) => {
data = res.journal_id;
});
return data;
},
async getJournalByAbbr() {
var data;
await this.$api.post('api/Article/getJournalByAbbr', { abbr: this.abbr }).then((res) => {
// localStorage.setItem('ms_journal_alias', res.journal_id);
data = res.data.detail ? res.data.detail.journal_id : null;
});
return data;
}
} }
} };
</script> </script>