|
|
@ -3,6 +3,7 @@ import {Article} from "../../../shared/model/article";
|
|
|
|
import {AlertController, NavController, ToastController} from "@ionic/angular";
|
|
|
|
import {AlertController, NavController, ToastController} from "@ionic/angular";
|
|
|
|
import {getGiftCount, getUser, useGiftCount} from "../../../mine/mine.service";
|
|
|
|
import {getGiftCount, getUser, useGiftCount} from "../../../mine/mine.service";
|
|
|
|
import {HomeService} from "../../home.service";
|
|
|
|
import {HomeService} from "../../home.service";
|
|
|
|
|
|
|
|
import {Router} from "@angular/router";
|
|
|
|
|
|
|
|
|
|
|
|
import {debounceTime, Subject, takeUntil} from "rxjs";
|
|
|
|
import {debounceTime, Subject, takeUntil} from "rxjs";
|
|
|
|
|
|
|
|
|
|
|
@ -22,7 +23,8 @@ export class ArticleItemComponent implements OnInit,AfterViewInit {
|
|
|
|
private alertCtrl: AlertController,
|
|
|
|
private alertCtrl: AlertController,
|
|
|
|
private cdr: ChangeDetectorRef,
|
|
|
|
private cdr: ChangeDetectorRef,
|
|
|
|
private toastCtrl: ToastController,
|
|
|
|
private toastCtrl: ToastController,
|
|
|
|
private homeService: HomeService) {
|
|
|
|
private homeService: HomeService,
|
|
|
|
|
|
|
|
private router: Router) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
ngOnInit() {
|
|
|
@ -39,7 +41,21 @@ export class ArticleItemComponent implements OnInit,AfterViewInit {
|
|
|
|
this.alertCtrl.create({
|
|
|
|
this.alertCtrl.create({
|
|
|
|
header: '提示',
|
|
|
|
header: '提示',
|
|
|
|
message: '请先登录后再进行操作',
|
|
|
|
message: '请先登录后再进行操作',
|
|
|
|
buttons: ['确定']
|
|
|
|
buttons: [
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
text: '取消',
|
|
|
|
|
|
|
|
role: 'cancel'
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
text: '去登录',
|
|
|
|
|
|
|
|
handler: () => {
|
|
|
|
|
|
|
|
// 保存当前路径并跳转到登录页
|
|
|
|
|
|
|
|
this.navCtrl.navigateForward('/mine/login', {
|
|
|
|
|
|
|
|
state: { returnUrl: this.router.url }
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
]
|
|
|
|
}).then(alert => alert.present());
|
|
|
|
}).then(alert => alert.present());
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
this.homeService.getArticlePrice(this.article.eventId).subscribe((res) => {
|
|
|
|
this.homeService.getArticlePrice(this.article.eventId).subscribe((res) => {
|
|
|
@ -50,7 +66,6 @@ export class ArticleItemComponent implements OnInit,AfterViewInit {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.username = res.username
|
|
|
|
this.username = res.username
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
getFreeReadCount():number{
|
|
|
|
getFreeReadCount():number{
|
|
|
@ -121,7 +136,7 @@ export class ArticleItemComponent implements OnInit,AfterViewInit {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
detail() {
|
|
|
|
detail() {
|
|
|
|
if (this.article.unlock && this.article.stocks != "" && this.article.content != "") {
|
|
|
|
if (this.article.unlock && this.article.content != "") {
|
|
|
|
this.navCtrl.navigateForward('/home/article-detail', {
|
|
|
|
this.navCtrl.navigateForward('/home/article-detail', {
|
|
|
|
state: {article: this.article}
|
|
|
|
state: {article: this.article}
|
|
|
|
});
|
|
|
|
});
|
|
|
|