refactor, go work
This commit is contained in:
23
app/frontend/src/App.vue
Normal file
23
app/frontend/src/App.vue
Normal file
@@ -0,0 +1,23 @@
|
||||
<script setup>
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="container">
|
||||
<router-view></router-view>
|
||||
<!-- <LoginPage msg="Wails + Vue" /> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.logo {
|
||||
height: 6em;
|
||||
padding: 1.5em;
|
||||
will-change: filter;
|
||||
}
|
||||
.logo:hover {
|
||||
filter: drop-shadow(0 0 2em #e80000aa);
|
||||
}
|
||||
.logo.vue:hover {
|
||||
filter: drop-shadow(0 0 2em #42b883aa);
|
||||
}
|
||||
</style>
|
||||
36
app/frontend/src/components/Dashboard.vue
Normal file
36
app/frontend/src/components/Dashboard.vue
Normal file
@@ -0,0 +1,36 @@
|
||||
<template>
|
||||
<div class="container d-flex justify-content-center align-items-center" style="height: 100vh;">
|
||||
<form @submit.prevent="submitForm">
|
||||
<div class="mb-3">
|
||||
<button type="button" class="btn btn-primary" @click="openFileDialog">
|
||||
<b-icon-file-earmark-excel />
|
||||
Dosya Seç
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {ClaimFile} from "../../bindings/main/BotService.js";
|
||||
export default {
|
||||
methods: {
|
||||
openFileDialog() {
|
||||
ClaimFile().then((resultValue) => {
|
||||
let value = resultValue;
|
||||
if(value != '')
|
||||
{
|
||||
alert("Dosya Seçildi")
|
||||
}
|
||||
}).catch((err) => {
|
||||
alert("Dosya Seçilemedi")
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/* Add custom styles here if needed */
|
||||
</style>
|
||||
78
app/frontend/src/components/LoginPage.vue
Normal file
78
app/frontend/src/components/LoginPage.vue
Normal file
@@ -0,0 +1,78 @@
|
||||
<template>
|
||||
<div class="login">
|
||||
<h2 class="mb-4">Luca Girişi</h2>
|
||||
<form @submit.prevent="login">
|
||||
<div class="form-group">
|
||||
<label for="username">Kullanıcı Adı:</label>
|
||||
<input type="text" id="username" class="form-control" v-model="username" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password">Şifre:</label>
|
||||
<input type="password" id="password" class="form-control" v-model="password" required>
|
||||
</div>
|
||||
<button style="margin-top: 15px;" type="submit" class="btn btn-primary">Login</button>
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {Login} from "../../bindings/main/LoginService.js";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
username: '',
|
||||
password: ''
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
|
||||
login() {
|
||||
let that = this
|
||||
Login(this.username, this.password).then((resultValue) => {
|
||||
let value = resultValue;
|
||||
console.log("entered")
|
||||
if(value.LoggedIn)
|
||||
{
|
||||
that.$router.push({ name: 'Dashboard' });
|
||||
}
|
||||
}).catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<!--
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import {Login} from "../../bindings/main/LoginService";
|
||||
import {Events} from "@wailsio/runtime";
|
||||
|
||||
const name = ref('')
|
||||
const result = ref('Please enter your name below 👇')
|
||||
const time = ref('Listening for Time event...')
|
||||
|
||||
const doLogin = () => {
|
||||
let localName = name.value;
|
||||
if (!localName) {
|
||||
localName = 'anonymous';
|
||||
}
|
||||
Login(localName).then((resultValue) => {
|
||||
result.value = resultValue;
|
||||
}).catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
Events.On('time', (timeValue) => {
|
||||
time.value = timeValue.data;
|
||||
});
|
||||
})
|
||||
|
||||
defineProps({
|
||||
msg: String,
|
||||
})
|
||||
|
||||
</script> -->
|
||||
38
app/frontend/src/main.js
Normal file
38
app/frontend/src/main.js
Normal file
@@ -0,0 +1,38 @@
|
||||
import { createApp } from 'vue';
|
||||
import App from './App.vue';
|
||||
import { createRouter, createWebHistory } from 'vue-router'; // Import Vue Router
|
||||
import 'bootstrap/dist/css/bootstrap.min.css';
|
||||
import { BootstrapIconsPlugin } from "bootstrap-icons-vue";
|
||||
|
||||
// Import components for routing
|
||||
import LoginPage from './components/LoginPage.vue';
|
||||
import Dashboard from './components/Dashboard.vue'; // Assuming you have a Dashboard view
|
||||
|
||||
// Define routes
|
||||
const routes = [
|
||||
{ path: '/Dashboard',
|
||||
name: 'Dashboard',
|
||||
components : {
|
||||
default : Dashboard
|
||||
}
|
||||
}, // Route to Dashboard
|
||||
{ path: '/',
|
||||
name: 'LoginPage',
|
||||
components : {
|
||||
default : LoginPage
|
||||
}
|
||||
}, // Route to Login
|
||||
// You can define more routes here
|
||||
];
|
||||
|
||||
// Create router instance
|
||||
const router = createRouter({
|
||||
history: createWebHistory(process.env.BASE_URL),
|
||||
routes,
|
||||
});
|
||||
|
||||
// Create Vue app and use router
|
||||
const app = createApp(App);
|
||||
app.use(BootstrapIconsPlugin);
|
||||
app.use(router);
|
||||
app.mount('#app');
|
||||
Reference in New Issue
Block a user