zengh
2022-05-09 52c39f5e2711e5535b689b66dfa5e100c7882b7f
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
<template>
    <view class="nick_name">
        <view class="interval"></view>
        <view class="row nick_name_info">
            <text class="lable">昵称</text>
            <input placeholder="请输入昵称" v-model="name">
        </view>
        <view class="interval"></view>
        <view class="btn">
            <button class="btn-update" @click="updateUserInfo()">确认修改</button>
        </view>
    </view>
</template>
 
<script>
    export default{
        data (){
            return {
                name:"",
                pathUrl:this.$store.state.piAPI + "/blade-user",
                // pathUrl:"http://localhost:8102"
            }
        },
        onLoad(option) {
            //获取页面传递的参数数据
            this.name = option.name;
        },
        methods:{
            //修改用户昵称信息
            updateUserInfo(){
                uni.request({
                    url:this.pathUrl + "/updateUserInfo",
                    method:"POST",
                    data:{
                        id: this.$store.state.puserID,
                        name:this.name
                    },
                    success:(res)=> {
                        if(res.data.code==200){
                            uni.showToast({
                                title: '修改成功!',
                                duration: 2000
                            });
                        }
                    }
                })
            }
        }
    }
</script>
<style lang="scss">
    page{
        background-color: rgba($color: #cdcdcd, $alpha: 0.2);
    }
</style>
<style lang="scss" scoped>
    .nick_name{
        width: 100%;
        height: 100%;
    }
    .interval {
        width: 100%;
        height: 30rpx;
    }
    
    .nick_name_info{
        background-color: #FFFFFF;
        height: 90rpx;
        width: 100%;
        line-height: 90rpx;
        
        
        .lable{
            float: left;
            margin-left: 30rpx;
            font-size: 28rpx;
        }
        
        input{
            // background-color: #009F95;
            height: 90rpx;
            width: 80%;
            line-height: 90rpx;
            position: absolute;
            left: 80px;
            font-size: 28rpx;
        }
    }
    
    .btn{
        width: 100%;
        text-align: center;
        
        .btn-update {
            line-height: 75rpx;
            border-radius: 50px;
            width: 90%;
            height: 75rpx;
            background-color: #00BFFF;
            font-size: 28rpx;
            
            letter-spacing: 3rpx;
            color: #FFFFFF;
            outline: none;
        }
    }
    
    
    
</style>