Skip to content

Commit

Permalink
Изменил роутинг
Browse files Browse the repository at this point in the history
  • Loading branch information
Raznex committed Feb 29, 2024
1 parent f6bfcb6 commit a720ba6
Show file tree
Hide file tree
Showing 7 changed files with 183 additions and 78 deletions.
16 changes: 0 additions & 16 deletions frontend/.idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions frontend/src/router/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { createRouter, createWebHistory } from 'vue-router';
import AboutView from '../views/AboutView.vue';
import HomeView from '../views/HomeView.vue';
import LoginView from '../views/LoginView.vue';
import RegisterView from '../views/RegisterView';
import RegV from "@/views/RegV.vue";
import StartPage from "@/views/StartPage.vue";
import GameSelection from "@/views/GameSelection.vue";
import GameDesc from "@/views/GameDesc.vue";
import GameDescAdmin from "@/views/GameDescAdmin.vue";
import LogV from "@/views/LogV.vue";

const routes = [
{
Expand All @@ -23,16 +22,11 @@ const routes = [
{
path: '/login',
name: 'Login',
component: LoginView,
component: LogV,
},
{
path: '/register',
name: 'Register',
component: RegisterView,
},
{
path: '/gamereg',
name: 'RegV',
component: RegV,
},
{
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/store/modules/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ const state = {
user: null,
};

const url = 'https://industry-game.ru';

const getters = {
isAuthenticated: state => !!state.user,
isAdmin: state => state?.user?.type === 'ADMIN',
Expand All @@ -14,11 +16,11 @@ const getters = {

const actions = {
async register({dispatch}, user) {
let {data} = await axios.post('https://industry-game.ru/api/v1/players/register/', user);
let {data} = await axios.post(url + '/api/v1/players/register/', user);
await dispatch('saveMe', data);
},
async login({dispatch}, user) {
let {data} = await axios.post('/api/v1/players/login/', user);
let {data} = await axios.post(url + '/api/v1/players/login/', user);
await dispatch('saveMe', data);
},
async saveMe({commit}, data) {
Expand Down
11 changes: 10 additions & 1 deletion frontend/src/views/GameSelection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<p class="byte">
{'Name'}, скорее присоединяйся к игре
</p>
<div class="d-flex flex-wrap gap-3 justify-content-center">
<div :class="{'': true, 'game-selection_admin': userRole === 'ADMIN', 'game-selection_user': userRole === 'PLAYER' }">
<GameCard />
<GameCard />
<GameCard />
Expand All @@ -18,9 +18,18 @@
<script setup>
import HeaderGame from "@/components/HeaderGame.vue";
import GameCard from "@/components/GameCard.vue";
let userRole = 'PLAYER';
</script>

<style scoped>
.game-selection_user {
display: flex;
flex-wrap: wrap;
gap: 2rem;
justify-content: center;
}
.byte {
font-family: Roboto, Helvetica, Arial, sans-serif;
text-align: left;
Expand Down
162 changes: 162 additions & 0 deletions frontend/src/views/LogV.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
<template>
<div class="overflow-hidden d-flex justify-content-center">
<div class="reg">
<HeaderGame />
<b-form
class="w-100 d-flex flex-column gap-3 align-items-center"
style="max-width: 420px"
@submit.stop.prevent
>
<p class="form__title">
Привет, давай знакомиться!
</p>
<div class="w-100">
<label
for="userName"
class="form__label"
>ФИО</label>
<b-form-input
id="userName"
v-model="form.userName"
class="form__input"
:state="userNameValidation"
placeholder="Введите свое имя"
/>
<b-form-invalid-feedback
:state="userNameValidation"
>
Это поле не должно быть пустым.
</b-form-invalid-feedback>
</div>
<div class="w-100">
<label
for="userPassword"
class="form__label"
>Пароль</label>
<b-form-input
id="userPassword"
v-model="form.userPassword"
class="form__input"
:state="userPasswordValidation"
placeholder="Придумайте пароль"
/>
<b-form-invalid-feedback :state="userPasswordValidation">
Пароль должен содержать не менее 8 символов.
</b-form-invalid-feedback>
</div>
<div class="d-flex justify-content-end mt-2 w-100">
<b-button
class="reg__button"
type="submit"
:disabled="!isFormValid"
@click="handleSubmit"
>
Готово
</b-button>
</div>
</b-form>
</div>
</div>
</template>

<script>
import HeaderGame from "@/components/HeaderGame.vue";
export default {
components: {HeaderGame},
data() {
return {
form: {
userName: '',
userTelegramm: '',
userNickname: '',
userPassword: '',
},
};
},
computed: {
userNameValidation() {
return this.form.userName.length > 1;
},
userTelegrammValidation() {
return this.form.userTelegramm?.length > 5;
},
userNicknameValidation() {
return this.form.userNickname?.length > 5;
},
userPasswordValidation() {
return this.form.userPassword?.length > 8;
},
isFormValid() {
// Check if all fields are valid
return (
this.userNameValidation &&
this.userTelegrammValidation &&
this.userNicknameValidation &&
this.userPasswordValidation
);
},
},
methods: {
handleSubmit() {
console.log(
this.form
);
// Add logic to handle form submission
// Reset form fields if needed
this.form.userTelegramm = '';
this.form.userName = '';
this.form.userNickname = '';
this.form.userPassword = '';
},
},
};
</script>
<style scoped>
.reg {
color: #454862;
font-family: Roboto, Helvetica, Arial, sans-serif;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background: url("@/assets/MainBackground.svg") no-repeat center;
width: 100vw;
height: 100vh;
overflow-x: hidden;
}
.form__input{
background-color: #F2F2F2;
padding: 18px 15px 18px 15px;
border: none;
font-size: calc(0.7rem + 0.45vw);
}
.form__label {
border: none;
font-size: calc(0.7rem + 0.45vw);
font-weight: 400;
}
.form__title {
font-weight: 400;
color: #00D5FB;
font-size: calc(0.925rem + 0.3vw);
}
.reg__button {
font-family: Roboto, Helvetica, Arial, sans-serif;
display: flex;
align-items: center;
justify-content: space-around;
background-color: #00D5FB;
outline: none;
border: none;
font-size: 18px;
font-weight: 600;
padding: 12px 21px 12px 21px;
}
</style>
11 changes: 5 additions & 6 deletions frontend/src/views/StartPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@
приведи свой дистрикт к победе
</p>
<b-button class="starpage__button mt-4">
Войти в игру
<img
src="@/assets/Arrow.svg"
alt="arrow"
>
Войти
</b-button>
<b-button class="starpage__button mt-4">
Зарегистрироваться
</b-button>
</div>
</div>
Expand Down Expand Up @@ -60,7 +59,7 @@
background-color: #00D5FB;
outline: none;
border: none;
Width: 215px;
Width: 300px;
Height: 56px;
font-size: 24px;
font-weight: 600;
Expand Down
45 changes: 0 additions & 45 deletions frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1185,15 +1185,6 @@
"@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0"

"@nuxt/opencollective@^0.3.2":
version "0.3.3"
resolved "https://registry.yarnpkg.com/@nuxt/opencollective/-/opencollective-0.3.3.tgz#80ff0eb8f6fca1d0ed5a089b9688f41bff2dd8ab"
integrity sha512-6IKCd+gP0HliixqZT/p8nW3tucD6Sv/u/eR2A9X4rxT/6hXlMzA4GZQzq4d2qnBAwSwGpmKyzkyTjNjrhaA25A==
dependencies:
chalk "^4.1.0"
consola "^2.15.0"
node-fetch "^2.6.7"

"@polka/url@^1.0.0-next.24":
version "1.0.0-next.24"
resolved "https://registry.yarnpkg.com/@polka/url/-/url-1.0.0-next.24.tgz#58601079e11784d20f82d0585865bb42305c4df3"
Expand Down Expand Up @@ -2250,22 +2241,6 @@ bootstrap-vue-next@^0.16.6:
"@floating-ui/vue" "^1.0.6"
"@vueuse/core" "^10.7.2"

bootstrap-vue@^2.23.1:
version "2.23.1"
resolved "https://registry.yarnpkg.com/bootstrap-vue/-/bootstrap-vue-2.23.1.tgz#8f866f7cda27eb0e7e13a0bea8d55d8fc7a82199"
integrity sha512-SEWkG4LzmMuWjQdSYmAQk1G/oOKm37dtNfjB5kxq0YafnL2W6qUAmeDTcIZVbPiQd2OQlIkWOMPBRGySk/zGsg==
dependencies:
"@nuxt/opencollective" "^0.3.2"
bootstrap "^4.6.1"
popper.js "^1.16.1"
portal-vue "^2.1.7"
vue-functional-data-merge "^3.1.0"

bootstrap@^4.6.1:
version "4.6.2"
resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-4.6.2.tgz#8e0cd61611728a5bf65a3a2b8d6ff6c77d5d7479"
integrity sha512-51Bbp/Uxr9aTuy6ca/8FbFloBUJZLHwnhTcnjIeRn2suQWsWzcuJhGjKDB5eppVte/8oCdOL3VuwxvZDUggwGQ==

bootstrap@^5.3.3:
version "5.3.3"
resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-5.3.3.tgz#de35e1a765c897ac940021900fcbb831602bac38"
Expand Down Expand Up @@ -2584,11 +2559,6 @@ connect-history-api-fallback@^2.0.0:
resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-2.0.0.tgz#647264845251a0daf25b97ce87834cace0f5f1c8"
integrity sha512-U73+6lQFmfiNPrYbXqr6kZ1i1wiRqXnp2nhMsINseWXO8lDau0LGEffJ8kQi4EjLZympVgRdvqjAgiZ1tgzDDA==

consola@^2.15.0:
version "2.15.3"
resolved "https://registry.yarnpkg.com/consola/-/consola-2.15.3.tgz#2e11f98d6a4be71ff72e0bdf07bd23e12cb61550"
integrity sha512-9vAdYbHj6x2fLKC4+oPH0kFzY/orMZyG2Aj+kNylHxKGJ/Ed4dpNyAQYwJOdqO4zdM7XpVHmyejQDcQHrnuXbw==

consolidate@^0.15.1:
version "0.15.1"
resolved "https://registry.yarnpkg.com/consolidate/-/consolidate-0.15.1.tgz#21ab043235c71a07d45d9aad98593b0dba56bab7"
Expand Down Expand Up @@ -4825,16 +4795,6 @@ pkg-dir@^4.1.0:
dependencies:
find-up "^4.0.0"

popper.js@^1.16.1:
version "1.16.1"
resolved "https://registry.yarnpkg.com/popper.js/-/popper.js-1.16.1.tgz#2a223cb3dc7b6213d740e40372be40de43e65b1b"
integrity sha512-Wb4p1J4zyFTbM+u6WuO4XstYx4Ky9Cewe4DWrel7B0w6VVICvPwdOpotjzcf6eD8TsckVnIMNONQyPIUFOUbCQ==

portal-vue@^2.1.7:
version "2.1.7"
resolved "https://registry.yarnpkg.com/portal-vue/-/portal-vue-2.1.7.tgz#ea08069b25b640ca08a5b86f67c612f15f4e4ad4"
integrity sha512-+yCno2oB3xA7irTt0EU5Ezw22L2J51uKAacE/6hMPMoO/mx3h4rXFkkBkT4GFsMDv/vEe8TNKC3ujJJ0PTwb6g==

portfinder@^1.0.26:
version "1.0.32"
resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.32.tgz#2fe1b9e58389712429dc2bea5beb2146146c7f81"
Expand Down Expand Up @@ -6037,11 +5997,6 @@ vue-eslint-parser@^9.4.2:
lodash "^4.17.21"
semver "^7.3.6"

vue-functional-data-merge@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/vue-functional-data-merge/-/vue-functional-data-merge-3.1.0.tgz#08a7797583b7f35680587f8a1d51d729aa1dc657"
integrity sha512-leT4kdJVQyeZNY1kmnS1xiUlQ9z1B/kdBFCILIjYYQDqZgLqCLa0UhjSSeRX6c3mUe6U5qYeM8LrEqkHJ1B4LA==

vue-hot-reload-api@^2.3.0:
version "2.3.4"
resolved "https://registry.yarnpkg.com/vue-hot-reload-api/-/vue-hot-reload-api-2.3.4.tgz#532955cc1eb208a3d990b3a9f9a70574657e08f2"
Expand Down

0 comments on commit a720ba6

Please sign in to comment.