<template>
	<view class="appWrapper">

		<form action="">
			<view style="height:30rpx"></view>
			<view class="form-item">
				<view class="title">
					<text class="necessary">*</text>
					监察标题:
				</view>
				<select name="" id="">
					<option value="">标题一</option>
					<option value="">标题二</option>
					<option value="">标题三</option>
				</select>
			</view>
			<view class="form-item">
				<view class="title">所属站点:</view>
				<select name="" id="">
					<option value="">站点一</option>
					<option value="">站点二</option>
					<option value="">站点三</option>
				</select>
			</view>

			<view class="form-item">
				<view class="title">监察内容:</view>
				<textarea maxlength="-1"  @input="textareaAInput" placeholder="" width="250"></textarea>
				
				
			</view>
			
			<view class="form-item">
				<view class="title">上传图片:</view>
				<view style="width:500rpx">
					<view class="cu-form-group" style="padding:0">
						<view class="grid col-4 grid-square flex-sub">
							<view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage" :data-url="imgList[index]">
							 <image :src="imgList[index]" mode="aspectFill"></image>
								<view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="index">
									<text class='cuIcon-close'></text>
								</view>
							</view>
							<view class="solids" @tap="ChooseImage" v-if="imgList.length<4">
								<text class='cuIcon-cameraadd'></text>
							</view>
						</view>
					</view>
				</view>
			</view>

			<view class="btn-area submitBottomBtn padding-lr-sm">
				<button class="bg-blue round  margin-top" @click="submit()">提 交 </button>
			</view>
		</form>


	</view>
</template>

<script>
	export default {
		data() {
			return {
				imgList: [],
				isShow: false,
				formMess: {
					"userName": "sss",
					"siteName": "",
					"place": "",
					"longitude": "",
					"dimension": "",
					"contactor": "",
					"mobile": "",
				},
			}
		},
		onLoad: function(option) {
		},
		methods: {
			
			radioChange(e) {
				console.log('type:' + e.detail.value);
				this.radioOne = e.detail.value;
			},
			
			ChooseImage() {
				uni.chooseImage({
					count: 4, //默认9
					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album'], //从相册选择
					success: (res) => {
						if (this.imgList.length != 0) {
							this.imgList = this.imgList.concat(res.tempFilePaths)
						} else {
							this.imgList = res.tempFilePaths
						}
					}
				});
			},
			
			ViewImage(e) {
				uni.previewImage({
					urls: this.imgList,
					current: e.currentTarget.dataset.url
				});
			},
			DelImg(e) {
				uni.showModal({
					title: '删除',
					content: '确定要删除此图片吗？',
					cancelText: '取消',
					confirmText: '确定',
					success: res => {
						if (res.confirm) {
							this.imgList.splice(e.currentTarget.dataset.index, 1)
						}
					}
				})
			},
			
			submit() {
				uni.navigateTo({
					url: '/pages/accountManage/success/success',
				});
			},
		}
	}
</script>

<style lang="scss">
	
	

	select {
		// background: url(../../../../static/arrow.png) no-repeat scroll 98% center;
		background-size: 6%;
	}

	

</style>
