inleft
2022-08-26 87317f44d9cc20ad70b6971168667e1c843e03d8
添加上传进度条
添加日志统计文字
3 files modified
77 ■■■■■ changed files
src/api/fileManage.js 6 ●●●●● patch | view | raw | blame | history
src/components/mini/box10-add.vue 21 ●●●●● patch | view | raw | blame | history
src/components/mini/mdDetail.vue 50 ●●●●● patch | view | raw | blame | history
src/api/fileManage.js
@@ -11,7 +11,8 @@
  return axios({
    url: '/sysFileInfo/upload',
    method: 'post',
    data: parameter
    data: parameter,
    timeout:60*60*1000
  })
}
@@ -22,7 +23,8 @@
  return axios({
    url: '/outside/sysFileInfo/upload',
    method: 'post',
    data: parameter
    data: parameter,
    timeout:60*60*1000
  })
}
src/components/mini/box10-add.vue
@@ -380,12 +380,31 @@
                myFileInfoUpload(formData).then((res) => {
                    if (res.success) {
                        this.$message.success('上传成功')
                        option.onSuccess(res, option.file)
                        // 在上传成功后进度条显示为99
                        progress.percent = 100
                    } else {
                        this.$message.error('上传失败:' + res.message)
                    }
                })
                let progress = {
                    percent: 1
                }
                let speed = 100 / (option.file.size / 65000) //上传速度
                const intervalId = setInterval(() => {
                    // 控制进度条防止在未上传成功时进度条达到100
                    if (progress.percent < 99 && progress.percent + speed < 100) {
                        progress.percent += speed //控制进度条速度
                        option.onProgress(progress) //onProgress接收一个对象{ percent: 进度 }在进度条上显示
                    } else if ((progress.percent < 100)) {
                        progress.percent++
                    } else if (progress.percent >= 100) {
                        clearInterval(intervalId)
                    }
                }, 500)
            },
            disabledDate(current) {
                return current < moment().subtract(1, "day");
src/components/mini/mdDetail.vue
@@ -4,6 +4,16 @@
        <div class="headertop filter-dot headertop-bar " v-if="coverURL.length>0">
            <figure class="centerbg" v-bind:style="{'background-image':'url('+this.coverURL+')'}">
            </figure>
            <div class="countMeta"
                v-if="articleFileType==fileType.fileTypeMarkDown_1|| articleFileType==fileType.fileTypeHtml_2">
                <div style="display: flex;justify-content: space-between;padding: 0px 10px;">
                    <div style="display: flex;align-items: center;"> <span>发布时间:{{articelMeta.publishDate}}</span></div>
                    <div style="display: inline-grid;">
                        <span style="text-align: end;">字数:{{wordCount}}</span>
                        <span>预计耗时:{{Math.floor(wordCount/500)}}~{{Math.ceil(wordCount/300)}}分钟</span>
                    </div>
                </div>
            </div>
        </div>
        <div class="mySecret" v-if="myLock">
@@ -27,6 +37,7 @@
        </div>
        <div v-else>
            <div v-if="articleFileType==fileType.fileTypeTalking_9">
                <div class="markdown-body  articleTitle">
                    <h4>{{articelMeta.title}}</h4>
@@ -91,9 +102,9 @@
                <div class="articleTitle">
                    <h4>{{articelMeta.title}}</h4>
                </div>
                <vue-markdown :source="source" v-if="source.length>0"></vue-markdown>
                <vue-markdown :source="source" v-if="source== null || source.length>0"></vue-markdown>
                <div class="introduceSamll" v-else-if="introduce.length==0">
                <div class="introduceSamll" v-else-if="introduce==null || introduce.length==0">
                    <p>空荡荡的..我好像忘记写点什么了OωO</p>
                </div>
@@ -229,6 +240,8 @@
                },
                options: optionsConfig,
                img404: myConstant.img404,
                wordCount: 0
            }
        },
        created() {
@@ -257,6 +270,22 @@
            },
        },
        methods: {
            getWordCount() {
                var iTotal = 0;
                var c;
                for (var i = 0; i < this.source.length; i++) {
                    c = this.source.charAt(i);
                    //基本汉字
                    if (c.match(/[\u4e00-\u9fa5]/)) {
                        iTotal++;
                    }
                    //基本汉字补充
                    else if (c.match(/[\u9FA6-\u9fcb]/)) {
                        iTotal++;
                    }
                }
                this.wordCount = iTotal;
            },
            articleOptionHandle(type) {
                this.$message.info(type)
            },
@@ -321,7 +350,11 @@
                                    this.source = res.data;
                                }).catch(() => [
                                    this.$message.error("获取文件好像失败了..", 3)
                                ])
                                ]).finally(() => {
                                    setTimeout(() => {
                                        _this.getWordCount();
                                    }, 500);
                                })
                        }
                    } else if (res.data.articleFileType == this.fileType.fileTypeVideo_3) {
                        if (res.data.videoUrlList == null || res.data.videoUrlList.length < 1) {
@@ -413,6 +446,14 @@
            transition: all 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
            border-radius: 16px;
        }
    }
    .countMeta {
        position: absolute;
        bottom: 0px;
        width: 100%;
        background: #f0f2f5;
        opacity: 0.6;
    }
    .headertop {
@@ -557,5 +598,8 @@
                max-width: 120px;
            }
        }
        .countMeta{
            bottom: 10px;
        }
    }
</style>