slcing registrasi awal

This commit is contained in:
2024-10-31 15:53:59 +07:00
parent 54f56d9602
commit 8d24534928
27 changed files with 1079 additions and 854 deletions

22
auth-code/api/api.js Normal file
View File

@@ -0,0 +1,22 @@
const URL = "";
export async function callApi(fn_url, params, headers) {
try {
console.log("API CALL")
var url = URL + fn_url
var resp = await axios.post(url, params, headers)
if (resp != 'OK') {
return {
status: 'ERR',
message: resp.message
}
} else {
}
} catch (e) {
return {
status: "ERR",
message: e.message
}
}
}

View File

@@ -0,0 +1,32 @@
<template>
<v-app id="inspire">
<div class="hidden-md-and-up">
<mobile-component></mobile-component>
</div>
<div class="hidden-md-and-down">
<dekstop-component></dekstop-component>
</div>
</v-app>
</template>
<script type="module">
import dekstop from './dekstop.vue';
import mobile from './mobile.vue';
export default {
name: "authentication",
components: {
"dekstop-component": dekstop,
"mobile-component": mobile,
},
mounted() {},
data() {
return {
visible: false,
};
},
computed: {},
methods: {},
}
</script>
<style scoped></style>

View File

@@ -0,0 +1,100 @@
<template>
<v-app id="inspire">
<v-row no-gutters>
<v-col lg="8" md="7">
<v-img
min-height="100vh"
cover
style="background-repeat: repeat-y;"
class="bg-white"
src="./images/bg-left.jpg"
></v-img>
</v-col>
<v-col lg="4" md="5">
<v-container class="fill-height" fluid>
<v-col align-self="center">
<v-card
class="mx-auto px-5 py-12"
elevation="0"
rounded="lg"
width="75%"
>
<div class="d-flex justify-center mb-16 bg-surface-variant">
<v-img
class="bg-white"
height="86px"
aspect-ratio="16/9"
src="../globalimages/logo.png"
></v-img>
</div>
<v-alert
density="compact"
:text="alert.message"
:type="alert.type"
class="mt-4 mb-3 w-100"
variant="tonal"
>
</v-alert>
<v-text-field
:label="$t('message.authtext')"
v-model="password"
:append-inner-icon="visible ? 'mdi-eye':'mdi-eye-off'"
:type="visible ? 'text' : 'password'"
:placeholder="$t('message.authtext')"
variant="outlined"
@click:append-inner="visible = !visible"
></v-text-field>
<div class="text-center">
<v-btn
:loading="loading"
@click="login"
class="mt-5 text-none"
color="blue"
size="large"
variant="elevated"
block
>
SUBMIT
<template v-slot:loader>
<v-progress-circular indeterminate></v-progress-circular>
</template>
</v-btn>
</div>
</v-card>
</v-col>
</v-container>
</v-col>
</v-row>
</v-app>
</template>
<script type="module">
export default {
name: "dekstop",
data() {
return {
visible: false
};
},
computed: {
alert() {
return this.$store.state.auth.alert
},
authcode: {
get() {
return this.$store.state.auth.authcode;
},
set(val) {
this.$store.commit("auth/setAuthcode", val);
}
}
},
methods: {
submit() {
this.$store.dispatch("auth/submit")
}
},
};
</script>
<style scoped></style>

View File

@@ -0,0 +1,87 @@
<template>
<div style="background-image: url(./images/bg-left.jpg); height: 100vh;">
<v-container class="fill-height" fluid>
<v-col align-self="center">
<v-card
class="mx-auto px-5 py-12"
elevation="0"
rounded="lg"
width="90%"
>
<div class="d-flex justify-center mb-16 bg-surface-variant">
<v-img
class="bg-white"
height="86px"
aspect-ratio="16/9"
src="../globalimages/logo.png"
></v-img>
</div>
<v-alert
density="compact"
:text="alert.message"
:type="alert.type"
class="mt-4 mb-3 w-100"
variant="tonal"
>
</v-alert>
<v-text-field
:label="$t('message.authtext')"
v-model="password"
:append-inner-icon="visible ? 'mdi-eye':'mdi-eye-off'"
:type="visible ? 'text' : 'password'"
:placeholder="$t('message.authtext')"
variant="outlined"
@click:append-inner="visible = !visible"
></v-text-field>
<div class="text-center">
<v-btn
:loading="loading"
@click="login"
class="mt-5 text-none"
color="blue"
size="large"
variant="elevated"
block
>
SUBMIT
<template v-slot:loader>
<v-progress-circular indeterminate></v-progress-circular>
</template>
</v-btn>
</div>
</v-card>
</v-col>
</v-container>
</div>
</template>
<script type="module">
export default {
name: "mobile",
data() {
return {
visible: false
};
},
computed: {
alert() {
return this.$store.state.auth.alert
},
authcode: {
get() {
return this.$store.state.auth.authcode;
},
set(val) {
this.$store.commit("auth/setAuthcode", val);
}
}
},
methods: {
submit() {
}
},
};
</script>
<style scoped></style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

118
auth-code/index.html Normal file
View File

@@ -0,0 +1,118 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Authentication</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" />
<script src="https://code.iconify.design/iconify-icon/2.1.0/iconify-icon.min.js"></script>
</head>
<body>
<div id="app"></div>
<!-- Moment -->
<script src="../libraries/moment.js"></script>
<!-- Vue.js -->
<!-- DEV -->
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<!-- PROD -->
<!-- <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>
<script src="../globalscript/theme.js"></script>
<script src="../globalscript/global.js"></script>
<!-- loader single file component -->
<script src="../libraries/vue3-sfc-loader.js"></script>
<script src="./language.js"></script>
<script type="module">
const { loadModule } = window["vue3-sfc-loader"];
import system from "../globalstore/globalstore.js";
import auth from "./modules/auth.js"
const options = {
moduleCache: {
vue: Vue,
},
getFile(url) {
return fetch(url).then((response) =>
response.ok ? response.text() : Promise.reject(response)
);
},
addStyle(textContent) {
const style = document.createElement("style");
style.textContent = textContent;
const ref = document.head.getElementsByTagName("style")[0] || null;
document.head.insertBefore(style, ref)
},
};
const messages = CustomMessages;
const browserLocale = navigator.language || navigator.languages[0]
const i18n = VueI18n.createI18n({
locale: browserLocale.startsWith("id") ? "id" : "en",
fallbackLocale: "en",
messages,
});
window.i18n = i18n;
moment.locale(browserLocale.startsWith("id") ? "id" : "en");
const store = Vuex.createStore({
modules: {
system: system,
auth: auth,
},
});
const app = Vue.createApp({
data() {
return {
visible: false,
bg_src: "",
loading: false
};
},
template : `<main-component></main-component>`,
});
const vuetify = Vuetify.createVuetify({
theme: {
themes: CustomTheme,
},
});
app.use(store);
app.use(vuetify);
app.use(i18n);
const components = {
"main-component": "./components/authentication.vue",
};
Promise.all(
Object.entries(components).map(([name, path]) => {
return loadModule(path, options).then((component) => {
app.component(name, component);
});
})
)
.then(() => {
app.mount("#app");
})
.catch((error) => {
console.log("Error loading components: ", error);
});
</script>
</body>
</html>

14
auth-code/language.js Normal file
View File

@@ -0,0 +1,14 @@
var CustomMessages = {
en: {
message: {
authtext: 'Enter the authentication code',
msgInfo: 'Contact Administrator to get the authentication code',
},
},
id: {
message: {
authtext: 'Masukan kode autentifikasi',
msgInfo: "Hubungi Administrator untuk mendapatkan kode autentifikasi",
},
},
};

55
auth-code/modules/auth.js Normal file
View File

@@ -0,0 +1,55 @@
import * as api from "../api/api.js"
const Store = {
state() {
return {
alert: {
show: false,
type: 'info',
message: window.i18n.global.t('message.msgInfo')
},
authcode: "",
loading: false,
}
},
mutations: {
setAuthcode(state, data) {
state.authcode = data
},
setAlert(state, data) {
state.alert = data
},
setLoading(state, data) {
state.loading = data
}
},
actions: {
async submit({state, commit}) {
commit('setLoading', true)
try {
let fn = "linking"
let params = {
AuthCodeCode: state.authcode
}
let headers = {}
let resp = await api.callApi(fn, params, headers)
if (resp.data.status != 'OK') {
commit('setLoading', false);
} else {
commit('setLoading', false);
localStorage.setItem("token", resp.data.token)
localStorage.setItem("user", JSON.stringify(resp.data.data))
window.location.replace("")
}
} catch (error) {
console.log(error);
commit('setLoading', false);
}
}
}
}
export default Store