Skip to content
reply.ts 1.42 KiB
Newer Older
wangqinghua's avatar
wangqinghua committed
import {Component} from '@angular/core';
import {NavController, NavParams, ViewController} from "ionic-angular";
import {AppService} from "../../service/http.service";
import {TabsService} from "../../pages/tabs/tabs.service";

@Component({
    selector: 'reply',
    templateUrl: 'reply.html'
})
export class ReplyComponent {

    comment;
    relpyList;
    replyContent;

    constructor(public navCtrl: NavController, public navParams: NavParams,
                private tabSer: TabsService,
                public viewCtrl: ViewController, public appService: AppService) {
    }

    ionViewDidLoad() {
        this.comment = this.navParams.get('comment');
        console.log(this.comment);
        this.getReply();
    }

    getReply() {
        const data = {
            commentId: this.comment.id,
            pageNum: 1,
            pageSize: 100
        };
        this.tabSer.commentReplySearch(data).subscribe(
            (res) => {
                this.relpyList = res.data.list;
            }
        )
    }

    replyHandle() {
        const data = {
            commentId: this.comment.id,
            content: this.replyContent,
            parentId: '',
        };
        this.tabSer.commentReply(data).subscribe(
            (res) => {
                this.getReply();
            }
        )
    }

    cancel() {

    }

    close() {
        this.viewCtrl.dismiss();
    }

    stop(e) {
        e.stopPropagation();
    }

}