linwe
2024-08-08 3c738f4fe2762bba8087e5a22fc0dc06560eab0e
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
<template>
    <view class="">
        <view class="container">
            <u--textarea v-model="content" placeholder="说点什么" border="none"></u--textarea>
            <view class="upload flex flex-wrap">
                <u-upload :fileList="form.images" :previewFullImage="uploadConfig.previewFullImage"
                    :accept="uploadConfig.acceptImg" :multiple="uploadConfig.multiple" :maxCount="uploadConfig.maxCount"
                    :capture="uploadConfig.capture" @afterRead="afterReadImg" @delete="deletePic">
                    <view class="upload-item upload-icon flex_base">
                        <u-icon name="camera-fill" color="#DBDBDB" size="40"></u-icon>
                    </view>
                </u-upload>
            </view>
            <view class="flex">
                <u-icon name="info-circle-fill" color="#2DD3C2"></u-icon>
                <text class="f-24 c-99 ml-20">请勿涉及不文明及违规内容,违法必究!发现违法内容及时向客服举报!</text>
            </view>
        </view>
        <footer-btn @click="submitInfo" />
    </view>
</template>
 
<script>
    import uploadMixin from "@/mixin/uploadMixinPicCheck";
    import {
        handlePublish
    } from "@/api/circle/circle.js"
    export default {
        mixins: [uploadMixin],
        data() {
            return {
                form: {
                    images: []
                },
                content: "",
                roleType: 0
            }
        },
 
        onLoad() {
            let role = uni.getStorageSync('activeRole')
            if (role.roleAlias == "inhabitant") {
                this.roleType = 0
            } else {
                this.roleType = 1;
            }
        },
 
        methods: {
 
            getImagesUrl() {
                if (this.form.images.length) {
                    let arr = [];
                    for (let i of this.form.images) {
                        arr.push(i.name)
                    }
                    return arr.join(",")
                } else {
                    return ""
                }
            },
 
            submitInfo() {
                let param = {
                    circleText: this.content,
                    circleImages: this.getImagesUrl(),
                    circleType: this.roleType,
                }
                let role = uni.getStorageSync('activeRole')
                if (role.roleAlias == "inhabitant") {
                    param.houseCode = uni.getStorageSync("siteInfo").houseCode
                }
                handlePublish(param).then(res => {
                    if (res.code == 200) {
                        uni.showToast({
                            title: res.msg
                        })
                        setTimeout(() => {
                            uni.navigateBack();
                            uni.$emit("refreshList")
                        }, 1000)
                    }
                })
            }
        }
    }
</script>
 
<style lang="scss">
    .container {
        padding: 20rpx 30rpx 0;
 
        .upload {
            padding: 30rpx 0;
            border-bottom: 1px solid #F5F5F5;
            margin-bottom: 20rpx;
        }
 
        .upload-item {
            width: 140rpx;
            height: 140rpx;
            border-radius: 8rpx;
            background: #F5F5F5;
        }
    }
</style>