<template>
	<view class="page" :style="themeColor">
		<view
			class="flex flex-direction flex-wrap align-stretch justify-center benben-position-layout flex iNeedFeedback_flex_0"
			:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
			<view class='flex flex-wrap align-stretch justify-between iNeedFeedback_fd0_0'>
				<view class='flex flex-wrap align-center iNeedFeedback_fd0_0_c0' @tap.stop="handleJumpDiy"
					data-type="back" data-url="1">
					<text class='fu-iconfont2  iNeedFeedback_fd0_0_c0_c0'>&#xE794;</text>
				</view>
				<view class='flex flex-wrap align-center'>
					<text class='iNeedFeedback_fd0_0_c1_c0'>我要反馈</text>
				</view>
				<view class='flex align-center justify-end iNeedFeedback_fd0_0_c2' >
				</view>
			</view>

		</view>
		<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
		<!---意见反馈表单flex布局开始-->
		<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout iNeedFeedback_flex_1">
			<view class='flex flex-wrap align-center iNeedFeedback_fd1_0'>
				<text class='iNeedFeedback_fd1_0_c0'>反馈类型</text>
			</view>
			<view class='flex flex-direction flex-wrap align-stretch iNeedFeedback_fd1_1'>
				<benben-select-diy ref="showSelectPopup1681201808828" class-name='flex flex-wrap align-center flex'
					:items.sync="select_type" v-model="select_id" default-type="aid" default-label="title"
					:allow-cancel='false' type="radio" :disabled='false'>
					<template v-for='(item,key0) in select_type'>
						<view v-if="item.isSelected"
							class='flex align-center justify-center flex iNeedFeedback_fd1_1_c0_c0' :key="key0"
							@tap="$refs.showSelectPopup1681201808828.tapHandle(key0)">
							<text class='flex-sub iNeedFeedback_fd1_1_c0_c0_c0'>{{item.title}}</text>
						</view>
						<view v-else class='flex align-center justify-center iNeedFeedback_fd1_1_c0_c1' :key="key0"
							@tap="$refs.showSelectPopup1681201808828.tapHandle(key0)">
							<text class='iNeedFeedback_fd1_1_c0_c1_c0'>{{item.title}}</text>
						</view>
					</template>
				</benben-select-diy>
			</view>
			<text class='iNeedFeedback_fd1_2'>反馈内容</text>
			<view class='flex flex-direction flex-wrap align-stretch iNeedFeedback_fd1_3'>
				<view class='flex flex-wrap iNeedFeedback_fd1_3_c0'>
					<textarea class='flex iNeedFeedback_input_fd1_3_c0' confirm-type="done"
						:placeholder="'问题描述的越详细，有助于我们更快的解决问题'" :maxlength="240"
						placeholder-style="color:#999;font-size:28rpx" v-model="problemDescription" />

				</view>
				<view class='flex flex-direction flex-wrap align-stretch'>
					<benben-images-upload ref="benbenImagesUploadfd1_3_c1_c0" :img-list.sync="singleImageUpload"
						:is-show-tips='true' :img-ids.sync="imgs_ids" :maxlength="6">
						<template #content="{ num, maxlength, isShow, imgList }">
							<view class="flex flex-wrap align-start flex iNeedFeedback_fd1_3_c1_c0">

								<view v-for="(image, index) in imgList" :key="index"
									class='flex position-relative iNeedFeedback_fd1_3_c1_c00'>
									<text class='fu-iconfont2 position-absolute iNeedFeedback_fd1_3_c1_c000'
										@tap.stop="$refs.benbenImagesUploadfd1_3_c1_c0.delImage(index)">&#xE8E7;</text>
									<image class='iNeedFeedback_fd1_3_c1_c001'
										@tap.stop="$refs.benbenImagesUploadfd1_3_c1_c0.previewImage(index)"
										mode="aspectFill" :src='image'></image>
								</view>

								<image class='iNeedFeedback_fd1_3_c1_c01'
									@tap.stop="$refs.benbenImagesUploadfd1_3_c1_c0.manyChooseImage()" v-if="isShow"
									mode="aspectFit" :src='STATIC_URL+"122.png"'></image>
								<text class='image_upload_tips iNeedFeedback_fd1_3_c1_c02'>请上传应用截图，最多上传6张</text>
							</view>
						</template>
					</benben-images-upload>
				</view>
			</view>
		</view>

		<!---意见反馈表单flex布局结束-->
		<!---flex布局flex布局开始-->
		<view class="flex benben-flex-layout flex-wrap align-center">
			<view class='flex flex-wrap align-center flex-sub iNeedFeedback_fd2_0'>
			</view>
		</view>

		<!---flex布局flex布局结束-->
		<!---flex布局flex布局开始-->
		<view class="flex benben-flex-layout flex-wrap align-center iNeedFeedback_flex_3">
			<view class='flex flex-direction flex-wrap align-start flex-sub iNeedFeedback_fd3_0'>
				<view class='flex flex-wrap align-center'>
					<text class='iNeedFeedback_fd3_0_c0_c0'>请留下您的联系方式</text>
				</view>
				<view class='flex flex-wrap align-center iNeedFeedback_fd3_0_c1'>
					<input class='iNeedFeedback_fd3_0_c1_c0' type="text" placeholder="手机号/邮箱/QQ号" confirm-type="done"
						:maxlength="-1" placeholder-style="color:rgba(191, 191, 191, 1);font-size:28rpx"
						v-model="contactInformation" />
				</view>
			</view>
		</view>

		<!---flex布局flex布局结束-->
		<view class="flex flex-wrap align-start justify-center benben-position-layout flex iNeedFeedback_flex_4">
			<button class='flex-sub iNeedFeedback_fd4_0' @tap.stop="sumbitFunc()">提交</button>

		</view>
		<view :style="{height: '136rpx'}"></view>


	</view>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'
	export default {
		components: {},


		data() {
			return {
				"select_id": "",
				"select_type": [],
				"problemDescription": "",
				"singleImageUpload": [],
				"contactInformation": "",
				imgs_ids:"",
				is_checked:false
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			this.getFeedBackFunc()
		},
		
		methods: {
			//获取反馈类型列表
			async getFeedBackFunc() {
				//请求方法
				//数据验证
			
				let datafeedBackList = await this.$api.post(global.apiUrls.post636dbfbfd7b81, {
			
				});
				if (datafeedBackList.data.code != 1) {
					this.$message.info(datafeedBackList.data.msg);
					return
				}
				let infofeedBackList = datafeedBackList.data;
				this.select_type = infofeedBackList.data
			},
			//提交
			sumbitFunc() {
				if(this.is_checked) return
				if (!validate(this.select_id, 'require')) {
					this.$message.info('反馈类型不能为空');
					return false;
				}
				if (!validate(this.problemDescription, 'require')) {
					this.$message.info('问题描述不能为空');
					return false;
				}
				
				if (!(this.singleImageUpload.length > 0)) {
					this.$message.info('图片不能为空');
					return false;
				}
				if (!validate(this.contactInformation, 'require')) {
					this.$message.info('联系方式不能为空');
					return false;
				}
				let thumb = this.singleImageUpload.length>0?this.imgs_ids:""
				console.log(thumb)
				this.is_checked = true
				this.$api.post(global.apiUrls.post636dc0bcb5991,{
					thumb:thumb,
					type:this.select_id,
					body:this.problemDescription,
					contact:this.contactInformation
				}).then(res=>{
					this.$message.info(res.data.msg);
					if(res.data.code==1){
						setTimeout(() => {
							this.$urouter.navigateBack(1);
						}, 800)
					}else{
						this.is_checked = false
					}
				})
				
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: rgba(255, 255, 255, 1);
		background-size: 100% auto !important;
	}

	.iNeedFeedback_flex_0 {
		border-bottom: 1px solid #eee;
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.iNeedFeedback_fd0_0_c2 {
		padding: 0rpx 0rpx 0rpx 0rpx;
		width: 200rpx;
	}

	.iNeedFeedback_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333333;
		line-height: 50rpx;
	}

	.iNeedFeedback_fd0_0_c0_c0 {
		font-size: 36rpx;
		font-weight: 400;
		color: #333;
	}

	.iNeedFeedback_fd0_0_c0 {
		width: 200rpx;
	}

	.iNeedFeedback_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
		line-height: 88rpx;
	}

	.iNeedFeedback_flex_1 {
		background: #fff;
		background-size: 100% auto !important;
	}

	.iNeedFeedback_fd1_3_c1_c02 {
		font-size: 24rpx;
		color: rgba(191, 191, 191, 1);
		font-weight: 400;
		width: 100%;
	}

	.iNeedFeedback_fd1_3_c1_c01 {
		width: 160rpx;
		height: 160rpx;
		margin: 0rpx 24rpx 24rpx 0rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.iNeedFeedback_fd1_3_c1_c001 {
		width: 160rpx;
		height: 160rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.iNeedFeedback_fd1_3_c1_c000 {
		top: 0rpx;
		right: 0rpx;
		z-index: 10;
		color: #ff5536;
	}

	.iNeedFeedback_fd1_3_c1_c00 {
		margin: 0rpx 24rpx 24rpx 0rpx;
	}

	.iNeedFeedback_fd1_3_c1_c0 {
		padding: 24rpx 0rpx 0rpx 24rpx;
	}

	.iNeedFeedback_input_fd1_3_c0 {
		width: 100%;
		height: 166rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #333;
	}

	.iNeedFeedback_fd1_3_c0 {
		width: 686rpx;
		border-radius: 10rpx 10rpx 10rpx 10rpx;
		margin: 0rpx 0rpx 0rpx 32rpx;
		padding: 0rpx 0rpx 24rpx 0rpx;
	}

	.iNeedFeedback_fd1_3 {
		margin: 0rpx 0rpx 32rpx 0rpx;
	}

	.iNeedFeedback_fd1_2 {
		font-size: 32rpx;
		font-weight: 500;
		color: #1A1A1A;
		line-height: 109rpx;
		margin: 0rpx 32rpx 0rpx 32rpx;
	}

	.iNeedFeedback_fd1_1_c0_c1_c0 {
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
	}

	.iNeedFeedback_fd1_1_c0_c1 {
		border: 1px solid rgba(191, 191, 191, 1);
		background: #fff;
		margin: 24rpx 16rpx 0rpx 16rpx;
		height: 64rpx;
		border-radius: 12rpx 12rpx 12rpx 12rpx;
		width: 206rpx;
		color: rgba(153, 153, 153, 1);
		font-size: 28rpx;
		font-weight: 400;
		text-align: center;
	}

	.iNeedFeedback_fd1_1_c0_c0_c0 {
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
	}

	.iNeedFeedback_fd1_1_c0_c0 {
		background: rgba(255, 147, 0, 1);
		margin: 24rpx 16rpx 0rpx 16rpx;
		height: 64rpx;
		border-radius: 12rpx 12rpx 12rpx 12rpx;
		width: 206rpx;
		color: rgba(255, 255, 255, 1);
		font-size: 28rpx;
		line-height: 64rpx;
		font-weight: 400;
		text-align: center;
	}

	.iNeedFeedback_fd1_1 {
		border-bottom: 10px solid rgba(246, 247, 248, 1);
		padding: 0rpx 16rpx 16rpx 16rpx;
	}

	.iNeedFeedback_fd1_0_c0 {
		font-size: 32rpx;
		font-weight: 500;
		color: #1A1A1A;
		margin: 0rpx 32rpx 0rpx 32rpx;
	}

	.iNeedFeedback_fd1_0 {
		padding: 32rpx 0rpx 0rpx 0rpx;
	}

	.iNeedFeedback_fd2_0 {
		background: rgba(246, 247, 249, 1);
		height: 20rpx;
		background-size: 100% auto !important;
	}

	.iNeedFeedback_flex_3 {
		padding: 0rpx 0rpx 0rpx 32rpx;
	}

	.iNeedFeedback_fd3_0_c1_c0 {
		width: 600rpx;
	}

	.iNeedFeedback_fd3_0_c1 {
		margin: 32rpx 0rpx 0rpx 0rpx;
	}

	.iNeedFeedback_fd3_0_c0_c0 {
		color: #1A1A1A;
		font-size: 32rpx;
		font-weight: 500;
		line-height: 32rpx;
	}

	.iNeedFeedback_fd3_0 {
		border-bottom: 1px solid #eee;
		padding: 40rpx 0rpx 24rpx 0rpx;
	}

	.iNeedFeedback_flex_4 {
		width: 750rpx;
		height: 136rpx;
		overflow: hidden;
		z-index: 10;
		bottom: calc(0rpx + var(--window-bottom));
	}

	.iNeedFeedback_fd4_0 {
		background: rgba(255, 147, 0, 1);
		border-radius: 100rpx 100rpx 100rpx 100rpx;
		font-size: 32rpx;
		color: #fff;
		margin: 0rpx 32rpx 0rpx 32rpx;
		height: 88rpx;
		line-height: 88rpx;
		width: 686rpx;
		font-weight: 400;
	}
</style>
