first commit
This commit is contained in:
26
loginstephen/components/ComponentA.js
Normal file
26
loginstephen/components/ComponentA.js
Normal file
@@ -0,0 +1,26 @@
|
||||
// components/ComponentA.js
|
||||
|
||||
const ComponentA = {
|
||||
template: `
|
||||
<div>
|
||||
<h2>Component A</h2>
|
||||
<p>Count: {{ count }}</p>
|
||||
<v-btn @click="increment">Increment</v-btn>
|
||||
<v-btn @click="decrement">Decrement</v-btn>
|
||||
</div>
|
||||
`,
|
||||
computed: {
|
||||
count() {
|
||||
return this.$store.state.count;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
increment() {
|
||||
this.$store.dispatch('increment');
|
||||
},
|
||||
decrement() {
|
||||
this.$store.dispatch('decrement');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
22
loginstephen/components/ComponentB.js
Normal file
22
loginstephen/components/ComponentB.js
Normal file
@@ -0,0 +1,22 @@
|
||||
// components/ComponentB.js
|
||||
|
||||
const ComponentB = {
|
||||
template: `
|
||||
<div>
|
||||
<h2>Component B</h2>
|
||||
<p>Data: {{ data }}</p>
|
||||
<v-btn @click="fetchData">Fetch Data</v-btn>
|
||||
</div>
|
||||
`,
|
||||
computed: {
|
||||
data() {
|
||||
return this.$store.state.data;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async fetchData() {
|
||||
await this.$store.dispatch('fetchData');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
9
loginstephen/images/bg_cover.svg
Normal file
9
loginstephen/images/bg_cover.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 4.4 MiB |
4292
loginstephen/images/bg_image.svg
Normal file
4292
loginstephen/images/bg_image.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 24 MiB |
30
loginstephen/images/frame_1.svg
Normal file
30
loginstephen/images/frame_1.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 594 KiB |
9
loginstephen/images/logo.svg
Normal file
9
loginstephen/images/logo.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 66 KiB |
188
loginstephen/index.html
Normal file
188
loginstephen/index.html
Normal file
@@ -0,0 +1,188 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>WESTONE</title>
|
||||
<!-- Vuetify CSS -->
|
||||
<link href="../css/vuetify.css" rel="stylesheet">
|
||||
<!-- Local Stylesheet for Fonts -->
|
||||
<link rel="stylesheet" href="../css/styles.css">
|
||||
<link href="../css/materialdesignicon.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
<!-- Vue.js -->
|
||||
<script src="../libraries/vue3.4.36.global.prod.js"></script>
|
||||
<!-- Vuex -->
|
||||
<script src="../libraries/vuex.js"></script>
|
||||
<!-- Vuetify -->
|
||||
<script src="../libraries/vuetify3.js"></script>
|
||||
<!-- vue-i18n -->
|
||||
<script src="../libraries/vue-i18n.global.js"></script>
|
||||
<!-- Axios -->
|
||||
<script src="../libraries/axios.js"></script>
|
||||
<!-- Store JS -->
|
||||
<script src="store/store.js"></script>
|
||||
<!-- Component JS -->
|
||||
<script src="components/ComponentA.js"></script>
|
||||
<script src="components/ComponentB.js"></script>
|
||||
|
||||
<script>
|
||||
// Locale messages
|
||||
const messages = {
|
||||
en: {
|
||||
message: {
|
||||
login: 'Login',
|
||||
email: 'Email',
|
||||
password: 'Password',
|
||||
forgotPassword: 'Forgot password?',
|
||||
placeholderEmail: 'Enter your email',
|
||||
placeholderPassword: 'Enter your password'
|
||||
}
|
||||
},
|
||||
id: {
|
||||
message: {
|
||||
login: 'Masuk',
|
||||
email: 'Surel',
|
||||
password: 'Kata Sandi',
|
||||
forgotPassword: 'Lupa kata sandi?',
|
||||
placeholderEmail: 'Isikan email anda',
|
||||
placeholderPassword: 'Isikan kata sandi anda'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Get the browser's preferred language
|
||||
const browserLocale = navigator.language || navigator.languages[0];
|
||||
|
||||
// Initialize vue-i18n
|
||||
const i18n = VueI18n.createI18n({
|
||||
locale: browserLocale.startsWith('id') ? 'id' : 'en', // Set locale based on browser setting
|
||||
fallbackLocale: 'en', // Set fallback locale
|
||||
messages, // Set locale messages
|
||||
});
|
||||
|
||||
// Vue App
|
||||
const app = Vue.createApp({
|
||||
components: {
|
||||
'component-a': ComponentA,
|
||||
'component-b': ComponentB
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
visible: false,
|
||||
bg_src: './images/bg_cover.svg',
|
||||
items: [
|
||||
{
|
||||
src: './images/frame_1.svg',
|
||||
},
|
||||
{
|
||||
src: './images/frame_1.svg',
|
||||
}
|
||||
],
|
||||
loading: false // Initialize loading state
|
||||
}
|
||||
},
|
||||
template: `
|
||||
<v-row no-gutters>
|
||||
<v-col cols="8">
|
||||
<v-img
|
||||
:aspect-ratio="1"
|
||||
class="bg-white"
|
||||
:src="bg_src"
|
||||
width="100vw"
|
||||
height="100vh"
|
||||
cover
|
||||
></v-img>
|
||||
</v-col>
|
||||
<v-col cols="4">
|
||||
<div class="d-flex justify-center mb-6 mt-4 bg-surface-variant">
|
||||
<v-img
|
||||
class="bg-white"
|
||||
height="86px"
|
||||
src="./images/logo.svg"
|
||||
></v-img>
|
||||
</div>
|
||||
<v-container class="mb-6">
|
||||
<v-row
|
||||
align="end"
|
||||
style="min-height: 480px"
|
||||
no-gutters
|
||||
justify="center"
|
||||
>
|
||||
<v-col>
|
||||
<div class="d-flex justify-center">
|
||||
<v-sheet class="pa-2 ma-2">
|
||||
<h2 class="text-h6 font-weight-black">{{ $t('message.login') }}</h2>
|
||||
</v-sheet>
|
||||
</div>
|
||||
<div class="d-flex justify-center mb-6">
|
||||
<v-card
|
||||
class="mx-auto pa-12 pb-8"
|
||||
elevation="0"
|
||||
min-width="400"
|
||||
rounded="lg"
|
||||
>
|
||||
<div class="text-subtitle-1 text-medium-emphasis">{{ $t('message.email') }}</div>
|
||||
<v-text-field
|
||||
density="compact"
|
||||
:placeholder="$t('message.placeholderEmail')"
|
||||
prepend-inner-icon="mdi-email-outline"
|
||||
variant="outlined"
|
||||
></v-text-field>
|
||||
<div class="text-subtitle-1 text-medium-emphasis d-flex align-center justify-space-between">
|
||||
{{ $t('message.password') }}
|
||||
<a
|
||||
class="text-caption text-decoration-none text-blue"
|
||||
href="#"
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
{{ $t('message.forgotPassword') }}</a>
|
||||
</div>
|
||||
<v-text-field
|
||||
:append-inner-icon="visible ? 'mdi-eye-off' : 'mdi-eye'"
|
||||
:type="visible ? 'text' : 'password'"
|
||||
density="compact"
|
||||
:placeholder="$t('message.placeholderPassword')"
|
||||
prepend-inner-icon="mdi-lock-outline"
|
||||
variant="outlined"
|
||||
@click:append-inner="visible = !visible"
|
||||
></v-text-field>
|
||||
<div class="text-center">
|
||||
<v-btn
|
||||
:loading="loading"
|
||||
@click="loading = !loading"
|
||||
class="mt-8 text-none"
|
||||
color="blue"
|
||||
size="large"
|
||||
variant="elevated"
|
||||
block
|
||||
>
|
||||
{{ $t('message.login') }}
|
||||
<template v-slot:loader>
|
||||
<v-progress-linear indeterminate></v-progress-linear>
|
||||
</template>
|
||||
</v-btn>
|
||||
</div>
|
||||
</v-card>
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-col>
|
||||
</v-row>
|
||||
`
|
||||
});
|
||||
|
||||
const vuetify = Vuetify.createVuetify();
|
||||
|
||||
app.use(store);
|
||||
app.use(vuetify);
|
||||
app.use(i18n);
|
||||
app.mount('#app');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
63
loginstephen/store/store.js
Normal file
63
loginstephen/store/store.js
Normal file
@@ -0,0 +1,63 @@
|
||||
// store/store.js
|
||||
const URL = "/westone-api/system/";
|
||||
const store = Vuex.createStore({
|
||||
state() {
|
||||
return {
|
||||
count: 0,
|
||||
data: null,
|
||||
email:null,
|
||||
password:null,
|
||||
dialog_success:false
|
||||
};
|
||||
},
|
||||
mutations: {
|
||||
increment(state) {
|
||||
state.count++;
|
||||
},
|
||||
decrement(state) {
|
||||
state.count--;
|
||||
},
|
||||
setData(state, payload) {
|
||||
state.data = payload;
|
||||
},
|
||||
setEmail(state, data) {
|
||||
state.email = data;
|
||||
},
|
||||
setPassword(state, data) {
|
||||
state.password = data;
|
||||
},
|
||||
setDialogSuccess(state, data) {
|
||||
state.dialog_success = data;
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
increment({ commit }) {
|
||||
commit('increment');
|
||||
},
|
||||
decrement({ commit }) {
|
||||
commit('decrement');
|
||||
},
|
||||
async loginState({ state, commit }) {
|
||||
const params = {
|
||||
email: state.email,
|
||||
password: state.pasword
|
||||
};
|
||||
|
||||
try {
|
||||
const response = await axios.post(URL+'/login', params);
|
||||
commit('setData', response.data);
|
||||
} catch (error) {
|
||||
commit('setError', error);
|
||||
}
|
||||
},
|
||||
async LoginParam({ commit }, params) {
|
||||
try {
|
||||
const response = await axios.post(URL+'/login', params);
|
||||
commit('setData', response.data);
|
||||
} catch (error) {
|
||||
commit('setError', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user