<template>
	<view class="content">
		<view class="radioStyle">
			<tn-radio-group v-model="radioValue" width="100%" wrap :size="radioGroupSize">
				<tn-radio :iconSize="iconSize" :labelSize="labelSize" v-for="(item, index) in radioList" :key="index" :name="item.name" :disabled="item.disabled">
					<view class="radioFont">{{ item.name }}</view>
				</tn-radio>
			</tn-radio-group>
		</view>
		<view class="radioBtn">
			<tn-button @click="submitFeedback()" backgroundColor="#0186ff" width="600rpx" height="100rpx"
			:fontSize="btnFontSize">Submit</tn-button>
		</view>
		<tn-toast ref="toast"></tn-toast>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				radioGroupSize: 45,
				labelSize: 45,
				iconSize: 40,
				btnFontSize: 36,
				radioValue: '',
				radioList:[
					{
						'name': 'Scan faild',
						'disabled': false
					},
					{
						'name': 'Too many ads',
						'disabled': false
					},
					{
						'name': 'Need more infomation',
						'disabled': false
					},
					{
						'name': 'Bugs',
						'disabled': false
					},
					{
						'name': 'Other',
						'disabled': false
					}
				]
			}
		},
		onLoad() {
			//更改starTipStatus状态
			this.setStarTipStatus(false);
		},
		onHide() {
			
		},
		methods: {
			
			//设置弹窗状态结果
			setStarTipStatus(value){
				uni.setStorageSync('starTipStatus', value);
			},
			
			//提交反馈
			submitFeedback(){
				let that = this;
				if(that.radioValue == '' || that.radioValue == null){
					that.$refs.toast.show({
					    title: 'Fail',
					    content: 'please select one!',
					    icon: 'fail',
					    duration: 3000
					})
				}else{
					that.$refs.toast.show({
					    title: 'Success',
					    content: 'Thanks for feedback!',
					    icon: 'success',
					    duration: 3000
					})
					//返回上一个页面
					setTimeout(() =>{
						uni.navigateBack();
					}, 3000);
				}
			}
		}
	}
</script>

<style lang="scss">
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: flex-start;
		background-color: #1F222B;
		height:100vh;
	}
	
	.radioStyle{
		//border: 1px solid red;
		margin-top: 50rpx;
		margin-left: 50rpx;
		padding-top: 100rpx;
	}
	
	.radioFont{
		color: #fff;
		//margin-top: 50rpx;
	}
	
	.radioBtn{
		//border: 1px solid yellow;
		margin-top: 600rpx;
	}
</style>