Commit cb7cae78 by talequale

merge

parents 6af0b275 5a576cbe
const Action = function(fn) {
this.fn = fn;
this.execute = this.execute.bind(this);
};
Action.prototype = {
execute: function() {
......@@ -7,17 +8,43 @@ Action.prototype = {
}
};
const ACTION = {
NAVIGATE: new Action((where, data)=>{
store.set({
'navigation.current': where,
'navigation.data': data || {}
});
}),
CARD: {
LEARN_MORE: new Action((item)=>{
store.set({
'navigation.current': 'InfoPage',
'navigation.data': {id: item.id, category: item.category_id}
});
ACTION.NAVIGATE.execute('InfoPage', {id: item.id, category: item.category_id});
})
},
YOU_CAN: {
START_TEST_TESTING: new Action(()=>{
console.log('START_TEST_TESTING');
ACTION.NAVIGATE.execute('ChooseType');
})
},
TEST: {
DEMO: {
GOTO_FINAL_WELCOME: new Action(()=>{
ACTION.NAVIGATE.execute('WelcomeDemoFinal');
}),
GOTO_FINAL_LAST_NOTIFICATION: new Action(()=>{
ACTION.NAVIGATE.execute('WelcomeDemoFinalLastNotification');
}),
GOTO_FINAL_TEST: new Action(()=>{
ACTION.NAVIGATE.execute('WelcomeDemoFinalLastNotification');
}),
LIMITLESS: new Action(()=>{
})
}
},
Action
};
export default ACTION
export {ACTION};
typeof window !== 'undefined' && (window.ACTION = ACTION);
......@@ -38,5 +38,5 @@ tmpStore.sub([
'isMobile', 'navigation.current', 'loaded'
], (is, page, loaded)=>{
if(!is && page === 'Profile' && loaded)
store.set('navigation.current', 'Account');
ACTION.NAVIGATE.execute( 'Account');
});
\ No newline at end of file
......@@ -42,4 +42,4 @@ async function subscribe() {
}
subscribe();
\ No newline at end of file
setTimeout(subscribe, 10000);
\ No newline at end of file
......@@ -17,6 +17,7 @@ $green-gray: #B2C5B7;
$teal: #3B6977;
$red: #FF0000;
$brick: #C94C0A;
$persimmon: #EC7B3F;
$sienna: #D8960D;
$standardCard: #BDD6DE;
......
import '/model/Store';
import {ACTION} from "/controller/Action";
import './view/page/login/Login.jsx';
import './view/page/account/WelcomePage.jsx';
......
......@@ -5,6 +5,7 @@ import IconTrial from '/svg/icon-trial.svg';
import IconBase from '/svg/icon-base.svg';
import IconResult from '/svg/icon-result.svg';
import './accountNavigation.scss';
import {ACTION} from "/controller/Action";
const AccountNavigation = D.declare('view.block.AccountNavigation', () => {
return <div class="account-navigation">
......@@ -18,7 +19,7 @@ const AccountNavigation = D.declare('view.block.AccountNavigation', () => {
</Button>
</li>
<li className="account-navigation__item">
<Button class={"button button--secondary account-navigation__button"}>
<Button class={"button button--secondary account-navigation__button"} onclick={ACTION.YOU_CAN.START_TEST_TESTING.execute}>
<IconTrial width="32" height="32"/>
<span>Пройти пробное тестирование</span>
<Arr width="17" height="11"/>
......@@ -40,7 +41,7 @@ const AccountNavigation = D.declare('view.block.AccountNavigation', () => {
</li>
</ul>
</div>
})
});
export default AccountNavigation;
export {AccountNavigation};
......@@ -27,7 +27,7 @@ const Header = D.declare('view.block.Header', () => {
if(typeof actions[name] === 'function'){
actions[name]();
}else{
store.set( 'navigation.current', actions[name]);
ACTION.NAVIGATE.execute( actions[name]);
}
}
};
......@@ -43,7 +43,7 @@ const Header = D.declare('view.block.Header', () => {
Object.keys(Page)
.map( name =>
<button class="temp-button" type={'button'} onClick={() => {
store.set('navigation.current', name);
ACTION.NAVIGATE.execute( name);
tempPageMenuHidden.toggle();
}}>
{name}
......
......@@ -121,6 +121,10 @@
}
}
.button--thirdery {
background: $persimmon;
color: #fff
}
.button--bordered {
padding: 5px 44px;
min-width: 200px;
......
import './accountPage.scss';
import AccountBlock from '../../block/account/Account.jsx';
import {AsyncAuthAjax} from "../../../controller/Ajax";
import {API} from "../../../dict/Consts";
import Card from "../../cmp/card/Card";
import CardSlider from "../../cmp/cardSlider/CardSlider";
import AccountNavigation from "../../block/accountNav/AccountNavigation";
......
......@@ -4,7 +4,7 @@ import Cross from '/svg/cross.svg';
const Profile = D.declare('view.page.Profile', () => {
return <div class="profile-page">
<button class="profile-page__link-back" onclick={()=> store.set( 'navigation.current', 'Account')} type="button" aria-label="Вернуться на страницу аккаунта">
<button class="profile-page__link-back" onclick={()=> ACTION.NAVIGATE.execute( 'Account')} type="button" aria-label="Вернуться на страницу аккаунта">
<Cross width="24" height="24"/>
</button>
<div class="profile-page__wrapper">
......
......@@ -133,7 +133,7 @@ const WelcomePage = D.declare('view.page.WelcomePage', () =>
</Button>
]}>
<div className="welcome-page__message welcome-page__message--warning">
<h1 className="welcome-page__title"><em>Внимание!</em>
Тестирование
невозможно прервать</h1>
<h1 className="welcome-page__title"><em>Внимание!</em>
Тестирование
 невозможно прервать</h1>
<div className="welcome-page__text">
<p>Это последнее предупреждение. Вы&nbsp;уверены, что&nbsp;готовы начать?</p>
</div>
......
......@@ -12,3 +12,7 @@ export {TestRequests} from "./tmp/TestRequests";
export {InfoPage} from "./product/InfoPage";
export {QuizPage} from "./quiz/QuizPage";
export {ChooseType} from "./test/demo/ChooseType"
export {WelcomeDemoFinal} from "./test/demo/WelcomeDemoFinal"
export {WelcomeDemoFinalLastNotification} from "./test/demo/WelcomeDemoFinalLastNotification"
\ No newline at end of file
......@@ -33,7 +33,7 @@ const Login = D.declare('view.page.Login', () => {
store.sub('account.token', async function(data){
if(!data){
let phone = store.get('account.phone') || loginStore.get('phone') || initialState.phone;
store.set( 'navigation.current', 'Login' );
ACTION.NAVIGATE.execute( 'Login' );
loginStore.set(initialState);
loginStore.set({phone})
......@@ -45,9 +45,9 @@ const Login = D.declare('view.page.Login', () => {
}else{
store.set( 'account.data', result );
if( result.lastLoginAt ){
store.set( 'navigation.current', 'Account' );
ACTION.NAVIGATE.execute( 'Account' );
}else{
store.set( 'navigation.current', 'Welcome' );
ACTION.NAVIGATE.execute( 'Welcome' );
}
}
}
......
import {ACTION} from "/controller/Action";
const ChooseType = D.declare( 'view.page.ChooseType', () => {
return <div>
<h1>Пробное тестирование</h1>
<button onClick={ACTION.TEST.DEMO.GOTO_FINAL_WELCOME.execute}>Тренировка итогового тестирования</button>
<button onClick={ACTION.TEST.DEMO.LIMITLESS.execute}>Бесконечная генерация вопросов</button>
</div>
} );
export default ChooseType;
export { ChooseType };
\ No newline at end of file
import {ACTION} from "/controller/Action";
import Button from "/view/cmp/button/Button.jsx";
import Arr from "/svg/arr.svg";
import Info from "/view/block/info/Info";
const WelcomeDemoFinal = D.declare( 'view.page.WelcomeDemoFinal', () => {
return <Info
img={
<picture>
<source srcset="/uploads/images/assistant-final-mob.svg" media={"(max-width: 767px)"}/>
<img src="/uploads/images/assistant-final.svg" width="450" height="360" alt={"Изображение помощника"}/>
</picture>
}
buttons={[
<Button class={"button button--thirdery welcome-page__button"} type={"button"}
onclick={ACTION.TEST.DEMO.GOTO_FINAL_LAST_NOTIFICATION.execute}>
<span>Начать тестирование</span><Arr width="17" height="11"/>
</Button>
]}>
<div className="welcome-page__message">
<h1 className="welcome-page__title">Добро пожаловать в&nbsp;пробное итоговое тестирование!</h1>
<div className="welcome-page__text">
<p>Текст про тестирование и&nbsp;его правила.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do&nbsp;eiusmod tempor incididunt ut&nbsp;labore et&nbsp;dolore magna aliqua.</p>
<p class="welcome-page__date">Тестирование проходит в&nbsp;период: <time>25.08-30.08</time></p>
</div>
</div>
</Info>
} );
export default WelcomeDemoFinal;
export { WelcomeDemoFinal };
\ No newline at end of file
import {ACTION} from "/controller/Action";
import Button from "/view/cmp/button/Button.jsx";
import Arr from "/svg/arr.svg";
import Info from "/view/block/info/Info";
const WelcomeDemoFinalLastNotification = D.declare( 'view.page.WelcomeDemoFinalLastNotification', () => {
return <Info
img={
<picture>
<source srcset="/uploads/images/assistant-warning-mob.svg" media={"(max-width: 767px)"}/>
<img src="/uploads/images/assistant-warning.svg" width="450" height="360" alt={"Изображение помощника"}/>
</picture>
}
buttons={[
<Button class={"button button--thirdery welcome-page__button welcome-page__button--wide"} type={"button"}
onclick={ACTION.TEST.DEMO.GOTO_FINAL_TEST.execute}
>
<span>Я готов! Начать</span><Arr width="17" height="11"/>
</Button>
]}>
<div className="welcome-page__message welcome-page__message--warning">
<h1 className="welcome-page__title"><em>Внимание!</em>
Тестирование
 невозможно прервать</h1>
<div className="welcome-page__text">
<p>Это последнее предупреждение. Вы&nbsp;уверены, что&nbsp;готовы начать?</p>
</div>
</div>
</Info>
} );
export default WelcomeDemoFinalLastNotification;
export { WelcomeDemoFinalLastNotification };
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment