zhengyiming
2025-02-10 0470145fcd755d3f87bffc7a985bd3cc82c5f3f6
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
<template>
  <div class="mine-page-top-view">
    <slot name="avatar"></slot>
    <div class="setting-wrapper" v-if="showUserHomePageBtn" @click="goUserHomePage">
      <div class="setting-text">我的主页</div>
    </div>
  </div>
  <div class="mine-page-operation-wrapper" v-if="showOperation">
    <div class="mine-page-operation-item" @click="goEditProfile">
      <img class="mine-page-operation-item-icon" :src="IconEdit" />
      <div class="mine-page-operation-item-text">编辑资料</div>
      <img class="mine-page-operation-item-arrow" :src="IconArrow" />
    </div>
    <button class="mine-page-operation-item share" open-type="share">
      <!-- <div class="mine-page-operation-item-inner"> -->
      <img class="mine-page-operation-item-icon" :src="IconCard" />
      <div class="mine-page-operation-item-text">发送名片</div>
      <img class="mine-page-operation-item-arrow" :src="IconArrow" />
      <!-- </div> -->
    </button>
  </div>
</template>
 
<script setup lang="ts">
import { useUser, useIsLogin } from '@/hooks';
import Taro from '@tarojs/taro';
import IconEdit from '@/assets/mine/icon-edit.png';
import IconCard from '@/assets/mine/icon-card.png';
import IconArrow from '@/assets/mine/icon-arrow.png';
 
defineOptions({
  name: 'UserHomeTopView',
});
 
type Props = {
  showUserHomePageBtn?: boolean;
  showOperation?: boolean;
};
 
const props = withDefaults(defineProps<Props>(), {
  showUserHomePageBtn: false,
  showOperation: false,
});
 
const { userDetail } = useUser();
 
function goUserHomePage() {
  Taro.navigateTo({
    url: `${RouterPath.userHomePage}?userId=${userDetail.value?.userId}`,
  });
}
 
function goEditProfile() {
  Taro.navigateTo({
    url: RouterPath.userInfo,
  });
}
</script>
 
<style lang="scss">
@import '@/styles/common.scss';
 
.mine-page-top-view {
  padding-top: 34px;
  display: flex;
  margin-bottom: 20px;
 
  .setting-wrapper {
    height: 56px;
    background: rgba(#000, $alpha: 0.15);
    border-radius: 200px 0px 0px 200px;
    align-self: center;
    display: flex;
    align-items: center;
    margin-right: calc(boleGetCssVar('size', 'body-padding-h') * -1);
    padding-left: 24px;
    padding-right: 16px;
 
    .setting-icon {
      width: 32px;
      height: 32px;
      margin-right: 4px;
      margin-left: 32px;
    }
 
    .setting-text {
      font-weight: 400;
      font-size: 24px;
      color: #ffffff;
      line-height: 34px;
    }
  }
}
 
.mine-page-operation-wrapper {
  display: flex;
  padding-top: 22px;
  margin-bottom: 36px;
 
  .mine-page-operation-item {
    flex: 1;
    min-width: 0;
    align-items: center;
    display: flex;
    padding-left: 28px;
    border-right: 1px solid #efefef;
 
    &:last-child {
      border-right: none;
    }
 
    &.share {
      background-color: transparent;
      padding-right: 0;
      appearance: none;
      text-align: left;
 
      &::after {
        border: none;
      }
      /* .mine-page-operation-item-inner {
        display: flex;
        align-items: center;
      } */
    }
 
    .mine-page-operation-item-icon {
      width: 32px;
      height: 32px;
      margin-right: 8px;
    }
 
    .mine-page-operation-item-text {
      flex: 1;
      min-width: 0;
      font-weight: bold;
      font-size: 24px;
      color: boleGetCssVar('text-color', 'primary');
      line-height: 34px;
    }
 
    .mine-page-operation-item-arrow {
      width: 28px;
      height: 28px;
      margin-right: 28px;
    }
  }
}
</style>