罗广辉
2025-10-23 6d009f08368f93713c1ebeca6acde4163042faa4
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
<!-- 我的 -->
<template>
    <view class="page-wrap">
        
        <view class="flex items-center pb-30rpx pl-30rpx pr-20rpx">
            <view class="mr-20rpx">
                <u-avatar :src="userStore?.userInfo?.avatar" size="70" />
            </view>
            <view class="flex-1">
                <view class="userName">{{ userStore?.userInfo?.nick_name }}</view>
                <view class="departs">
                    <img src="/src/static/images/user/mobile.svg" alt="" />
                    <span>{{user.deptName}}</span>
                </view>
            </view>
            <view class="rightLogo">
                <img src="/src/static/images/user/logo2.svg" alt="" />
            </view>
        </view>
        <view class="personalInformation">
            <div class="message">
                <div class="messagebox">个人信息</div>
                <div class="editInfo" @click="handelEdit(1)">点击编辑
                <img src="/src/static/images/user/rightBtn.svg" alt="" /></div>
            </div>
            <div class="passwordBox">
                <div class="messagebox">修改密码</div>
                <div class="editInfo" @click="handelEdit(2)">点击编辑 <img src="/src/static/images/user/rightBtn.svg" alt="" /></div>
            </div>
        </view>
 
        <view class="mt-20rpx">
            <div class="goOutStyle" @click="logOut">退出登录</div>
        </view>
        <div class="bottomLogo"><img src="/src/static/images/user/logo1.svg" alt="" /></div>
    </view>
</template>
 
<script setup>
    import {
        getUserInfo,
        updateInfo,
        updatePassword
    } from '@/api/user/index.js';
    import {
        useClipboard
    } from "@/hooks";
    import {
        useUserStore
    } from "@/store/index.js";
    import {
        onShow
    } from "@dcloudio/uni-app";
    import {
        getDeviceRegionApi
    } from "@/api/map.js";
 
    const {
        setClipboardData,
        getClipboardData
    } = useClipboard();
    const userStore = useUserStore();
    const user = ref('')
    const getUserInfoData = () => {
        getUserInfo().then(res => {
             user.value = res.data.data;
        });
    };
 
    function logOut() {
        userStore.setUserInfo(null)
        uni.redirectTo({
            url: '/pages/login/index'
        })
    }
 
    function getDeviceRegion() {
        getDeviceRegionApi().then(res => {
            // console.log(res.data.data, '用户设备')
        })
    }
    const handelEdit=(val)=>{
 
        if(val === 1){
            uni.navigateTo({
              url: `/subPackages/userDetail/infos/index`
            });
        }else {
            uni.navigateTo({
              url: `/subPackages/userDetail/password/index`
            });
        }
 
    }
    // 登录鉴权,微信小程序端点击tabbar的底层逻辑不触发uni.switchTab,需要在页面onShow生命周期中校验权限
    onShow(async () => {
        getDeviceRegion()
        getUserInfoData()
        uni.setTabBarItem({
          index: 2, // Tab 的索引(从0开始)
          visible: false,
        })
        uni.setTabBarItem({
          index: 3, // Tab
          visible: true,
        });
    });
</script>
<style scoped lang="scss">
    .page-wrap {
        width: 100%;
        height: 100%;
        background: url('/src/static/images/user/allBg.svg') no-repeat center center;
        background-size: cover;
        padding-top: 44px;
    }
 
    .userName {
        font-family: "Source Han Sans CN";
        font-weight: 500;
        font-size: 18px;
        color: #000000;
 
    }
 
    .departs {
        display: flex;
        align-items: center;
        margin-top: 11px;
 
        span {
            font-family: "Source Han Sans CN";
            font-weight: 400;
            font-size: 14px;
            color: rgba(0, 0, 0, 0.6);
            margin-left: 3px;
        }
    }
 
    .rightLogo {
        width: 100px;
        height: 40px;
    }
       .bottomLogo {
           position: absolute;
           bottom: 25px;
           left: 0;
           right: 0;
           margin: 0 auto;
           text-align: center;
       }
    .goOutStyle {
        width: 295px;
        height: 38px;
        background: #1D6FE9;
        border-radius: 20px 20px 20px 20px;
        font-family: "Source Han Sans CN";
        font-weight: 400;
        font-size: 14px;
        color: #FFFFFF;
        text-align: center;
        line-height: 38px;
        margin: auto;
        margin-top: 57px;
    }
 
    .personalInformation {
        display: flex;
        justify-content: space-between;
        padding: 0 12px;
 
        .message,
        .passwordBox {
            width: 170px;
            height: 80px;
            .messagebox{
                padding: 10px 12px;
                font-family: "Source Han Sans CN";
                font-weight: 500;
                font-size: 14px;
                color: #000000;
            }
            .editInfo {
                padding: 10px 12px;
                color: rgba(0, 0, 0, 0.5);
                font-family: "Source Han Sans CN";
                font-weight: 400;
                font-size: 12px;
                display: flex;
                align-items: center;
                img{
                    width: 14px;
                    height: 14px;
                }
            }
        }
 
        .message {
            background: url('/src/static/images/user/info.svg') no-repeat center;
            background-size: 100% 100%;
 
        }
 
        .passwordBox {
            background: url('/src/static/images/user/password.svg') no-repeat center;
            background-size: 100% 100%;
 
        }
    }
</style>