备份助记词 部分

	<!-- 导航栏返回按钮 -->
	<!-- <van-nav-bar title='备份助记词' left-arrow @click-left="onClickLeft" /> -->
	<!-- 选中词 -->
	<div class="seleWords">
		<ul class="selected">
			<li :class="{'transSelect':selectab === index }" class="li" v-for="(item2 , index) in wordsArr" @click="addRemove(index,item2)">{{item2.name}}</li>
		</ul>
	</div>

	<!-- 助词表 -->
	<div>
		<ul class="wordsbox">
			<li :class="{'active':item.active}" class="li" v-for="(item,index) in arr" :key="index" @click="add(index,item.name,item)">{{item.name}}</li>
		</ul>
	</div>
	<button class="btn" @click="Verification">
		验证
	</button>
</div>
export default {
	data() {
		return {

			wordsArr: [],
			wordsNum: [],
			arr: [{
				active: false,
				name: "cactus"
			}, {
				active: false,
				name: "cushion"
			}, {
				active: false,
				name: "panda"
			}, {
				active: false,
				name: "cactus"
			}],
			selectab: "",
			// mnemonic: ["notice","cactus","cushion","panda","stool","loud","wash","finger","actual","surface","job","girl"],

		};
	},
	mounted() {},
	methods: {
		// 添加
		add(number, name, item) {
			if (!item.active) {
				this.$set(item, 'active', true);
			}
			if (this.wordsArr.includes(item.name) === false) {
				this.wordsArr.push(item)
			} else {
				alert("已经有一样的了")
			}


			// var temp = e.srcElement;
			// temp.style.background = "#999";
			// //定义一个变量接收数组
			// let size = this.arr;
			// // 空数组添加点击的这个内容
			// let num = this.wordsArr.length;
			// this.wordsNum.length = 0;
			// if (num !== 12) {
			// 	this.wordsArr.push(size[number]);
			// 	let choures = 12 - num;
			// 	if (choures === 0) {
			// 		this.wordsNum.length = 0;
			// 	} else {
			// 		for (let i = 1; i < choures; i++) {
			// 			this.wordsNum.push(i);
			// 		}
			// 	}
			// } else {
			// 	this.wordsNum.length = 0;
			// }
		},
		// 返回上一页
		onClickLeft() {
			this.$router.go(-1)
		},
		// 验证
		Verification() {
			let flag = true;
			let len = this.wordsArr.length;
			// 判断本地存储的长度跟选中添加的长度是否一致
			if (this.mnemonic.length !== len) {
				flag = false;
			}
			// 判断每个数组中的单词是不是全等
			for (let i = 0; i < len; i++) {
				if (this.wordsArr[i] !== this.mnemonic[i]) {
					flag = false;
				}
			}
			if (flag === true) {
				console.log("验证正确")

			} else {
				// 验证失败的步骤
				this.$dialog.alert({
					message: '请输入正确的助记词'
				}).then(() => {
					this.$router.go(0)
				});
			}
		},
		addRemove(index, item) {

			if (item.name === this.arr[index].name) {
				this.wordsArr.splice(index, 1)
				this.$set(this.arr[index], 'active', false)
			}
			// if(item.active){
			//   this.$set(item,'active',false);
			// }

			//   this.arr.splice(index,item)
			//   console.log(index)
			//     //获取点击的元素,也就是wordsArr的索引
			// 	let words = this.wordsArr;
			// 	//原数组
			// 	let size = this.arr;
			// 	//标识
			// 	let uuid = words[index];
			// 	size.forEach((v , i)=>{
			// 		if(uuid === v){
			// 			//记录arr数组需要还原的位置索引
			// 		}
			// 	});
			// 	//有了需要还原数组的索引,改变原数组的位置的样式(这个vue如何改变样式,我不会写了,这个你自己写吧)
			//
			// 	//删除点击的这个元素,也就是wordsArr中的元素,重新获取wordsArr的长度,再重新计算空格的数量。
			// 	words.splice(index,1);
			// 	//console.log(words);
			//
			// 	let num = words.length;
			// 	this.wordsNum.length = 0;
			// 	if (num > 0) {
			// 		let choures = 12 - num;
			// 		if (choures === 0) {
			// 			this.wordsNum.length = 0;
			// 		} else {
			// 			for (let i = 1; i < choures; i++) {
			// 				this.wordsNum.push(i);
			// 			}
			// 		}
			// 	}
			//
			//
		}
	},
}
.spareAux {
	text-align: center;
}

.spareAux .wordsbox {
	padding: 0 1rem;
	display: flex;
	flex-wrap: wrap;
	justify-content: space-around;
}

.spareAux .wordsbox .li {
	text-align: center;
	width: 50px;
	height: 20px;
	line-height: 20px;
	border-radius: 5px;
	background: -webkit-gradient(linear, 30% 35%, 95% 100%, from(#232E6C), to(#4D5B80), color-stop(0.5, #4E5C81));
	color: #fff;
	border-radius: 5px;
	margin-bottom: 0.5rem;
}

.spareAux .wordsbox .li.active {
	background: red;
}

.spareAux .seleWords {
	margin: 0.5rem;
	box-shadow: 0px 4px 10px #666;
	padding: 0.5rem 0rem;
}

/* 空格填充词 */
.spareAux .selected {
	display: flex;
	flex-wrap: wrap;
	padding-left: 0.8rem;
	width: 90%;

}

.spareAux .selected li {
	border: 1px solid #232e6c;
	width: 50px;
	height: 20px;
	line-height: 20px;
	display: inline-block;
	background: #FFFFFF;
	color: #232e6c;
	margin-right: 0.2rem;
	border-radius: 5px;
	margin-bottom: 0.5rem;
}

.spareAux .btn {
	width: 90%;
	margin: 0 auto;
	font-size: 0.35rem;
	color: #fff;
	height: 0.81rem;
	border-radius: 5px;
	background: -webkit-gradient(linear, 30% 35%, 95% 100%, from(#232E6C), to(#4D5B80), color-stop(0.5, #4E5C81));
	line-height: 0.81rem;
	outline: none;
	border: none;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
软件名称:单手<br>软件版本:V0.2<br>软件授权:免费<br>软件语言:简体中文<br>使用平台:XP/2003<br>建议分类:教育教学/外语学习<br>插件情况:无<br>软件简介:小巧绿色且易于沉迷的单拼写软件。<br>更多介绍:<br> 本软件基于一个很简单的原理:单忆需要重复,初期重复次数要多,往后可以越来越少。程序每次从库中按一定条件选择出25个单让你忆,然后让你根据提示进行拼写,拼写正确次数达标时即可过关,否则总出错的单会一直缠着你。<br> 你无需按照固定的时间间隔来学习,因为每学一次都会有进步,每学一次都有新体验。每次拼写完你都会获得一定经验值,随着经验值的增长,你的汇量自然得到扩大。<br> 因为它比一张软盘的容量还小,所以只要带上库文件和主程序,你就可以在任何有电脑的地方继续学习。学完一个库后,你可以到网上下载新的库继续学习;你还可以拿自己用过的库制作成更出色的库文件来共享给别人。<br> 在V0.2版中,新增的库维护器可以对属于你自己的库进行更方便的定制,新增的音标显示和单朗读功能使你即使脱离其它典软件也可以学习新单。<br> 附带库文件的内容是大学英语四级汇,更多库请到作者主页免费下载。如需特殊库也可联系作者免费定制。<br><br>注意<br>---------<br> 应用程序必须同库文件“Englishword.pls”在同一文件夹内才能运行。<br> 字体文件“Ksphonet.ttf”只有同应用程序在同一文件夹内才能保证音标正确显示。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值