import { Observable } from 'rxjs' ; import { CommentRequest , ReplyRequest } from 'src/app/interface/request.interface' ; import { CommentService } from '../providers/comment.service' ; export abstract class ReplyBaseComponent { abstract isComment : boolean ; constructor ( public commentService ) { } protected abstract getCreateCommentParams ( ) ; protected abstract getReplyCommentParams ( ) ; submit ( ) { const obs = this . isComment ? this . commentService . createComment ( this . getCreateCommentParams ( ) ) : this . commentService . replyComment ( this . getReplyCommentParams ( ) ) ; const message = this . isComment ? '评论发表成功' : '' ; this . commentService . handleOperateCommentResult ( obs , message , this . commentService . refreshComment ) ; } }