Blame view

泰额版/Food Labeling Management App UniApp/src/pages/index/index.vue 4.43 KB
59e51671   “wangming”   1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
  <template>
    <view class="page">
      <view class="header-hero" :style="{ paddingTop: statusBarHeight + 'px' }">
        <view class="top-bar">
          <view class="top-left-empty" />
          <view class="top-center">
            <image class="header-logo" src="/static/logo_us.png" mode="aspectFit" />
          </view>
          <view class="top-right" @click="isMenuOpen = true">
            <AppIcon name="menu" size="sm" color="white" />
          </view>
        </view>
        <view class="hero-info">
          <text class="app-sub">{{ storeName }}</text>
          <LocationPicker />
        </view>
      </view>
  
      <view class="main">
        <view class="content">
          <view class="quick-actions">
            <view
              v-for="action in quickActions"
              :key="action.label"
              class="action-wrap"
              @click="navTo(action.path)"
            >
              <view class="action-card">
                <AppIcon :name="action.icon" size="md" color="white" />
              </view>
              <text class="action-label">{{ action.label }}</text>
            </view>
          </view>
        </view>
      </view>
  
      <SideMenu v-model="isMenuOpen" />
    </view>
  </template>
  
  <script setup lang="ts">
f64eecbf   杨鑫   前端更新
42
  import { ref, computed, onMounted, onBeforeUnmount } from 'vue'
59e51671   “wangming”   1
43
44
45
46
47
48
49
  import { useI18n } from 'vue-i18n'
  import { onShow } from '@dcloudio/uni-app'
  import AppIcon from '../../components/AppIcon.vue'
  import SideMenu from '../../components/SideMenu.vue'
  import LocationPicker from '../../components/LocationPicker.vue'
  import { getStatusBarHeight } from '../../utils/statusBar'
  import { getAccessToken } from '../../utils/authSession'
f64eecbf   杨鑫   前端更新
50
  import { STORE_CHANGED_EVENT, getCurrentStoreName } from '../../utils/stores'
59e51671   “wangming”   1
51
52
53
54
  
  const { t } = useI18n()
  const statusBarHeight = getStatusBarHeight()
  
f64eecbf   杨鑫   前端更新
55
56
  const currentStoreName = ref(getCurrentStoreName())
  const storeName = computed(() => currentStoreName.value || 'None Selected')
59e51671   “wangming”   1
57
58
  const isMenuOpen = ref(false)
  
f64eecbf   杨鑫   前端更新
59
60
61
62
63
64
65
66
67
68
69
70
71
  function refreshStoreName() {
    currentStoreName.value = getCurrentStoreName()
  }
  
  onMounted(() => {
    refreshStoreName()
    uni.$on(STORE_CHANGED_EVENT, refreshStoreName)
  })
  
  onBeforeUnmount(() => {
    uni.$off(STORE_CHANGED_EVENT, refreshStoreName)
  })
  
59e51671   “wangming”   1
72
  onShow(() => {
f64eecbf   杨鑫   前端更新
73
    refreshStoreName()
59e51671   “wangming”   1
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
    if (!getAccessToken()) {
      uni.reLaunch({ url: '/pages/login/login' })
      return
    }
    if (!uni.getStorageSync('storeId')) {
      uni.redirectTo({ url: '/pages/store-select/store-select' })
    }
  })
  
  const quickActions = computed(() => [
    {
      label: t('Labeling'),
      icon: 'tag',
      path: '/pages/labels/labels',
    },
  ])
  
  const navTo = (path: string) => {
    uni.navigateTo({ url: path })
  }
  </script>
  
  <style scoped>
  .page {
    min-height: 100vh;
    background: #f9fafb;
    box-sizing: border-box;
  }
  
  .header-hero {
    min-height: 260rpx;
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-primary-dark));
    padding-left: 32rpx;
    padding-right: 32rpx;
    padding-bottom: 32rpx;
  }
  
  .top-bar {
    height: 96rpx;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  .top-left-empty {
    width: 64rpx;
    height: 64rpx;
  }
  
  .top-right {
    width: 64rpx;
    height: 64rpx;
    border-radius: 999rpx;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .top-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  
  .header-logo {
    width: 300rpx;
    height: 80rpx;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 12rpx;
    padding: 8rpx 12rpx;
    margin-bottom: 8rpx;
  }
  
  .hero-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 16rpx;
  }
  
  .app-sub {
    font-size: 26rpx;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 12rpx;
  }
  
  .main {
    max-width: 960rpx;
    margin: 0 auto;
    padding: 48rpx 48rpx 64rpx;
  }
  
  .content {
    background: transparent;
  }
  
  .quick-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 40rpx;
  }
  
  .action-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20rpx;
    cursor: pointer;
  }
  
  .action-card {
    width: 120rpx;
    height: 120rpx;
    border-radius: 28rpx;
    background: var(--theme-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6rpx 16rpx var(--theme-primary-shadow);
    transition: box-shadow 0.2s ease;
  }
  
  .action-card:active {
    box-shadow: 0 2rpx 8rpx var(--theme-primary-shadow-light);
  }
  
  .action-label {
    font-size: 28rpx;
    font-weight: 500;
    color: #111827;
    text-align: center;
  }
  </style>