<template>
    <div class="content">
        <div class="header">
            <u-navbar
                :background="{backgroundColor: '#ffcb57'}"
                :border-bottom="false"
                title="意见反馈"
                title-color="#472d21"
            ></u-navbar>
        </div>
        <view class="wrap">
            <u-input v-model="content" type="textarea" height="240"></u-input>
            <view class="mc-btn">
                <u-button
                    :custom-style="{margin: '0 30rpx',backgroundColor: '#ffcb57',color: '#472d21'}"
                    hover-class="defaultBtnhover"
                    @click="placeOrder"
                >立即提交</u-button>
            </view>
        </view>
        <u-toast ref="uToast" />
    </div>
</template>

<script>
import request from '../../common/service';
export default {
    data() {
        return {
            content: '',
        };
    },
    onLoad() {},
    computed: {},
    methods: {
        placeOrder() {
            if (!this.content) {
                this.$refs.uToast.show({
                    title: '请完善信息后再提交！',
                });
                return;
            }
            request
                .post('/api/Feedback/SH', {
                    Model: {
                        FContent: this.content,
                    },
                })
                .then((res) => {
                    const { code, message } = res;
                    if (code === 0) {
                        this.$refs.uToast.show({
                            title: '提交成功！',
                            isTab: true,
                            url: '/pages/my/index',
                        });
                    } else {
                        this.$refs.uToast.show({
                            title: message,
                        });
                    }
                });
        },
    },
    onShareAppMessage(res) {
        if (res.from === 'button') {
            // 来自页面内分享按钮
            console.log(res.target);
        }
        return {
            title: '京台分享更多精彩',
            path: '/pages/index/index',
            imageUrl: '/static/images/share/WechatIMG96.png'
        };
    },
};
</script>

<style lang="scss" scoped>
.content {
    .header {
        background-color: #ffcb57;
    }
    .wrap {
        display: flex;
        flex-direction: column;
        height: calc(100vh - var(--window-top));
        width: 100%;
        /deep/.u-input {
            margin: 30rpx 32rpx;
            background-color: #fff;
            border-radius: 10rpx;
            .u-input__textarea {
                padding: 10rpx;
            }
        }
    }
}
</style>
