<template>
	<view class="questionBankAnswer-contentbtnbox">
		<view :class="timu_order <= 1 ? 'noprevbtn' : ''" class="questionBankAnswer-contentprevbtn" @tap="prevpage">
			上一题
		</view>
		<view :class="timu_order >= total_num  ? 'nonextbtn' : ''" class="questionBankAnswer-contentnextbtn"
			@tap="nextpage">
			下一题
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			timu_list: {
				type: Array,
				default: function() {
					return [];
				},
			},
			timu_order: {
				type: Number,
				default: 0
			},
			total_num: {
				type: Number,
				default: -1
			},
			confirmText: {
				type: String,
				default: '结束练习'
			},
		},
		data() {
			return {

			}
		},
		methods: {
			prevpage() {
				if (this.timu_order <= 1) {
					this.$myUtils.$prompt.showToast({
						icon: 'none',
						title: '没有上一题'
					});
				} else {
					this.$emit('choice_timu_by_id', this.timu_order - 2)
				}
			},
			nextpage() {
				if (this.timu_order >= this.timu_list.length) {
					this.$myUtils.$prompt.showToast({
						icon: 'none',
						title: '没有下一题'
					});
					// uni.showModal({
					// 	title: '提示',
					// 	content: '已没有下一题',
					// 	confirmText: this.confirmText,
					// 	confirmColor: '#3c7bfc',
					// 	success: (res) => {
					// 		if (res.confirm) {
					// 			this.$emit('tap_handler',1);
					// 		} else if (res.cancel) {
					// 			// console.log('用户点击取消');
					// 		}
					// 	}
					// });
				} else {
					this.$emit('choice_timu_by_id', this.timu_order)
				}
			},
		}
	}
</script>

<style>
</style>
