about.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <script setup lang="ts">
  2. import type { AboutProps, DescriptionItem } from './about';
  3. import { h } from 'vue';
  4. import {
  5. VBEN_DOC_URL,
  6. VBEN_GITHUB_URL,
  7. VBEN_PREVIEW_URL,
  8. } from '@vben/constants';
  9. import { VbenLink, VbenRenderContent } from '@vben-core/shadcn-ui';
  10. interface Props extends AboutProps {}
  11. defineOptions({
  12. name: 'AboutUI',
  13. });
  14. withDefaults(defineProps<Props>(), {
  15. description:
  16. '是一个现代化开箱即用的中后台解决方案,采用最新的技术栈,包括 Vue 3.0、Vite、TailwindCSS 和 TypeScript 等前沿技术,代码规范严谨,提供丰富的配置选项,旨在为中大型项目的开发提供现成的开箱即用解决方案及丰富的示例,同时,它也是学习和深入前端技术的一个极佳示例。',
  17. name: 'Vben Admin',
  18. title: '关于项目',
  19. });
  20. declare global {
  21. const __VBEN_ADMIN_METADATA__: {
  22. authorEmail: string;
  23. authorName: string;
  24. authorUrl: string;
  25. buildTime: string;
  26. dependencies: Record<string, string>;
  27. description: string;
  28. devDependencies: Record<string, string>;
  29. homepage: string;
  30. license: string;
  31. repositoryUrl: string;
  32. version: string;
  33. };
  34. }
  35. const {
  36. authorEmail,
  37. authorName,
  38. authorUrl,
  39. buildTime,
  40. dependencies = {},
  41. devDependencies = {},
  42. homepage,
  43. license,
  44. version,
  45. // vite inject-metadata 插件注入的全局变量
  46. // eslint-disable-next-line no-undef
  47. } = __VBEN_ADMIN_METADATA__ || {};
  48. const vbenDescriptionItems: DescriptionItem[] = [
  49. {
  50. content: version,
  51. title: '版本号',
  52. },
  53. {
  54. content: license,
  55. title: '开源许可协议',
  56. },
  57. {
  58. content: buildTime,
  59. title: '最后构建时间',
  60. },
  61. {
  62. content: h(VbenLink, { href: homepage }, { default: () => '点击查看' }),
  63. title: '主页',
  64. },
  65. {
  66. content: h(VbenLink, { href: VBEN_DOC_URL }, { default: () => '点击查看' }),
  67. title: '文档地址',
  68. },
  69. {
  70. content: h(
  71. VbenLink,
  72. { href: VBEN_PREVIEW_URL },
  73. { default: () => '点击查看' },
  74. ),
  75. title: '预览地址',
  76. },
  77. {
  78. content: h(
  79. VbenLink,
  80. { href: VBEN_GITHUB_URL },
  81. { default: () => '点击查看' },
  82. ),
  83. title: 'Github',
  84. },
  85. {
  86. content: h('div', [
  87. h(
  88. VbenLink,
  89. { class: 'mr-2', href: authorUrl },
  90. { default: () => authorName },
  91. ),
  92. h(
  93. VbenLink,
  94. { href: `mailto:${authorEmail}` },
  95. { default: () => authorEmail },
  96. ),
  97. ]),
  98. title: '作者',
  99. },
  100. ];
  101. const dependenciesItems = Object.keys(dependencies).map((key) => ({
  102. content: dependencies[key],
  103. title: key,
  104. }));
  105. const devDependenciesItems = Object.keys(devDependencies).map((key) => ({
  106. content: devDependencies[key],
  107. title: key,
  108. }));
  109. </script>
  110. <template>
  111. <div class="m-5">
  112. <div class="card-box p-5">
  113. <div>
  114. <h3 class="text-foreground text-2xl font-semibold leading-7">
  115. {{ title }}
  116. </h3>
  117. <p class="text-foreground mt-3 text-sm leading-6">
  118. <VbenLink :href="VBEN_GITHUB_URL">
  119. {{ name }}
  120. </VbenLink>
  121. {{ description }}
  122. </p>
  123. </div>
  124. <div class="mt-4">
  125. <dl class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4">
  126. <template v-for="item in vbenDescriptionItems" :key="item.title">
  127. <div class="border-border border-t px-4 py-6 sm:col-span-1 sm:px-0">
  128. <dt class="text-foreground text-sm font-medium leading-6">
  129. {{ item.title }}
  130. </dt>
  131. <dd class="text-foreground mt-1 text-sm leading-6 sm:mt-2">
  132. <VbenRenderContent :content="item.content" />
  133. </dd>
  134. </div>
  135. </template>
  136. </dl>
  137. </div>
  138. </div>
  139. <div class="card-box mt-6 p-5">
  140. <div>
  141. <h5 class="text-foreground text-lg">生产环境依赖</h5>
  142. </div>
  143. <div class="mt-4">
  144. <dl class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4">
  145. <template v-for="item in dependenciesItems" :key="item.title">
  146. <div class="border-border border-t px-4 py-3 sm:col-span-1 sm:px-0">
  147. <dt class="text-foreground text-sm">
  148. {{ item.title }}
  149. </dt>
  150. <dd class="text-foreground/80 mt-1 text-sm sm:mt-2">
  151. <VbenRenderContent :content="item.content" />
  152. </dd>
  153. </div>
  154. </template>
  155. </dl>
  156. </div>
  157. </div>
  158. <div class="card-box mt-6 p-5">
  159. <div>
  160. <h5 class="text-foreground text-lg">开发环境依赖</h5>
  161. </div>
  162. <div class="mt-4">
  163. <dl class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4">
  164. <template v-for="item in devDependenciesItems" :key="item.title">
  165. <div class="border-border border-t px-4 py-3 sm:col-span-1 sm:px-0">
  166. <dt class="text-foreground text-sm">
  167. {{ item.title }}
  168. </dt>
  169. <dd class="text-foreground/80 mt-1 text-sm sm:mt-2">
  170. <VbenRenderContent :content="item.content" />
  171. </dd>
  172. </div>
  173. </template>
  174. </dl>
  175. </div>
  176. </div>
  177. </div>
  178. </template>