Document.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <main>
  3. <section>
  4. <div v-for="(item, key) in data" :key="key" :style="{ background: item.background }">
  5. <img :src="getAssetURL(item.img)" />
  6. <div :style="{ color: item.color }">
  7. {{ item.title }}
  8. <span>{{ item.content }}</span>
  9. </div>
  10. </div>
  11. </section>
  12. <footer>
  13. <a-popover :popup-visible="showUpload" position="tl">
  14. <div :class="{ 'text-hide': showUpload }">
  15. <div
  16. @click="
  17. () => {
  18. showUpload = true;
  19. }
  20. "
  21. >
  22. <img src="@/assets/document/3.svg" class="img-normal" v-if="!showUpload" />
  23. <img src="@/assets/document/4.svg" class="img-hover" v-if="!showUpload" />
  24. <img src="@/assets/document/5.svg" class="img-active" v-if="showUpload" />
  25. </div>
  26. <p>已选择 0/0 个文档</p>
  27. </div>
  28. <template #content>
  29. <div class="upload-wrap">
  30. <header>
  31. <p>文档解析站</p>
  32. <div
  33. @click="
  34. () => {
  35. showUpload = false;
  36. }
  37. "
  38. >
  39. <icon-close size="large" />
  40. </div>
  41. </header>
  42. </div>
  43. </template>
  44. </a-popover>
  45. </footer>
  46. </main>
  47. </template>
  48. <script>
  49. import { defineComponent, ref, inject } from "vue";
  50. export default defineComponent({
  51. components: {},
  52. setup() {
  53. const showUpload = ref(false);
  54. const { helper } = inject("$global");
  55. const DEFAULT_DATA = [
  56. {
  57. background: "rgba(72, 177, 244, 0.06)",
  58. color: "rgb(72, 177, 244)",
  59. img: "/src/assets/document/1.png",
  60. title: "自定义个人文档",
  61. content: "支持个人文档上传,以列表形式管理个人文档库"
  62. },
  63. {
  64. background: "rgba(158, 128, 255, 0.06)",
  65. color: "rgb(158, 128, 255)",
  66. img: "/src/assets/document/2.png",
  67. title: "多文档问答",
  68. content: "支持勾选多个文档,实现基于限定文档的问答"
  69. }
  70. ];
  71. const data = ref(DEFAULT_DATA);
  72. return { data, getAssetURL: helper.getAssetURL, showUpload };
  73. }
  74. });
  75. </script>
  76. <style lang="scss" scoped>
  77. main {
  78. height: 100%;
  79. display: flex;
  80. flex-direction: column;
  81. overflow: hidden;
  82. > section {
  83. overflow-y: auto;
  84. display: flex;
  85. flex-wrap: wrap;
  86. gap: 20px;
  87. flex: 1;
  88. > div {
  89. width: 382px;
  90. height: 120px;
  91. padding: 20px 24px;
  92. border-radius: 8px;
  93. display: flex;
  94. > img {
  95. width: 30px;
  96. height: 38px;
  97. margin-right: 12px;
  98. }
  99. > div {
  100. font-size: 18px;
  101. font-weight: 700;
  102. > span {
  103. font-size: 15px;
  104. font-weight: 400;
  105. color: #797d7f;
  106. margin-top: 8px;
  107. overflow: hidden;
  108. text-overflow: ellipsis;
  109. display: -webkit-box;
  110. -webkit-line-clamp: 2;
  111. -webkit-box-orient: vertical;
  112. line-height: 1.4;
  113. }
  114. }
  115. }
  116. }
  117. > footer {
  118. > div {
  119. display: inline-flex;
  120. align-items: center;
  121. gap: 8px;
  122. height: 32px;
  123. border-radius: 21px;
  124. border: 1px solid #e3e3e3;
  125. white-space: nowrap;
  126. overflow: hidden;
  127. transition-duration: 0.3s;
  128. width: 250px;
  129. &.text-hide {
  130. width: 110px;
  131. overflow: hidden;
  132. }
  133. > p {
  134. overflow: hidden;
  135. white-space: nowrap;
  136. }
  137. > div {
  138. cursor: pointer;
  139. width: 110px;
  140. height: 32px;
  141. .img-normal {
  142. display: block;
  143. }
  144. .img-hover {
  145. display: none;
  146. }
  147. &:hover {
  148. .img-normal {
  149. display: none;
  150. }
  151. .img-hover {
  152. display: block;
  153. }
  154. }
  155. > img {
  156. width: 110px;
  157. height: 32px;
  158. }
  159. }
  160. }
  161. }
  162. }
  163. .upload-wrap {
  164. width: 800px;
  165. height: 300px;
  166. > header {
  167. display: flex;
  168. align-items: center;
  169. justify-content: space-between;
  170. > p {
  171. font-size: 18px;
  172. font-weight: bold;
  173. }
  174. > div {
  175. width: 38px;
  176. height: 38px;
  177. border-radius: 6px;
  178. cursor: pointer;
  179. justify-content: center;
  180. align-items: center;
  181. display: flex;
  182. &:hover {
  183. background: rgba(0, 0, 0, 0.05);
  184. }
  185. }
  186. }
  187. }
  188. </style>