Commit 1c9d7da4 by yeran

add the module of memoryLetterWord

1 parent 18851a84
......@@ -8,3 +8,12 @@ import request from '../utils/request'
export function getArticleDetails (data) {
return request({url : 'brain/article/detail' , data})
}
/**
* 获取随机英文单词
* @param data
* @return {AxiosPromise}
*/
export function getRandomWordsAPI(data) {
return request({url : 'brain/article/randomWords' , data})
}
......@@ -79,6 +79,11 @@ const constantRouterMap = [
component: _import('randomLetter/answerLetter'),
name: 'answerLetter',
},
{
path: '/randomLetter/answerLetterWord',
component: _import('randomLetter/answerLetterWord'),
name: 'answerLetterWord',
},
//圆周率
{
path: '/pi/index',
......
......@@ -181,11 +181,11 @@
}
.list .item {
width: 5%;
height: 50px;
display: flex;
align-items: center;
justify-content: center;
margin: 4px 8px;
}
.list .item .data-1 {
......
......@@ -47,7 +47,6 @@
if(down){
if (this.count_time > 0) {
this.count_time = this.count_time - 1;
console.log(this.count_time)
} else {
clearInterval(this.timer);
this.start();
......
<template>
<div class="content">
<div class="title">
<div class="circle">单词默写</div>
<div class="submit-btn" @click="submit">提交</div>
</div>
<div class="list">
<div class="item" v-for="(item,index) in answer">
<div class="text-2">
<input class="text-1" v-model="item.txt" type="text" >
</div>
</div>
</div>
</div>
</template>
<script>
import StoreUtil from "../../store/stateStore";
import BaseConstant from "../../store/constants/baseConstant";
export default {
name: "answerLetterWord",
props: {},
data() {
return {
correctAnswer: [],
myAnswer: [],
answer: []
}
},
methods: {
submit() {
this.myAnswer = [];
let answer_time_end = new Date().getTime();
StoreUtil.stateSave(BaseConstant.BRAIN_TRAIN_TRAIN_INFO_NOW, {
data: {
answer: this.answer,
correctAnswer: this.correctAnswer
},
result: {
answer_time_end: answer_time_end,
}
});
this.$router.push({
path: '/home/result',
query: {
type: 2,
level: this.level,
id: this.caseAlias,
model_id: this.modelAlias
}
});
},
pre() {
},
next() {
},
input(e) {
},
},
mounted() {
this.correctAnswer = JSON.parse(JSON.stringify(StoreUtil.getState().train.currentCase.data.randomNumber));
if (!this.correctAnswer) {
this.$message({
type: 'error',
content: '单词不存在!'
});
}
this.answerLength = this.correctAnswer.length;
for (let i = 0; i < this.answerLength; i++) {
this.answer.push({
txt: '',
check: false,
});
}
console.log(this.correctAnswer,this.answer);
StoreUtil.stateSave(BaseConstant.BRAIN_TRAIN_TRAIN_INFO_NOW, {
result: {
answer_time_start: new Date().getTime()
},
result_detail: {
q: ''
}
});
}
}
</script>
<style scoped>
.content {
padding: 30px 24px;
}
.title {
display: flex;
align-items: center;
}
.circle {
font-size: 30px;
color: #333;
}
.submit-btn {
width: 100px;
height: 60px;
display: flex;
align-items: center;
justify-content: center;
color: #017af7;
font-size: 28px;
border: 2px solid #017af7;
border-radius: 8px;
margin-left: auto;
}
.list {
margin-top: 30px;
display: flex;
flex-wrap: wrap;
}
.item {
display: flex;
align-items: center;
justify-content: center;
}
.text-2 {
width: 90%;
height: 80px;
display: flex;
align-items: center;
justify-content: center;
border-bottom: 2px solid #409eff;
color: #333;
font-size: 20px;
}
.text-1 {
width: 100%;
height: 100%;
display: flex;
text-align: center;
border: 0px;
outline: none;
cursor: pointer;
}
.operation .item {
width: 196px;
height: 80px;
color: white;
font-size: 28px;
display: flex;
align-items: center;
justify-content: center;
}
</style>
......@@ -4,7 +4,7 @@
<div class="circle">英语速记</div>
<div class="limit_time">{{count_time}} s</div>
</div>
<div class="line-style">
<div v-if="mode===1" class="line-style">
<div class="label" style="margin-top: 6px">划辅助线</div>
<div class="list">
<div class="item" :class="{active: checked == 0}" @click="change(0)">不划</div>
......@@ -15,12 +15,18 @@
</div>
</div>
<div class="number-list">
<div v-if="mode===1" class="number-list">
<div class="number-data" v-for="(item,index) in numberList">
<div class="number-item" :key="index" :style="{borderRightColor: item.border?'#666':''}">{{item.num}}
</div>
</div>
</div>
<div v-else class="number-list">
<div class="number-data-word" v-for="(item,index) in numberList">
<div class="number-item" :key="index" :style="{borderRightColor: item.border?'#666':''}">{{item.num}}
</div>
</div>
</div>
<div class="start" @click="start">记忆完成</div>
</div>
......@@ -30,6 +36,7 @@
import StoreUtil from "../../store/stateStore";
import BaseConstant from "../../store/constants/baseConstant";
import BaseTrainPage from "../../framework/core/baseTrainPage";
import {getRandomWordsAPI} from "../../api/article";
export default new BaseTrainPage({
name: "startMemoryLetter",
......@@ -37,18 +44,22 @@
return {
count_time: 0,
checked: 0,
numberList: []
numberList: [],
mode: 1,
}
},
methods: {
countDown() {
countDown(down = true) {
this.timer = setInterval(() => {
if (this.count_time > 0) {
this.count_time = this.count_time - 1;
console.log(this.count_time)
if (down) {
if (this.count_time > 0) {
this.count_time = this.count_time - 1;
} else {
clearInterval(this.timer);
this.start();
}
} else {
clearInterval(this.timer);
this.start();
this.count_time = this.count_time + 1;
}
}, 1000)
},
......@@ -69,16 +80,36 @@
init() {
this.numberList = [];
let number = this.levelConfig.numb_quantity;
for (let i = 0; i < number; i++) {
let arr = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
this.numberList.push({
num: arr[Math.floor(Math.random() * 26)],
border: false
})
this.mode = parseInt(this.levelConfig.mode);
if (1 === this.mode) { //随机字母
for (let i = 0; i < number; i++) {
let arr = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
this.numberList.push({
num: arr[Math.floor(Math.random() * 26)],
border: false
})
}
} else if (2 === this.mode) { // 随机单词
// 获取随机单词
getRandomWordsAPI({
level: 1,
numbs: number,
type: 'english'
}).then((words) => {
if (words && words.data) {
for (let i = 0; i < words.data.length; i++) {
this.numberList.push({
num: words.data[i].word,
border: false
})
}
}
});
}
this.count_time = this.levelConfig.limit_remember_time;
this.countDown();
this.count_time = parseInt(this.levelConfig.limit_remember_time);
this.countDown(this.count_time > 0);
StoreUtil.stateSave(BaseConstant.BRAIN_TRAIN_TRAIN_INFO_NOW, {
data: {
......@@ -96,9 +127,14 @@
learn_time_end: new Date().getTime()
}
});
let path = '';
if (this.mode === 1) {
path = '/randomLetter/answerLetter';
} else if (this.mode === 2) {
path = '/randomLetter/answerLetterWord';
}
this.$router.push({
path: '/randomLetter/answerLetter',
path: path,
query: {
level: this.level,
id: this.caseAlias,
......@@ -200,6 +236,14 @@
justify-content: center;
}
.number-data-word {
display: flex;
align-items: center;
justify-content: center;
padding: 4px 8px;
font-size: 0.4rem;
}
.number-item {
width: 90%;
height: 50px;
......
......@@ -46,7 +46,6 @@
this.timer = setInterval(() => {
if (this.count_time > 0) {
this.count_time = this.count_time - 1;
console.log(this.count_time)
} else {
clearInterval(this.timer);
this.start();
......
......@@ -52,8 +52,8 @@
value: ''
})
}
this.count_time = this.levelConfig.limit_remember_time;
this.countDown();
this.count_time = parseInt(this.levelConfig.limit_remember_time);
this.countDown(this.count_time > 0);
StoreUtil.stateSave(BaseConstant.BRAIN_TRAIN_TRAIN_INFO_NOW, {
data: {
......@@ -72,19 +72,23 @@
}
})
},
countDown() {
countDown(down = true) {
this.timer = setInterval(() => {
if (this.count_time > 0) {
this.count_time = this.count_time - 1;
if (down) {
if (this.count_time > 0) {
this.count_time = this.count_time - 1;
} else {
clearInterval(this.timer);
this.start();
}
} else {
clearInterval(this.timer);
this.start();
this.count_time = this.count_time + 1;
}
}, 1000)
},
start() {
clearInterval(this.timer);
CaseUtil.goToTrain('/studiesChina/answerStudies',this);
CaseUtil.goToTrain('/studiesChina/answerStudies', this);
},
},
async mounted() {
......@@ -156,7 +160,6 @@
}
.operation {
width: 400px;
position: fixed;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!