lin
2024-03-21 f843c9a44fd437c2f26186b91dd950221666caac
圈子发布新增housecode
1 files modified
69 ■■■■■ changed files
pages/circle/publish.vue 69 ●●●●● patch | view | raw | blame | history
pages/circle/publish.vue
@@ -22,7 +22,9 @@
<script>
    import uploadMixin from "@/mixin/uploadMixinPicCheck";
    import { handlePublish } from "@/api/circle/circle.js"
    import {
        handlePublish
    } from "@/api/circle/circle.js"
    export default {
        mixins: [uploadMixin],
        data() {
@@ -30,50 +32,55 @@
                form: {
                    images: []
                },
                content:"",
                roleType:0
                content: "",
                roleType: 0
            }
        },
        onLoad(){
            let role =  uni.getStorageSync('activeRole')
            if(role.roleAlias == "inhabitant"){
        onLoad() {
            let role = uni.getStorageSync('activeRole')
            if (role.roleAlias == "inhabitant") {
                this.roleType = 0
            }else {
            } else {
                this.roleType = 1;
            }
        },
        methods: {
            getImagesUrl(){
                if(this.form.images.length){
            getImagesUrl() {
                if (this.form.images.length) {
                    let arr = [];
                    for(let i of this.form.images){
                    for (let i of this.form.images) {
                        arr.push(i.name)
                    }
                    return arr.join(",")
                }else {
                } else {
                    return ""
                }
                }
            },
            submitInfo() {
                 handlePublish({
                     circleText:this.content,
                     circleImages:this.getImagesUrl(),
                     circleType:this.roleType
                 }).then(res=>{
                     if(res.code == 200){
                         uni.showToast({
                             title:res.msg
                         })
                         setTimeout(()=>{
                             uni.navigateBack();
                             uni.$emit("refreshList")
                         },1000)
                     }
                 })
                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)
                    }
                })
            }
        }
    }