This commit is contained in:
scammo
2021-06-07 17:41:25 +02:00
parent 136b12b43f
commit 7a616b5083
91 changed files with 378 additions and 137 deletions

View File

@ -1,30 +1,8 @@
<template>
<div id="nav">
<router-link to="/">Home</router-link> |
<router-link to="/about">About</router-link>
</div>
<router-view/>
</template>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}
#nav {
padding: 30px;
}
#nav a {
font-weight: bold;
color: #2c3e50;
}
#nav a.router-link-exact-active {
color: #42b983;
}
</style>
<footer>
<a href="https://wtf-eg.de/impressum/" class="m-4">Impressum</a>
<a href="https://wtf-eg.de/datenschutz/" class="m-4">Datenschutz</a>
<a href="https://git.wtf-eg.de/kompetenzinventar" class="m-4">git(ea)</a>
</footer>
</template>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

View File

@ -1,59 +0,0 @@
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-router" target="_blank" rel="noopener">router</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>

View File

@ -1,5 +1,13 @@
import { createApp } from 'vue'
import { createApp } from 'vue/dist/vue.esm-bundler';
import App from './App.vue'
import router from './router'
createApp(App).use(router).mount('#app')
import 'bootstrap/dist/css/bootstrap.min.css'
const app = createApp(App)
app.use(router)
app.mount('#app')
app.config.globalProperties.apiUrl="todo"

View File

@ -1,20 +1,39 @@
import { createRouter, createWebHistory } from 'vue-router'
import Home from '../views/Home.vue'
import Index from '@/views/Index.vue'
import Search from '@/views/Search.vue'
import Edit from '@/views/profile/Edit.vue'
import View from '@/views/profile/View.vue'
const routes = [
{
path: '/',
name: 'Home',
component: Home
path: '/s',
name: 's',
component: {
template: "<router-view/>"
},
children: [
{
path: 'search',
name: 'Search',
component: Search
},
{
path: '/profile/:member',
name: 'ProfileMember',
component: View
},
{
path: '/profile-edit',
name: 'ProfileEdit',
component: Edit
},
]
},
{
path: '/about',
name: 'About',
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
}
path: '/',
name: 'Index',
component: Index
},
]
const router = createRouter({

View File

@ -1,5 +0,0 @@
<template>
<div class="about">
<h1>This is an about page</h1>
</div>
</template>

View File

@ -1,18 +0,0 @@
<template>
<div class="home">
<img alt="Vue logo" src="../assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/>
</div>
</template>
<script>
// @ is an alias to /src
import HelloWorld from '@/components/HelloWorld.vue'
export default {
name: 'Home',
components: {
HelloWorld
}
}
</script>

75
src/views/Index.vue Normal file
View File

@ -0,0 +1,75 @@
<template>
<div class="container">
<h1>Kompetenz Inventar by WTF eG</h1>
<form @submit.prevent="submitLogin()">
<div class="mb-3">
<label for="exampleInputEmail1" class="form-label"
>E-Mail Aresse:
</label>
<input
type="email"
class="form-control"
id="exampleInputEmail1"
v-model="email"
required
/>
</div>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">Passwort:</label>
<input
type="password"
class="form-control"
id="exampleInputPassword1"
v-model="password"
required
/>
</div>
<button type="submit" class="btn btn-primary mb-4">Login</button>
</form>
<div class="alert alert-danger mb-4 mt-4" role="alert" v-if="showErrorMessage">
Mit deinen Login Daten ist ein Fehler aufgetreten. Versuch es nochmal oder <a href="https://resetpw.wtf-eg.de/">erzeuge ein neues Passwort</a>.
</div>
<p>
Das Login gilt nur für WTF eG Mitglieder. Du kannst dein Ldap Passwort
hier ändern.
</p>
</div>
</template>
<script>
import axios from 'axios'
export default {
name: "Index",
methods: {
async submitLogin(){
this.showErrorMessage = false
try{
const loginResult = await axios.post(
`${this.apiUrl}/login`,
{
email: this.email,
password: this.password
})
if(loginResult.status === 200){
//success login
this.router.push({path: 's/search'})
}
else{
this.showErrorMessage = true
}
}catch(error){
console.error()
this.showErrorMessage = true
}
}
},
data(){
return {
showErrorMessage: false,
email: '',
password: ''
}
}
}
</script>

58
src/views/Search.vue Normal file
View File

@ -0,0 +1,58 @@
<template>
<h1>Suche</h1>
<form @submit.prevent="submitSearch()">
<div class="row">
<div class="col">
<input
type="text"
class="form-control"
id="searchText"
v-model="searchText"
required
/>
</div>
<div class="col">
<button type="submit" class="btn btn-primary mb-4">Suche Starten</button>
</div>
</div>
</form>
<div class="alert alert-danger mb-4 mt-4" role="alert" v-if="showErrorMessage">
Bei der Suche ist ein Fehler aufgetreten
</div>
</template>
<script>
import axios from 'axios'
export default {
name: 'Search',
data(){
return {
showErrorMessage: false,
searchText: '',
}
},
methods: {
async submitSearch(){
this.showErrorMessage = false
try{
const loginResult = await axios.post(
`${this.apiUrl}/search`,
// Beispiel Hafte Daten
{
searchText: this.searchText,
})
if(loginResult.status === 200){
//success login
router.push({path: 's/search'})
}
else{
this.showErrorMessage = true
}
}catch(error){
console.error()
this.showErrorMessage = true
}
}
}
}
</script>

View File

@ -0,0 +1,11 @@
<template>
<div class="container">
<h1>Profil Ändern</h1>
</div>
</template>
<script>
export default {
name: 'profileEdit'
}
</script>

View File

@ -0,0 +1,11 @@
<template>
<div class="container">
<h1>Profil Ansehen</h1>
</div>
</template>
<script>
export default {
name: 'profileView'
}
</script>