Files
doodle-mini/miniprogram/pages/profile/profile.ts
T
2026-04-23 12:08:07 +08:00

69 lines
1.7 KiB
TypeScript

import { getTodayDownloadCount } from '../../utils/downloadPrint';
Page({
data: {
userName: '微信用户',
avatarUrl: '',
printCount: 0,
favoriteCount: 0,
version: '',
isDevEnv: false,
},
onLoad() {
const info = wx.getAccountInfoSync();
const version = info.miniProgram.version || '开发版';
const isDevEnv = info.miniProgram.envVersion === 'develop';
this.setData({ version, isDevEnv });
},
onShow() {
this.refreshStats();
},
refreshStats() {
const printCount = getTodayDownloadCount();
// 收藏数待与收藏页数据源打通后接入
const favoriteCount = 0;
this.setData({ printCount, favoriteCount });
},
onGoToDownloads() {
wx.setStorageSync('favorites_active_tab', 'downloads');
wx.switchTab({ url: '/pages/favorites/favorites' });
},
onGoToFavorites() {
wx.setStorageSync('favorites_active_tab', 'favorites');
wx.switchTab({ url: '/pages/favorites/favorites' });
},
onGoToGuide() {
wx.navigateTo({ url: '/supportPages/guide/guide' });
},
onGoToPrintSettings() {
wx.showToast({ title: '功能开发中', icon: 'none' });
},
onGoToSettings() {
wx.showToast({ title: '功能开发中', icon: 'none' });
},
onGoToDebug() {
wx.navigateTo({ url: '/supportPages/debug/debug' });
},
onGoToFeedback() {
wx.showToast({ title: '功能开发中', icon: 'none' });
},
onGoToAbout() {
wx.showToast({ title: '涂鸦丫练习纸', icon: 'none' });
},
onGoToPremium() {
wx.showToast({ title: '功能开发中', icon: 'none' });
},
});