<template>
	<view class="allbg">
		<!-- 顶部自定义导航 -->
		<tn-nav-bar :isBack="false" backTitle="" :bottomShadow="true" backgroundColor="transparent">
			<view class="custom-nav tn-flex tn-flex-col-center tn-flex-row-left">
				<view style="padding-left: 15rpx;" @click="goBack()">
					<text class="tn-icon-left" style="font-size: 40rpx;color: #FFFFFF;"></text>
				</view>
				<view class="tn-margin-top"
					style="">
					<tn-tabs :list="[{name:''}]" :current="topCurrent" activeColor="#ffffff" :bold="false"
						:fontSize="36"></tn-tabs>
				</view>
			</view>
		</tn-nav-bar>
		<!-- :style="{paddingTop: vuex_custom_bar_height + 'px'}" -->
		<view class="tn-safe-area-inset-bottom bgmsg" >
			<view class="tn-flex tn-flex-row-between tn-flex-col-center tn-padding-top tn-margin">
				<view class="tn-flex justify-content-item bfre">
					<view class="bf tn-padding-right-xs">反馈人</view>
				</view>
			
			<view class=""  style="border-radius: 10rpx;text-align: right;">
				<input placeholder="填写姓名" name="input" v-model="formData.name" placeholder-style="color:#9B9B9B"></input>
			</view>
		</view>
		<view class="line"></view>
			<view class="tn-flex tn-flex-row-between tn-flex-col-center  tn-margin">
				<view class="tn-flex justify-content-item bfre">
					<view class="bf tn-padding-right-xs">联系方式</view>
				</view>
			
			<view class=""  style="border-radius: 10rpx;text-align: right;">
				<input placeholder="填写联系方式"  v-model="formData.phone" name="input" placeholder-style="color:#9B9B9B"></input>
			</view>
		</view>
		<view class="line"></view>
			<view class="tn-flex tn-flex-row-between tn-flex-col-center  tn-margin">
				<view class="tn-flex justify-content-item bfre">
					<view class="bf tn-padding-right-xs">反馈内容</view>
				</view>
			</view>
			<view class="tn-bg-gray--light tn-padding tn-margin" style="border-radius: 10rpx;">
				<textarea maxlength="500" v-model="formData.content" placeholder="填写反馈内容" placeholder-style="color:#9B9B9B"></textarea>
			</view>

		</view>
		<!-- 悬浮按钮-->
		<view class='tn-flex tn-tabbar-height' style="margin-top: 50rpx;">
			<view class="tn-flex-1 justify-content-item tn-margin-sm tn-text-center">
					<tn-button shape="round" backgroundColor="#2368F2" fontColor="#ffffff" fontSize="32rpx"  width="616rpx" height="85rpx"
						 @tap="submit">
						<!-- <text class="tn-icon-light tn-padding-right-xs tn-color-black"></text> -->
						<text style="font-size: 32rpx;">提交信息</text>
					</tn-button>
				</view>
		</view>

	</view>
</template>

<script>
import { messageAdd} from "@/util/api";
import store from "@/store";
	export default {
		data() {
			return {
				topCurrent: 0,
        formData:{
          name:'',
          phone:'',
          content:'',
          association_id:store.state.Gid,
          member_id:uni.getStorageSync('uid'),
          createtime:new Date().toISOString().slice(0, 19).replace('T', ' ')
        }
			}
		},
		onLoad() {

		},
		methods: {
      submit(){
        messageAdd(this.formData)
            .then(res => {
              console.log(res);
              if(res.code==1){
                uni.showToast({
                  title: '提交成功！',
                  icon: 'none',
                  duration: 2000
                });
                this.formData.name='';
                this.formData.phone='';
                this.formData.content='';
              }else{
                uni.showToast({
                  title: res.msg,
                  icon: 'none',
                  duration: 2000
                });
              }
            })
            .catch(error => {
              uni.showToast({
                title: error,
                icon: 'none',
                duration: 2000
              });
            })
      },
			// 跳转
			tn(e) {
				uni.navigateTo({
					url: e,
				});
			},
			goBack() {
				if (getCurrentPages().length > 1) {
					uni.navigateBack()
				} else {
					uni.redirectTo({
						url: '/pages/index/index'
					})

				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	.allbg{
		background: url('https://ysx.hschool.com.cn/uploads/8/20250508/71582b6f021a4bed1b409ee3d48bf298.png') no-repeat;
		background-size: 100%;
		position: absolute;
		width: 100%;
	}
	/* 底部悬浮按钮 start*/
	.tn-tabbar-height {
		min-height: 100rpx;
		height: calc(120rpx + env(safe-area-inset-bottom) / 2);
	}

	.tn-footerfixed {
		position: fixed;
		width: 100%;
		bottom: calc(30rpx + env(safe-area-inset-bottom));
		z-index: 1024;
		box-shadow: 0 1rpx 6rpx rgba(0, 0, 0, 0);
	}

	/* 底部悬浮按钮 end*/

	/* 标签内容 start*/
	.tn-tag-content {
		&__item {
			display: inline-block;
			line-height: 45rpx;
			padding: 10rpx 30rpx;
			margin: 20rpx 20rpx 5rpx 0rpx;

			&--prefix {
				padding-right: 10rpx;
			}
		}
	}

	/* 标签内容 end*/
	.bgmsg{
		background-color: #FFFFFF;
		border-radius: 18rpx;
		margin: 0 30rpx;
		margin-top: 440rpx;
		padding-bottom: 2rpx;
	}

	.bfre{
		position: relative;
		.bf{
			margin-left: 12rpx;
			&::before{
				border-radius: 936rpx;
				content: ' ';
				width: 4rpx;
				height: 24rpx;
				background: #2368F2;
				position: absolute;
				top: 8rpx;
				left: 0;
			}
			
		}
	}

	.line {
		width: 630rpx;
		height: 1rpx;
		background: #E5E5E5;
		margin: 0 auto;
	}
</style>
