index.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <view class="container">
  3. <view class="header">
  4. <view class="language-switch" @click="handleLanguageSwitch">
  5. <text class="language-text">{{ currentLocaleName }}</text>
  6. </view>
  7. <text class="title">{{ t('home.title') }}</text>
  8. <text class="subtitle">{{ t('home.subtitle') }}</text>
  9. </view>
  10. <view class="content">
  11. <view class="card">
  12. <text class="card-title">{{ t('home.systemInfo') }}</text>
  13. <view class="info-item">
  14. <text class="label">{{ t('home.framework') }}:</text>
  15. <text class="value">{{ t('home.frameworkValue') }}</text>
  16. </view>
  17. <view class="info-item">
  18. <text class="label">{{ t('home.platform') }}:</text>
  19. <text class="value">{{ t('home.platformValue') }}</text>
  20. </view>
  21. </view>
  22. <view class="action-section">
  23. <button type="primary" @click="handleClick">{{ t('home.startButton') }}</button>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script setup>
  29. import { computed } from 'vue'
  30. import { useI18n } from 'vue-i18n'
  31. import { useLocaleStore } from '@/store/locale'
  32. const { t } = useI18n()
  33. const localeStore = useLocaleStore()
  34. // 获取当前语言名称
  35. const currentLocaleName = computed(() => localeStore.getCurrentLocaleName())
  36. // 切换语言
  37. const handleLanguageSwitch = () => {
  38. const success = localeStore.toggleLocale()
  39. if (success) {
  40. uni.showToast({
  41. title: t('common.language.switchSuccess'),
  42. icon: 'success'
  43. })
  44. }
  45. }
  46. const handleClick = () => {
  47. uni.showToast({
  48. title: t('home.welcomeMessage'),
  49. icon: 'success'
  50. })
  51. }
  52. </script>
  53. <style lang="scss" scoped>
  54. .container {
  55. min-height: 100vh;
  56. padding: 40rpx;
  57. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  58. }
  59. .header {
  60. text-align: center;
  61. padding: 60rpx 0;
  62. position: relative;
  63. .language-switch {
  64. position: absolute;
  65. top: 20rpx;
  66. right: 20rpx;
  67. background: rgba(255, 255, 255, 0.2);
  68. padding: 12rpx 24rpx;
  69. border-radius: 30rpx;
  70. backdrop-filter: blur(10rpx);
  71. border: 1rpx solid rgba(255, 255, 255, 0.3);
  72. .language-text {
  73. font-size: 24rpx;
  74. color: #ffffff;
  75. font-weight: 500;
  76. }
  77. }
  78. .title {
  79. display: block;
  80. font-size: 48rpx;
  81. font-weight: bold;
  82. color: #ffffff;
  83. margin-bottom: 20rpx;
  84. }
  85. .subtitle {
  86. display: block;
  87. font-size: 28rpx;
  88. color: rgba(255, 255, 255, 0.8);
  89. }
  90. }
  91. .content {
  92. .card {
  93. background: #ffffff;
  94. border-radius: 20rpx;
  95. padding: 40rpx;
  96. margin-bottom: 40rpx;
  97. box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.1);
  98. .card-title {
  99. display: block;
  100. font-size: 32rpx;
  101. font-weight: bold;
  102. color: #333333;
  103. margin-bottom: 30rpx;
  104. }
  105. .info-item {
  106. display: flex;
  107. justify-content: space-between;
  108. align-items: center;
  109. padding: 20rpx 0;
  110. border-bottom: 1rpx solid #f0f0f0;
  111. &:last-child {
  112. border-bottom: none;
  113. }
  114. .label {
  115. font-size: 28rpx;
  116. color: #666666;
  117. }
  118. .value {
  119. font-size: 28rpx;
  120. color: #333333;
  121. font-weight: 500;
  122. }
  123. }
  124. }
  125. .action-section {
  126. padding: 20rpx 0;
  127. button {
  128. width: 100%;
  129. height: 88rpx;
  130. line-height: 88rpx;
  131. border-radius: 44rpx;
  132. font-size: 32rpx;
  133. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  134. }
  135. }
  136. }
  137. </style>