tj
2025-05-30 d9a780fa538cb7a83aefa04e75cb53185d690d7d
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
<template>
  <view class="page">
    <view class="profile-section" :style="backgroundStyle">
      <up-sticky bgColor="#000">
        <view class="top-bar">
          <up-icon name="list" size="60rpx" color="#D0E1E9" @click="onSettingClick" />
          <view class="top-bar-right">
            <up-icon name="share" size="60rpx" color="#D0E1E9" />
          </view>
        </view>
      </up-sticky>
      <view class="profile-content">
        <view class="profile-header">
          <view class="avatar-container">
            <image v-if="userStore?.userInfo?.customerDTO?.cover" class="avatar"
              :src="userStore?.userInfo?.customerDTO?.cover" mode="aspectFill" />
            <image v-else class="avatar"
              src="https://ai-public.mastergo.com/ai/img_res/e8ae645c666c247b895b488e60b048f5.jpg" mode="aspectFill" />
            <view class="add-icon">
              <up-icon name="plus" size="20rpx" color="#333" />
            </view>
          </view>
          <view class="user-info">
            <view class="username">影途 {{ userStore?.userInfo?.customerDTO?.name }}</view>
            <view class="user-id">影途号:{{ userStore?.userInfo?.customerDTO?.id }}</view>
            <view class="location">IP 属地:{{ userStore.address?.ad_info?.province }}</view>
          </view>
        </view>
 
        <view class="edit-profile" @click="goToProfile">点击这里,填写简介</view>
 
        <view class="stats">
          <view class="stat-row">
            <view class="stat-item">
              <text class="number">0</text>
              <text class="label">关注</text>
            </view>
            <view class="stat-item">
              <text class="number">0</text>
              <text class="label">粉丝</text>
            </view>
            <view class="stat-item">
              <text class="number">1</text>
              <text class="label">获赞与收藏</text>
            </view>
          </view>
          <view class="action-buttons">
            <up-button text="编辑资料" size="mini" type="info" plain hairline
              :custom-style="{ backgroundColor: 'transparent', borderColor: '#B1ABA9' }" />
            <up-icon name="setting" size="40rpx" @click="gotoUrl('/sub-pages/mine/settings')" />
          </view>
        </view>
      </view>
 
      <scroll-view class="function-cards" scroll-x show-scrollbar="false">
        <view class="card" v-for="item in cardList" :key="item.title">
          <view class="card-content">
            <text class="card-title">{{ item.title }}</text>
            <text class="card-subtitle">{{ item.subtitle }}</text>
          </view>
        </view>
      </scroll-view>
    </view>
 
    <view class="tab-section">
      <up-sticky bgColor="#fff">
        <up-tabs :list="tabList" :current="current" @change="onTabChange" lineColor="#2979ff"
          activeStyle="color: #2979ff" />
      </up-sticky>
 
      <swiper class="swiper-box" :current="current" @change="onSwiperChange" duration="300">
        <swiper-item v-for="(item, index) in tabList" :key="index">
          <view class="empty-state">
            <image class="empty-icon"
              src="https://ai-public.mastergo.com/ai/img_res/fc3cb775274ef0f5e58ac01687a9c121.jpg" mode="aspectFit" />
            <text class="empty-text">快去发布你的笔记吧</text>
            <up-button class="publish-btn" size="mini" type="warning" shape="circle">去发布</up-button>
          </view>
        </swiper-item>
      </swiper>
    </view>
 
    <common-footer flg="0" />
    <setting-popup v-model="settingShow" />
  </view>
</template>
 
<script setup lang="ts">
import { ref, computed, watch } from 'vue';
import { onShow } from '@dcloudio/uni-app'
import SettingPopup from '@/components/setting/setting-popup.vue';
import { usePlatformLoginType } from '@/composables/usePlatformLoginType'
import { useUserStore } from '@/store/user'
import { useLocation } from '@/composables/useLocation'
import { useNavigator } from '@/composables/useNavigator'
 
const { apitype } = usePlatformLoginType()
const userStore = useUserStore()
const { navigateTo } = useNavigator()
const {getLocation,province } = useLocation()
 
 
const gotoUrl = (url: string) => {
  navigateTo(url)
}
 
watch(
  () => userStore.userInfo,      // 监听 userInfo 这个响应式属性
  (newVal, oldVal) => {
    console.log('userInfo 发生变化:', newVal)
  },
  { deep: true } // 如果 userInfo 是对象,需要深度监听其属性变化
)
 
onShow(() => {
  getLocation()
});
 
 
// 当前 tab 索引
const current = ref(0);
 
// 背景图
const backgroundUrl = ref('');
 
// 控制设置弹窗显示
const settingShow = ref(false);
 
// tab 列表
const tabList = ref([
  { name: '笔记' },
  { name: '收藏' },
  { name: '赞过' },
]);
 
// 横向滑动卡片
const cardList = ref([
  { title: '购物车', subtitle: '查看推荐好物' },
  { title: '创作灵感', subtitle: '学创作找灵感' },
  { title: '浏览记录', subtitle: '看过的笔记' },
  { title: '浏览记录', subtitle: '看过的笔记' },
]);
 
// 背景样式
const backgroundStyle = computed(() => {
  return backgroundUrl.value
    ? `background: url(${backgroundUrl.value}) center center / cover no-repeat;`
    : 'background-color: #1e1e1e;';
});
 
// 方法定义
const onSettingClick= ()=> {
  settingShow.value = true;
}
 
const onTabChange=(item: { index: number })=> {
  current.value = item.index;
}
 
const onSwiperChange=(e: any) => {
  current.value = e.detail.current;
}
 
 
const goToProfile=  ()=> {
  navigateTo('/profile');
}
</script>
 
 
<style>
.page {
  height: 100vh;
  overflow-y: auto;
}
 
.top-bar {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24rpx 32rpx;
}
 
.top-bar-right {
  display: flex;
  align-items: center;
}
 
.icon-margin {
  margin-right: 32rpx;
}
 
.profile-section {
  position: relative;
  /* height: 680rpx; */
}
 
.bg-image {
  position: absolute;
  width: 100%;
  height: 100%;
  z-index: 1;
}
 
.profile-content {
  position: relative;
  z-index: 2;
  padding: 30rpx;
}
 
.profile-header {
  display: flex;
  align-items: flex-start;
  margin-bottom: 24rpx;
}
 
.avatar-container {
  position: relative;
  margin-right: 24rpx;
}
 
.avatar {
  width: 120rpx;
  height: 120rpx;
  border-radius: 60rpx;
  border: 2px solid #ffffff;
}
 
.add-icon {
  position: absolute;
  right: -8rpx;
  bottom: -8rpx;
  width: 40rpx;
  height: 40rpx;
  background-color: #FFE411;
  border-radius: 20rpx;
  display: flex;
  align-items: center;
  justify-content: center;
}
 
.user-info {
  flex: 1;
}
 
.username {
  font-size: 30rpx;
  color: #FCFFFE;
  font-weight: bold;
  margin-bottom: 8rpx;
}
 
.user-id,
.location {
  font-size: 26rpx;
  color: #666666;
  margin-bottom: 4rpx;
}
 
.edit-profile {
  color: #999999;
  font-size: 26rpx;
  margin-bottom: 20rpx;
}
 
.stats {
  display: flex;
  /* margin-bottom: 20rpx; */
  align-items: center;
  justify-content: space-between;
}
 
.stat-row {
  display: flex;
}
 
.stat-item {
  margin-right: 48rpx;
  display: flex;
  flex-direction: column;
  align-items: center;
}
 
.stat-item:last-child {
  margin-right: auto;
}
 
.number {
  font-size: 30rpx;
  color: #A19B99;
  font-weight: bold;
  margin-bottom: 4rpx;
}
 
.label {
  font-size: 24rpx;
  color: #B1ABA9;
}
 
.action-buttons {
  display: flex;
  gap: 16rpx;
}
 
.edit-btn {
  padding: 0 24rpx !important;
  background-color: #f5f5f5 !important;
  color: #333333 !important;
  border: none !important;
}
 
.settings-btn {
  width: 80rpx !important;
  background-color: #f5f5f5 !important;
  color: #333333 !important;
  border: none !important;
  padding: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
}
 
.function-cards {
  /* padding: 32rpx 0; */
  white-space: nowrap;
  overflow: auto;
  padding-bottom: 20rpx;
}
 
.card {
  display: inline-block;
  width: 180rpx;
  height: 80rpx;
  margin-left: 20rpx;
  background-color: rgba(60, 60, 60, 0.4);
  /* 灰色 + 20% 透明度 */
  border-radius: 16rpx;
  padding: 10rpx;
  box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
}
 
.card:last-child {
  margin-right: 24rpx;
}
 
.card-content {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
 
.card-title {
  font-size: 30rpx;
  color: #E7E1DF;
  font-weight: bold;
}
 
.card-subtitle {
  font-size: 20rpx;
  color: #BEBBB8;
}
 
.tab-section {
  padding: 0 32rpx;
}
 
.tab-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 48rpx;
}
 
.tab {
  position: relative;
  padding: 16rpx 0;
  display: flex;
  align-items: center;
}
 
.tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 48rpx;
  height: 4rpx;
  background-color: #333;
  border-radius: 2rpx;
}
 
.tab-text {
  font-size: 16px;
  color: #333;
  margin-right: 8rpx;
}
 
.tab-count {
  font-size: 16px;
  color: #999;
}
 
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48rpx 0;
  min-height: 600rpx;
}
 
.empty-icon {
  width: 200rpx;
  height: 200rpx;
  margin-bottom: 24rpx;
}
 
.empty-text {
  font-size: 14px;
  color: #999;
  /* margin-bottom: 24rpx; */
}
 
.publish-btn {
  background-color: #ffe411 !important;
  color: #333 !important;
  border: none !important;
  border-radius: 32rpx !important;
  padding: 0 48rpx !important;
}
</style>
<style lang="scss" scoped>
.swiper-box {
  // min-height: 600rpx;
  /* 或 100vh,或具体 px */
  min-height: 800px;
}
</style>