模版列表记忆功能
This commit is contained in:
@@ -19,8 +19,8 @@ const service = axios.create({
|
|||||||
// baseURL: 'https://submission.tmrjournals.com/', //正式 记得切换
|
// baseURL: 'https://submission.tmrjournals.com/', //正式 记得切换
|
||||||
// baseURL: 'http://www.tougao.com/', //测试本地 记得切换
|
// baseURL: 'http://www.tougao.com/', //测试本地 记得切换
|
||||||
// baseURL: 'http://192.168.110.110/tougao/public/index.php/',
|
// baseURL: 'http://192.168.110.110/tougao/public/index.php/',
|
||||||
// baseURL: '/api', //本地
|
baseURL: '/api', //本地
|
||||||
baseURL: '/', //正式
|
// baseURL: '/', //正式
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -147,6 +147,12 @@ const API = {
|
|||||||
deleteTemplate: 'api/mail_template/deleteTemplate',
|
deleteTemplate: 'api/mail_template/deleteTemplate',
|
||||||
deleteStyle: 'api/mail_template/deleteStyle'
|
deleteStyle: 'api/mail_template/deleteStyle'
|
||||||
};
|
};
|
||||||
|
// 仅在当前 SPA 会话内记忆筛选(刷新页面即重置)
|
||||||
|
const mailboxMouldSessionMemory = {
|
||||||
|
journalId: '',
|
||||||
|
scene: '',
|
||||||
|
language: ''
|
||||||
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@@ -203,8 +209,15 @@ export default {
|
|||||||
}));
|
}));
|
||||||
this.journalList = mapped;
|
this.journalList = mapped;
|
||||||
if (mapped.length > 0) {
|
if (mapped.length > 0) {
|
||||||
this.tplFilters.journalId = String(mapped[0].journal_id);
|
const rememberedJournalId = String(mailboxMouldSessionMemory.journalId || '').trim();
|
||||||
|
const hasRemembered = rememberedJournalId && mapped.some(j => String(j.journal_id) === rememberedJournalId);
|
||||||
|
this.tplFilters.journalId = hasRemembered
|
||||||
|
? rememberedJournalId
|
||||||
|
: String(mapped[0].journal_id);
|
||||||
}
|
}
|
||||||
|
this.tplFilters.scene = String(mailboxMouldSessionMemory.scene || '');
|
||||||
|
this.tplFilters.language = String(mailboxMouldSessionMemory.language || '');
|
||||||
|
this.syncTplFilterMemory();
|
||||||
if (this.activeTab === 'styles') {
|
if (this.activeTab === 'styles') {
|
||||||
this.fetchStyles();
|
this.fetchStyles();
|
||||||
} else {
|
} else {
|
||||||
@@ -226,6 +239,11 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// ========== Templates ==========
|
// ========== Templates ==========
|
||||||
|
syncTplFilterMemory() {
|
||||||
|
mailboxMouldSessionMemory.journalId = String((this.tplFilters && this.tplFilters.journalId) || '');
|
||||||
|
mailboxMouldSessionMemory.scene = String((this.tplFilters && this.tplFilters.scene) || '');
|
||||||
|
mailboxMouldSessionMemory.language = String((this.tplFilters && this.tplFilters.language) || '');
|
||||||
|
},
|
||||||
fetchTemplates() {
|
fetchTemplates() {
|
||||||
this.tplLoading = true;
|
this.tplLoading = true;
|
||||||
const params = {
|
const params = {
|
||||||
@@ -233,6 +251,7 @@ export default {
|
|||||||
scene: this.tplFilters.scene || '',
|
scene: this.tplFilters.scene || '',
|
||||||
language: this.tplFilters.language || ''
|
language: this.tplFilters.language || ''
|
||||||
};
|
};
|
||||||
|
this.syncTplFilterMemory();
|
||||||
this.$api
|
this.$api
|
||||||
.post(API.listTemplates, params)
|
.post(API.listTemplates, params)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
@@ -257,11 +276,13 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleCreateTemplate() {
|
handleCreateTemplate() {
|
||||||
|
this.syncTplFilterMemory();
|
||||||
// 传入当前模板列表选中的期刊,详情页用于默认回填
|
// 传入当前模板列表选中的期刊,详情页用于默认回填
|
||||||
const journalId = this.tplFilters && this.tplFilters.journalId ? String(this.tplFilters.journalId) : '';
|
const journalId = this.tplFilters && this.tplFilters.journalId ? String(this.tplFilters.journalId) : '';
|
||||||
this.$router.push({ path: '/mailboxMouldDetail', query: journalId ? { journal_id: journalId } : {} });
|
this.$router.push({ path: '/mailboxMouldDetail', query: journalId ? { journal_id: journalId } : {} });
|
||||||
},
|
},
|
||||||
handleEditTemplate(row) {
|
handleEditTemplate(row) {
|
||||||
|
this.syncTplFilterMemory();
|
||||||
const templateId = row && (row.template_id || row.id);
|
const templateId = row && (row.template_id || row.id);
|
||||||
const journalId = this.tplFilters && this.tplFilters.journalId ? String(this.tplFilters.journalId) : '';
|
const journalId = this.tplFilters && this.tplFilters.journalId ? String(this.tplFilters.journalId) : '';
|
||||||
const query = templateId ? { template_id: String(templateId) } : {};
|
const query = templateId ? { template_id: String(templateId) } : {};
|
||||||
@@ -274,6 +295,7 @@ export default {
|
|||||||
this.previewVisible = true;
|
this.previewVisible = true;
|
||||||
},
|
},
|
||||||
handleDeleteTemplate(row) {
|
handleDeleteTemplate(row) {
|
||||||
|
this.syncTplFilterMemory();
|
||||||
const templateId = row && (row.template_id || row.id);
|
const templateId = row && (row.template_id || row.id);
|
||||||
if (!templateId) return;
|
if (!templateId) return;
|
||||||
this.$confirm(this.$t('mailboxMould.deleteConfirm'), this.$t('mailboxMould.colActions'), {
|
this.$confirm(this.$t('mailboxMould.deleteConfirm'), this.$t('mailboxMould.colActions'), {
|
||||||
|
|||||||
Reference in New Issue
Block a user