inleft
2022-03-03 5dfef883049e7f0670f6c6b1b225b233aee41eea
评论页刷新策略调整
4 files modified
65 ■■■■ changed files
src/components/mini/box12-comment.vue 34 ●●●●● patch | view | raw | blame | history
src/components/mini/box13-reply.vue 10 ●●●●● patch | view | raw | blame | history
src/components/mini/mdDetail.vue 14 ●●●● patch | view | raw | blame | history
src/components/swichLabel/main6-comment.vue 7 ●●●● patch | view | raw | blame | history
src/components/mini/box12-comment.vue
@@ -3,9 +3,9 @@
        <replyBox ref="commentBoxId" v-bind="$attrs"></replyBox>
        <a-modal v-model="visible" :title="replyTaget" :footer="null"
            :bodyStyle="{'overflow':'overlay','maxHeight': '550px','scrollbarWidth': 'none'}">
            <replyBox ref="replyBoxId" v-bind="$attrs"></replyBox>
            <replyBox ref="replyBoxId" v-bind="$attrs" @sendMsg="sendMsg()"></replyBox>
        </a-modal>
        <div class="mySecret" v-if="commentListData.length==0">
        <div class="mySecret" style="max-height:350px ;" v-if="commentListData.length==0">
            <p>空空如也..</p>
        </div>
        <div v-for="temp in commentListData" class="commentList">
@@ -99,34 +99,31 @@
    } from '../../api/blogArticleComment.js'
    export default {
        props: ["articleId"],
        components: {
            replyBox
        },
        beforeMount() {
            queryBlogCommentList({
                pageNo: this.page.current,
                pageSize: this.page.pageSize,
                articleId: this.$attrs.acticleId
            }).then((res) => {
                this.page.total = Number(res.data.total)
                this.page.pageSize = Number(res.data.size);
                this.commentListData = res.data.records;
                return res
            })
        },
        methods: {
            onChange(current) {
                this.page.current = current;
            updateCommentList(articleId) {
                queryBlogCommentList({
                    pageNo: this.page.current,
                    pageSize: this.page.pageSize,
                    articleId: this.$attrs.articleId
                    articleId: articleId
                }).then((res) => {
                    this.page.total = Number(res.data.total)
                    this.page.pageSize = Number(res.data.size);
                    this.commentListData = res.data.records;
                })
            },
            sendMsg() {
                this.visible = false;
                this.$message.info("列表刷新中..")
                setTimeout(() => {
                    this.updateCommentList(this.$attrs.articleId);
                }, 1000);
            },
            onChange(current) {
                this.page.current = current;
                this.updateCommentList();
            },
            loadMore(temp) {
                temp.isHasNext = 0;
@@ -156,7 +153,6 @@
        },
        data() {
            return {
                // articleId: null,
                isAllowedComment: true,
                page: {
                    size: "small",
src/components/mini/box13-reply.vue
@@ -59,7 +59,6 @@
    } from '../../api/blogArticleComment.js'
    export default {
        props: ["articleId"],
        methods: {
            getMsgInfo(param) {
                this.msgInfo = param;
@@ -67,7 +66,7 @@
                this.replyHolder = "@" + this.msgInfo.useName;
            },
            send() {
                console.log(this.msgInfo);
                console.log(11);
                if (this.form.nickName === "") {
                    this.$message.info("怎么称呼..")
                    return
@@ -88,9 +87,7 @@
                        res = false;
                    }
                });
                var articleId=this.$attrs.acticleId;
                console.log(articleId);
                var articleId=this.$attrs.articleId;
                let commentType = (articleId == null || articleId == undefined) ? 1 : 2;
                this.isSending = true;
@@ -110,7 +107,8 @@
                }).then((res) => {
                    this.isSending = false;
                    if (res.code == 200) {
                        this.$message.info("已送达,审核通过后显示..")
                        this.$emit("sendMsg");
                        this.$message.info("信息已送达..")
                    } else {
                        this.$notification.error({
                            message: '好像哪里不对劲..',
src/components/mini/mdDetail.vue
@@ -33,14 +33,13 @@
            </div>
        </div>
        <div class="articleComment">
            <comment :acticleId="acticleId"></comment>
            <comment ref="myComment" :articleId="articleId"> </comment>
        </div>
    </div>
</template>
<script>
    // import esPath from '../../assets/es.md'
    import VueMarkdown from 'vue-markdown'
    import md5 from 'js-md5';
@@ -59,7 +58,7 @@
        data() {
            return {
                source: "",
                acticleId: "",
                articleId: "",
                showMsg: false,
                myLock: false,
                errorMsg: '',
@@ -74,20 +73,21 @@
            }
        },
        created() {
            this.acticleId = this.$route.query.id;
            this.articleId = this.$route.query.id;
        },
        watch: {
            '$route'(to, from) {
                if ("mdDetail" === to.name) {
                    this.acticleId = this.$route.query.id;
                    this.articleId = this.$route.query.id;
                }
            },
            acticleId: function(newValue, oldValue) {
            articleId: function(newValue, oldValue) {
                if (newValue == undefined || newValue == null || newValue == "") {
                    this.showMsg = true;
                    this.errorMsg = "日志id参数缺失";
                } else {
                    this.queryDetail();
                    this.$refs.myComment.updateCommentList(this.articleId);
                }
            }
@@ -97,7 +97,7 @@
                this.showMsg = true;
                this.errorMsg = "加载中..";
                queryBlogArticleDetail({
                    id: this.acticleId,
                    id: this.articleId,
                    authWord: this.secret == "" ? null : md5(this.secret)
                }).then((res) => {
                    this.showMsg = true;
src/components/swichLabel/main6-comment.vue
@@ -2,7 +2,7 @@
    <div class="myFriend" style="min-height: 950px;">
        <h1 style="text-align: center;">碎碎念</h1>
        <comment></comment>
        <comment ref="myComment"></comment>
    </div>
</template>
@@ -11,7 +11,10 @@
    export default {
        components: {
            comment
        }
        },
        mounted() {
            this.$refs.myComment.updateCommentList(null);
        },
    }
</script>