123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- import { Component } from '@angular/core';
- @Component({
- selector: 'app-tab1',
- templateUrl: 'tab1.page.html',
- styleUrls: ['tab1.page.scss'],
- standalone: false,
- })
- export class Tab1Page {
- isDark = false;
- currentTime = this.formatTime(new Date());
- dynamicStats = [
- { value: '12', label: '已探索景点' },
- { value: '7.5h', label: '今日游览时长' },
- { value: '125km', label: '本周旅行里程' }
- ];
- smartRecommendation = '根据您的旅行偏好,推荐参观当地历史博物馆';
- socialFeed = [
- {
- user: {
- avatar: 'assets/avatars/avatar1.png',
- nickname: '旅行达人'
- },
- content: '发现了一个绝美的小众景点!#旅行日记',
- likes: 24,
- comments: 8
- },
- {
- user: {
- avatar: 'assets/avatars/avatar2.png',
- nickname: '背包客'
- },
- content: '第一次独自旅行完成!',
- likes: 15,
- comments: 5
- }
- ];
- constructor() {
- setInterval(() => {
- this.currentTime = this.formatTime(new Date());
- }, 1000);
- }
- private formatTime(date: Date): string {
- return `${date.getHours()}:${date.getMinutes().toString().padStart(2, '0')}`;
- }
- toggleTheme() {
- this.isDark = !this.isDark;
- document.body.classList.toggle('dark', this.isDark);
- }
- startSmartPlan() {
- alert(`开始${this.smartRecommendation}`);
- }
- }
|