Commit 58896321 by yuhac

Merge branch 'dev' of ssh://code.ledouya.com:2222/yangchao/brains-h5 into dev

2 parents 98a2bfb0 5681cda8
Showing with 2075 additions and 1544 deletions
......@@ -12,7 +12,7 @@
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="0">
<title>脑力中国</title>
<title>摩天轮学习力</title>
</head>
<body>
<div id="app"></div>
......
{
"name": "help-h5",
"name": "wisdom",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
......@@ -274,6 +274,14 @@
"integrity": "sha1-ePrtjD0HSrgfIrTphdeehzj3IPg=",
"dev": true
},
"async-validator": {
"version": "1.8.5",
"resolved": "https://registry.npmjs.org/async-validator/-/async-validator-1.8.5.tgz",
"integrity": "sha512-tXBM+1m056MAX0E8TL2iCjg8WvSyXu0Zc8LNtYqrVeyoL3+esHRZ4SieE9fKQyyU09uONjnMEjrNBMqT0mbvmA==",
"requires": {
"babel-runtime": "6.x"
}
},
"asynckit": {
"version": "0.4.0",
"resolved": "http://registry.npm.taobao.org/asynckit/download/asynckit-0.4.0.tgz",
......@@ -571,8 +579,7 @@
"babel-helper-vue-jsx-merge-props": {
"version": "2.0.3",
"resolved": "http://registry.npm.taobao.org/babel-helper-vue-jsx-merge-props/download/babel-helper-vue-jsx-merge-props-2.0.3.tgz",
"integrity": "sha1-Iq69OzOQIyjlEyk6jkmSs4T58bY=",
"dev": true
"integrity": "sha1-Iq69OzOQIyjlEyk6jkmSs4T58bY="
},
"babel-helpers": {
"version": "6.24.1",
......@@ -1100,7 +1107,6 @@
"version": "6.26.0",
"resolved": "http://registry.npm.taobao.org/babel-runtime/download/babel-runtime-6.26.0.tgz",
"integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
"dev": true,
"requires": {
"core-js": "^2.4.0",
"regenerator-runtime": "^0.11.0"
......@@ -2019,8 +2025,7 @@
"core-js": {
"version": "2.6.5",
"resolved": "http://registry.npm.taobao.org/core-js/download/core-js-2.6.5.tgz",
"integrity": "sha1-RLyNJJ5/sv9dAOA0Gn/7lPv2eJU=",
"dev": true
"integrity": "sha1-RLyNJJ5/sv9dAOA0Gn/7lPv2eJU="
},
"core-util-is": {
"version": "1.0.2",
......@@ -2496,6 +2501,11 @@
"integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=",
"dev": true
},
"deepmerge": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-1.5.2.tgz",
"integrity": "sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ=="
},
"define-properties": {
"version": "1.1.3",
"resolved": "http://registry.npm.taobao.org/define-properties/download/define-properties-1.1.3.tgz",
......@@ -2778,6 +2788,19 @@
"integrity": "sha1-scz2Gd9yla6he8aVHcaJYyYp5Kk=",
"dev": true
},
"element-ui": {
"version": "2.13.0",
"resolved": "https://registry.npmjs.org/element-ui/-/element-ui-2.13.0.tgz",
"integrity": "sha512-KYsHWsBXYbLELS8cdfvgJTOMSUby3UEjvsPV1V1VmgJ/DdkOAS4z3MiOrPxrT9w2Cc5lZ4eVSQiGhYFR5NVChw==",
"requires": {
"async-validator": "~1.8.1",
"babel-helper-vue-jsx-merge-props": "^2.0.0",
"deepmerge": "^1.2.0",
"normalize-wheel": "^1.0.1",
"resize-observer-polyfill": "^1.5.0",
"throttle-debounce": "^1.0.1"
}
},
"elliptic": {
"version": "6.4.1",
"resolved": "http://registry.npm.taobao.org/elliptic/download/elliptic-6.4.1.tgz",
......@@ -6042,6 +6065,11 @@
"sort-keys": "^1.0.0"
}
},
"normalize-wheel": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/normalize-wheel/-/normalize-wheel-1.0.1.tgz",
"integrity": "sha1-rsiGr/2wRQcNhWRH32Ls+GFG7EU="
},
"npm-run-path": {
"version": "2.0.2",
"resolved": "http://registry.npm.taobao.org/npm-run-path/download/npm-run-path-2.0.2.tgz",
......@@ -9037,8 +9065,7 @@
"regenerator-runtime": {
"version": "0.11.1",
"resolved": "http://registry.npm.taobao.org/regenerator-runtime/download/regenerator-runtime-0.11.1.tgz",
"integrity": "sha1-vgWtf5v30i4Fb5cmzuUBf78Z4uk=",
"dev": true
"integrity": "sha1-vgWtf5v30i4Fb5cmzuUBf78Z4uk="
},
"regenerator-transform": {
"version": "0.10.1",
......@@ -9202,6 +9229,11 @@
"integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=",
"dev": true
},
"resize-observer-polyfill": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz",
"integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg=="
},
"resolve": {
"version": "1.10.0",
"resolved": "http://registry.npm.taobao.org/resolve/download/resolve-1.10.0.tgz",
......@@ -9972,6 +10004,11 @@
"integrity": "sha1-ry2LvJsE907hevK02QSPgHrNGKg=",
"dev": true
},
"throttle-debounce": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/throttle-debounce/-/throttle-debounce-1.1.0.tgz",
"integrity": "sha512-XH8UiPCQcWNuk2LYePibW/4qL97+ZQ1AN3FNXwZRBNPPowo/NRU5fAlDCSNBJIYCKbioZfuYtMhG4quqoJhVzg=="
},
"through2": {
"version": "2.0.5",
"resolved": "http://registry.npm.taobao.org/through2/download/through2-2.0.5.tgz",
......@@ -10554,6 +10591,11 @@
}
}
},
"vue-navigation": {
"version": "1.1.4",
"resolved": "https://registry.npm.taobao.org/vue-navigation/download/vue-navigation-1.1.4.tgz",
"integrity": "sha1-vpkBkGJGR9qjS4zVJfrU+21HJUI="
},
"vue-router": {
"version": "3.0.2",
"resolved": "http://registry.npm.taobao.org/vue-router/download/vue-router-3.0.2.tgz",
......
......@@ -5,7 +5,7 @@
"author": "yangchao <408986770@qq.com>",
"private": true,
"scripts": {
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js --host 10.4.2.105",
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev",
"build": "node build/build.js"
},
......@@ -16,6 +16,7 @@
"less-loader": "^4.1.0",
"lib-flexible": "^0.3.2",
"vue": "^2.5.2",
"vue-navigation": "^1.1.4",
"vue-router": "^3.0.1",
"vuex": "^3.1.0"
},
......@@ -29,7 +30,7 @@
"babel-plugin-transform-vue-jsx": "^3.5.0",
"babel-preset-env": "^1.3.2",
"babel-preset-stage-2": "^6.22.0",
"element-ui": "^2.4.7",
"element-ui": "^2.4.7",
"chalk": "^2.0.1",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.28.0",
......
<template>
<div id="app">
<router-view/>
<navigation>
<router-view/>
</navigation>
</div>
</template>
<script>
import {mapActions} from 'vuex'
export default {
name: 'App',
methods: {
...mapActions({
getCategoryList: 'dispatchGetCategoryList',
getQuestionList: 'dispatchGetQuestionList',
getSpecialList: 'dispatchSpecialList',
getHotKeys: 'dispatchGetHotKeys'
})
},
created(){
this.getCategoryList();
this.getQuestionList();
this.getSpecialList();
this.getHotKeys();
}
}
import StoreUtil from "./store/stateStore";
export default {
name: 'App',
methods: {},
created() {
//在页面加载时读取sessionStorage里的状态信息
if (sessionStorage.getItem("store")) {
this.$store.replaceState(Object.assign({}, StoreUtil.getState(), JSON.parse(sessionStorage.getItem("store"))))
}
//在页面刷新时将vuex里的信息保存到sessionStorage里
window.addEventListener("beforeunload", () => {
sessionStorage.setItem("store", JSON.stringify(StoreUtil.getState()))
});
// bind event
this.$navigation.on('forward', (to, from) => {
console.log('forward to', to, 'from ', from)
});
this.$navigation.on('back', (to, from) => {
console.log('back to', to, 'from ', from)
});
this.$navigation.on('replace', (to, from) => {
console.log('replace to', to, 'from ', from)
});
this.$navigation.on('refresh', (to, from) => {
console.log('refresh to', to, 'from ', from)
});
this.$navigation.on('reset', () => {
console.log('reset')
});
// and use [once, off] methods
this.$navigation.once('forward', () => {
console.log('appear once')
});
const off = () => {
console.log('1111-----will not appear')
};
// this.$navigation.on('forward', off);
// this.$navigation.off('forward', off);
}
}
</script>
<style>
......
import request from '../utils/request'
//文章列表
export function getArticleList (data) {
return request({
url : 'colleges/supportArticle/list' ,
data
})
}
//文章详情
/**
* 文章详情
* @param data
* @return {AxiosPromise}
*/
export function getArticleDetails (data) {
return request({
url : 'colleges/supportArticle/detail' ,
data
})
}
\ No newline at end of file
return request({url : 'brain/article/detail' , data})
}
import request from '../utils/request'
//分类列表
export function getCategoryList (data) {
return request({
url : 'colleges/supportCategory/list' ,
data
})
}
import request from '../utils/request'
/**
* 获取训练配置
* @param data
* @return {AxiosPromise}
*/
export function getCaseConfig (data) {
return request({url : 'brain/trainModelCase/config', data})
}
/**
* 获取实例详情
* @param data
* @return {AxiosPromise}
*/
export function getCaseDetail(data) {
return request({url : 'brain/trainModelCase/detail', data})
}
/**
* 获取模型详情
* @param data
* @return {AxiosPromise}
*/
export function getModelDetail(data) {
return request({url : 'brain/trainModel/detail', data})
}
export function collectUserInfo (data) {
return request({
url : 'Colleges/Contacts/submit' ,
......
import request from '../utils/request'
//关键字
export function getKeywords (data) {
return request({
url : 'colleges/supportCategory/keywords' ,
data
})
}
\ No newline at end of file
import request from '../utils/request'
//获取问答列表
export function queryQuestionList (data) {
return request({
url : 'colleges/supportPlateAnswer/list' ,
data
})
}
\ No newline at end of file
import request from '../utils/request'
//专题列表
export function querySpecialList (data) {
return request({
url : 'colleges/supportPlateSpecial/list' ,
data
})
}
.mask{
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0,0,0,.5);
z-index: 99;
}
.title{
font-size: 32px;
color: #000;
font-weight: 600;
}
.content{
position: fixed;
top: 0;
bottom: 0;
right: 0;
left: 170px;
background-color: #fff;
z-index: 100;
transition: all .3s linear;
transform: translateX(100%);
&.active{
transform: translateX(0);
}
}
.hd{
position: relative;
display: flex;
align-items: center;
justify-content: space-between;
padding: 24px 30px;
border-bottom: 1px solid #E8E8E8; /*no*/
.app-logo{
width: 280px;
height: 70px;
margin-left: 30px;
}
.icon-group{
width: 46px;
height: 46px;
}
}
.main-bd{
position: absolute;
left: 0;
right: 0;
top: 130px;
bottom: 0;
padding: 12px 30px 12px 60px;
overflow: auto;
.input-box{
display: flex;
align-items: center;
margin: 12px 0 20px;
.input{
flex: 1;
display: block;
padding: 14px 20px;
font-size: 30px;
color: #333;
border:1px solid #C6C6C6;/*no*/
border-radius:8px;
background-color: #F9F9F9;
}
.search-btn{
margin-left: 12px;
display: block;
font-size: 30px;/*px*/
color: #666;
min-width: 80px;
}
}
.hot-keys{
position: relative;
overflow: hidden;
.keys{
float: left;
display: block;
margin-left: 20px;
font-size: 20px;
color: #3091FE;
}
&.after{
content: '';
clear: both;
zoom: 1;
}
}
.item{
margin: 40px auto;
.top{
display: flex;
align-items: center;
.icon-arrow{
width: 20px;
height: 14px;
margin-left: 20px;
transition: all .2s linear;
&.rotate{
transform: rotate(180deg);
}
}
}
.sub-menu{
padding: 30px 0 0;
overflow: hidden;
.item-menu{
float: left;
font-size: 32px;
color: #666;
margin-right: 60px;
}
}
}
}
\ No newline at end of file
<template>
<div class='drawer-box' v-if="showDrawer">
<div class="mask" @click="toggleDrawerStatus"></div>
<div class="content" :class="{ active : animate }">
<div class="hd">
<img class="app-logo" src="http://static.ledouya.com/Flu7n1DcDv45J4qNSj9snKHmdTs2" @click="handleBack">
<img class="icon-group" src="../../assets/images/icon-close.png" @click="toggleDrawerStatus">
</div>
<div class="main-bd">
<div class="search-box">
<div class="title">首页</div>
<div class="input-box">
<input class="input" type="text" v-model="keywords" placeholder="请输入你想搜索的">
<a class="search-btn" href="javascript:;" @click="handleSearchBtnClick">搜索</a>
</div>
<div class="hot-keys">
<a class="keys" href="javascript:;" v-for="(item,index) in hotKeys" @click="handleKeyItemClick(item)">{{ item }}</a>
</div>
</div>
<!---->
<div class="cate-list" v-if="cateList[0].children">
<div class="item" v-for="(item,index) in cateList[0].children" :key="index">
<div class="top" @click.stop="toggleCateItem(index)">
<div class="title">{{ item.name }}</div>
<img class="icon-arrow" :class="{ rotate : !item.is_edit }" src="../../assets/images/arrow.png" alt="">
</div>
<div class="sub-menu" v-if="item.children" v-show="item.is_edit ">
<div class="item-menu" v-for="(target,idx) in item.children" @click.stop="handleCateClick(target)">{{ target.name }}</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import { mapGetters , mapMutations } from 'vuex'
export default{
data(){
return{
keywords : '' ,
animate : false
}
},
computed : {
...mapGetters({
hotKeys : 'getHotKeys' ,
showDrawer : 'getDrawerStatus' ,
cateList : 'getCategoryList' ,
showFormModal : 'getFormStatus'
})
},
watch : {
showDrawer : function () {
this.toggleFormStatus({ flag : false });
setTimeout(()=>{
if( this.showDrawer ) {
this.animate = true;
} else this.animate = false;
},100)
}
},
methods : {
...mapMutations([
'toggleDrawerStatus' ,
'toggleFormStatus'
]),
handleBack(){
this.toggleDrawerStatus();
this.$router.push({
path : '/'
})
},
toggleCateItem(index){
this.cateList[0].children[index].is_edit = !this.cateList[0].children[index].is_edit;
this.$store.commit('insertCategoryList',this.cateList)
},
handleSearchBtnClick(){
if( !this.keywords.trim().length ){
this.$message({
title : '温馨提示' ,
content : '请输入搜索关键字'
})
return ;
}
this.toggleDrawerStatus();
this.$router.push({
path : '/display/search?keywords=' + this.keywords
})
this.keywords = '';
},
handleKeyItemClick(item){
this.toggleDrawerStatus();
this.$router.push({
path : '/display/search?keywords=' + item
})
this.keywords = '';
},
handleCateClick(e){
this.toggleDrawerStatus();
this.$router.push({
path : `/display/${e.id}?cateName=${e.name}`
})
this.keywords = '';
}
}
}
</script>
<style scoped lang="less">
@import "./index.less";
</style>
\ No newline at end of file
.mask{
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0,0,0,.5);
z-index: 3;
}
.content{
position: fixed;
padding-bottom: 30px;
bottom: 0;
left: 0;
right: 0;
background-color: #fff;
z-index: 9;
transition: all .3s linear;
transform: translateY(100%);
&.active{
transform: translateY(0);
}
}
.hd{
position: relative;
border-bottom: 1px solid #E8E8E8;/*no*/
.title{
padding: 30px;
font-size: 32px;/*px*/
text-align: center;
color: #999;
}
.icon-close{
position: absolute;
width: 46px;
height: 46px;
right: 30px;
top: 30px;
}
}
.bd{
padding: 30px;
position: relative;
text-align: center;
.text{
font-size: 30px;/*px*/
color: #333;
}
.tel-link{
display: block;
margin-top: 10px;
font-size: 40px;
color: #3091FE;
}
&:after{
content: '';
display: block;
position: absolute;
left: 30px;
right: 30px;
bottom: 0;
background-color: #E8E8E8;
height: 1px; /*no*/
}
}
.tips{
padding: 30px 24px 10px;
font-size: 30px;/*px*/
color: #333;
}
.form-box{
padding: 30px 24px;
.input{
padding: 24px 30px;
border : 1px solid #c6c6c6; /*no*/
width: 100%;
font-size: 30px;/*px*/
margin-bottom: 30px;
}
}
.submit-btn{
margin: 50px 24px 0;
background-color: #3091FE;
text-align: center;
color: #fff;
font-size: 32px;
padding: 25px 30px;
}
\ No newline at end of file
<template>
<div class='form-wrapper' v-show="showFormModal">
<div class="mask" @click.stop="toggleFormStatus( { flag : false })"></div>
<div class="content" :class="{ active : animate }">
<div class="hd">
<div class="title">开店咨询</div>
<img class="icon-close" src="../../assets/images/icon-close.png" alt="" @click.stop="toggleFormStatus( { flag : false })">
</div>
<div class="bd">
<div class="text">请拨打开店咨询热线:</div>
<a class="tel-link" href="tel:400-6865539">400-6865539</a>
</div>
<div class="tips">或者填写你的联系方式,我们会主动与你联系</div>
<div class="form-box">
<input type="text" class="input" placeholder="姓名" v-model="name">
<input type="tel" class="input" placeholder="手机号码" v-model="phone" maxlength="11">
<input type="text" class="input" placeholder="公司名称(选填)" v-model="company">
</div>
<div class="submit-btn" @click="handleSubmitBtnClick">提交信息</div>
</div>
<Loading :loading="loading"></Loading>
</div>
</template>
<script>
import { mapGetters , mapMutations } from 'vuex'
import Loading from '../../components/Loading'
//api
import { collectUserInfo } from '../../api/common'
export default{
components : {
Loading
},
data(){
return{
name : '' ,
phone : '',
company : '' ,
animate : false ,
loading : false
}
},
computed : {
...mapGetters({
showFormModal : 'getFormStatus'
})
},
watch : {
showFormModal : function () {
setTimeout(()=>{
this.animate = !this.animate;
},100)
}
},
methods : {
...mapMutations([
'toggleFormStatus'
]),
handleSubmitBtnClick(){
if(!this.validate()) return;
this.loading = true;
collectUserInfo({
name : this.name ,
phone : this.phone ,
title : this.company || this.phone ,
details : this.company || this.phone
}).then(res=>{
this.loading = false;
this.toggleFormStatus( { flag : false });
if(res.error === 0 ){
this.$message({
title : '温馨提示' ,
content : res.error_reason
})
}
})
},
validate(){
if(!this.name.trim().length){
this.$message({
title : '温馨提示' ,
content : '请输入姓名'
})
return false;
}
if(!this.phone.trim().length){
this.$message({
title : '温馨提示' ,
content : '请输入联系方式'
})
return false;
}
return true;
}
}
}
</script>
<style scoped lang="less">
@import "./index.less";
</style>
\ No newline at end of file
import CaseUtil from "../service/base/caseUtil";
export default class BaseCasePage {
baseData = {
caseAlias: null,
modelAlias: null,
thirdToken: null,
caseConfig: {},
caseInfo: {},
};
baseShare = {
canShare: false,
sysShare: false,
shareInfo: {
title: '',
path: '',
imageUrl: '',
options: null
},
};
constructor(pageObj) {
console.log('---BaseCasePage-----');
if (pageObj.data) { // data域合并。
let _data = pageObj.data();
let data = this.baseData;
let share = JSON.parse(JSON.stringify(this.baseShare));
pageObj.data = function () {
if (!_data) _data = {};
let newData = JSON.parse(JSON.stringify(data));
if (_data.share) share = Object.assign(share, _data.share);
return Object.assign(newData, _data, {share: share});
};
}
//拦截入参,onLoad 事件特殊处理
if (pageObj.mounted) {
let _onLoad = pageObj.mounted;
pageObj.mounted = async function () {
//获取页面数据
let caseAlias = this.caseAlias ? this.caseAlias : '0';//默认值为
if (this.$route.query && this.$route.query.id) {
caseAlias = this.$route.query.id;
}
if (this.$route.query && this.$route.query.model_id) {
this.modelAlias = this.$route.query.model_id;
}
if (this.$route.query && this.$route.query.thirdToken) {
this.thirdToken = this.$route.query.thirdToken;
}
this.caseAlias = caseAlias;
// console.log(caseAlias, '---caseAlias----', this.thirdToken);
//根据caseAlias 获取页面数据-同步阻塞方法
await CaseUtil.loadCaseInfo(caseAlias, this.modelAlias, false, (caseInfo) => {
this.caseInfo = caseInfo;
this.caseConfig = caseInfo.config;
// console.log(this.caseConfig,'----this.caseInfo---');
_onLoad.call(this);
});
};
}
return pageObj;
}
}
import CaseUtil from "../service/base/caseUtil";
import BaseCasePage from "./baseCasePage";
export default class BaseTrainPage extends BaseCasePage{
baseData = {
level: 0,
levelConfig: {},
};
constructor(pageObj) {
console.log('---BaseTrainPage-----');
//拦截入参,onLoad 事件特殊处理
if (pageObj.mounted) {
let _onLoad = pageObj.mounted;
pageObj.mounted = async function () {
//获取当前level的配置数据
this.level = this.$route.query.level;
this.levelConfig = this.caseConfig[this.level];
await _onLoad.call(this);
};
super(pageObj);
if (pageObj.data) { // data域合并。
let _data = pageObj.data;
let data = this.baseData;
pageObj.data = function () {
return Object.assign(JSON.parse(JSON.stringify(data)), _data());
};
}
}
return pageObj;
}
}
/**
* 模型实例工具类
*/
import {getCaseConfig, getCaseDetail} from "../../../api/common";
import StoreUtil from "../../../store/stateStore";
import BaseConstant from "../../../store/constants/baseConstant";
import fa from "element-ui/src/locale/lang/fa";
export default class CaseUtil {
/**
* 获取case完整信息
* @param caseAlias
* @param modelAlias
* @param force
* @param callback
* @return {Promise<unknown>}
*/
static loadCaseInfo(caseAlias, modelAlias, force = false, callback = null) {
if (!caseAlias || !caseAlias.length) {
return false;
}
//缓存读取
if (!force && StoreUtil.getState().train.cases['case_' + caseAlias]) {
if (callback) callback(StoreUtil.getState().train.cases['case_' + caseAlias]);
return true;
}
//网络获取
let data = {
id: caseAlias,
model_id: modelAlias,
};
return new Promise(resolve => {
getCaseDetail(data).then((res) => {
// 执行数据存储
let info = res.data;
if (info.config) {
info.config = JSON.parse(info.config);
}
StoreUtil.stateSave(BaseConstant.BRAIN_TRAIN_CASE_INFO, info);
if (callback) callback(info);
});
resolve(true);
});
}
/**
* 获取case配置
* @param caseAlias
* @param modelAlias
* @param force
* @param callback
* @return {Promise<unknown>|null}
*/
static loadCaseConfig(caseAlias, modelAlias, force = false, callback = null) {
if (!caseAlias || !caseAlias.length) {
return null;
}
//缓存读取
//网络获取
let data = {
id: caseAlias,
model_id: modelAlias
};
return new Promise(resolve => {
getCaseConfig(data).then((res) => {
// 执行数据存储
if (callback) callback(res.data);
});
resolve(true);
});
}
static goToTrain(path,that){
StoreUtil.stateSave(BaseConstant.BRAIN_TRAIN_TRAIN_INFO_NOW, {
case_id: that.caseAlias,
model_id: that.modelAlias,
level: that.level,
level_config: that.caseConfig[that.level],
});
that.$router.push({
path: path,
query: {
level: that.level,
id: that.caseAlias,
model_id: that.modelAlias
}
});
}
}
// 获取 getUToken
export function getToken () {
return window.localStorage.getItem('token') ;
// return 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImp0aSI6IiJ9.eyJpc3MiOiIiLCJhdWQiOiIiLCJqdGkiOiIiLCJpYXQiOjE1NDgyMTE3ODcsIm5iZiI6MTU0ODIxMTc4NywiZXhwIjoxNTc5NzQ3Nzg3LCJ0b2tlbiI6ImQ3ODI3NGRkZDJiZDU5MjYxN2NmY2I0NDFkNmY3YWQ1IiwidXRva2VuIjoiZDc4Mjc0ZGRkMmJkNTkyNjE3Y2ZjYjQ0MWQ2ZjdhZDUiLCJidG9rZW4iOiIxZGY0NmUwMmRiNDkyYjQ2MTEyMGMyNWEyMTk2NTNlYiIsInJvbGUiOiJ1c2VyIiwidWlkIjoiNDIiLCJvcGVuaWQiOiJvMVc2SnMxLVJySDJQc3oxU29uU0lkY05vNlBvIn0.Q8WDoUviFakJl1IVEpPmMMaS9EgfvzycBHfocuBkaXw'
}
//获取cookie、
export function getCookie(name) {
if(name === 'token'){
return "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImp0aSI6IiJ9.eyJpc3MiOiIiLCJhdWQiOiIiLCJqdGkiOiIiLCJpYXQiOjE1ODE1ODk1NTAsIm5iZiI6MTU4MTU4OTU1MCwiZXhwIjoxNTgyMTk0MzUwLCJ0b2tlbiI6IjAwYWZlYWZiM2IyZTg0YTNjZTI4NDU2N2I0NjE4Nzg4IiwiYnRva2VuIjoiMDBhZmVhZmIzYjJlODRhM2NlMjg0NTY3YjQ2MTg3ODgiLCJtdG9rZW4iOiIzYzcyNDg1ZGZiM2E3NTViYjVhOTZiYjg4ODVkZjU4OCIsImFjY291bnQiOiIxODcxMDg0NzMwOCIsInRva2VuX3R5cGUiOiJidXNpbmVzcyIsInJvbGUiOiJtYXN0ZXIiLCJpbmR1c3RyeV90eXBlIjoiIiwic291cmNlIjoicGMifQ.rlrK8BZTub_uiTmtcXVomaSU-XRuadLIzdxUNXSIQBU";
}
let arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
if (arr = document.cookie.match(reg))
return (arr[2]);
else
return null;
}
//设置cookie
export function setCookie (c_name, value, expiredays) {
let exdate = new Date();
exdate.setDate(exdate.getDate() + expiredays);
document.cookie = c_name + "=" + escape(value) + ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString());
};
//删除cookie
export function delCookie (name) {
let exp = new Date();
exp.setTime(exp.getTime() - 1);
let cval = getCookie(name);
if (cval != null)
document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
};
......@@ -3,25 +3,31 @@
import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store'
import StoreUtil from './store/stateStore';
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import 'lib-flexible/flexible'
Vue.use(ElementUI)
Vue.config.productionTip = false
import Navigation from "vue-navigation";
let store = StoreUtil.getStore();
Vue.use(ElementUI);
Vue.config.productionTip = false;
//global components
import Message from './components/Message'
Vue.prototype.$message = Message.install;
Vue.use(Navigation, {router, store});
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
store,
components: { App },
template: '<App/>'
})
el: '#app',
router,
store,
components: {App},
template: '<App/>'
});
......@@ -3,7 +3,7 @@ import Router from 'vue-router'
const _import = require('./_import_' + process.env.NODE_ENV)
Vue.use(Router)
Vue.use(Router);
import Layout from '../views/layout/Layout.vue'
......@@ -13,7 +13,7 @@ const constantRouterMap = [
},
{
path: '/',
component: Layout ,
component: Layout ,
children : [
{
path : '/' ,
......@@ -86,6 +86,11 @@ const constantRouterMap = [
name : 'pi' ,
},
{
path : '/pi/preLearn' ,
component : _import('pi/preLearn') ,
name : 'preLearn' ,
},
{
path : '/pi/answerPi' ,
component : _import('pi/answerPi') ,
name : 'answerPi' ,
......@@ -151,18 +156,23 @@ const constantRouterMap = [
},
//国学经典
{
path : '/studiesChnia/index' ,
component : _import('studiesChnia/index') ,
name : 'studiesChniaIndex' ,
path : '/studiesChina/preLearn' ,
component : _import('studiesChina/preLearn') ,
name : 'preLearn' ,
},
{
path : '/studiesChina/index' ,
component : _import('studiesChina/index') ,
name : 'studiesChinaIndex' ,
},
{
path : '/studiesChnia/answerStudies' ,
component : _import('studiesChnia/answerStudies') ,
path : '/studiesChina/answerStudies' ,
component : _import('studiesChina/answerStudies') ,
name : 'answerStudies' ,
},
{
path : '/studiesChnia/studiesResult' ,
component : _import('studiesChnia/studiesResult') ,
path : '/studiesChina/studiesResult' ,
component : _import('studiesChina/studiesResult') ,
name : 'studiesResult' ,
},
]
......
File mode changed
export const trainAction = {}
;
File mode changed
export default class BaseConstant {
static APP_ENV_INFO = 'app_env_info';
static APP_ACCESS_AUTH = 'app_access_auth';
static SYSTEM_LAUNCH_TOKEN = 'system_launch_token';
static SYSTEM_SYS_INFO = 'system_sys_info';
/**
* 系统类信息
* @type {string}
*/
static SYSTEM_INFO = 'system_info';
static SYSTEM_USER_LOCATION = 'system_user_location';
static USER_BASE_INFO = 'user_base_info';
static USER_OVERVIEW_INFO = 'user_overview_info';
static BRAIN_TRAIN_MODEL_INFO = 'brain_train_model_info';
static BRAIN_TRAIN_CASE_INFO = 'brain_train_case_info';
static BRAIN_TRAIN_CASE_CONFIG = 'brain_train_case_config';
static BRAIN_TRAIN_CASE_ANSWER = 'brain_train_case_answer';
static BRAIN_TRAIN_TRAIN_INFO_NOW = 'brain_train_train_info_now';
static BRAIN_TRAIN_CASE_INFO_NOW_CLEAN = 'brain_train_train_info_now_clean';
}
const getters = {
nickname : state => state.app.userInfo.nickname || JSON.parse(sessionStorage.getItem('userInfo')).nickname,
routers : state => state.routers ,
subRouters : state => state.subRouters
}
export default getters
export const appGetter = {
};
File mode changed
File mode changed
import Vue from 'vue'
import Vuex from 'vuex'
import app from './modules/app'
Vue.use(Vuex)
const state = {
baseURL : process.env.NODE_ENV === 'development' ? 'http://api.xuetang.test.ledianyun.com/' :'https://xuetang.api.ledianyun.com/' ,
}
import Vue from 'vue';
import Vuex from 'vuex';
import createLogger from 'vuex/dist/logger';
import {appModule} from './modules/app';
import {trainModule} from './modules/train';
import {sysModule} from './modules/sys';
import {userModule} from './modules/user';
Vue.use(Vuex);
const store = new Vuex.Store({
modules : {
app,
randomNumber: [], //随机数字正确答案
myNumberAnswer: [], //我的随机数字答案
randomLetter: [], //随机字母正确答案
myLetterAnswer: [], //我的随机字母答案
forwardAnswer: [], //正向速算结果
reserveAnswer: [], //逆向速算结果
articleAnswer: [], //阅读理解结果
},
state
})
modules: {
app: appModule,
train: trainModule,
sys: sysModule,
user: userModule,
},
state: {
},
mutations: {},
plugins: [createLogger()],
// strict: process.env.NODE_ENV !== 'production'
});
export default store
export default store;
import { getCategoryList } from '../../api/category'
import { queryQuestionList } from '../../api/question'
import { querySpecialList } from '../../api/special'
import { getKeywords } from '../../api/keywords'
import BaseConstant from '../constants/baseConstant';
const app = {
state : {
//分类列表
categoryList : [] ,
//问答列表
questionList : [] ,
//专题列表
specialList : [] ,
//热词列表
hotKeys : [],
//目标分类
targetCategory : {},
//form
showFormModal : false ,
//侧边栏
showDrawer : false
},
getters : {
//获取分类
getCategoryList(state){
return state.categoryList.length ? state.categoryList : JSON.parse(sessionStorage.getItem('categoryList'));
},
//选中的文章信息
getTargetCategory(state){
return state.targetCategory;
},
//获取问答
getQuestionList(state){
return state.questionList.length ? state.questionList : JSON.parse(sessionStorage.getItem('questionList'));
},
//获取专题
getSpecialList(state){
return state.specialList.length ? state.specialList : JSON.parse(sessionStorage.getItem('specialList'));
},
//获取热词
getHotKeys(state){
return state.hotKeys.length ? state.hotKeys : JSON.parse(sessionStorage.getItem('hotKeys'));
},
//获取form状态
getFormStatus(state){
return state.showFormModal;
},
//获取状态
getDrawerStatus(state){
return state.showDrawer;
}
},
mutations : {
//插入分类
insertCategoryList(state,payload){
state.categoryList = payload;
sessionStorage.setItem('categoryList',JSON.stringify(payload));
},
//插入目标文章
insertTargetCategory(state,payload){
state.targetCategory = payload;
},
//插入问答
insertQuestionList(state,payload){
state.questionList = payload;
sessionStorage.setItem('questionList',JSON.stringify(payload));
},
//插入专题
insertSpecialList(state,payload){
state.specialList = payload;
sessionStorage.setItem('specialList',JSON.stringify(payload));
},
//插入热词
insertHotKeys(state,payload){
state.hotKeys = payload;
sessionStorage.setItem('hotKeys',JSON.stringify(payload));
},
//切换状态
toggleFormStatus(state,payload){
state.showFormModal = payload.flag;
},
//切换
toggleDrawerStatus(state){
state.showDrawer = !state.showDrawer
}
},
actions : {
//异步请求分类列表
dispatchGetCategoryList({ commit }){
//加载分类
let categoryList = JSON.parse(sessionStorage.getItem('categoryList'));
const state = {
platform: 'custom',
domains: {
//基础服务
serviceURL: 'https://pg.ledianyun.com/oem/qidian/api/',
storeURL: 'https://pg.ledianyun.com/oem/qidian/api/',
openURL: 'https://pg.ledianyun.com/oem/qidian/api/'
},
version: 'latest',
//当前环境
envVersion: 'develop',
mtoken: '',
btoken: '',
authorize: {
token: '',
exp: 0
},
};
if( categoryList && categoryList.length ) return;
console.log('---');
getCategoryList().then(res=>{
if(res.data && res.data.length){
if(res.data[0].children) res.data[0].children[0].is_edit = true;
commit('insertCategoryList',res.data);
}
})
},
//异步请求问答列表
dispatchGetQuestionList({ commit }){
let questionList = JSON.parse(sessionStorage.getItem('questionList'));
if( questionList && questionList.length ) return;
export const appModule = {
// namespaced: true,
state,
getters: {},
actions: {},
mutations: {
[BaseConstant.APP_ACCESS_AUTH](state, authorize) {
state.authorize = Object.assign(state.authorize, {
token: authorize.token,
exp: authorize.exp,
});
},
queryQuestionList().then(res => {
if ( res.data && res.data.info ) {
res.data.info.map((v,index)=>{
if( index === 0 ) v.is_expand = true
else v.is_expand = false
})
commit('insertQuestionList',res.data.info)
}
})
},
//异步请求专题列表
dispatchSpecialList({ commit }){
let specialList = JSON.parse(sessionStorage.getItem('specialList'));
if( specialList && specialList.length ) return;
querySpecialList().then(res => {
if ( res.data && res.data.info ) {
commit('insertSpecialList',res.data.info)
}
})
},
//异步请求热词
dispatchGetHotKeys( { commit }){
let hotKeys = JSON.parse(sessionStorage.getItem('hotKeys'));
if( hotKeys && hotKeys.length ) return;
getKeywords().then(res=>{
if(res.data && res.data.length) {
commit('insertHotKeys',res.data);
}
})
}
}
}
export default app
\ No newline at end of file
[BaseConstant.APP_ENV_INFO](state, action) {
state = Object.assign(state, action);
},
}
};
import BaseConstant from '../constants/baseConstant';
const state = {
launch_token: 'launch',
network: 'normal',
sysInfo: {},
location: {
latitude: 0,
longitude: 0,
location_time: null
},
launched:false,
};
export const sysModule = {
state,
getters: {},
actions: {},
mutations: {
[BaseConstant.SYSTEM_LAUNCH_TOKEN](state, action) {
state.launch_token = action;
},
[BaseConstant.SYSTEM_SYS_INFO](state, action) {
state.sysInfo = Object.assign(state.sysInfo, action);
},
[BaseConstant.SYSTEM_INFO](state, action) {
state = Object.assign(state, action);
},
init(state, action) {
state.launched = action;
},
}
};
import {trainMutation} from '../mutations/train';
import {trainAction} from '../actions/train';
const state = {
models: {}, //模型信息列表
cases: {},// 训练实例列表(包括配置信息)
currentCase: {
case_id: 0,
model_id:0,
level:0,
level_config:{},
data:{},
result:{},
result_detail:{}
},
randomNumber: [], //随机数字正确答案
myNumberAnswer: [], //我的随机数字答案
randomLetter: [], //随机字母正确答案
myLetterAnswer: [], //我的随机字母答案
forwardAnswer: [], //正向速算结果
reserveAnswer: [], //逆向速算结果
articleAnswer: [], //阅读理解结果
};
export const trainModule = {
// namespaced: true,
state,
mutations: trainMutation,
actions: trainAction,
};
import BaseConstant from '../constants/baseConstant';
const state = {
userBaseInfo: {}, //用户基础信息
};
export const userModule = {
state,
getters: {},
actions: {},
mutations: {
[BaseConstant.USER_BASE_INFO](state, action) {
state.userBaseInfo = Object.assign(state.userBaseInfo, action);
},
}
};
import BaseConstant from '../constants/baseConstant';
export const trainMutation = {
[BaseConstant.BRAIN_TRAIN_MODEL_INFO](state, action) {
let model_id = action.id;
if (!state.models["model_" + model_id]) {
state.models["model_" + model_id] = {};
}
state.models["model_" + model_id] = Object.assign(state.models["model_" + model_id], action);
},
[BaseConstant.BRAIN_TRAIN_CASE_INFO](state, action) {
let case_id = action.id;
if (!state.cases["case_" + case_id]) {
state.cases["case_" + case_id] = {};
}
state.cases["case_" + case_id] = Object.assign(state.cases["case_" + case_id], action);
},
[BaseConstant.BRAIN_TRAIN_CASE_ANSWER](state, action) {
let model_name = action.model_name;
state[model_name] = action;
},
[BaseConstant.BRAIN_TRAIN_TRAIN_INFO_NOW](state, action) {
if (action.data) {
action.data = Object.assign(state.currentCase.data, action.data);
}
if (action.result) {
action.result = Object.assign(state.currentCase.result, action.result);
}
if (action.result_detail) {
action.result_detail = Object.assign(state.currentCase.result_detail, action.result_detail);
}
state.currentCase = Object.assign(state.currentCase, action);
},
[BaseConstant.BRAIN_TRAIN_CASE_INFO_NOW_CLEAN](state, action) {
state.currentCase = {
case_id: 0,
model_id:0,
level:0,
level_config:{},
data:{},
result:{},
result_detail:{}
};
},
};
import configStore from './index';
const store = configStore;
export default class StoreUtil {
static getStore() {
return store;
}
/**
* redux 快速存储方法
* @param handler
* @param data
*/
static stateSave(handler, data = null) {
store.commit(handler, data);
}
/**
* 获取到state
* @return {any}
*/
static getState() {
return store.state;
}
/**
* 本地缓存
* @param key
* @param data
* @param exp
*/
static localSave(key, data, exp = null) {
data = {
value: data,
exp: exp ? (new Date().getTime() / 1000 + exp) : null
};
window.localStorage.setItem(key, JSON.stringify(data));
}
/**
* 从本地缓存获取数据
* @param key
* @return {null|*}
*/
static localGet(key) {
let data = window.localStorage.getItem(key);
if (!data) {
return null;
}
data = JSON.parse(data);
if (data.exp && new Date().getTime() > data.exp) {
StoreUtil.localRemove(key);
}
return data.value;
}
/**
* 移除本地缓存
* @param key
*/
static localRemove(key) {
window.localStorage.removeItem(key);
}
/**
* 清空本地缓存
*/
static localClear() {
window.localStorage.clear();
}
}
......@@ -30,4 +30,45 @@ input::-webkit-inner-spin-button {
}
.content p{
line-height: 20px;
}
\ No newline at end of file
}
.m-selector {
display: flex;
align-items: center;
width: 100%;
justify-content: center;
flex-wrap: wrap;
color: #666;
margin-top: 20px;
}
.m-selector .item{
/*width: 46px;*/
min-width: 46px;
padding: 8px 6px;
height: 46px;
display: flex;
align-items: center;
justify-content: center;
border: 2px solid #666;
border-radius: 8px;
margin-left: 20px;
margin-top : 8px;
margin-bottom : 8px;
}
.m-selector .active {
color: #fff;
background: #409eff;
border-color: #409eff;
}
.startAnswer {
margin: 0 auto ;
padding: 16px 40px;
border-radius: 40px;
font-size: 16px;
background: #409EFF;
color: #fff;
display: flex;
align-items: center;
justify-content: center;
}
// 请求
import axios from 'axios'
import StoreUtil from "../store/stateStore";
import {getCookie, setCookie} from "../framework/util/cookie";
const baseURL = process.env.NODE_ENV === 'development' ? 'http://api.xuetang.test.ledianyun.com/' :'https://xuetang.api.ledianyun.com/';
let isDev = process.env.NODE_ENV === 'development';
isDev = true;
const baseURL = isDev ? 'http://api.brain.test.ledianyun.com/' : 'https://api.brain.ledianyun.com/';
// create an axios instance
const service = axios.create({
baseURL : baseURL , // api的base_url
timeout : 30000, // request timeout
method : 'post' ,
transformRequest : [function (data) {
return JSON.stringify(data)
}],
headers : {
'Content-Type' : 'application/json'
}
})
baseURL: baseURL, // api的base_url
timeout: 30000, // request timeout
method: 'post',
transformRequest: [function (data) {
return JSON.stringify(data)
}],
headers: {
'Content-Type': 'application/json'
}
});
// request interceptor
service.interceptors.request.use(config => {
//console.log(config)
return config;
} , error => {
// Do something with request error
console.log(error)
return Promise.reject(error)
})
if (!config.body) config.body = {};
config.body = Object.assign(config.body, {
version: 'latest',
third_token: StoreUtil.localGet('thirdToken')
});
//请求头
if (!config.body.notAuth) {
config.headers['token'] = getCookie('token');
}
return config;
}, error => {
// Do something with request error
console.log(error);
return Promise.reject(error)
});
// request interceptor
service.interceptors.response.use( response => {
if( response.data.error !== 0 ){
alert( response.data['error_reason'] )
return {};
}
return response.data;
} , error => {
alert( error.message )
return Promise.reject(error)
})
service.interceptors.response.use(response => {
if (response.data.error == 10001 || response.data.error == 10002 || response.data.error == 10003
|| response.data.error == 10004 || !getCookie('token')) {
// window.localStorage.setItem('currentPath', window.location.href);
setCookie('currentPath', window.location.href);
window.location.href = store.state.testUrl + "api/wechat/auth?path=" + store.state.path;
return {};
} else {
if (response.data.error !== 0) {
this.$message({
type: 'error',
content: response.data['error_reason']
});
return {};
}
return response.data;
}
}, error => {
alert(error.message);
return Promise.reject(error)
});
export default service
\ No newline at end of file
export default service
......@@ -10,7 +10,7 @@
<div class="question-item" v-for="(item,index) in questionList" v-if="(index+1) == subject_number">
<div class="question">{{index+1}}{{item.question}}</div>
<div v-for="(i) in item.answer" class="answer">
<input v-model="myAnswer" type="radio" :value="i" :name="i" />{{i}}
<input v-model="myAnswer" type="radio" :value="i" :name="i"/>{{i}}
</div>
</div>
......@@ -28,6 +28,9 @@
<script>
import {article} from "../../utils/article";
import StoreUtil from "../../store/stateStore";
import BaseConstant from "../../store/constants/baseConstant";
export default {
name: "answerQuestion",
data() {
......@@ -41,50 +44,70 @@
},
methods: {
pre() {
if(this.subject_number>1) {
this.myAnswer = this.questionList[this.subject_number-2].myAnswer;
if (this.subject_number > 1) {
this.myAnswer = this.questionList[this.subject_number - 2].myAnswer;
this.subject_number = this.subject_number - 1;
}
},
next() {
if(this.subject_number<this.questionList.length) {
this.questionList[this.subject_number-1].myAnswer = this.myAnswer?this.myAnswer:'未作答';
if (this.subject_number < this.questionList.length) {
this.questionList[this.subject_number - 1].myAnswer = this.myAnswer ? this.myAnswer : '未作答';
this.myAnswer = this.questionList[this.subject_number].myAnswer;
this.subject_number = this.subject_number + 1;
}
},
submit() {
this.questionList[this.subject_number-1].myAnswer = this.myAnswer;
this.$store.state.articleAnswer = this.questionList;
this.questionList[this.subject_number - 1].myAnswer = this.myAnswer;
let answer_time_end = new Date().getTime();
StoreUtil.stateSave(BaseConstant.BRAIN_TRAIN_TRAIN_INFO_NOW, {
data: {
answer: this.questionList,
},
result: {
answer_time_end: answer_time_end,
}
});
this.$router.push({
path: '/fastReading/readResult',
query: {
time: this.count_time
}
query: {}
})
},
countDown() {
this.timer = setInterval(()=>{
if(this.count_time > 0) {
this.timer = setInterval(() => {
if (this.count_time > 0) {
this.count_time = this.count_time - 1;
}else {
} else {
clearInterval(this.timer);
}
},1000)
}, 1000)
},
},
mounted() {
this.count_time = this.$route.query.time;
this.countDown();
article[0].questionList.forEach((v,i)=>{
this.article_index = JSON.parse(JSON.stringify(StoreUtil.getState().train.currentCase.data.article_index));
article[0].questionList.forEach((v, i) => {
this.questionList.push({
question: v.question,
answer: v.answer,
myAnswer: '未作答',
correctAnswer: v.correctAnswer
correctAnswer: v.correctAnswer,
check: false,
})
})
});
StoreUtil.stateSave(BaseConstant.BRAIN_TRAIN_TRAIN_INFO_NOW, {
result: {
answer_time_start: new Date().getTime()
},
result_detail: {
q: []
}
});
this.count_time = this.$route.query.time;
this.countDown();
}
}
</script>
......@@ -126,13 +149,16 @@
.question-list {
margin-top: 30px;
}
.question-item {
}
.question {
color: #333;
font-size: 30px;
}
.answer {
text-indent: 40px;
font-size: 28px;
......@@ -142,6 +168,7 @@
align-items: center;
padding-left: 40px;
}
.operation {
width: 400px;
position: fixed;
......@@ -175,12 +202,14 @@
border-top-right-radius: 40px;
background: #409eff;
}
.operation .item-3 {
border-bottom-left-radius: 40px;
border-top-left-radius: 40px;
color: #999;
border: 2px solid #999;
}
.operation .item-4 {
border-bottom-right-radius: 40px;
border-top-right-radius: 40px;
......
......@@ -16,13 +16,13 @@
<div>比赛规则</div>
</div>
<div class="explain">
1、选手在“国际脑力运动”线上平台报名参加脑力世界杯并选中本项比赛。
1、选手在“摩天轮脑力运动”线上平台报名参加脑力世界杯并选中本项比赛。
</div>
<div class="explain">
1. Athlete register Intellectual World Cup on the "International Intellectual Sports" online platform and select this discipline.
</div>
<div class="explain">
2、所有选手在“国际脑力运动”线上平台上点击进入本项目比赛倒计时页面,倒计时归零后立即开始比赛。
2、所有选手在“摩天轮脑力运动”线上平台上点击进入本项目比赛倒计时页面,倒计时归零后立即开始比赛。
</div>
<div class="explain">
2. All athletes clicked into the countdown page on the "International Intellectual Sports"
......@@ -87,26 +87,49 @@
<div class="explain">
3. The highest round score is the final score.
</div>
<div class="m-selector">
选择模式:
<div v-for="(item, index) in caseConfig" :key="index" :index="index" :item="item">
<div class="item" :class="{active: (level === index)}" @click="changLevel(index)">{{item.level_name}}
</div>
</div>
</div>
<div class="start" @click="start">开始训练</div>
</div>
</template>
<script>
export default {
import BaseCasePage from "../../framework/core/baseCasePage";
import CaseUtil from "../../framework/service/base/caseUtil";
export default new BaseCasePage({
name: "index",
data() {
return {
level: 0,
}
},
methods: {
changLevel(level) {
if (level !== this.level) {
this.level = level;
}
},
start() {
this.$router.push({
path: '/fastReading/readArticle'
})
CaseUtil.goToTrain('/fastReading/readArticle',this);
}
},
mounted() {
}
}
})
</script>
<style scoped>
.content {
padding: 30px 24px 120px;
padding: 30px 24px 156px;
}
.title {
display: flex;
......
<template>
<div class="content">
<div class="title">第1轮 <span>{{count_time}}s</span></div>
<div class="article" v-html="content"></div>
<div class="start" @click="start">阅读完成</div>
<div class="title">
<div class="circle">{{article_index+1}}</div>
<div class="limit_time">{{count_time}} s</div>
</div>
<div v-if="articles && articles.length" class="article" v-html="articles[0].content"></div>
<div class="startAnswer" @click="start">阅读完成</div>
</div>
</template>
<script>
import {article} from "../../utils/article";
import BaseTrainPage from "../../framework/core/baseTrainPage";
import {getArticleDetails} from "../../api/article";
import StoreUtil from "../../store/stateStore";
import BaseConstant from "../../store/constants/baseConstant";
export default {
export default new BaseTrainPage({
name: "readArticle",
data() {
return {
content: article[0].text,
count_time: 900,
article_index: 0,
articles: [],
count_time: 0,
timer: ''
}
},
methods: {
start() {
clearInterval(this.timer);
StoreUtil.stateSave(BaseConstant.BRAIN_TRAIN_TRAIN_INFO_NOW, {
data:{
articles: this.articles,
article_index: this.article_index,
questions: [],
},
result: {
learn_time_end: new Date().getTime()
}
});
this.$router.push({
path: '/fastReading/answerQuestion',
query: {
level: this.level,
id: this.caseAlias,
model_id: this.modelAlias,
time: this.count_time
}
})
},
countDown() {
this.timer = setInterval(()=>{
if(this.count_time > 0) {
this.timer = setInterval(() => {
if (this.count_time > 0) {
this.count_time = this.count_time - 1;
}else {
} else {
clearInterval(this.timer);
}
},1000)
}, 1000)
},
init() {
getArticleDetails({
ids: [this.levelConfig.article_ids[0]]
}).then((articles) => {
this.articles = [];
if (articles && articles.data) {
this.articles.push(...articles.data);
this.count_time = this.levelConfig.limit_remember_time;
this.countDown();
// 获取第一篇文章对应的问题
StoreUtil.stateSave(BaseConstant.BRAIN_TRAIN_TRAIN_INFO_NOW, {
result: {
learn_time_start: new Date().getTime()
}
});
} else {
this.$message({
type: 'error',
content: '文章不存在!'
});
}
})
},
},
mounted() {
this.countDown()
this.init()
}
}
})
</script>
<style scoped>
.content {
padding: 30px 24px;
}
.title {
display: flex;
align-items: center;
}
.circle {
font-size: 30px;
color: #333;
}
.limit_time {
width: 100px;
height: 60px;
display: flex;
align-items: center;
justify-content: center;
color: #017af7;
font-size: 28px;
margin-left: auto;
}
.title span {
color: #409eff;
margin-left: 20px;
}
.article {
margin-top: 30px;
margin-bottom: 24px;
}
.start {
margin: 60px auto ;
width: 500px;
height: 80px;
border-radius: 40px;
font-size: 32px;
background: #409EFF;
color: #fff;
display: flex;
align-items: center;
justify-content: center;
}
</style>
<template>
<div class="content">
<div class="title">正向速算答题记录</div>
<div class="title">阅读理解答题记录</div>
<div class="data-list">
<div class="data-item" style="width: 1000%">正向速算:<span>得分{{score}}</span></div>
<div class="data-item" style="width: 1000%">阅读理解:<span>得分{{result.score}}</span></div>
</div>
<div class="data-list">
<div class="data-item">答题数量:<span>{{number}}</span></div>
<div class="data-item">正确数量:<span>{{correctNumber}}</span></div>
<div class="data-item">答题用时:<span>{{900-residue_time}}s</span></div>
<div class="data-item">剩余时间:<span>{{residue_time}}s</span></div>
<div class="data-item">正确率:<span>{{percentage}}%</span></div>
<div class="data-item">答题数量:<span>{{result.question_numb}}</span></div>
<div class="data-item">正确数量:<span>{{result.right_numb}}</span></div>
<div class="data-item">答题用时:<span>{{use_time_desc}}</span></div>
<div class="data-item">剩余时间:<span>{{result.answer_time_left}}s</span></div>
<div class="data-item">正确率:<span>{{result.right_rate}}%</span></div>
</div>
<div class="answer">答案对比</div>
<div class="answer-list">
<div class="answer-item" v-for="(item,index) in answerList">
<div class="subject">{{index+1}}{{item.question}}</div>
<div class="subject" style="text-indent: 20px">你的答案:<span>{{item.myAnswer}}</span></div>
<div v-if="item.check" class="subject subject-success" style="text-indent: 20px">你的答案:{{item.myAnswer}}</div>
<div v-else class="subject subject-error" style="text-indent: 20px">你的答案:{{item.myAnswer}}</div>
<div class="subject" style="text-indent: 20px">正确答案:{{item.correctAnswer}}</div>
</div>
</div>
<div class="operation">
<div class="item item-1">再来一局</div>
<div class="item item-1" @click="again()">再来一局</div>
<div class="item item-2" @click="goback()">返回列表</div>
</div>
</div>
</template>
<script>
import StoreUtil from "../../store/stateStore";
import BaseConstant from "../../store/constants/baseConstant";
import {secSimpleText} from "../../framework/util/func";
export default {
name: "readResult",
data() {
return {
score: 0, //分数
number: '100', //答题数量
correctNumber: 0, //正确数量
percentage: 0, //正确率
answerList: [],
residue_time: '', //剩余时间
use_time_desc: '',
result: {
score: 0,
question_numb: 0,
right_numb: 0,
right_rate: 0,
learn_time: 0,
learn_left_time: 0,
answer_time: 0,
answer_time_left: 0,
use_time: 0
},
result_detail: {
question: [],
answer: []
}
}
},
methods: {
goback() {
StoreUtil.stateSave(BaseConstant.BRAIN_TRAIN_CASE_INFO_NOW_CLEAN);
this.$router.push({
path: '/'
})
},
again() {
let url = '/fastReading/index';
let query = {
id: StoreUtil.getState().train.currentCase.case_id,
model_id: StoreUtil.getState().train.currentCase.model_id
};
StoreUtil.stateSave(BaseConstant.BRAIN_TRAIN_CASE_INFO_NOW_CLEAN);
this.$router.push({
path: url,
query
})
}
},
created() {
this.residue_time = this.$route.query.time;
this.answerList = this.$store.state.articleAnswer;
this.number = this.answerList.length;
this.answerList.forEach(v=>{
if(v.myAnswer == v.correctAnswer) {
this.correctNumber = this.correctNumber + 1;
mounted() {
let data = StoreUtil.getState().train.currentCase.data;
let result = StoreUtil.getState().train.currentCase.result;
let levelConfig = StoreUtil.getState().train.currentCase.level_config;
this.answerList = data.answer;
this.result.question_numb = this.answerList.length;
this.result.answer_time = result.answer_time_end - result.learn_time_start;
this.result.answer_time_left = levelConfig.limit_remember_time - this.result.answer_time/1000;
this.use_time_desc = secSimpleText(this.result.answer_time);
for (let i = 0; i < this.answerList.length; i++) {
if (('' + this.answerList[i].correctAnswer) === ('' + this.answerList[i].myAnswer)) {
this.result.right_numb += 1;
this.answerList[i].check = true;
}
})
this.score = this.correctNumber * 19;
this.percentage = (this.correctNumber/this.number*100).toFixed(2);
}
this.result.right_rate = (this.result.right_numb / this.result.question_numb * 100).toFixed(2);
this.result.score = this.result.right_numb * 19;
this.result_detail.question = [
{
q: this.answerList,
a: []
}
];
this.result_detail.answer = [];
console.log(this.result, this.result_detail);
}
}
</script>
......@@ -115,10 +166,17 @@
.answer-item .subject span {
color: red;
}
.answer-item .subject-error {
color: red;
}
.answer-item .subject-success {
color: blue;
}
.operation {
width: 400px;
position: fixed;
bottom: 120px;
bottom: 24px;
display: flex;
left: 50%;
transform: translateX(-50%);
......
......@@ -2,43 +2,58 @@
<div class="content">
<div class="title">正向速算答题记录</div>
<div class="data-list">
<div class="data-item" style="width: 1000%">正向速算:<span>得分{{score}}</span></div>
<div class="data-item" style="width: 1000%">正向速算:<span>得分{{result.score}}</span></div>
</div>
<div class="data-list">
<div class="data-item">答题数量:<span>{{number}}</span></div>
<div class="data-item">正确数量:<span>{{correctNumber}}</span></div>
<div class="data-item">答题用时:<span>{{540-residue_time}}s</span></div>
<div class="data-item">剩余时间:<span>{{residue_time}}s</span></div>
<div class="data-item">正确率:<span>{{percentage}}%</span></div>
<div class="data-item">答题数量:<span>{{result.question_numb}}</span></div>
<div class="data-item">正确数量:<span>{{result.right_numb}}</span></div>
<div class="data-item">答题用时:<span>{{use_time_desc}}</span></div>
<div class="data-item">剩余时间:<span>{{result.answer_time_left}}s</span></div>
<div class="data-item">正确率:<span>{{result.right_rate}}%</span></div>
</div>
<div class="answer">答案对比</div>
<div class="answer-list">
<div class="answer-item" v-for="(item,index) in answerList">
<div class="subject">{{index+1}}{{item.subject}}</div>
<div class="subject" style="text-indent: 20px">你的答案:<span>{{item.myAnswer}}</span></div>
<div v-if="item.check" class="subject subject-success" style="text-indent: 20px">你的答案:{{item.myAnswer}}</div>
<div v-else class="subject subject-error" style="text-indent: 20px">你的答案:{{item.myAnswer}}</div>
<div class="subject" style="text-indent: 20px">正确答案:{{item.correctAnswer}}</div>
</div>
</div>
<div class="operation">
<div class="item item-1">再来一局</div>
<div class="item item-1" @click="again()">再来一局</div>
<div class="item item-2" @click="goback()">返回列表</div>
</div>
</div>
</template>
<script>
import StoreUtil from "../../store/stateStore";
import BaseConstant from "../../store/constants/baseConstant";
import {secSimpleText} from "../../framework/util/func";
export default {
name: "forwardResult",
data() {
return {
score: 0, //分数
number: '100', //答题数量
correctNumber: 0, //正确数量
percentage: 0, //正确率
answerList: [],
residue_time: '', //剩余时间
use_time_desc: '',
result: {
score: 0,
question_numb: 0,
right_numb: 0,
right_rate: 0,
learn_time: 0,
learn_left_time: 0,
answer_time: 0,
answer_time_left: 0,
use_time: 0
},
result_detail: {
question: [],
answer: []
}
}
},
methods: {
......@@ -46,19 +61,54 @@
this.$router.push({
path: '/'
})
},
again() {
let url = '/forward/index';
let query = {
id: StoreUtil.getState().train.currentCase.case_id,
model_id: StoreUtil.getState().train.currentCase.model_id,
};
console.log(this.type, '-type-');
StoreUtil.stateSave(BaseConstant.BRAIN_TRAIN_CASE_INFO_NOW_CLEAN);
this.$router.push({
path: url,
query
})
}
},
created() {
this.residue_time = this.$route.query.time;
this.answerList = this.$store.state.forwardAnswer;
this.answerList = [];
let data = StoreUtil.getState().train.currentCase.data;
let result = StoreUtil.getState().train.currentCase.result;
let levelConfig = StoreUtil.getState().train.currentCase.level_config;
this.answerList = data.answerList;
this.number = this.answerList.length;
this.answerList.forEach(v=>{
if(v.myAnswer == v.correctAnswer) {
this.correctNumber = this.correctNumber + 1;
this.result.question_numb = this.answerList.length;
this.result.answer_time = result.answer_time_end - result.answer_time_start;
this.result.answer_time_left = levelConfig.limit_remember_time - this.result.answer_time/1000;
this.use_time_desc = secSimpleText(this.result.answer_time);
for (let i = 0; i < this.answerList.length; i++) {
if (('' + this.answerList[i].correctAnswer) === ('' + this.answerList[i].myAnswer)) {
this.result.right_numb += 1;
this.answerList[i].check = true;
}
}
this.result.right_rate = (this.result.right_numb / this.result.question_numb * 100).toFixed(2);
this.result.score = this.result.right_numb * 19;
this.result_detail.question = [
{
q: this.answerList,
a: []
}
})
this.score = this.correctNumber * 19;
this.percentage = (this.correctNumber/this.number*100).toFixed(2);
];
this.result_detail.answer = [];
console.log(this.result, this.result_detail);
}
}
</script>
......@@ -67,6 +117,7 @@
.content {
padding: 30px 24px 200px;
}
.title {
width: 100%;
display: flex;
......@@ -76,6 +127,7 @@
color: #000;
margin-bottom: 20px;
}
.data-list {
display: flex;
flex-wrap: wrap;
......@@ -91,6 +143,7 @@
.data-item span {
color: #1f72ff;
}
.answer {
background: #409eff;
width: 150px;
......@@ -104,21 +157,31 @@
margin-bottom: 15px;
border-radius: 8px;
}
.answer-list {
}
.answer-item .subject {
.answer-item .subject {
margin-bottom: 10px;
font-size: 28px;
color: #333;
}
.answer-item .subject span {
.answer-item .subject span {
color: red;
}
.answer-item .subject-error {
color: red;
}
.answer-item .subject-success {
color: blue;
}
.operation {
width: 400px;
position: fixed;
bottom: 120px;
bottom: 24px;
display: flex;
left: 50%;
transform: translateX(-50%);
......
......@@ -16,13 +16,13 @@
<div>比赛规则</div>
</div>
<div class="explain">
1、选手在“国际脑力运动”线上平台报名参加脑力世界杯并选中本项比赛。
1、选手在“摩天轮脑力运动”线上平台报名参加脑力世界杯并选中本项比赛。
</div>
<div class="explain">
1. Athlete register Intellectual World Cup on the "International Intellectual Sports" online platform and select this discipline.
</div>
<div class="explain">
2、所有选手在“国际脑力运动”线上平台上点击进入本项目比赛倒计时页面,倒计时归零后立即开始比赛。
2、所有选手在“摩天轮脑力运动”线上平台上点击进入本项目比赛倒计时页面,倒计时归零后立即开始比赛。
</div>
<div class="explain">
2. All athletes clicked into the countdown page on the "International Intellectual Sports" online platform,
......@@ -79,26 +79,47 @@
2. The highest round score is the final score.
</div>
<div class="m-selector">
选择模式:
<div v-for="(item, index) in caseConfig" :key="index" :index="index" :item="item">
<div class="item" :class="{active: (level === index)}" @click="changLevel(index)">{{item.level_name}}
</div>
</div>
</div>
<div class="start" @click="start">开始训练</div>
</div>
</template>
<script>
export default {
import BaseCasePage from "../../framework/core/baseCasePage";
import CaseUtil from "../../framework/service/base/caseUtil";
export default new BaseCasePage({
name: "index",
data() {
return {
level: 0,
}
},
methods: {
changLevel(level) {
if (level !== this.level) {
this.level = level;
}
},
start() {
this.$router.push({
path: '/forward/forwardAnswer'
})
CaseUtil.goToTrain('/forward/forwardAnswer',this);
}
},
mounted() {
}
}
})
</script>
<style scoped>
.content {
padding: 30px 24px 120px;
padding: 30px 24px 156px;
}
.title {
display: flex;
......
<template>
<div class='question-box'>
<div class="title">常见问题</div>
<div class="list">
<div class="item" v-for="(item,index) in questionList" :key="index" @click.stop="toggleExpandArticle(index)">
<div class="hd">
<div class="text">{{ item.name }}</div>
<img class="icon-arrow" src="../../../assets/images/arrow-down.png" v-if="item.is_expand" >
<img class="icon-arrow" src="../../../assets/images/arrow-right.png" v-else>
</div>
<div class="article-box" v-if="item.item_list.length && item.is_expand">
<a :href="`/display/${target.category_id}/details/${target.id}`" class="article" v-for="(target,idx) in item.item_list" :key="target.id">· {{ target.title }}</a>
</div>
</div>
</div>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
export default{
computed : {
...mapGetters({
questionList : 'getQuestionList'
})
},
methods : {
toggleExpandArticle(index){
this.questionList[index].is_expand = !this.questionList[index].is_expand;
this.$store.commit('insertQuestionList', this.questionList )
}
}
}
</script>
<style scoped lang="less">
.question-box{
padding: 30px 24px 0;
}
.title{
position: relative;
font-size: 30px;/*px*/
color: #999;
text-align: center;
&:after,&:before{
content: '';
display: block;
position: absolute;
top: 50%;
width: 40%;
border-bottom: 1px solid #E8E8E8; /*no*/
transform: translateY(-50%);
}
&:before{
left: 0;
}
&:after{
right: 0;
}
}
.item{
position: relative;
padding-top: 30px;
padding-bottom: 30px;
.hd{
display: flex;
align-items: center;
justify-content: space-between;
.text{
font-size: 34px;/*px*/
color: #111111;
font-weight:500;
}
.icon-arrow{
width: 30px;
height: 30px;
}
}
.article-box{
padding-top: 10px;
.article{
display: block;
margin: 10px 0;
color: #3091FE;
}
}
&:after{
content: '';
display: block;
position: absolute;
height: 1px;/*no*/
background-color: #E8E8E8;
left: -30px;
right: -30px;
bottom: 0;
}
}
</style>
\ No newline at end of file
<template>
<div class='special-box'>
<div class="title">热门专题</div>
<div class="list">
<a :href="item.link" class="item" v-for="(item,index) in specialList">
<img class="icon" :src="item.picture" :title="item.name">
<h2>{{ item.name }}</h2>
</a>
</div>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
export default{
computed : {
...mapGetters({
specialList : 'getSpecialList'
})
},
methods : {
}
}
</script>
<style scoped lang="less">
.special-box{
padding: 30px 24px 0;
}
.title{
position: relative;
font-size: 30px;/*px*/
color: #999;
text-align: center;
&:after,&:before{
content: '';
display: block;
position: absolute;
top: 50%;
width: 40%;
border-bottom: 1px solid #E8E8E8; /*no*/
transform: translateY(-50%);
}
&:before{
left: 0;
}
&:after{
right: 0;
}
}
.list{
padding: 30px 24px 0;
overflow: hidden;
}
.item{
float: left;
text-align: center;
width: 25%;
margin-bottom: 30px;
.icon{
width: 90px;
height: 90px;
margin: 0 auto;
}
h2{
margin-top: 10px;
font-size: 30px;/*px*/
color: #666;
}
}
</style>
\ No newline at end of file
......@@ -27,25 +27,24 @@
data() {
return {
memory: [
{
label: '国学经典',
path: '/studiesChnia/index'
path: '/studiesChina/index?id=1&model_id=1'
},
{
label: '随机数字',
path: '/randomNumber/index'
path: '/randomNumber/index?id=4&model_id=2'
},
{
label: '随机字母',
path: '/randomLetter/index'
label: '英语速记',
path: '/randomLetter/index?id=5&model_id=3'
},
{
label: '圆周率',
path: '/pi/index'
path: '/pi/index?id=6&model_id=4'
},
{
label: '活力大脑对应',
label: '活力大脑',
path: '/randomLetter/index'
},
{
......@@ -56,17 +55,17 @@
speed: [
{
label: '原点凝视',
path: '/stareOrigin/index'
path: '/stareOrigin/index?id=7&model_id=6'
},
{
label: '之字运动',
path: '/zhiExercise/index'
path: '/zhiExercise/index?id=8&model_id=7'
},
],
heartCount: [
{
label: '正向训练',
path: '/forward/index'
path: '/forward/index?id=9&model_id=8'
},
{
label: '逆向训练',
......@@ -74,7 +73,7 @@
},
{
label: '阅读理解',
path: '/fastReading/index'
path: '/fastReading/index?id=10&model_id=5'
},
]
}
......
<template>
<div class="content">
<div class="title" v-if="type == 1">随机数字</div>
<div class="title" v-if="type == 2">随机字母</div>
<div class="title" v-if="type == 2">英语速记</div>
<div class="title" v-if="type == 3">圆周率</div>
<div class="data-list">
<div class="data-item">答题数量:<span>{{number}}</span></div>
<div class="data-item">正确数量:<span>{{correctNumber}}</span></div>
<div class="data-item">正确率:<span>{{percentage}}%</span></div>
<div class="data-item">用时:<span>0分4秒98</span></div>
<div class="data-item">答题数量:<span>{{result.question_numb}}</span></div>
<div class="data-item">正确数量:<span>{{result.right_numb}}</span></div>
<div class="data-item">正确率:<span>{{result.right_rate}}%</span></div>
<div class="data-item">用时:<span>{{use_time_desc}}</span></div>
</div>
<div class="answer">你的答案</div>
<div class="list">
<div class="item" v-for="(item,index) in myAnswer">
<div class="data-1">{{item.txt}}</div>
<div v-if="item.check" class="data-2">{{item.txt}}</div>
<div v-else class="data-1">{{item.txt}}</div>
</div>
</div>
<div class="answer">正确答案</div>
......@@ -29,53 +30,105 @@
</template>
<script>
import StoreUtil from "../../store/stateStore";
import {secSimpleText} from "../../framework/util/func";
import BaseConstant from "../../store/constants/baseConstant";
export default {
name: "result",
data() {
return {
answer: 100,
myAnswer: [],
correctAnswer: [],
number: 0,
correctNumber: 0,
percentage: 0,
type: 1, //1随机数字 2随机字母 3圆周率
use_time_desc: '',
result: {
score: 0,
question_numb: 0,
right_numb: 0,
right_rate: 0,
learn_time: 0,
learn_left_time: 0,
answer_time: 0,
answer_time_left: 0,
use_time: 0
},
result_detail: {
question: [],
answer: []
}
}
},
methods: {
goback() {
StoreUtil.stateSave(BaseConstant.BRAIN_TRAIN_CASE_INFO_NOW_CLEAN);
this.$router.push({
path: '/'
})
},
again() {
let url = '';
if(this.type == 1) {
let query = {
id: StoreUtil.getState().train.currentCase.case_id,
model_id: StoreUtil.getState().train.currentCase.model_id
};
console.log(this.type, '-type-');
if (this.type == 1) {
url = '/randomNumber/index';
}else if(this.type == 2) {
} else if (this.type == 2) {
url = '/randomLetter/index'
}else {
} else {
url = '/pi/index'
}
StoreUtil.stateSave(BaseConstant.BRAIN_TRAIN_CASE_INFO_NOW_CLEAN);
this.$router.push({
path: url
path: url,
query
})
}
},
mounted() {
if(this.$route.query&&this.$route.query.number) {
this.correctNumber = this.$route.query.correctNumber;
this.number = this.$route.query.number;
this.type = this.$route.query.type;
if(this.type == 1 || this.type == 3) {
this.myAnswer = this.$store.state.myNumberAnswer;
this.correctAnswer = this.$store.state.randomNumber;
}else if(this.type==2) {
this.myAnswer = this.$store.state.myLetterAnswer;
this.correctAnswer = this.$store.state.randomLetter;
this.type = this.$route.query.type;
let data = StoreUtil.getState().train.currentCase.data;
let result = StoreUtil.getState().train.currentCase.result;
let levelConfig = StoreUtil.getState().train.currentCase.level_config;
this.correctAnswer = data.correctAnswer;
this.myAnswer = data.answer;
this.number = this.correctAnswer.length;
this.result.question_numb = this.correctAnswer.length;
this.result.learn_time = result.learn_time_end - result.learn_time_start;
this.result.learn_left_time = levelConfig.limit_remember_time - this.result.learn_time;
this.result.answer_time = result.answer_time_end - result.answer_time_start;
this.result.use_time = result.answer_time_end - result.learn_time_start;
this.use_time_desc = secSimpleText(this.result.use_time);
for (let i = 0; i < this.correctAnswer.length; i++) {
if ((''+this.correctAnswer[i].num) === (''+this.myAnswer[i].txt)) {
this.result.right_numb += 1;
this.myAnswer[i].check = true;
}
this.percentage = (this.correctNumber/this.number*100).toFixed(2);
}
this.result.right_rate = (this.result.right_numb / this.result.question_numb * 100).toFixed(2);
this.result_detail.question = [
{
q: StoreUtil.getState().train.currentCase.result_detail.q,
a: this.correctAnswer
}
];
this.result_detail.answer = [
{
a: this.myAnswer,
check_result: 0
}
];
console.log(this.result, this.result_detail);
}
}
</script>
......@@ -134,6 +187,7 @@
align-items: center;
justify-content: center;
}
.list .item .data-1 {
width: 90%;
height: 100%;
......@@ -142,6 +196,7 @@
align-items: center;
justify-content: center;
}
.list .item .data-2 {
width: 90%;
height: 100%;
......@@ -150,10 +205,11 @@
align-items: center;
justify-content: center;
}
.operation {
width: 400px;
position: fixed;
bottom: 120px;
bottom: 24px;
display: flex;
left: 50%;
transform: translateX(-50%);
......
<template>
<div class='app-wrapper'>
<!-- <app-nav></app-nav>-->
<router-view/>
<!-- <app-footer></app-footer>-->
<!-- <Form/>-->
<!-- <Drawer/>-->
</div>
</template>
<script>
import AppNav from './components/AppNav.vue'
import AppFooter from './components/AppFooter.vue'
import Form from '../../components/Form'
import Drawer from '../../components/Drawer'
export default {
components: {
AppNav,
AppFooter,
Form,
Drawer
}
}
</script>
......
<template>
<div class='ft-btn' @click.stop="toggleFormStatus( { flag : true })">开店咨询</div>
</template>
<script>
import { mapMutations } from 'vuex'
export default{
methods : {
...mapMutations([
'toggleFormStatus'
])
}
}
</script>
<style scoped lang="less">
.ft-btn{
position: fixed;
left: 0;
right: 0;
bottom: 0;
font-size: 32px; /*px*/
color: #fff;
padding: 25px 30px;
text-align: center;
background-color: #3091FE;
}
</style>
\ No newline at end of file
<template>
<div class='app-nav'>
<img class="app-logo" src="http://static.ledouya.com/Flu7n1DcDv45J4qNSj9snKHmdTs2" @click="handleBack">
<img class="icon-group" src="../../../assets/images/icon-group.png" @click="toggleDrawerStatus">
</div>
</template>
<script>
import { mapMutations } from 'vuex'
export default{
methods : {
...mapMutations([
'toggleDrawerStatus'
]),
handleBack(){
this.$router.push({
path : '/'
})
}
}
}
</script>
<style scoped lang="less">
.app-nav{
position: fixed;
top: 0;
left: 0;
right: 0;
padding: 30px 24px;
display: flex;
align-items: center;
justify-content: space-between;
background-color: #fff;
z-index: 5;
}
.app-logo{
width: 280px;
height: 70px;
}
.icon-group{
width: 70px;
height: 70px;
}
</style>
\ No newline at end of file
......@@ -12,7 +12,9 @@
<div class="answer-list">
<div class="item" v-for="(item,index) in answer">
<div class="data" :style="{background: item.focus?'#409eff':''}" @click="changeFocus(index)">{{item.txt}}</div>
<div class="data" :style="{background: (index==focus)?'#409eff':''}" @click="changeFocus(index)">
{{item.txt}}
</div>
</div>
</div>
......@@ -26,14 +28,18 @@
<div class="item" @click="input(7)">7</div>
<div class="item" @click="input(8)">8</div>
<div class="item" @click="input(9)">9</div>
<div class="item delete">删除</div>
<div class="item delete" @click="del">删除</div>
<div class="item zero" @click="input(0)">0</div>
</div>
</div>
</template>
<script>
export default {
import StoreUtil from "../../store/stateStore";
import BaseConstant from "../../store/constants/baseConstant";
import BaseTrainPage from "../../framework/core/baseTrainPage";
export default new BaseTrainPage({
name: "answerPi",
data() {
return {
......@@ -41,74 +47,91 @@
answer: [],
focus: 0,
correctAnswer: [],
correctNumber: 0
}
},
methods:{
methods: {
//提交
submit() {
this.answer.forEach((v,i)=>{
if(v.txt === this.correctAnswer[i].num) {
this.correctNumber = this.correctNumber + 1;
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.$store.state.myNumberAnswer = this.answer;
});
this.$router.push({
path: '/home/result',
query: {
number: this.answerLength,
correctNumber: this.correctNumber,
type: 3
type: 3,
level: this.level,
id: this.caseAlias,
model_id: this.modelAlias
}
})
});
},
//前插一位
pre() {
this.answer[this.focus].focus = false;
this.answer.splice(this.focus,0,{
this.answer.splice(this.focus, 0, {
txt: '',
focus: false,
})
this.answer[this.focus].focus = true;
});
this.focus = this.focus;
this.answer.length = this.answerLength;
},
//后插一位
next(){
this.answer.splice(this.focus+1,0,{
next() {
this.answer.splice(this.focus + 1, 0, {
txt: '',
focus: false,
})
});
this.focus = this.focus + 1;
this.answer.length = this.answerLength;
},
//点击改变焦点
changeFocus(i){
this.answer[this.focus].focus = false;
changeFocus(i) {
this.answer[i].focus = true;
this.focus = i;
},
input(val) {
this.answer[this.focus].txt = val;
if(this.focus < this.answer.length-1) {
this.answer[this.focus].focus = false;
this.focus ++ ;
this.answer[this.focus].focus = true;
if (this.focus < this.answer.length - 1) {
this.focus++;
}
}
},
del() {
if (this.answer[this.focus].txt == '') {//当前无值,则进1删除
let oldFocusItem = this.focus;
this.focus = (oldFocusItem > 0) ? (oldFocusItem - 1) : 0;
this.answer[this.focus].txt = '';
} else {
this.answer[this.focus].txt = '';
}
},
},
mounted() {
this.correctAnswer = this.$store.state.randomNumber;
if(this.$route.query&&this.$route.query.number) {
this.answerLength = this.$route.query.number;
for(let i=0; i< this.answerLength; i++) {
this.answer.push({
txt: '',
focus: i == 0 ? true : false,
})
}
this.correctAnswer = JSON.parse(JSON.stringify(StoreUtil.getState().train.currentCase.data.randomNumber));
this.answerLength = this.correctAnswer.length;
let q = [];
this.answer = [];
for (let i = 0; i < this.answerLength; i++) {
this.answer.push({
txt: '',
focus: i === 0,
check: false,
});
q.push(this.correctAnswer[i].num);
}
StoreUtil.stateSave(BaseConstant.BRAIN_TRAIN_TRAIN_INFO_NOW, {
result: {
answer_time_start: new Date().getTime()
},
result_detail: {
q: q.join(',')
}
});
}
}
})
</script>
<style scoped>
......@@ -165,6 +188,7 @@
align-items: center;
flex-wrap: wrap;
}
.answer-list .item {
width: 5%;
height: 50px;
......@@ -172,6 +196,7 @@
align-items: center;
justify-content: center;
}
.answer-list .item .data {
width: 90%;
height: 100%;
......@@ -180,6 +205,7 @@
align-items: center;
justify-content: center;
}
.btn-list {
display: flex;
align-items: center;
......
<template>
<div class="content">
<div class="line-style">
<div class="label">圆周率</div>
</div>
<div 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>
<div class="item" :class="{active: checked == 2}" @click="change(2)">2</div>
<div class="item" :class="{active: checked == 3}" @click="change(3)">3</div>
<div class="item" :class="{active: checked == 4}" @click="change(4)">4</div>
<div class="item" :class="{active: checked == 5}" @click="change(5)">5</div>
<div class="item" :class="{active: checked == 8}" @click="change(8)">8</div>
</div>
</div>
<div 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 class="title">圆周率训练</div>
<div class="m-selector">
<div v-for="(item, index) in caseConfig" :key="index" :index="index" :item="item">
<div class="item" :class="{active: (level === index)}" @click="changLevel(index)">{{item.level_name}}
</div>
</div>
</div>
<div class="start" @click="accomplish">记忆完成</div>
<el-button type="primary" class="start" @click="start">开始训练</el-button>
</div>
</template>
<script>
import {pi} from '@/utils/pi'
export default {
import BaseCasePage from "../../framework/core/baseCasePage";
import CaseUtil from "../../framework/service/base/caseUtil";
export default new BaseCasePage({
name: "index",
data() {
return {
checked: 0,
number: 0,
numberList: []
level: 0,
}
},
methods: {
change(val) {
if(this.checked == val) return;
this.checked = val;
this.numberList.forEach(v=>{
v.border = false
})
if(this.checked != 0) {
this.numberList.forEach((vv,ii)=>{
if((ii+1)%val == 0) {
vv.border = true;
}
})
changLevel(level) {
if (level !== this.level) {
this.level = level;
}
},
accomplish() {
this.$router.push({
path: '/pi/answerPi',
query: {
number: 200
}
})
start() {
CaseUtil.goToTrain('/pi/preLearn',this);
}
},
mounted() {
this.numberList = pi;
this.numberList.forEach(v=>{
v.border = false
})
this.$store.state.randomNumber = this.numberList;
}
}
})
</script>
<style scoped>
.content {
padding: 30px 24px;
}
.line-style {
display: flex;
/*align-items: center;*/
margin-top: 20px;
}
.line-style .label {
font-size: 30px;
color: #333;
width: 150px;
}
.line-style .list {
display: flex;
flex-direction: column;
padding-top: 48px;
align-items: center;
flex-wrap: wrap;
}
.line-style .item {
height: 60px;
display: flex;
align-items: center;
justify-content: center;
border: 2px solid #666;
border-radius: 8px;
margin-left: 20px;
padding: 0 24px;
margin-bottom: 20px;
}
.line-style .active {
color: #fff;
background: #409eff;
border-color: #409eff;
}
.number-list {
display: flex;
flex-wrap: wrap;
/*margin-top: 20px;*/
}
.number-data {
width: 5%;
display: flex;
align-items: center;
justify-content: center;
}
.number-item {
width: 90%;
height: 50px;
display: flex;
align-items: center;
justify-content: center;
border-right: 2px solid transparent;
.title {
color: #1685ff;
font-size: 34px;
font-weight: bold;
margin-bottom: 50px;
}
.start {
margin: 60px auto ;
margin-top: 60px;
width: 500px;
height: 80px;
border-radius: 40px;
font-size: 32px;
background: #409EFF;
color: #fff;
display: flex;
align-items: center;
justify-content: center;
}
</style>
<template>
<div class="content">
<div class="title">
<div class="circle">圆周率训练</div>
<div class="limit_time">{{count_time}} s</div>
</div>
<div 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>
<div class="item" :class="{active: checked == 2}" @click="change(2)">2</div>
<div class="item" :class="{active: checked == 4}" @click="change(4)">4</div>
<div class="item" :class="{active: checked == 6}" @click="change(6)">6</div>
<div class="item" :class="{active: checked == 8}" @click="change(8)">8</div>
</div>
</div>
<div 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 class="start" @click="start">记忆完成</div>
</div>
</template>
<script>
import {getPi} from "../../utils/pi";
import BaseTrainPage from "../../framework/core/baseTrainPage";
import StoreUtil from "../../store/stateStore";
import BaseConstant from "../../store/constants/baseConstant";
export default new BaseTrainPage({
name: "preLearn",
data() {
return {
checked: 0,
count_time:0,
numberList: []
}
},
methods: {
countDown(down=true) {
this.timer = setInterval(() => {
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();
}
}else{
this.count_time = this.count_time + 1;
}
}, 1000)
},
change(val) {
if (this.checked == val) return;
this.checked = val;
this.numberList.forEach(v => {
v.border = false
})
if (this.checked != 0) {
this.numberList.forEach((vv, ii) => {
if ((ii + 1) % val == 0) {
vv.border = true;
}
})
}
},
init() {
this.numberList = [];
let numb_start = this.levelConfig.numb_start;
let numb_end = this.levelConfig.numb_end;
let array = getPi(true, numb_start-1, numb_end);
for (let i = 0, len = array.length; i < len; i++) {
this.numberList.push({
num: array[i],
border: false
})
}
this.count_time = parseInt(this.levelConfig.limit_remember_time);
this.countDown(false);
StoreUtil.stateSave(BaseConstant.BRAIN_TRAIN_TRAIN_INFO_NOW, {
data: {
randomNumber: this.numberList,
},
result: {
learn_time_start: new Date().getTime()
}
});
},
start() {
clearInterval(this.timer);
StoreUtil.stateSave(BaseConstant.BRAIN_TRAIN_TRAIN_INFO_NOW, {
result: {
learn_time_end: new Date().getTime()
}
});
this.$router.push({
path: '/pi/answerPi',
query: {
level: this.level,
id: this.caseAlias,
model_id: this.modelAlias
}
});
}
},
mounted() {
this.init();
},
activated() {
console.log('activated')
},
deactivated() {
clearInterval(this.timer);
console.log('deactivated')
},
destroyed() {
clearInterval(this.timer);
console.log('destroyed')
}
})
</script>
<style scoped>
.content {
padding: 30px 24px;
}
.title {
display: flex;
align-items: center;
}
.circle {
font-size: 30px;
color: #333;
}
.limit_time {
width: 100px;
height: 60px;
display: flex;
align-items: center;
justify-content: center;
color: #017af7;
font-size: 28px;
margin-left: auto;
}
.line-style {
display: flex;
/*align-items: center;*/
margin-top: 20px;
}
.line-style .label {
font-size: 30px;
color: #333;
width: 150px;
}
.line-style .list {
display: flex;
align-items: center;
flex-wrap: wrap;
}
.line-style .item {
height: 60px;
display: flex;
align-items: center;
justify-content: center;
border: 2px solid #666;
border-radius: 8px;
margin-left: 20px;
padding: 0 24px;
margin-bottom: 20px;
}
.line-style .active {
color: #fff;
background: #409eff;
border-color: #409eff;
}
.number-list {
display: flex;
flex-wrap: wrap;
/*margin-top: 20px;*/
}
.number-data {
width: 5%;
display: flex;
align-items: center;
justify-content: center;
}
.number-item {
width: 90%;
height: 50px;
display: flex;
align-items: center;
justify-content: center;
border-right: 2px solid transparent;
}
.start {
margin: 60px auto;
width: 500px;
height: 80px;
border-radius: 40px;
font-size: 32px;
background: #409EFF;
color: #fff;
display: flex;
align-items: center;
justify-content: center;
}
</style>
<template>
<div class="content">
<div class="title">
<div>随机数字</div>
<div>英语速记</div>
<div class="submit" @click="submit">提交</div>
</div>
<div class="next-pre">
......@@ -12,7 +12,9 @@
<div class="answer-list">
<div class="item" v-for="(item,index) in answer">
<div class="data" :style="{background: item.focus?'#409eff':''}" @click="changeFocus(index)">{{item.txt}}</div>
<div class="data" :style="{background: (index==focus)?'#409eff':''}" @click="changeFocus(index)">
{{item.txt}}
</div>
</div>
</div>
......@@ -38,7 +40,7 @@
<div class="item" @click="input('s')">s</div>
<div class="item" @click="input('t')">t</div>
<div class="item" @click="input('u')">u</div>
<div class="item delete">删除</div>
<div class="item delete" @click="del">删除</div>
<div class="item" @click="input('v')">v</div>
<div class="item" @click="input('w')">w</div>
<div class="item" @click="input('x')">x</div>
......@@ -49,7 +51,11 @@
</template>
<script>
export default {
import BaseTrainPage from "../../framework/core/baseTrainPage";
import StoreUtil from "../../store/stateStore";
import BaseConstant from "../../store/constants/baseConstant";
export default new BaseTrainPage({
name: "answerLetter",
data() {
return {
......@@ -57,74 +63,90 @@
answer: [],
focus: 0,
correctAnswer: [],
correctNumber: 0
}
},
methods:{
//提交
submit() {
this.answer.forEach((v,i)=>{
if(v.txt === this.correctAnswer[i].num) {
this.correctNumber = this.correctNumber + 1;
methods: {
submit() { //提交
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.$store.state.myLetterAnswer = this.answer;
});
this.$router.push({
path: '/home/result',
query: {
number: this.answerLength,
correctNumber: this.correctNumber,
type: 2
type: 2,
level: this.level,
id: this.caseAlias,
model_id: this.modelAlias
}
})
});
},
//前插一位
pre() {
this.answer[this.focus].focus = false;
this.answer.splice(this.focus,0,{
this.answer.splice(this.focus, 0, {
txt: '',
focus: false,
})
this.answer[this.focus].focus = true;
});
this.focus = this.focus;
this.answer.length = this.answerLength;
},
//后插一位
next(){
this.answer.splice(this.focus+1,0,{
next() {
this.answer.splice(this.focus + 1, 0, {
txt: '',
focus: false,
})
});
this.focus = this.focus + 1;
this.answer.length = this.answerLength;
},
//点击改变焦点
changeFocus(i){
this.answer[this.focus].focus = false;
changeFocus(i) {
this.answer[i].focus = true;
this.focus = i;
},
input(val) {
this.answer[this.focus].txt = val;
if(this.focus < this.answer.length-1) {
this.answer[this.focus].focus = false;
this.focus ++ ;
this.answer[this.focus].focus = true;
if (this.focus < this.answer.length - 1) {
this.focus++;
}
}
},
del() {
if (this.answer[this.focus].txt == '') {//当前无值,则进1删除
let oldFocusItem = this.focus;
this.focus = (oldFocusItem > 0) ? (oldFocusItem - 1) : 0;
this.answer[this.focus].txt = '';
} else {
this.answer[this.focus].txt = '';
}
},
},
mounted() {
this.correctAnswer = this.$store.state.randomLetter;
if(this.$route.query&&this.$route.query.number) {
this.answerLength = this.$route.query.number;
for(let i=0; i< this.answerLength; i++) {
this.answer.push({
txt: '',
focus: i == 0 ? true : false,
})
}
this.answer = [];
this.correctAnswer = JSON.parse(JSON.stringify(StoreUtil.getState().train.currentCase.data.randomNumber));
this.answerLength = this.correctAnswer.length;
let q = [];
for (let i = 0; i < this.answerLength; i++) {
this.answer.push({
txt: '',
focus: i === 0,
check: false,
});
q.push(this.correctAnswer[i].num);
}
StoreUtil.stateSave(BaseConstant.BRAIN_TRAIN_TRAIN_INFO_NOW, {
result: {
answer_time_start: new Date().getTime()
},
result_detail: {
q: q.join(',')
}
});
}
}
})
</script>
<style scoped>
......@@ -181,6 +203,7 @@
align-items: center;
flex-wrap: wrap;
}
.answer-list .item {
width: 5%;
height: 50px;
......@@ -188,6 +211,7 @@
align-items: center;
justify-content: center;
}
.answer-list .item .data {
width: 90%;
height: 100%;
......@@ -196,6 +220,7 @@
align-items: center;
justify-content: center;
}
.btn-list {
display: flex;
align-items: center;
......
<template>
<div class="content">
<div class="title">随机字母设置</div>
<div class="number">记忆数量
<input type="number" placeholder="请输入记忆数量" class="input" v-model="number">
<div class="title">随机字母训练</div>
<div class="m-selector">
<div v-for="(item, index) in caseConfig" :key="index" :index="index" :item="item">
<div class="item" :class="{active: (level === index)}" @click="changLevel(index)">{{item.level_name}}
</div>
</div>
</div>
<el-button type="primary" class="start" @click="start">开始训练</el-button>
</div>
</template>
<script>
export default {
import BaseCasePage from "../../framework/core/baseCasePage";
import CaseUtil from "../../framework/service/base/caseUtil";
export default new BaseCasePage({
name: "index",
data() {
return {
number: 50
level: 0,
}
},
methods: {
start() {
if(!this.number || this.number <= 0) {
alert('请输入正确的个数');
return;
changLevel(level) {
if (level !== this.level) {
this.level = level;
}
if(this.number>320) {
alert('记忆数量必须小于或等于320');
return;
}
this.$router.push({
path : '/randomLetter/startMemoryLetter',
query: {
number: this.number
}
})
},
start() {
CaseUtil.goToTrain('/randomLetter/startMemoryLetter',this);
}
},
mounted() {
}
}
})
</script>
<style scoped>
.content {
display: flex;
flex-direction: column;
......@@ -52,22 +53,7 @@
font-weight: bold;
margin-bottom: 50px;
}
.number {
display: flex;
align-items: center;
font-size: 30px;
}
.input {
width: 300px;
margin: 0 12px;
height: 70px;
border: 2px solid #617e99;
padding-left: 10px;
border-radius: 4px;
}
.el-input__inner {
height: 90px;
}
.start {
margin-top: 60px;
width: 500px;
......
<template>
<div class="content">
<div class="line-style">
<div class="label">随机字母</div>
<div class="title">
<div class="circle">英语速记</div>
<div class="limit_time">{{count_time}} s</div>
</div>
<div 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>
<div class="item" :class="{active: checked == 2}" @click="change(2)">2</div>
<div class="item" :class="{active: checked == 3}" @click="change(3)">3</div>
<div class="item" :class="{active: checked == 4}" @click="change(4)">4</div>
<div class="item" :class="{active: checked == 5}" @click="change(5)">5</div>
<div class="item" :class="{active: checked == 6}" @click="change(5)">6</div>
<div class="item" :class="{active: checked == 8}" @click="change(8)">8</div>
</div>
</div>
<div class="number-list">
<div class="number-data" v-for="(item,index) in letterList">
<div class="number-item" :key="index" :style="{borderRightColor: item.border?'#666':''}">{{item.num}}</div>
<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 class="start" @click="goAnswer">记忆完成</div>
<div class="start" @click="start">记忆完成</div>
</div>
</template>
<script>
export default {
import StoreUtil from "../../store/stateStore";
import BaseConstant from "../../store/constants/baseConstant";
import BaseTrainPage from "../../framework/core/baseTrainPage";
export default new BaseTrainPage({
name: "startMemoryLetter",
data() {
return {
number: 0,
count_time: 0,
checked: 0,
letterList: []
numberList: []
}
},
methods: {
countDown() {
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();
}
}, 1000)
},
change(val) {
if(this.checked == val) return;
if (this.checked == val) return;
this.checked = val;
this.letterList.forEach(v=>{
this.numberList.forEach(v => {
v.border = false
})
if(this.checked != 0) {
this.letterList.forEach((vv,ii)=>{
if((ii+1)%val == 0) {
});
if (this.checked != 0) {
this.numberList.forEach((vv, ii) => {
if ((ii + 1) % val == 0) {
vv.border = true;
}
})
}
},
goAnswer(){
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.count_time = this.levelConfig.limit_remember_time;
this.countDown();
StoreUtil.stateSave(BaseConstant.BRAIN_TRAIN_TRAIN_INFO_NOW, {
data: {
randomNumber: this.numberList,
},
result: {
learn_time_start: new Date().getTime()
}
});
},
start() {
clearInterval(this.timer);
StoreUtil.stateSave(BaseConstant.BRAIN_TRAIN_TRAIN_INFO_NOW, {
result: {
learn_time_end: new Date().getTime()
}
});
this.$router.push({
path: '/randomLetter/answerLetter',
query: {
number: this.number
level: this.level,
id: this.caseAlias,
model_id: this.modelAlias
}
})
});
}
},
mounted() {
if(this.$route.query&&this.$route.query.number) {
this.number = this.$route.query.number;
for(let i=0;i<this.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.letterList.push({
num: arr[Math.floor(Math.random()*26)],
border: false
})
this.$store.state.randomLetter = this.letterList;
}
}
this.init();
},
activated() {
console.log('activated')
},
deactivated() {
clearInterval(this.timer);
console.log('deactivated')
},
destroyed() {
clearInterval(this.timer);
console.log('destroyed')
}
}
})
</script>
<style scoped>
.content {
padding: 30px 24px;
}
.title {
display: flex;
align-items: center;
}
.circle {
font-size: 30px;
color: #333;
}
.limit_time {
width: 100px;
height: 60px;
display: flex;
align-items: center;
justify-content: center;
color: #017af7;
font-size: 28px;
margin-left: auto;
}
.line-style {
display: flex;
/*align-items: center;*/
margin-top: 20px;
}
.line-style .label {
font-size: 30px;
color: #333;
width: 150px;
}
.line-style .list {
display: flex;
align-items: center;
flex-wrap: wrap;
}
.line-style .item {
height: 60px;
display: flex;
......@@ -105,22 +180,26 @@
padding: 0 24px;
margin-bottom: 20px;
}
.line-style .active {
color: #fff;
background: #409eff;
border-color: #409eff;
}
.number-list {
display: flex;
flex-wrap: wrap;
margin-top: 20px;
}
.number-data {
width: 5%;
display: flex;
align-items: center;
justify-content: center;
}
.number-item {
width: 90%;
height: 50px;
......@@ -129,8 +208,9 @@
justify-content: center;
border-right: 2px solid transparent;
}
.start {
margin: 60px auto ;
margin: 60px auto;
width: 500px;
height: 80px;
border-radius: 40px;
......
......@@ -12,7 +12,9 @@
<div class="answer-list">
<div class="item" v-for="(item,index) in answer">
<div class="data" :style="{background: item.focus?'#409eff':''}" @click="changeFocus(index)">{{item.txt}}</div>
<div class="data" :style="{background: (index==focus)?'#409eff':''}" @click="changeFocus(index)">
{{item.txt}}
</div>
</div>
</div>
......@@ -26,14 +28,18 @@
<div class="item" @click="input(7)">7</div>
<div class="item" @click="input(8)">8</div>
<div class="item" @click="input(9)">9</div>
<div class="item delete">删除</div>
<div class="item delete" @click="del">删除</div>
<div class="item zero" @click="input(0)">0</div>
</div>
</div>
</template>
<script>
export default {
import StoreUtil from "../../store/stateStore";
import BaseConstant from "../../store/constants/baseConstant";
import BaseTrainPage from "../../framework/core/baseTrainPage";
export default new BaseTrainPage({
name: "answerNumber",
data() {
return {
......@@ -41,75 +47,90 @@
answer: [],
focus: 0,
correctAnswer: [],
correctNumber: 0
}
},
methods:{
//提交
submit() {
this.answer.forEach((v,i)=>{
if(v.txt === this.correctAnswer[i].num) {
console.log(v.txt,this.correctAnswer[i].num);
this.correctNumber = this.correctNumber + 1;
}
})
this.$store.state.myNumberAnswer = this.answer;
this.$router.push({
path: '/home/result',
query: {
number: this.answerLength,
correctNumber: this.correctNumber,
type: 1
}
})
},
methods: {
//前插一位
pre() {
this.answer[this.focus].focus = false;
this.answer.splice(this.focus,0,{
this.answer.splice(this.focus, 0, {
txt: '',
focus: false,
})
this.answer[this.focus].focus = true;
});
this.focus = this.focus;
this.answer.length = this.answerLength;
},
//后插一位
next(){
this.answer.splice(this.focus+1,0,{
next() {
this.answer.splice(this.focus + 1, 0, {
txt: '',
focus: false,
})
});
this.focus = this.focus+1;
this.answer.length = this.answerLength;
},
//点击改变焦点
changeFocus(i){
this.answer[this.focus].focus = false;
changeFocus(i) {
this.answer[i].focus = true;
this.focus = i;
},
input(val) {
this.answer[this.focus].txt = val;
if(this.focus < this.answer.length-1) {
this.answer[this.focus].focus = false;
this.focus ++ ;
this.answer[this.focus].focus = true;
if (this.focus < this.answer.length - 1) {
this.focus++;
}
},
del() {
if(this.answer[this.focus].txt==''){//当前无值,则进1删除
let oldFocusItem = this.focus;
this.focus = (oldFocusItem > 0) ? (oldFocusItem - 1) : 0;
this.answer[this.focus].txt = '';
}else{
this.answer[this.focus].txt = '';
}
},
submit() { //提交
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: 1,
level: this.level,
id: this.caseAlias,
model_id: this.modelAlias
}
})
}
},
mounted() {
this.correctAnswer = this.$store.state.randomNumber;
if(this.$route.query&&this.$route.query.number) {
this.answerLength = this.$route.query.number;
for(let i=0; i< this.answerLength; i++) {
this.answer.push({
txt: '',
focus: i == 0 ? true : false,
})
}
this.answer = [];
this.correctAnswer = JSON.parse(JSON.stringify(StoreUtil.getState().train.currentCase.data.randomNumber));
this.answerLength = this.correctAnswer.length;
let q = [];
for (let i = 0; i < this.answerLength; i++) {
this.answer.push({
txt: '',
focus: i === 0,
check: false,
});
q.push(this.correctAnswer[i].num);
}
StoreUtil.stateSave(BaseConstant.BRAIN_TRAIN_TRAIN_INFO_NOW, {
result: {
answer_time_start: new Date().getTime()
},
result_detail: {
q: q.join(',')
}
});
}
}
})
</script>
<style scoped>
......@@ -166,6 +187,7 @@
align-items: center;
flex-wrap: wrap;
}
.answer-list .item {
width: 5%;
height: 50px;
......@@ -173,6 +195,7 @@
align-items: center;
justify-content: center;
}
.answer-list .item .data {
width: 90%;
height: 100%;
......@@ -181,6 +204,7 @@
align-items: center;
justify-content: center;
}
.btn-list {
display: flex;
align-items: center;
......
<template>
<div class="content">
<div class="title">随机数字设置</div>
<div class="number">记忆数量
<input type="number" placeholder="请输入记忆数量" class="input" v-model="number">
<div class="title">随机数字训练</div>
<div class="m-selector">
<div v-for="(item, index) in caseConfig" :key="index" :index="index" :item="item">
<div class="item" :class="{active: (level === index)}" @click="changLevel(index)">{{item.level_name}}
</div>
</div>
</div>
<el-button type="primary" class="start" @click="start">开始训练</el-button>
</div>
</template>
<script>
export default {
import BaseCasePage from "../../framework/core/baseCasePage";
import CaseUtil from "../../framework/service/base/caseUtil";
export default new BaseCasePage({
name: "index",
data() {
return {
number: 50
level: 0,
}
},
methods: {
start() {
if(!this.number || this.number <= 0) {
alert('请输入正确的个数');
return;
changLevel(level) {
if (level !== this.level) {
this.level = level;
}
if(this.number>320) {
alert('记忆数量必须小于或等于320');
return;
}
this.$router.push({
path : '/randomNumber/startMemory',
query: {
number: this.number
}
})
},
start() {
CaseUtil.goToTrain('/randomNumber/startMemory',this);
}
},
mounted() {
}
}
})
</script>
<style scoped>
.content {
display: flex;
flex-direction: column;
......@@ -52,22 +54,7 @@
font-weight: bold;
margin-bottom: 50px;
}
.number {
display: flex;
align-items: center;
font-size: 30px;
}
.input {
width: 300px;
margin: 0 12px;
height: 70px;
border: 2px solid #617e99;
padding-left: 10px;
border-radius: 4px;
}
.el-input__inner {
height: 90px;
}
.start {
margin-top: 60px;
width: 500px;
......
<template>
<div class="content">
<div class="line-style">
<div class="label">随机数字</div>
<div class="title">
<div class="circle">随机数字</div>
<div class="limit_time">{{count_time}} s</div>
</div>
<div 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>
<div class="item" :class="{active: checked == 2}" @click="change(2)">2</div>
<div class="item" :class="{active: checked == 3}" @click="change(3)">3</div>
<div class="item" :class="{active: checked == 4}" @click="change(4)">4</div>
<div class="item" :class="{active: checked == 5}" @click="change(5)">5</div>
<div class="item" :class="{active: checked == 6}" @click="change(6)">6</div>
<div class="item" :class="{active: checked == 8}" @click="change(8)">8</div>
</div>
</div>
<div 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 class="number-item" :key="index" :style="{borderRightColor: item.border?'#666':''}">{{item.num}}
</div>
</div>
</div>
<div class="start" @click="goAnswer">记忆完成</div>
<div class="start" @click="start">记忆完成</div>
</div>
</template>
<script>
export default {
import BaseTrainPage from "../../framework/core/baseTrainPage";
import StoreUtil from "../../store/stateStore";
import BaseConstant from "../../store/constants/baseConstant";
export default new BaseTrainPage({
name: "startMemory",
data() {
return {
checked: 0,
number: 0,
count_time: 0,
numberList: []
}
},
methods: {
//去答题
goAnswer() {
this.$router.push({
path: '/randomNumber/answerNumber',
query: {
number: this.number
countDown() {
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();
}
})
}, 1000)
},
change(val) {
if(this.checked == val) return;
if (this.checked == val) return;
this.checked = val;
this.numberList.forEach(v=>{
this.numberList.forEach(v => {
v.border = false
})
if(this.checked != 0) {
this.numberList.forEach((vv,ii)=>{
if((ii+1)%val == 0) {
});
if (this.checked != 0) {
this.numberList.forEach((vv, ii) => {
if ((ii + 1) % val == 0) {
vv.border = true;
}
})
}
}
},
mounted() {
if(this.$route.query&&this.$route.query.number) {
this.number = this.$route.query.number;
for(let i=0;i<this.number;i++) {
},
init() {
this.numberList = [];
let number = this.levelConfig.numb_quantity;
for (let i = 0; i < number; i++) {
this.numberList.push({
num: Math.floor ( Math.random ( ) * 10 ),
num: Math.floor(Math.random() * 10),
border: false
})
this.$store.state.randomNumber = this.numberList;
});
}
this.count_time = this.levelConfig.limit_remember_time;
this.countDown();
StoreUtil.stateSave(BaseConstant.BRAIN_TRAIN_TRAIN_INFO_NOW, {
data: {
randomNumber: this.numberList,
},
result: {
learn_time_start: new Date().getTime()
}
});
},
start() {
clearInterval(this.timer);
StoreUtil.stateSave(BaseConstant.BRAIN_TRAIN_TRAIN_INFO_NOW, {
result: {
learn_time_end: new Date().getTime()
}
});
this.$router.push({
path: '/randomNumber/answerNumber',
query: {
level: this.level,
id: this.caseAlias,
model_id: this.modelAlias
}
})
}
},
mounted() {
this.init();
},
activated() {
console.log('activated')
},
deactivated() {
clearInterval(this.timer);
console.log('deactivated')
},
destroyed() {
clearInterval(this.timer);
console.log('destroyed')
}
}
})
</script>
<style scoped>
.content {
padding: 30px 24px;
}
.title {
display: flex;
align-items: center;
}
.circle {
font-size: 30px;
color: #333;
}
.limit_time {
width: 100px;
height: 60px;
display: flex;
align-items: center;
justify-content: center;
color: #017af7;
font-size: 28px;
margin-left: auto;
}
.line-style {
display: flex;
/*align-items: center;*/
margin-top: 20px;
}
.line-style .label {
font-size: 30px;
color: #333;
width: 150px;
}
.line-style .list {
display: flex;
align-items: center;
flex-wrap: wrap;
}
.line-style .item {
height: 60px;
display: flex;
......@@ -106,22 +178,26 @@
padding: 0 24px;
margin-bottom: 20px;
}
.line-style .active {
color: #fff;
background: #409eff;
border-color: #409eff;
}
.number-list {
display: flex;
flex-wrap: wrap;
margin-top: 20px;
}
.number-data {
width: 5%;
display: flex;
align-items: center;
justify-content: center;
}
.number-item {
width: 90%;
height: 50px;
......@@ -130,8 +206,9 @@
justify-content: center;
border-right: 2px solid transparent;
}
.start {
margin: 60px auto ;
margin: 60px auto;
width: 500px;
height: 80px;
border-radius: 40px;
......
......@@ -15,13 +15,13 @@
<div>比赛规则</div>
</div>
<div class="explain">
1、选手在“国际脑力运动”线上平台报名参加脑力世界杯并选中本项比赛。
1、选手在“摩天轮脑力运动”线上平台报名参加脑力世界杯并选中本项比赛。
</div>
<div class="explain">
1. Athlete register Intellectual World Cup on the "International Intellectual Sports" online platform and select this discipline.
</div>
<div class="explain">
2、所有选手在“国际脑力运动”线上平台上点击进入本项目比赛倒计时页面,倒计时归零后立即开始比赛。
2、所有选手在“摩天轮脑力运动”线上平台上点击进入本项目比赛倒计时页面,倒计时归零后立即开始比赛。
</div>
<div class="explain">
2. All athletes clicked into the countdown page on the "International Intellectual Sports" online platform,
......@@ -85,7 +85,9 @@
</template>
<script>
export default {
import BaseCasePage from "../../framework/core/baseCasePage";
export default new BaseCasePage({
name: "index",
methods: {
start() {
......@@ -93,8 +95,11 @@
path: '/reserve/reserveAnswer'
})
}
},
mounted() {
}
}
})
</script>
<style scoped>
......
......@@ -5,48 +5,68 @@
<div class="paragraph"><span>训练方法:</span>端正坐姿,将屏幕与视线垂直,3分钟内尽量不要眨眼,凝视图片黑色三角
区中心,如果感觉图片在动,则表示你的注意力涣散。发生这种现象时,请迅速眨一下眼睛,调整注意力,使图片保持“静止”。
</div>
<div class="m-selector">
模式:
<div v-for="(item, index) in caseConfig" :key="index" :index="index" :item="item">
<div class="item" :class="{active: (level === index)}" @click="changLevel(index)">{{item.level_name}}
</div>
</div>
</div>
<div class="start" @click="start">开始训练</div>
</div>
</template>
<script>
export default {
import BaseCasePage from "../../framework/core/baseCasePage";
import CaseUtil from "../../framework/service/base/caseUtil";
export default new BaseCasePage({
name: "index",
data() {
return {
level: 0,
}
},
methods: {
changLevel(level) {
if (level !== this.level) {
this.level = level;
}
},
start() {
this.$router.push({
path: '/stareOrigin/startOrigin'
})
CaseUtil.goToTrain('/stareOrigin/startOrigin', this);
}
},
mounted() {
}
}
})
</script>
<style scoped>
.content {
padding: 48px 48px 140px 48px;
}
.title {
text-align: center;
color: #000000;
font-size: 34px;
font-weight: bold;
}
.paragraph {
color: #666;
font-size: 28px;
line-height: 58px;
margin-top: 20px;
}
.paragraph span {
color: #000;
font-weight: bold;
}
.start {
width: 500px;
height: 80px;
......
<template>
<div class="content">
<div class="time">{{msg}}</div>
<img class="image" src="http://static.ledouya.com/Fr69BCullfyo0LibIfOdf1kIlx4v" alt="">
<img class="image" :src="pic_url" alt="">
</div>
</template>
<script>
export default {
import BaseTrainPage from "../../framework/core/baseTrainPage";
import StoreUtil from "../../store/stateStore";
import BaseConstant from "../../store/constants/baseConstant";
export default new BaseTrainPage({
name: "startOrigin",
data() {
return {
msg: '3分0秒',
msg: '0分0秒',
timer: '',
maxtime: 179
count_time: 0,
pic_url: 'http://static.ledouya.com/Fr69BCullfyo0LibIfOdf1kIlx4v'
}
},
methods: {
CountDown() {
this.timer = setInterval(()=>{
if (this.maxtime >= 0) {
let minutes = Math.floor(this.maxtime / 60);
let seconds = Math.floor(this.maxtime % 60);
this.msg = minutes + "分" + seconds + "秒";
this.maxtime = this.maxtime - 1;
} else{
countDown() {
this.timer = setInterval(() => {
if (this.count_time >= 0) {
let minutes = Math.floor(this.count_time / 60);
let seconds = Math.floor(this.count_time % 60);
this.msg = minutes + "分" + seconds + "秒";
this.count_time = this.count_time - 1;
} else {
clearInterval(this.timer);
this.start();
}
},1000)
}, 1000)
},
init() {
this.count_time = parseInt(this.levelConfig.limit_remember_time);
this.msg = Math.floor(this.count_time / 60) + "分" + Math.floor(this.count_time % 60) + "秒";
this.countDown();
this.pic_url = this.levelConfig.pic_url;
StoreUtil.stateSave(BaseConstant.BRAIN_TRAIN_TRAIN_INFO_NOW, {
data: {
pic_url: this.levelConfig.pic_url,
},
result: {
learn_time_start: new Date().getTime()
}
});
},
start() {
clearInterval(this.timer);
StoreUtil.stateSave(BaseConstant.BRAIN_TRAIN_TRAIN_INFO_NOW, {
result: {
learn_time_end: new Date().getTime()
}
});
this.$message({
type: 'success',
content: '凝视结束!'
});
}
},
mounted() {
this.CountDown();
this.init();
},
activated() {
console.log('activated')
},
deactivated() {
clearInterval(this.timer);
console.log('deactivated')
},
destroyed() {
clearInterval(this.timer);
console.log('destroyed')
}
}
})
</script>
<style scoped>
......@@ -43,11 +85,13 @@
flex-direction: column;
padding-top: 48px;
}
.time {
color: #409eff;
font-size: 30px;
margin-bottom: 20px;
}
.image {
width: 90%;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!