|
| 1 | +<template> |
| 2 | + <div class="upload-container"> |
| 3 | + <!-- 标题 --> |
| 4 | + <div class="title"> |
| 5 | + <div>选择数据源</div> |
| 6 | + </div> |
| 7 | + |
| 8 | + <!-- 数据源选择 --> |
| 9 | + <div class="resource-btn" >导入已有文本</div> |
| 10 | + |
| 11 | + <!-- 上传文件区域 --> |
| 12 | + <el-form> |
| 13 | + <div class="upload-section"> |
| 14 | + <div class="upload-label">上传文本文件</div> |
| 15 | + <el-upload |
| 16 | + class="upload-area" |
| 17 | + action="#" |
| 18 | + :file-list="fileList" |
| 19 | + :on-remove="handleRemove" |
| 20 | + :before-upload="beforeUpload" |
| 21 | + list-type="text" |
| 22 | + drag |
| 23 | + > |
| 24 | + <i class="el-icon-upload"></i> |
| 25 | + <div class="el-upload__text">拖拽文件至此,或者 <em>选择文件</em></div> |
| 26 | + <div class="el-upload__tip"> |
| 27 | + 已支持 TXT、MARKDOWN、PDF、HTML、XLSX、XLS、DOCX、CSV、EML、MSG、PPTX、PPT、XML、EPUB,每个文件不超过 15MB。 |
| 28 | + </div> |
| 29 | + </el-upload> |
| 30 | + </div> |
| 31 | + |
| 32 | + <!-- 下一步按钮 --> |
| 33 | + <div class="next-button"> |
| 34 | + <el-button type="primary" :disabled="!fileList.length">下一步</el-button> |
| 35 | + </div> |
| 36 | + </el-form> |
| 37 | + |
| 38 | + <!-- 知识库创建 --> |
| 39 | + <div class="create-knowledge"> |
| 40 | + <el-link type="primary" underline>创建一个空知识库</el-link> |
| 41 | + </div> |
| 42 | + </div> |
| 43 | +</template> |
| 44 | + |
| 45 | +<script setup> |
| 46 | +import { ref } from 'vue' |
| 47 | +
|
| 48 | +const fileList = ref([]) |
| 49 | +
|
| 50 | +const handleRemove = (file, fileList) => { |
| 51 | + console.log(file, fileList) |
| 52 | +} |
| 53 | +
|
| 54 | +const beforeUpload = (file) => { |
| 55 | + fileList.value.push(file) |
| 56 | + return false |
| 57 | +} |
| 58 | +</script> |
| 59 | + |
| 60 | +<style scoped lang="scss"> |
| 61 | +.upload-container { |
| 62 | + width: 600px; |
| 63 | + margin: 0 auto; |
| 64 | + padding: 20px; |
| 65 | + background-color: #fff; |
| 66 | + border-radius: 8px; |
| 67 | + border: 1px solid #ebebeb; |
| 68 | +} |
| 69 | +
|
| 70 | +.title { |
| 71 | + font-size: 22px; |
| 72 | + font-weight: bold; |
| 73 | +} |
| 74 | +
|
| 75 | +.resource-btn { |
| 76 | + margin-top: 20px; |
| 77 | + border-radius: 10px; |
| 78 | + cursor: pointer; |
| 79 | + width: 150px; |
| 80 | + border: 1.5px solid #528bff; |
| 81 | + padding: 10px; |
| 82 | + text-align: center; |
| 83 | + font-weight: 500; |
| 84 | + font-size: 14px; |
| 85 | + line-height: 30px; |
| 86 | + color: #101828; |
| 87 | +} |
| 88 | +
|
| 89 | +.upload-section { |
| 90 | + margin: 20px 0; |
| 91 | + padding-top: 10px; |
| 92 | +} |
| 93 | +
|
| 94 | +.upload-label { |
| 95 | + font-size: 16px; |
| 96 | + font-weight: bold; |
| 97 | + margin-bottom: 10px; |
| 98 | + color: #303133; |
| 99 | +} |
| 100 | +
|
| 101 | +.upload-area { |
| 102 | + margin-top: 10px; |
| 103 | + border: 1px dashed #d9d9d9; |
| 104 | + padding: 40px; |
| 105 | + text-align: center; |
| 106 | + background-color: #f5f7fa; |
| 107 | + border-radius: 8px; |
| 108 | +} |
| 109 | +
|
| 110 | +.el-upload__text em { |
| 111 | + color: #409eff; |
| 112 | + cursor: pointer; |
| 113 | +} |
| 114 | +
|
| 115 | +.el-upload__tip { |
| 116 | + margin-top: 10px; |
| 117 | + font-size: 12px; |
| 118 | + color: #909399; |
| 119 | +} |
| 120 | +
|
| 121 | +.next-button { |
| 122 | + text-align: left; |
| 123 | + margin-top: 20px; |
| 124 | +} |
| 125 | +
|
| 126 | +.create-knowledge { |
| 127 | + text-align: left; |
| 128 | + margin-top: 20px; |
| 129 | +} |
| 130 | +
|
| 131 | +.el-form-item { |
| 132 | + margin-bottom: 0; |
| 133 | +} |
| 134 | +
|
| 135 | +.source-radio-group { |
| 136 | + display: flex; |
| 137 | + justify-content: space-between; |
| 138 | +} |
| 139 | +
|
| 140 | +.el-radio-button { |
| 141 | + display: flex; |
| 142 | + align-items: center; |
| 143 | + justify-content: center; |
| 144 | + font-size: 14px; |
| 145 | + padding: 10px 20px; |
| 146 | +} |
| 147 | +
|
| 148 | +.el-radio-button .el-icon { |
| 149 | + margin-right: 8px; |
| 150 | +} |
| 151 | +</style> |
0 commit comments