<!--
 * @Author: euzhi
 * @Description: 问题反馈
-->
<template>
<view class="appCotent">
    <div class="pull">
        <div class="view__content">
            <div class="view__title">
                问题/意见描述
            </div>
            <div class="why">
                <u--textarea maxlength='500' count v-model="feedback.fbContent" placeholder="请填写10字以上的问题描述，以便我们更好地帮 您解决问题"></u--textarea>
            </div>
        </div>
        <div class="view__content">
            <div class="view__title">
                联系方式
            </div>
            <div class="why">
                <u--textarea height='20' v-model="feedback.contact" placeholder="请填写您的手机号或邮箱，便于我们联系 您解决问题"></u--textarea>
            </div>
        </div>
        <div class="view__btn view__no__bind" @click="addFeedback()">
            提交
        </div>
    </div>
</view>
</template>

<script>
export default {
    data() {
        return {
            feedback: {
                //反馈内容
                fbContent: '',
                //联系方式
                contact: '',
            },
        };
    },
    methods: {
        addFeedback() {
            let regChinese = /^[^\u4e00-\u9fa5]{0,}$/;
            let checkChinese = regChinese.test(this.feedback.contact);
            if(!checkChinese){
                 uni.showToast({
                        title: '请填写正确的联系方式',
                        icon: 'none',
                    })
                return;
            }
            let opts = {
                url: '/app/user/feedback',
                method: 'post'
            };
            this.http.httpTokenRequest(opts, this.feedback).then(res => {
                if (res.data.code == 200) {
                    uni.showToast({
                        title: '提交成功',
                        icon: 'success',
                    })
                } else {
                    uni.showToast({
                        title: '提交失败',
                        icon: 'error',
                    })
                }
            })
        }
    },
}
</script>

<style lang="scss" scoped>
.pull {
    padding: 40rpx 40rpx;

    .why {

        .u-textarea {
            background: #f6f6f6;
            border: none;
            border-radius: 12rpx;
        }
    }

    .view__content {
        background: #FFFFFF;
        box-shadow: 0rpx 0rpx 28rpx 1rpx rgba(232, 232, 232, 0.2);
        border-radius: 20rpx;
        padding: 30rpx;
        margin-bottom: 30rpx;

        .view__title {
            font-size: 32rpx;
            font-family: PingFang SC;
            font-weight: 500;
            color: #333333;
            margin-bottom: 19rpx;
        }

    }

    .view__btn {
        width: 670rpx;
        height: 76rpx;
        text-align: center;
        line-height: 76rpx;
        margin: 0 auto;
        font-size: 32rpx;
    }

    .view__no__bind {
        background: url('@/static/move-car/move-car-view2.png') no-repeat;
        margin-bottom: 30rpx;
        background-size: contain;
        color: rgba(255, 255, 255, 1);
        margin-top: 60rpx;
    }

    .view__back {
        background: url('@/static/move-car/move-car-view1.png') no-repeat;
        background-size: contain;
        color: rgba(153, 153, 153, 1);
    }
}
</style>
