<template>
	<!--    章节练习答题页-->
	<view :class="{'yejian': if_theme_dark}">
		<!--#ifdef APP-PLUS-->
		<view class="lz-status_bar">
			<view class="lz-top_view"></view>
		</view>
		<!--#endif-->
		<view class="kaoshi-head">
			<view class="kaoshi-head-top">
				<view class="kaoshi-head-left" @tap="$navigateBack">
					<view class="iconfont icon-zuojiantou"></view>
				</view>
				<view class="kaoshi-head-m">
					<view :class="{ 'moshi-active': !show_beiti, moshi: show_beiti }" @tap="show_beiti_click(false)">
						答题模式
					</view>
					<view :class="{ 'moshi-active': show_beiti, moshi: !show_beiti }" @tap="show_beiti_click(true)">背题模式
					</view>
				</view>
				<view class="kaoshi-head-right">
					<view class="iconfont icon-shezhi1" @tap="show_change_moshi=true"></view>
				</view>
			</view>
		</view>
		<view scroll-y style="height: 100%;">
			<view style="height: 10px;"></view>
			<view class="questionBankAnswer" v-if="current_timu && current_timu.id">
				<question-type :current_timu="current_timu" :timu_order="timu_order" :total_num="total_num">
				</question-type>
			</view>
			<view class="questionBankAnswer-content" v-if="current_timu && current_timu.question_name">
				<question-title :node="current_timu.question_name"></question-title>
				<block v-for="(item, index) in current_timu.answers" :key="index">
					<!-- {{item.answer}} -->
					<question-option :ref="'questionOption_' + index" :type="type" :item="item" :index="index"
						:show_beiti="show_beiti" :current_timu="current_timu" :copy_user_answer="copy_user_answer"
						:timu_index="timu_order - 1" :copy_post_status="copy_post_status"
						@post_answer_req="post_answer_req" @set_copy_user_answer="set_copy_user_answer"
						@set_sub_button_style="set_sub_button_style"></question-option>
				</block>
				<template v-if="current_timu.type == 4">
					<question-tiankong :current_timu="current_timu" :is_tiankong_sub="is_tiankong_sub"
						:show_beiti="show_beiti" @set_current_timu="set_current_timu" @post_answer_req="post_answer_req"
						@set_sub_button_style="set_sub_button_style"></question-tiankong>
				</template>
				<template v-else-if="current_timu.type == 5">
					<question-jianda :current_timu="current_timu" :is_jianda_sub="is_jianda_sub"
						:show_beiti="show_beiti" @set_current_timu="set_current_timu" @post_answer_req="post_answer_req"
						@set_sub_button_style="set_sub_button_style"></question-jianda>
				</template>
				<view v-if="current_timu.answers && (current_timu.type == 2) && !show_beiti">
					<button :class="is_duoxuan_sub ? 'duoxuan_checked' : 'duoxuan' " type=" "
						@tap="post_answer_req">{{is_duoxuan_sub ? '提交成功' : '确认答案'}}
					</button>
				</view>
				<question-pre-next v-if="timu_list.length > 0" :total_num="total_num" :timu_order="timu_order"
					:timu_list="timu_list" @choice_timu_by_id="choice_timu_by_id" @tap_handler="tap_handler"
					class="questionBankAnswer-contentbtnbox"></question-pre-next>
			</view>
			<view v-if="current_timu.type == 5" class="jdttishi">温馨提示：简答题不记入错题，默认为正确</view>
			<question-answer ref="questionAnswer"
				v-if="current_timu && current_timu.answers && show_beiti || copy_post_status[current_timu.id]"
				:timu_order="timu_order" :show_beiti="show_beiti" :current_timu="current_timu"
				:copy_post_answer_right="copy_post_answer_right" :timu_list="timu_list"></question-answer>
			<view style="height: 50px;"></view>
		</view>
		<view class="order-pay">
			<question-fav class="questionBankAnswer-bottom-flex" :current_timu="current_timu" @collect_opt="collect_opt"
				:type="type"></question-fav>
			<question-note class="questionBankAnswer-bottom-flex" :current_timu="current_timu"></question-note>
			<question-liuyan class="questionBankAnswer-bottom-flex" :current_timu="current_timu"></question-liuyan>
			<question-jiucuo class="questionBankAnswer-bottom-flex" :current_timu="current_timu"></question-jiucuo>
			
			<question-answer-sheet class="questionBankAnswer-bottom-flex"
				@show_choice_timu_list="show_choice_timu_list = true"></question-answer-sheet>
		</view>
		<question-answer-sheet-1 v-if="show_choice_timu_list" @show_choice_timu_list="show_choice_timu_list = false"
			:timu_order="timu_order" :timu_list="timu_list" :my_res="my_res" :total_num="total_num"
			@choice_timu_by_id="choice_timu_by_id"></question-answer-sheet-1>
		<question-set :show_change_moshi="show_change_moshi" :if_theme_dark="if_theme_dark" @emptyLog="emptyLog"
			:show_empty="true" @set_if_theme_dark="set_if_theme_dark" @hide_change_moshi="show_change_moshi = false">
		</question-set>

		<overtimu v-if="show_over_dati" :timuinfo="over_dati_info" @tap_handler="tap_handler"></overtimu>
		<ifcontinue v-if="show_continue_answer" :timuorder="timu_order" @tap_handler="tap_handler"></ifcontinue>
	</view>
</template>

<script>
	// 退出答题组件
	import overtimu from '@/components/overtimu/index';
	import {
		mapState
	} from 'vuex';
	import ifcontinue from "@/components/if-continue/index"

	export default {
		data() {
			return {
				type: '', //from_type 1：章节练习  2：历年真题
				copy_post_answer_right: {},
				//区分多选题是否点击提交按钮
				is_duoxuan_sub: false,
				is_tiankong_sub: false,
				is_jianda_sub: false,
				//是否显示继续答题弹框
				show_continue_answer: false,
				//是否显示新用户左右滑动切换题目的提示
				guide: false,
				// 答题、背题模式
				show_beiti: false,
				// 上一题
				last_timu: {},
				// 当前题目
				current_timu: {},
				// 下一题
				next_timu: {},
				total_num: 0, //全部题目数
				// 用户输入的答案
				copy_user_answer: {},
				copy_right_answer_code: {},
				copy_post_status: {},
				// 是否显示退出答题弹框
				show_over_dati: false,
				over_dati_info: {},
				// 答题开始时间
				start_time: 0,
				// 显示答题卡
				show_choice_timu_list: false,
				// 答题卡
				timu_list: [],
				// 模式
				show_change_moshi: false,
				if_theme_dark: false, // 黑夜模式
				// 上次答到第几题
				timu_order: -1,
				current_tika_index: 0,
				my_res: {
					right_num: 0,
					error_num: 0
				}
			};
		},
		components: {
			overtimu,
			ifcontinue,
		},
		computed: {
			...mapState(['subject', 'userinfo']),
			static_media() {
				return {
					img01: this.$myConfig.localMedia + '/static/img/dui.png',
				}
			},
		},
		onBackPress() {
			this.over_dati();
			return true;
		},
		onLoad(opts) {
			this.id = opts.id
			this.type = opts.from_type
			if (this.userinfo.user_id !== undefined) {
				this.init();
			}
			// 答题开始时间
			this.start_time = new Date().getTime();
			
		},
		onReady() {
			uni.setNavigationBarTitle({
				title: this.type == 1 ? '章节练习' : '历年真题'
			});
		},
		methods: {
			async init() {
				const info = await this.$myUserLogin.getUnitVipInfo(this.type, this.id);
				if (info.is_vip == 0 || info.owned_vip == 1) {
					this.get_timu_list();
				} else {
					//需要vip但还不是vip
					uni.showToast({
						title: '暂无权限',
						icon: 'none'
					})
					setTimeout(() => {
						uni.reLaunch({
							url: '/pages/index/index'
						})
					}, 1500)
				}
			},
			set_sub_button_style(type, value) {
				this[type] = value
			},
			set_current_timu(data) {
				this.current_timu = JSON.parse(JSON.stringify(data))
				let copy_user_answer_this = this.copy_user_answer;
				if (copy_user_answer_this[this.current_timu.id]) {
					copy_user_answer_this[this.current_timu.id] = this.current_timu.my_answer_arr
				}
			},
			set_copy_user_answer(data) {
				this.copy_user_answer = JSON.parse(JSON.stringify(data))
				this.setAnswerStyle(this.current_timu);
				this.setMyAnswer();
			},
			// 提交答案
			async post_answer_req() {
				let noanswer = false
				let answerlist = this.copy_user_answer[this.current_timu.id]
				if (this.current_timu.type == 2) {
					for (var i = 0; i < answerlist.length; i++) {
						if (answerlist[i].active) {
							noanswer = true
						}
					}
				} else if (this.current_timu.type == 4 || this.current_timu.type == 5) {
					if (answerlist.length != 0) {
						noanswer = true
						for (var i = 0; i < answerlist.length; i++) {
							if (!answerlist[i] || answerlist[i] == '') {
								noanswer = false
							}
						}
					}
				} else {
					noanswer = true
				}
				if (!noanswer) {
					uni.showToast({
						title: '您还未答题',
						icon: 'none'
					})
					return
				}
				let timu_index = this.timu_order - 1;
				this.copy_post_status = Object.assign({}, this.copy_post_status, {
					[this.current_timu.id]: true
				});
				let answer = '';
				if (this.current_timu.type <= 3) {
					this.is_duoxuan_sub = true
					let answers = this.copy_user_answer[this.current_timu.id];
					for (let i = 0, leng = answers.length; i < leng; i++) {
						if (answers[i].active) {
							answer += answers[i].answer_code
						}
					}
					if (this.current_timu.right_answer.toString().toLowerCase().replace(/\s/g, '') === answer
						.toString().toLowerCase().replace(/\s/g, '')) {
						this.copy_post_answer_right = Object.assign({}, this.copy_post_answer_right, {
							[this.current_timu.id]: true
						});
						if (timu_index !== -1) {
							// if_que 答题状态：1是错2是对3是未答过此题
							this.setTimuState(timu_index, 2)
						}
					} else {
						if (timu_index !== -1) {
							this.setTimuState(timu_index, 1)
						}
					}
				} else {
					if (this.current_timu.type == 4) {
						this.is_tiankong_sub = true
						if (this.current_timu.my_answer == this.current_timu.right_answer) {
							if (timu_index !== -1) {
								// if_que 答题状态：1是错2是对3是未答过此题
								this.setTimuState(timu_index, 2)
							}
						} else {
							if (timu_index !== -1) {
								// if_que 答题状态：1是错2是对3是未答过此题
								this.setTimuState(timu_index, 1)
							}
						}
					} else {
						this.is_jianda_sub = true
						if (this.current_timu.my_answer == this.current_timu.right_answer) {
							if (timu_index !== -1) {
								// if_que 答题状态：1是错2是对3是未答过此题
								this.timu_list.splice(timu_index, 1, {
									...this.timu_list[timu_index],
									state: 2
								})
							}
						} else {
							if (timu_index !== -1) {
								// if_que 答题状态：1是错2是对3是未答过此题
								this.timu_list.splice(timu_index, 1, {
									...this.timu_list[timu_index],
									state: 1
								})
							}
						}
					}
					this.is_jianda_sub = true
				}
				let url = ''
				// 1：章节练习  2：历年真题
				if (this.type == 1) {
					// 1：章节练习
					url = this.$myHttp.urlMap.unitansqueedit
				} else if (this.type == 2) {
					// 2：历年真题
					url = this.$myHttp.urlMap.zhentiansqueedit
				}
				let that = this;
				let res = await this.$myHttp.post({
					url: url,
					data: {
						id: this.current_timu.id,
						answer: this.current_timu.type <= 3 ? answer : this.current_timu.my_answer
					},
					needLogin: true
				});
				if (res.code == 1) {
					//0:错，1：对
					that.$set(this.current_timu, 'post_status', 1)
					this.setAnswerStyle(this.current_timu);
					this.setMyAnswer();
				}
			},
			//答题完成后，设置答题卡颜色
			setTimuState(timu_index, state) {
				this.timu_list.splice(timu_index, 1, {
					...this.timu_list[timu_index],
					state: state
				})
				this.get_my_res();
				//TODO 答题对错这里，需要进一步 优化
			},
			collect_opt(type) {
				this.$set(this.current_timu, 'is_fav', type)
			},

			// 获取答题卡
			async get_timu_list() {
				let data = {}
				let url = ''
				// 1：章节练习  2：历年真题
				if (this.type == 1) {
					// 1：章节练习
					data = {
						unit_id: this.id
					};
					url = this.$myHttp.urlMap.unitCard
				} else if (this.type == 2) {
					// 2：历年真题
					data = {
						library_id: this.id
					};
					url = this.$myHttp.urlMap.zhentiCard
				}

				let res = await this.$myHttp.post({
					url: url,
					data: data,
					needLogin: true
				});
				if (res.code == 1) {
					this.timu_list = res.data.card;
					this.total_num = this.timu_list.length;
					this.timu_order = res.data.position

					this.isChangeTimu = false
					if (res.data.curr_question != []) {
						let timu = this.set_right_flg(res.data.curr_question);
						this.current_timu = timu;
						this.save_user_answer(this.current_timu);
						this.is_duoxuan_sub = false
						this.is_tiankong_sub = false
						this.is_jianda_sub = false
					} else {
						this.current_timu = null;
					}
					// this.get_timu_order();
					this.get_my_res();
				}
			},
			get_my_res() {
				let error_num = 0,
					right_num = 0;
				for (let i = 0, leng = this.timu_list.length; i < leng; i++) {
					//if_que 答题状态：1是错2是对3是未答过此题
					if (this.timu_list[i].state == 1) {
						error_num++
					} else if (this.timu_list[i].state == 2) {
						right_num++
					}
				}
				this.$set(this.my_res, 'right_num', right_num)
				this.$set(this.my_res, 'error_num', error_num)
			},
			// 获取用户答到第几题
			// async get_timu_order() {
			// 	let data = {}
			// 	let url = ''
			// 	// 1：章节练习  2：历年真题
			// 	if (this.type == 1) {
			// 		// 1：章节练习
			// 		data = {
			// 			unit_id: this.id
			// 		};
			// 		url = this.$myHttp.urlMap.unit_postion
			// 	} else if (this.type == 2) {
			// 		// 2：历年真题
			// 		data = {
			// 			library_id: this.id
			// 		};
			// 		url = this.$myHttp.urlMap.zhenti_postion
			// 	}


			// 	let res = await this.$myHttp.post({
			// 		url: url,
			// 		data: data,
			// 		needLogin: true
			// 	});

			// 	if (res.code == 1) {
			// 		this.timu_order = res.data
			// 		this.get_timu_info();
			// 	}
			// },
			// 根据答题卡获取题目
			choice_timu_by_id(index) {
				this.timu_order = index + 1
				this.isChangeTimu = true
				this.get_timu_info()
				uni.pageScrollTo({
					scrollTop: 0,
					duration: 200
				});
			},
			// 获取当前题目
			async get_timu_info() {
				let id = this.timu_list[this.timu_order - 1].id;
				let res = await this.$myHttp.post({
					url: this.$myHttp.urlMap.timu_details,
					data: {
						id: id
					},
					needLogin: true
				});
				if (res.code == 1) {
					this.isChangeTimu = false
					if (res.data != []) {
						let timu = this.set_right_flg(res.data);
						this.current_timu = timu;
						this.save_user_answer(this.current_timu);
						this.is_duoxuan_sub = false
						this.is_tiankong_sub = false
						this.is_jianda_sub = false
					} else {
						this.current_timu = null;
					}
				} else {
					this.isChangeTimu = false
				}
			},
			// 设置正确答案的标记
			set_right_flg(timu) {
				if (timu.type <= 3) {
					timu.post_status = 0;
					if (timu.answers) {
						for (let i = 0, leng = timu.answers.length; i < leng; i++) {
							if (timu.right_answer.toString().toLowerCase().replace(/\s/g, '').indexOf(timu.answers[i]
									.answer_code.toString().toLowerCase().replace(/\s/g, '')) !== -1) {
								timu.answers[i]['right_flg'] = true
							}
						}
					}
				}
				return timu
			},

			// 本地存储用户答案
			save_user_answer(timu) {
				if (timu.type <= 3) {
					if (timu && timu.answers) {
						//copy_user_answer 用户输入的答案,
						if (!(this.copy_user_answer[timu.id])) {
							//本题用户的答案
							this.copy_user_answer = Object.assign({}, this.copy_user_answer, {
								[timu.id]: []
							});
							//copy_right_answer_code 本题的正确答案
							this.copy_right_answer_code = Object.assign({}, this.copy_right_answer_code, {
								[timu.id]: timu.right_answer
							});
							//copy_post_status 本题答没答过
							this.copy_post_status = Object.assign({}, this.copy_post_status, {
								[timu.id]: false
							});
							//copy_post_answer_right  本题答的是对是错
							this.copy_post_answer_right = Object.assign({}, this.copy_post_answer_right, {
								[timu.id]: false
							});

							for (let i = 0, leng = timu.answers.length; i < leng; i++) {
								this.copy_user_answer[timu.id].push({
									answer_code: timu.answers[i].answer_code,
									error_flg: false,
									active: false
								})
							}
							if (timu.my_answer !== '' && timu.my_answer !== null) {
								this.setUserAnswer(timu)
							} else {
								this.setAnswerStyle(timu);
							}
						} else {
							this.setAnswerStyle(timu);
						}
					}
				} else {
					let right_answer_arr = timu.right_answer.split('|');
					this.$set(timu, 'right_answer_arr', right_answer_arr)
					this.$set(timu, 'show_right_answer', false)
					if (!(this.copy_user_answer[timu.id]) || this.copy_user_answer[timu.id].length == 0) {
						//本地没有记录呢，如果my_answer有值，写进去
						this.copy_user_answer = Object.assign({}, this.copy_user_answer, {
							[timu.id]: []
						});
						this.copy_post_status = Object.assign({}, this.copy_post_status, {
							[timu.id]: false
						});
						if (timu.my_answer == '' || timu.my_answer == null) {
							//之前没有答过题
							let arr = [];
							arr.length = right_answer_arr.length;
							this.$set(timu, 'my_answer_arr', arr)
							this.$set(timu, 'my_answer', '')
							this.setAnswerStyle(timu);
						} else {
							//之前答过题了
							this.setUserAnswer(timu)
						}
					} else {
						//之前答过题了
						this.setUserAnswer(timu)
					}
				}
			},
			//获取题目信息后，如果答过题了，设置到本地
			setUserAnswer(timu) {
				//timu.my_answer !== '' && timu.my_answer !== null  说明这道题已经回答过了
				this.copy_post_status = Object.assign({}, this.copy_post_status, {
					[timu.id]: true
				});
				// 如果是判断和单选。执行以下处理
				if (timu.type == 1 || timu.type == 3) {
					let index = timu.answers.findIndex(item => item.answer_code == timu.my_answer)
					// this.$nextTick(() => {
					if (this.copy_user_answer[timu.id]) {
						for (let i = 0, leng = this.copy_user_answer[timu.id].length; i <
							leng; i++) {
							this.copy_user_answer[timu.id].splice(i, 1, {
								...this.copy_user_answer[timu.id][i],
								active: false,
								error_flg: false
							})
						}
						if (timu.right_answer.toString().toLowerCase().replace(/\s/g, '').indexOf(
								timu.my_answer.toString().toLowerCase().replace(/\s/g, '')) === -1) {
							this.copy_user_answer[timu.id].splice(index, 1, {
								...this.copy_user_answer[timu.id][index],
								active: true,
								error_flg: true
							})
						} else {
							this.copy_user_answer[timu.id].splice(index, 1, {
								...this.copy_user_answer[timu.id][index],
								active: true,
								error_flg: false
							})
						}
					}
					// });
				} else if (timu.type == 2) {
					// 如果是多选。执行以下处理
					if (this.copy_user_answer[timu.id]) {
						if (this.is_duoxuan_sub = true) {
							this.is_duoxuan_sub = false
						}
						for (let key of timu.my_answer) {
							let index = timu.answers.findIndex(item => item.answer_code == key)
							if (this.copy_user_answer[timu.id][index]) {
								if (this.copy_user_answer[timu.id][index].active) {
									if (timu.right_answer.toString().toLowerCase().replace(/\s/g, '').indexOf(key
											.toString().toLowerCase().replace(/\s/g, '')) === -1) {
										this.copy_user_answer[timu.id].splice(index, 1, {
											...this.copy_user_answer[timu.id][index],
											active: false,
											error_flg: true
										})
									} else {
										this.copy_user_answer[timu.id].splice(index, 1, {
											...this.copy_user_answer[timu.id][index],
											active: false,
											error_flg: false
										})
									}
								} else {
									if (timu.right_answer.toString().toLowerCase().replace(/\s/g, '').indexOf(key
											.toString().toLowerCase().replace(/\s/g, '')) === -1) {
										this.copy_user_answer[timu.id].splice(index, 1, {
											...this.copy_user_answer[timu.id][index],
											active: true,
											error_flg: true
										})
									} else {
										this.copy_user_answer[timu.id].splice(index, 1, {
											...this.copy_user_answer[timu.id][index],
											active: true,
											error_flg: false
										})
									}
								}
							}
						}
					}
				} else {
					// 如果是填空，简答
					this.$set(timu, 'my_answer_arr', timu.my_answer.split('|'))
					this.$set(timu, 'my_answer', timu.my_answer)
					this.$set(timu, 'show_right_answer', true)
					this.copy_user_answer = Object.assign({}, this.copy_user_answer, {
						[timu.id]: []
					});
					this.copy_user_answer[timu.id].push(...timu.my_answer_arr)
				}
				this.setAnswerStyle(timu);
			},
			//单选多选判断，选项正确错误
			setAnswerStyle(timu) {
				this.$nextTick(() => {
					timu.answers.forEach((item, index) => {
						this.$refs['questionOption_' + index][0].setAnswerStyle(this.copy_user_answer);
					})
					this.setMyAnswer();
				})
			},
			setMyAnswer() {
				if (this.show_beiti || this.copy_post_status[this.current_timu.id]) {
					// this.$nextTick(() => {
					this.$refs.questionAnswer.my_answer(this.copy_user_answer)
					// })
				}
			},
			//设置夜间模式
			set_if_theme_dark(data) {
				this.if_theme_dark = data
			},

			//清空答题卡记录
			emptyLog() {
				let that = this
				uni.showModal({
					title: "警告",
					content: "清除记录后错题记录也会清除，请谨慎操作",
					confirmText: "确认清除",
					confirmColor: '#3c7bfc',
					success: function success(res) {
						if (res.confirm) {
							that.emptyTestLog();
						} else if (res.cancel) {
							// console.log("用户点击取消");
						}
					}
				});
			},

			async emptyTestLog() {
				let data = {}
				let url = ""
				if (this.type == 1) {
					// 1：章节练习
					data = {
						unit_id: this.id
					};
					url = this.$myHttp.urlMap.emptyTestLog
				} else if (this.type == 2) {
					// 2：历年真题
					data = {
						library_id: this.id
					};
					url = this.$myHttp.urlMap.emptyLibraryLog
				}
				let res = await this.$myHttp.post({
					url: url,
					data: data,
					needLogin: true
				});
				if (res.code == 1) {
					this.get_timu_list();
					// this.get_timu_order();
					this.show_change_moshi = false;
					this.copy_user_answer = {}
				}
			},
			// 中途退出
			over_dati() {
				this.over_dati_info = {
					total_num: this.total_num,
					zhengquelv: (100 * (this.my_res.right_num / ((this.my_res.right_num + this.my_res.error_num == 0) ?
						1 : (this.my_res.right_num + this.my_res.error_num)))).toFixed(2),
					right_num: this.my_res.right_num,
					error_num: this.my_res.error_num,
					yida_num: this.my_res.right_num + this.my_res.error_num
				};
				// console.log(this.over_dati_info)
				this.$nextTick(() => {
					// 显示弹窗
					this.show_over_dati = true;
				});
			},
			tap_handler(type) {
				if (type == 0) {
					this.show_over_dati = false;
				} else if (type == 1) {
					this.$redirectTo(
						'/pages/questionBank/questionOver/index?id=' +
						this.id +
						'&from_type=' +
						this.type +
						'&end_time=' +
						this.endtime() +
						'&right_num=' +
						this.my_res.right_num +
						'&start_time=' +
						this.start_time +
						'&zhengquelv=' +
						100 * (this.my_res.right_num / ((this.my_res.right_num + this.my_res.error_num == 0) ? 1 : (
							this.my_res.right_num + this.my_res.error_num))).toFixed(2) +
						'&total_num=' +
						(this.my_res.right_num + this.my_res.error_num) || 0
					)
				} else if (type == 3) {
					this.show_continue_answer = false;
					this.choice_timu_by_id({
						id: this.timu_order
					})
				} else if (type == 4) {
					this.show_continue_answer = false;
					this.get_timu_info();
				}
			},
			show_beiti_click(type) {
				this.show_beiti = type;
				this.setAnswerStyle(this.current_timu);
			},

			endtime() {
				let yy = new Date().getFullYear();
				let mm = new Date().getMonth() < 10 ? "0" + (new Date().getMonth() + 1) : new Date().getMonth() + 1;
				let dd = new Date().getDate() < 10 ? "0" + new Date().getDate() : new Date().getDate();
				let hh = new Date().getHours();
				let mf = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes();
				let ss = new Date().getSeconds() < 10 ? '0' + new Date().getSeconds() : new Date().getSeconds();
				return yy + '-' + mm + '-' + dd + ' ' + hh + ':' + mf + ':' + ss
			}
		}
	};
</script>

<style lang="scss">
	@import "~@/static/css/tiku.css";

	.go-liuyan {
		display: flex;
		padding: 20rpx 0;

		.liuyan-inp {
			display: block;
			font-size: 28rpx;
			height: 50rpx;
			line-height: 50rpx;
			background-color: #f7f7f7;
			flex-grow: 1;
			border-radius: 8rpx;
			padding-left: 10rpx;
		}

		.but {
			background-color: #3c7bfc;
			padding: 10rpx 15rpx;
			border-radius: 10rpx;
			color: #fff;
			font-size: 24rpx;
			margin-left: 20rpx;
		}
	}
</style>