Support personal records and persistent smoking visibility. Add upload quota preflight, file cleanup, privacy entry, image caching and revision-based page refresh across the backend, admin and mini program.
26 lines
1.1 KiB
JavaScript
26 lines
1.1 KiB
JavaScript
const { tryLoginRenewal } = require('../utils/subscribe');
|
|
const { tabForPage, paths } = require('../utils/navigation');
|
|
Component({
|
|
data: { active: '', hidden: false },
|
|
lifetimes: { attached: function() { this.syncActive(); } },
|
|
pageLifetimes: { show: function() { this.syncActive(); } },
|
|
methods: {
|
|
setHidden: function(hidden) { this.setData({ hidden: !!hidden }); },
|
|
syncActive: function() {
|
|
var pages = getCurrentPages();
|
|
var current = pages[pages.length - 1];
|
|
this.setData({ active: tabForPage(current && current.route), hidden: !!(current && current.data && (current.data.publishOpen || current.data.showEditProfileModal || current.data.showEditPartnerModal)) });
|
|
},
|
|
navigate: function(e) {
|
|
tryLoginRenewal();
|
|
var tab = e.currentTarget.dataset.tab;
|
|
if (!paths[tab]) return;
|
|
var pages = getCurrentPages();
|
|
// 当前主页面重复点击不重新加载。
|
|
if (pages.length && pages[pages.length - 1].route === paths[tab]) return;
|
|
if (this._switching) return;
|
|
this._switching = true;
|
|
wx.switchTab({ url: '/' + paths[tab], complete: () => { this._switching = false; } });
|
|
}
|
|
} });
|