index.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. <template>
  2. <view class="home-page">
  3. <!-- 顶部渐变背景区域 -->
  4. <view class="header-bg" :style="{ paddingTop: statusBarHeight + 'px' }">
  5. <view class="header-content">
  6. <text class="header-title">智能eTMF小程序</text>
  7. </view>
  8. </view>
  9. <!-- 页面内容 -->
  10. <view class="page-content">
  11. <!-- 搜索框 -->
  12. <view class="search-box">
  13. <image class="search-icon" src="/static/pages/home/search.png" mode="aspectFit" />
  14. <input
  15. class="search-input"
  16. placeholder="输入要搜索的文档名称"
  17. placeholder-class="search-placeholder"
  18. v-model="searchKeyword"
  19. @confirm="handleSearch"
  20. />
  21. </view>
  22. <!-- 轮播图 -->
  23. <view class="banner-section">
  24. <swiper
  25. class="banner-swiper"
  26. :indicator-dots="true"
  27. :autoplay="true"
  28. :interval="3000"
  29. :duration="500"
  30. indicator-color="rgba(255, 255, 255, 0.5)"
  31. indicator-active-color="#1ec9c9"
  32. >
  33. <swiper-item v-for="(item, index) in bannerList" :key="index">
  34. <image class="banner-image" :src="item.image" mode="aspectFill" />
  35. </swiper-item>
  36. </swiper>
  37. </view>
  38. <!-- 智能扫描卡片 -->
  39. <view class="scan-card" @click="handleGoToScan">
  40. <view class="scan-icon-wrapper">
  41. <image class="scan-icon" src="/static/pages/home/scan-icon.png" mode="aspectFit" />
  42. </view>
  43. <view class="scan-info">
  44. <text class="scan-title">智能扫描</text>
  45. <text class="scan-desc">快速的扫描上传文档进行递交文档</text>
  46. </view>
  47. </view>
  48. <!-- 最近文档 -->
  49. <view class="recent-section">
  50. <view class="section-header">
  51. <text class="section-title">最近文档</text>
  52. <view class="more-btn" @click="handleViewMore">
  53. <text class="more-text">查看更多</text>
  54. <text class="more-arrow">›</text>
  55. </view>
  56. </view>
  57. <view class="document-list">
  58. <view
  59. v-for="(doc, index) in recentDocuments"
  60. :key="index"
  61. class="document-item"
  62. @click="handleDocumentClick(doc)"
  63. >
  64. <image class="doc-thumbnail" :src="doc.thumbnail" mode="aspectFill" />
  65. <view class="doc-info">
  66. <text class="doc-name">{{ doc.name }}</text>
  67. <text class="doc-meta">{{ doc.date }} | 共{{ doc.pages }}页</text>
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. <!-- 底部导航栏 -->
  74. <TabBar current-tab="home" />
  75. </view>
  76. </template>
  77. <script setup>
  78. import { ref, onMounted } from 'vue'
  79. import { useI18n } from 'vue-i18n'
  80. import TabBar from '@/components/TabBar/index.vue'
  81. const { t } = useI18n()
  82. // 状态栏高度
  83. const statusBarHeight = ref(0)
  84. // 搜索关键词
  85. const searchKeyword = ref('')
  86. // 轮播图数据
  87. const bannerList = ref([
  88. {
  89. image: '/static/pages/home/banner1.png'
  90. },
  91. {
  92. image: '/static/pages/home/banner2.png'
  93. }
  94. ])
  95. // 最近文档数据
  96. const recentDocuments = ref([
  97. {
  98. id: 1,
  99. name: 'HFSLKD_SKD_测试文档名称1',
  100. date: '2025/11/12 11:12',
  101. pages: 5,
  102. thumbnail: '/static/pages/home/doc-thumb.png'
  103. },
  104. {
  105. id: 2,
  106. name: 'HFSLKD_SKD_测试文档名称1',
  107. date: '2025/11/12 11:12',
  108. pages: 5,
  109. thumbnail: '/static/pages/home/doc-thumb.png'
  110. },
  111. {
  112. id: 3,
  113. name: 'HFSLKD_SKD_测试文档名称1',
  114. date: '2025/11/12 11:12',
  115. pages: 5,
  116. thumbnail: '/static/pages/home/doc-thumb.png'
  117. },
  118. {
  119. id: 4,
  120. name: 'HFSLKD_SKD_测试文档名称1',
  121. date: '2025/11/12 11:12',
  122. pages: 5,
  123. thumbnail: '/static/pages/home/doc-thumb.png'
  124. },
  125. {
  126. id: 5,
  127. name: 'HFSLKD_SKD_测试文档名称1',
  128. date: '2025/11/12 11:12',
  129. pages: 5,
  130. thumbnail: '/static/pages/home/doc-thumb.png'
  131. }
  132. ])
  133. onMounted(() => {
  134. // 获取系统信息
  135. const windowInfo = uni.getWindowInfo()
  136. statusBarHeight.value = windowInfo.statusBarHeight || 0
  137. })
  138. // 搜索
  139. const handleSearch = () => {
  140. if (!searchKeyword.value.trim()) {
  141. uni.showToast({
  142. title: '请输入搜索关键词',
  143. icon: 'none'
  144. })
  145. return
  146. }
  147. uni.showToast({
  148. title: `搜索: ${searchKeyword.value}`,
  149. icon: 'none'
  150. })
  151. // TODO: 实现搜索功能
  152. }
  153. // 跳转到扫描页面
  154. const handleGoToScan = () => {
  155. uni.reLaunch({
  156. url: '/pages/scan/index'
  157. })
  158. }
  159. // 查看更多文档
  160. const handleViewMore = () => {
  161. uni.showToast({
  162. title: '查看更多文档',
  163. icon: 'none'
  164. })
  165. // TODO: 跳转到文档列表页
  166. }
  167. // 点击文档
  168. const handleDocumentClick = (doc) => {
  169. uni.showToast({
  170. title: `打开文档: ${doc.name}`,
  171. icon: 'none'
  172. })
  173. // TODO: 跳转到文档详情页
  174. }
  175. </script>
  176. <style lang="scss" scoped>
  177. .home-page {
  178. width: 100%;
  179. min-height: 100vh;
  180. display: flex;
  181. flex-direction: column;
  182. background-color: #f5f5f5;
  183. padding-bottom: calc(100rpx + env(safe-area-inset-bottom));
  184. // 顶部渐变背景
  185. .header-bg {
  186. background: linear-gradient(180deg, #1ec9c9 0%, #1eb8b8 100%);
  187. .header-content {
  188. padding: 0 24rpx 16rpx;
  189. .header-title {
  190. font-size: 32rpx;
  191. font-weight: 600;
  192. color: #ffffff;
  193. display: block;
  194. padding: 12rpx 0;
  195. line-height: 1.4;
  196. }
  197. }
  198. }
  199. // 页面内容
  200. .page-content {
  201. flex: 1;
  202. padding: 0 24rpx 24rpx;
  203. margin-top: -12rpx;
  204. // 搜索框
  205. .search-box {
  206. background: #ffffff;
  207. border-radius: 16rpx;
  208. padding: 20rpx 24rpx;
  209. display: flex;
  210. align-items: center;
  211. margin-bottom: 24rpx;
  212. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.08);
  213. .search-icon {
  214. width: 32rpx;
  215. height: 32rpx;
  216. margin-right: 16rpx;
  217. }
  218. .search-input {
  219. flex: 1;
  220. font-size: 28rpx;
  221. color: #333333;
  222. }
  223. .search-placeholder {
  224. color: #999999;
  225. }
  226. }
  227. // 轮播图
  228. .banner-section {
  229. margin-bottom: 24rpx;
  230. .banner-swiper {
  231. width: 100%;
  232. height: 280rpx;
  233. border-radius: 16rpx;
  234. overflow: hidden;
  235. .banner-image {
  236. width: 100%;
  237. height: 100%;
  238. }
  239. }
  240. }
  241. // 智能扫描卡片
  242. .scan-card {
  243. background: #ffffff;
  244. border-radius: 16rpx;
  245. padding: 32rpx 24rpx;
  246. display: flex;
  247. align-items: center;
  248. margin-bottom: 24rpx;
  249. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.08);
  250. &:active {
  251. background-color: #f8f8f8;
  252. }
  253. .scan-icon-wrapper {
  254. width: 88rpx;
  255. height: 88rpx;
  256. background: linear-gradient(135deg, #1ec9c9 0%, #17b3b3 100%);
  257. border-radius: 16rpx;
  258. display: flex;
  259. align-items: center;
  260. justify-content: center;
  261. margin-right: 24rpx;
  262. .scan-icon {
  263. width: 56rpx;
  264. height: 56rpx;
  265. }
  266. }
  267. .scan-info {
  268. flex: 1;
  269. display: flex;
  270. flex-direction: column;
  271. gap: 8rpx;
  272. .scan-title {
  273. font-size: 32rpx;
  274. font-weight: 600;
  275. color: #333333;
  276. }
  277. .scan-desc {
  278. font-size: 24rpx;
  279. color: #999999;
  280. line-height: 1.4;
  281. }
  282. }
  283. }
  284. // 最近文档
  285. .recent-section {
  286. .section-header {
  287. display: flex;
  288. align-items: center;
  289. justify-content: space-between;
  290. margin-bottom: 24rpx;
  291. .section-title {
  292. font-size: 32rpx;
  293. font-weight: 600;
  294. color: #333333;
  295. }
  296. .more-btn {
  297. display: flex;
  298. align-items: center;
  299. gap: 4rpx;
  300. .more-text {
  301. font-size: 26rpx;
  302. color: #999999;
  303. }
  304. .more-arrow {
  305. font-size: 36rpx;
  306. color: #999999;
  307. font-weight: 300;
  308. }
  309. }
  310. }
  311. .document-list {
  312. .document-item {
  313. background: #ffffff;
  314. border-radius: 16rpx;
  315. padding: 24rpx;
  316. display: flex;
  317. align-items: center;
  318. margin-bottom: 16rpx;
  319. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.08);
  320. &:active {
  321. background-color: #f8f8f8;
  322. }
  323. .doc-thumbnail {
  324. width: 100rpx;
  325. height: 120rpx;
  326. border-radius: 8rpx;
  327. margin-right: 24rpx;
  328. background-color: #f0f0f0;
  329. }
  330. .doc-info {
  331. flex: 1;
  332. display: flex;
  333. flex-direction: column;
  334. gap: 12rpx;
  335. .doc-name {
  336. font-size: 28rpx;
  337. font-weight: 500;
  338. color: #333333;
  339. overflow: hidden;
  340. text-overflow: ellipsis;
  341. white-space: nowrap;
  342. }
  343. .doc-meta {
  344. font-size: 24rpx;
  345. color: #999999;
  346. }
  347. }
  348. }
  349. }
  350. }
  351. }
  352. }
  353. </style>