Просрал дедлайны, но вроде с фронтендом разобрался
This commit is contained in:
parent
1b48fdaa00
commit
350d661f02
23 changed files with 130 additions and 29 deletions
0
.idea/.gitignore
generated
vendored
Normal file
0
.idea/.gitignore
generated
vendored
Normal file
9
.idea/ProgTime-Web2-HW1.iml
generated
Normal file
9
.idea/ProgTime-Web2-HW1.iml
generated
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
7
.idea/discord.xml
generated
Normal file
7
.idea/discord.xml
generated
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DiscordProjectSettings">
|
||||||
|
<option name="show" value="ASK" />
|
||||||
|
<option name="description" value="" />
|
||||||
|
</component>
|
||||||
|
</project>
|
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/ProgTime-Web2-HW1.iml" filepath="$PROJECT_DIR$/.idea/ProgTime-Web2-HW1.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
54
.idea/workspace.xml
generated
Normal file
54
.idea/workspace.xml
generated
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ChangeListManager">
|
||||||
|
<list default="true" id="55379a43-dcff-4f4e-afd3-ee52acca3898" name="Changes" comment="">
|
||||||
|
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/.vscode/extensions.json" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/index.html" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/public/vite.svg" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/App.vue" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/components/Edit.vue" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/components/Item.vue" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main.ts" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/models/Note.ts" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/style.css" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/vite-env.d.ts" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/tsconfig.json" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/tsconfig.node.json" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/vite.config.ts" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/yarn.lock" beforeDir="false" />
|
||||||
|
</list>
|
||||||
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
|
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectId" id="2JoQH7HgUA93Snm0IO3cG4jDcgk" />
|
||||||
|
<component name="ProjectViewState">
|
||||||
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
|
<option name="showLibraryContents" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="PropertiesComponent"><![CDATA[{
|
||||||
|
"keyToString": {
|
||||||
|
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||||
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
|
"WebServerToolWindowFactoryState": "false",
|
||||||
|
"last_opened_file_path": "/home/andrey/Github/ProgTime-Web2-HW1/frontend",
|
||||||
|
"vue.rearranger.settings.migration": "true"
|
||||||
|
}
|
||||||
|
}]]></component>
|
||||||
|
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||||
|
<component name="TaskManager">
|
||||||
|
<task active="true" id="Default" summary="Default task">
|
||||||
|
<changelist id="55379a43-dcff-4f4e-afd3-ee52acca3898" name="Changes" comment="" />
|
||||||
|
<created>1672741867096</created>
|
||||||
|
<option name="number" value="Default" />
|
||||||
|
<option name="presentableId" value="Default" />
|
||||||
|
<updated>1672741867096</updated>
|
||||||
|
<workItem from="1672741868147" duration="13000" />
|
||||||
|
</task>
|
||||||
|
<servers />
|
||||||
|
</component>
|
||||||
|
</project>
|
0
.gitignore → frontend/.gitignore
vendored
0
.gitignore → frontend/.gitignore
vendored
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
@ -2,12 +2,13 @@
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import Item from "./components/Item.vue";
|
import Item from "./components/Item.vue";
|
||||||
import Edit from "./components/Edit.vue";
|
import Edit from "./components/Edit.vue";
|
||||||
import { Note } from "./models/Note";
|
|
||||||
|
|
||||||
const notes = ref([new Note(undefined, 'Make SUS'), new Note(undefined, 'аырофщшгвыпгыфа')])
|
let id = 0
|
||||||
const currentNote = ref(new Note())
|
|
||||||
|
|
||||||
function processNote(note: Note) {
|
const notes = ref([{id: id, title: "Hello World", checked: false}])
|
||||||
|
const currentNote = ref({id: id += 1, title: "", checked: false})
|
||||||
|
|
||||||
|
function processNote(note: any) {
|
||||||
const index = notes.value.findIndex((item) => item.id === note.id)
|
const index = notes.value.findIndex((item) => item.id === note.id)
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
notes.value[index] = note
|
notes.value[index] = note
|
||||||
|
@ -15,26 +16,37 @@ function processNote(note: Note) {
|
||||||
else {
|
else {
|
||||||
notes.value.push(note)
|
notes.value.push(note)
|
||||||
}
|
}
|
||||||
|
currentNote.value = {id: id += 1, title: "", checked: false}
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteNote(note: Note) {
|
function deleteNote(note: any) {
|
||||||
notes.value = notes.value.filter((item) => item.id !== note.id)
|
notes.value = notes.value.filter((item) => item.id !== note.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
function editNote(note: Note) {
|
function editNote(note: any) {
|
||||||
currentNote.value = note
|
currentNote.value = note
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateTitle(title: string) {
|
||||||
|
currentNote.value.title = title
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="container" id="container">
|
<div class="container" id="container">
|
||||||
<item v-for="note in notes"
|
<item v-for="note in notes"
|
||||||
:note="note"
|
:note="note"
|
||||||
|
:key="note.id"
|
||||||
@delete="deleteNote"
|
@delete="deleteNote"
|
||||||
@edit="editNote"
|
@edit="editNote"
|
||||||
|
@updateChecked="(checked) => note.checked = checked"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<edit @done="processNote" note="{{ currentNote }}"/>
|
<edit
|
||||||
|
v-bind:note="currentNote"
|
||||||
|
@done="processNote"
|
||||||
|
@updateTitle="updateTitle"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
|
@ -1,14 +1,27 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
defineEmits(['done'])
|
defineProps<{ note: any }>()
|
||||||
defineProps(['note'])
|
const emit = defineEmits<{
|
||||||
|
(e: 'done', note: any): void,
|
||||||
|
(e: 'updateTitle', title: string): void
|
||||||
|
}>()
|
||||||
|
|
||||||
|
function processNote(note: any) {
|
||||||
|
if (note.title === '') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
emit('done', note)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<input type="text" v-model="note.title">
|
<input type="text"
|
||||||
|
:value="note.title"
|
||||||
|
@input="event => $emit('updateTitle', event.target.value)">
|
||||||
|
|
||||||
<div class="btn" @click="note.title ? $emit('done', note) : null; note = new Note()">
|
<div class="btn" @click="processNote(note)">
|
||||||
<span><font-awesome-icon icon="fa-solid fa-check" /> Add</span></div>
|
<span><font-awesome-icon icon="fa-solid fa-check" /> Add</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,18 +1,21 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Note } from "../models/Note";
|
defineProps<{ note: any }>()
|
||||||
|
defineEmits<{
|
||||||
defineProps(['note'])
|
(e: 'delete', note: any): void
|
||||||
defineEmits(['delete', 'edit'])
|
(e: 'edit', note: any): void
|
||||||
|
(e: 'updateChecked', checked: boolean): void
|
||||||
|
}>()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<input type="checkbox" :checked="note.checked">
|
<input type="checkbox" :checked="note.checked" @change="event => $emit('updateChecked', event.target.checked)">
|
||||||
<span class="title">{{ note.title }}</span>
|
<span class="title">{{ note.title }}</span>
|
||||||
<div class="btn"><span><font-awesome-icon icon="fa-solid fa-pen-to-square" /> Edit</span></div>
|
<div class="btn" @click="$emit('edit', note)"><span><font-awesome-icon icon="fa-solid fa-pen-to-square" /> Edit</span></div>
|
||||||
<div class="btn" @click="$emit('delete', note)"><span><font-awesome-icon icon="fa-solid fa-trash" /> Delete</span></div>
|
<div class="btn" @click="$emit('delete', note)"><span><font-awesome-icon icon="fa-solid fa-trash" /> Delete</span></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.container {
|
.container {
|
||||||
display: flex;
|
display: flex;
|
|
@ -1,11 +0,0 @@
|
||||||
let currentId = 5;
|
|
||||||
|
|
||||||
export class Note {
|
|
||||||
|
|
||||||
constructor(public id = currentId, public title = '', public checked = false) {
|
|
||||||
currentId++
|
|
||||||
this.id = id
|
|
||||||
this.title = title
|
|
||||||
this.checked = checked
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue