123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- import { Component, OnInit } from '@angular/core';
- import { NavController } from '@ionic/angular';
- import { Router } from '@angular/router';
- @Component({
- selector: 'app-tab4',
- templateUrl: './tab4.page.html',
- styleUrls: ['./tab4.page.scss'],
- })
- export class Tab4Page implements OnInit {
- constructor(private navCtrl: NavController,private router: Router) {}//this.selectedContent = '发布';
- selectedContent: string = '发布';
- publishedWorks: any[] = [
- {description: '这是发布作品1的描述' },
- {description: '这是发布作品2的描述' },
- // 其他发布作品信息
- ];
- collectedWorks: any[] = [
- {description: '这是收藏作品1的描述' },
- {description: '这是收藏作品2的描述' },
- // 其他收藏作品信息
- ];
- likedWorks: any[] = [
- {description: '这是点赞作品1的描述' },
- {description: '这是点赞作品2的描述' },
- // 其他点赞作品信息
- ];
- viewedWorks: any[] = [
- {description: '这是浏览作品1的描述' },
- {description: '这是浏览作品2的描述' },
- // 其他浏览作品信息
- ];
- selectedWorks: any[] = [];
- showContent(content: string) {
- this.selectedContent = content;
- switch(content) {
- case '发布':
- this.selectedWorks = this.publishedWorks;
- break;
- case '收藏':
- this.selectedWorks = this.collectedWorks;
- break;
- case '点赞':
- this.selectedWorks = this.likedWorks;
- break;
- case '浏览':
- this.selectedWorks = this.viewedWorks;
- break;
- default:
- this.selectedWorks = [];
- }
- }
- openFeedbackPage() {
- // 打开反馈页面
- this.navCtrl.navigateForward('/feedback');
- }
-
- openSettingsPage() {
- // 打开设置页面
- this.router.navigate(['/settings']);
- }
- openLoginPage() {
- //打开登录页面
- this.navCtrl.navigateForward('../../modules/user/login/login.module');
- }
- openFollowingPage(){
- //打开关注页面
- this.router.navigate(['/following']);
- }
- openFollowerPage(){
- //打开粉丝页面
- this.router.navigate(['/follower']);
- }
- // 由于Parse.User.current()是随着localStorage变化的属性
- // 为了避免首次复制后用户状态变化,页面不同步,通过get方法实现实时获取
- // user:Parse.User|undefined
- // async ngOnInit() {
- // this.user = await Parse.User.current()
- // setInterval(async ()=>{
- // this.user = await Parse.User.current()
- // },1000)
- // }
- // logout(){
- // Parse.User.logOut();
- // }
- user={
- followers: 3,
- following: 2,
- likes: 0
- }
- ngOnInit() {
- this.showContent(this.selectedContent);
- }
- }
|