zhangwei
2024-08-27 71d2e42ae642cecb5e8f6776c702cd20bafe6c01
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
<template>
    <view class="">
        <view class="content chuany-flex chuany-align-end chuany-justify-center">
            <button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
                <!-- <image class="avatar" src="{{avatarUrl}}"></image> -->
                <up-avatar :src="avatarUrlImg" shape="circle" size='80'></up-avatar>
            </button>
 
        </view>
        <fui-list :topBorder='false'>
            <fui-list-cell arrow :bottomBorder='false' :padding="['20rpx', '32rpx', '20rpx', '32rpx']">
                <view class="fui-list__item">
                    <text>昵称</text>
                    <text class="fui-text__explain">{{userInfo.nickname}}</text>
                    <!-- <input type="nickname" class="fui-text__explain weui-input" placeholder="请输入昵称" /> -->
                </view>
            </fui-list-cell>
            <fui-list-cell arrow :bottomBorder='false' :padding="['20rpx', '32rpx', '20rpx', '32rpx']">
                <view class="fui-list__item">
                    <text>手机号</text>
                    <text class="fui-text__explain">{{userInfo.phone}}</text>
                </view>
            </fui-list-cell>
            <fui-list-cell arrow @click="goApply" :bottomBorder='false' :padding="['20rpx', '32rpx', '20rpx', '32rpx']">
                <text>申请接单</text>
            </fui-list-cell>
        </fui-list>
        <!-- <view class="tabbtns">
            <up-button color='#fece01' class="text-69" text="保存" @click=''></up-button>
        </view> -->
    </view>
</template>
 
<script setup>
    import {
        onLoad,
        onShow
    } from "@dcloudio/uni-app";
    import {
        ref,
        reactive,
        getCurrentInstance,
        toRefs
    } from 'vue';
    const {
        $upload,
        $api,
        $db
    } = getCurrentInstance().appContext.config.globalProperties
    onLoad(() => {
        // getUser()
    })
    onShow(() => {
        getUser()
    })
    let avatarUrlImg = ref('')
    let number1 = ref(0)
    let userInfo = reactive({
        nickname: '',
        phone: '',
        userWorker: false
    })
    // let src = "http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg"
    const goApply = () => {
        uni.navigateTo({
            url: '/pages/mine/apply'
        });
    }
    const onChooseAvatar = (e) => {
        const {
            avatarUrl
        } = e.detail
        avatarUrlImg.value = avatarUrl
    }
    const getUser = (e) => {
        $api.getUser().then(res => {
            userInfo.nickname = res.data.nickname
            userInfo.phone = res.data.phone
            $db.set('userInfo', JSON.stringify(res.data))
        })
    }
</script>
 
<style>
    .content {
        height: 300rpx;
        background: linear-gradient(to bottom, #fbec99, #ffffff);
    }
 
    .avatar-wrapper {
        border-radius: 50%;
        width: 80px !important;
        height: 80px;
        margin: 0;
        padding: 0;
        background-color: transparent;
    }
 
    .fui-list__item {
        flex: 1;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
 
    }
 
    .fui-text__explain {
        font-size: 28rpx;
        color: #7F7F7F;
        flex-shrink: 0;
    }
</style>