zhangxiaoxu123456
2021-12-06 f32f7d699607bb159d25dcf441942370aba2c968
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
<template>
    <view>
        <u-upload 
        @on-choose-fail="onChooseFail"  
        :before-remove="beforeRemove" 
        ref="upload" 
        :custom-btn="customBtn" 
        :show-upload-list="showUploadList" 
        :action="action" 
        :auto-upload="autoUpload" 
        :form-data="formData" name="img"
        :file-list="fileList"
        :show-progress="showProgress"
        :deletable="deletable" 
        :max-count="maxCount" 
        @on-click-preview="preciewClick"
        @on-list-change="onListChange">
            <!-- <u-avatar slot="addBtn"  v-if="img" :src="img"></u-avatar>
            <view v-else slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
                <u-icon name="photo" size="60" :color="$u.color['lightColor']"></u-icon>
            </view> -->
        </u-upload>
    </view>
</template>
 
<script>
    export default {
        name:"upload",
        data() {
            return {
                action: 'http://39.96.92.240:8099/user/updateImg',
                fileList: [],
                customBtn:false,
                showUploadList: true,
                autoUpload: true,
                showProgress: true,
                deletable: false,
                maxCount: 1,
                formData:{},
            };
        },
        mounted() {
            this.formData={userId:this.getStore("userInfo").id}
            let temp ={url:this.getStore("userInfo").img};
            this.fileList[0] = temp;
        },
        methods:{
            preciewClick() {
                console.log('1111111111')
            },
            onListChange(lists) {
                console.log('onListChange', lists);
                // this.lists = lists;
            },
            onChooseFail(e) {
                // console.log(e);
            },
            beforeRemove(index, lists) {
                return true;
            }
        }
    }
</script>
 
<style lang="scss" scoped>
.u-delete-icon {
        position: absolute;
        top: 10rpx;
        right: 10rpx;
        z-index: 10;
        border-radius: 100rpx;
        width: 44rpx;
        height: 44rpx;
        display: flex;
        align-items: center;
        justify-content: center;
    }
</style>