-
Notifications
You must be signed in to change notification settings - Fork 2.6k
perf: upload file count(#2029) #2061
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,8 +16,17 @@ | |
| <div class="content"> | ||
| <div class="text break-all pre-wrap"> | ||
| <div class="mb-8" v-if="document_list.length"> | ||
| <el-space wrap> | ||
| <template v-for="(item, index) in document_list" :key="index"> | ||
| <el-row :gutter="10"> | ||
| <el-col | ||
| v-for="(item, index) in document_list" | ||
| :key="index" | ||
| :xs="24" | ||
| :sm="12" | ||
| :md="12" | ||
| :lg="12" | ||
| :xl="12" | ||
| class="mb-8 w-full" | ||
| > | ||
| <el-card shadow="never" style="--el-card-padding: 8px" class="download-file cursor"> | ||
| <div class="download-button flex align-center" @click="downloadFile(item)"> | ||
| <el-icon class="mr-4"> | ||
|
|
@@ -27,17 +36,26 @@ | |
| </div> | ||
| <div class="show flex align-center"> | ||
| <img :src="getImgUrl(item && item?.name)" alt="" width="24" /> | ||
| <div class="ml-4 ellipsis" style="max-width: 150px" :title="item && item?.name"> | ||
| <div class="ml-4 ellipsis-1" :title="item && item?.name"> | ||
| {{ item && item?.name }} | ||
| </div> | ||
| </div> | ||
| </el-card> | ||
| </template> | ||
| </el-space> | ||
| </el-col> | ||
| </el-row> | ||
| </div> | ||
| <div class="mb-8" v-if="image_list.length"> | ||
| <el-space wrap> | ||
| <template v-for="(item, index) in image_list" :key="index"> | ||
| <el-row :gutter="10"> | ||
| <el-col | ||
| v-for="(item, index) in image_list" | ||
| :key="index" | ||
| :xs="24" | ||
| :sm="12" | ||
| :md="12" | ||
| :lg="12" | ||
| :xl="12" | ||
| class="mb-8" | ||
| > | ||
| <div class="file cursor border-r-4" v-if="item.url"> | ||
| <el-image | ||
| :src="item.url" | ||
|
|
@@ -52,12 +70,21 @@ | |
| class="border-r-4" | ||
| /> | ||
| </div> | ||
| </template> | ||
| </el-space> | ||
| </el-col> | ||
| </el-row> | ||
| </div> | ||
| <div class="mb-8" v-if="audio_list.length"> | ||
| <el-space wrap> | ||
| <template v-for="(item, index) in audio_list" :key="index"> | ||
| <el-row :gutter="10"> | ||
| <el-col | ||
| v-for="(item, index) in audio_list" | ||
| :key="index" | ||
| :xs="24" | ||
| :sm="12" | ||
| :md="12" | ||
| :lg="12" | ||
| :xl="12" | ||
| class="mb-8" | ||
| > | ||
| <div class="file cursor border-r-4" v-if="item.url"> | ||
| <audio | ||
| :src="item.url" | ||
|
|
@@ -66,8 +93,8 @@ | |
| class="border-r-4" | ||
| /> | ||
| </div> | ||
| </template> | ||
| </el-space> | ||
| </el-col> | ||
| </el-row> | ||
| </div> | ||
| {{ chatRecord.problem_text }} | ||
| </div> | ||
|
|
@@ -119,7 +146,6 @@ onMounted(() => {}) | |
| </script> | ||
| <style lang="scss" scoped> | ||
| .download-file { | ||
| width: 200px; | ||
| height: 43px; | ||
|
|
||
| &:hover { | ||
|
|
@@ -137,9 +163,6 @@ onMounted(() => {}) | |
| } | ||
| } | ||
|
|
||
| .show { | ||
| display: block; | ||
| } | ||
|
|
||
| .download-button { | ||
| display: none; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are several issues and optimizations in the provided code snippet: Issues:
Optimization Suggestions:
Improved Code:<script setup lang="ts">
// Your existing scripts here
</script>
<template>
<div class="content">
<div class="text break-all pre-wrap">
<div class="mb-8" v-if="document_list.length">
<el-row :gutter="10">
<el-col
v-for="(item, index) in document_list"
:key="index"
:xs="24"
:sm="12"
:md="12"
:lg="12"
:xl="12"
class="mb-8 w-full"
>
<el-card shadow="never" class="download-file cursor">
<div class="flex align-center download-button" @click="downloadFile(item)">
<!-- Custom icon goes here -->
<i class="fa fa-download"></i> Download File <!-- Add appropriate fontawesome icon -->
</div>
<div class="flex align-center show ml-4 el-ellipsis-1" title="File Name">
{{ item && item.name }}
</ div>
</el-card>
</el-col>
</el-row>
</div>
<div class="mb-8" v-if="image_list.length">
<el-row :gutter="10">
<el-col
v-for="(item, index) in image_list"
:key="index"
:xs="24"
:sm="12"
:md="12"
:lg="12"
:xl="12"
class="mb-8"
>
<template v-if="item.url">
<div class="file cursor border-r-4">
<el-image :src="item.url" lazy fit="cover" width="150px"></el-image>
</div>
</template>
</el-col>
</el-row>
</div>
<div class="mb-8" v-if="audio_list.length">
<el-row :gutter="10">
<el-col
v-for="(item, index) in audio_list"
:key="index"
:xs="24"
:sm="12"
:md="12"
:lg="12"
:xl="12"
class="mb-8"
>
<template v-if="item.url">
<div class="file cursor border-r-4">
<audio controls :src="item.url" preload></audio>
</div>
</template>
</el-col>
</el-row>
</div>
{{ chatRecord.problem_text }}
</div>
<!-- Other components remain unchanged -->
</div>
</template>
<style lang="scss" scoped>
.download-file {
padding: 8px; /* Set consistent padding */
}
.download-button,
.show {
cursor: pointer;
}
</style>This version removes duplicate properties, improves use of Bootstrap components, maintains a more structured layout with rows and columns, and uses consistent class names across similar structures for better maintainability. |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The HTML template you've provided contains some elements that need adjustment for better readability and responsiveness. Here are my suggestions:
Use Consistent Column Layout:
el-rowandel-colis consistent but lacks proper column widths for screens larger than desktop.Optimize Image Loading:
Code Formatting:
Responsive Design Considerations:
col-*) instead of custom styles like:xs,:sm, etc., for more flexibility.This adjusted version should improve both the look and performance of the component:
Remember to review specific styling needs based on your design requirements, especially if you aim for responsiveness across different device sizes.