Update Ui Signin

This commit is contained in:
ThienPhamVan
2026-03-20 11:00:25 +07:00
parent c9f20ed9fe
commit 4157344454
6 changed files with 123 additions and 57 deletions

25
constants/company.js Normal file
View File

@@ -0,0 +1,25 @@
export const COMPANY = {
name: 'BigDataTechCloud',
website: 'https://bigdatatech.cloud',
parent: {
name: 'BigDataTech',
website: 'https://bigdatatech.vn/',
email: 'contact@bigdatatech.vn',
phone: '(+84) 943 833 599',
address: 'Tầng 4, 505 Đường Minh Khai, Phường Vĩnh Tuy, Hà Nội',
slogan: 'BigDataTech - Giải pháp Big Data & Phát triển Phần mềm',
},
email: {
contact: 'contact@bigdatatech.vn',
support: 'contact@bigdatatech.vn',
},
phone: {
main: '(+84) 943 833 599',
hotline: '(+84) 943 833 599',
},
address: 'Tầng 4, 505 Đường Minh Khai, Phường Vĩnh Tuy, Hà Nội',
};

View File

@@ -1,56 +1,78 @@
<template> <template>
<div> <div>
<Nuxt class="has-background-light" style="min-height: 100vh;" v-if="ready" /> <Nuxt class="has-background-light" style="min-height: 100vh" v-if="ready" />
<Modal @close="showmodal=undefined" v-bind="showmodal" v-if="showmodal"></Modal> <Modal @close="showmodal = undefined" v-bind="showmodal" v-if="showmodal"></Modal>
<SnackBar @close="snackbar=undefined" v-bind="snackbar" v-if="snackbar" /> <SnackBar @close="snackbar = undefined" v-bind="snackbar" v-if="snackbar" />
</div> </div>
</template> </template>
<script> <script>
import { COMPANY } from '../constants/company';
export default { export default {
data() { data() {
return { return {
ready: false ready: false,
} company: COMPANY,
};
}, },
head() { head() {
return {title: 'Login'} return { title: `${this.company.name}` };
}, },
async created() { async created() {
let connlist = this.$readyapi(['registermethod', 'authmethod', 'usertype', 'authstatus', 'common']) let connlist = this.$readyapi(['registermethod', 'authmethod', 'usertype', 'authstatus', 'common']);
let filter = connlist.filter(v=>!v.ready) let filter = connlist.filter((v) => !v.ready);
let result = filter.length>0? await this.$getapi(filter) : undefined let result = filter.length > 0 ? await this.$getapi(filter) : undefined;
if(result==='error') { if (result === 'error') {
this.$dialog({width: '500px', icon: 'mdi mdi-alert-circle', this.$dialog({
content: 'An error occurred while connecting to the data. Please try again in a few minutes.', type: 'is-danger', progress:true, duration: 6}) width: '500px',
icon: 'mdi mdi-alert-circle',
content: 'An error occurred while connecting to the data. Please try again in a few minutes.',
type: 'is-danger',
progress: true,
duration: 6,
});
} else { } else {
this.ready = true this.ready = true;
} }
}, },
mounted() { mounted() {
var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
if(this.$empty(this.viewport)) { if (this.$empty(this.viewport)) {
if(width<=768) this.viewport = 1 //'mobile' if (width <= 768) this.viewport = 1; //'mobile'
else if(width>=769 && width<=1023) this.viewport = 2 //'tablet' else if (width >= 769 && width <= 1023) this.viewport = 2; //'tablet'
else if(width>=1024 && width<=1215) this.viewport = 3 //'desktop' else if (width >= 1024 && width <= 1215) this.viewport = 3; //'desktop'
else if(width>=1216 && width<=1407) this.viewport = 4 //'widescreen' else if (width >= 1216 && width <= 1407) this.viewport = 4; //'widescreen'
else if(width>=1408) this.viewport = 5 //'fullhd' else if (width >= 1408) this.viewport = 5; //'fullhd'
} }
if(this.$route.query.link) this.$store.commit("updateLink", {link: this.$route.query.link}) if (this.$route.query.link) this.$store.commit('updateLink', { link: this.$route.query.link });
if(this.$route.query.module) this.$store.commit('updateStore', {name: 'module', data: this.$route.query.module}) if (this.$route.query.module) this.$store.commit('updateStore', { name: 'module', data: this.$route.query.module });
}, },
computed: { computed: {
showmodal: { showmodal: {
get: function() {return this.$store.state['showmodal']}, get: function () {
set: function(val) {this.$store.commit('updateStore', {name: 'showmodal', data: val})} return this.$store.state['showmodal'];
},
set: function (val) {
this.$store.commit('updateStore', { name: 'showmodal', data: val });
},
}, },
snackbar: { snackbar: {
get: function() {return this.$store.state['snackbar']}, get: function () {
set: function(val) {this.$store.commit('updateStore', {name: 'snackbar', data: val})} return this.$store.state['snackbar'];
},
set: function (val) {
this.$store.commit('updateStore', { name: 'snackbar', data: val });
},
}, },
viewport: { viewport: {
get: function() {return this.$store.state.viewport}, get: function () {
set: function(val) {this.$store.commit("updateViewPort", {viewport: val})} return this.$store.state.viewport;
} },
} set: function (val) {
} this.$store.commit('updateViewPort', { viewport: val });
</script> },
},
},
};
</script>

View File

@@ -3,7 +3,7 @@
"version": "1.0.0", "version": "1.0.0",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "nuxt", "dev": "nuxt dev",
"build": "nuxt build", "build": "nuxt build",
"start": "nuxt start", "start": "nuxt start",
"generate": "nuxt generate" "generate": "nuxt generate"

View File

@@ -4,7 +4,7 @@
<div class="has-background-white px-6 py-6 login-box"> <div class="has-background-white px-6 py-6 login-box">
<div class="login-header"> <div class="login-header">
<Logo /> <Logo />
<h2 class="title mt-4">{{ isVietnamese ? 'Đăng nhập hệ thống' : 'Login' }}</h2> <h2 class="title mt-4">{{ isVietnamese ? 'Đăng nhập' : 'Login' }}</h2>
<p class="subtitle is-6 has-text-centered" v-if="getEnv"> <p class="subtitle is-6 has-text-centered" v-if="getEnv">
{{ getEnv }} {{ getEnv }}
</p> </p>
@@ -71,7 +71,11 @@
</div> </div>
<div class="field is-grouped mt-5 is-align-items-center is-justify-content-space-between"> <div class="field is-grouped mt-5 is-align-items-center is-justify-content-space-between">
<div class="control"> <div class="control">
<button class="button btn-primary" @click="signin()" @keyup.enter="signin()"> <button
:class="['button', 'btn-primary', isLoaded && 'is-loading']"
@click="signin()"
@keyup.enter="signin()"
>
{{ isVietnamese ? 'Đăng nhập' : 'Login' }} {{ isVietnamese ? 'Đăng nhập' : 'Login' }}
</button> </button>
</div> </div>
@@ -83,12 +87,18 @@
</div> </div>
</div> </div>
<footer class="login-footer"> <footer class="login-footer">
<span <span v-if="isVietnamese">
>©{{ new Date().getFullYear() }} ©{{ new Date().getFullYear() }} Bản quyển thuộc về
{{ <a :href="company.parent.website" target="_blank" :title="company.parent.slogan">
isVietnamese ? 'Bản quyền thuộc về Utopia Villas & Resort' : 'Copyright by Utopia Villas & Resort' {{ company.parent.name }}
}}</span </a>
> </span>
<span v-else>
©{{ new Date().getFullYear() }} Copyright by
<a :href="company.parent.website" target="_blank" :title="company.parent.name">
{{ company.parent.name }}
</a>
</span>
</footer> </footer>
</div> </div>
</div> </div>
@@ -96,9 +106,10 @@
</template> </template>
<script> <script>
import Bowser from 'bowser'; import Bowser from 'bowser';
import { COMPANY } from '../constants/company';
export default { export default {
head() { head() {
return { title: this.isVietnamese ? 'Đăng nhập' : 'Login' }; return { title: this.isVietnamese ? `Đăng nhập - ${this.company.name}` : `Login - ${this.company.name}` };
}, },
data() { data() {
return { return {
@@ -112,15 +123,15 @@ export default {
isLoaded: false, isLoaded: false,
data: undefined, data: undefined,
account: undefined, account: undefined,
company: COMPANY,
}; };
}, },
mounted() { // mounted() {
window.addEventListener('keyup', (ev) => // window.addEventListener('keyup', (ev) =>
ev.key === 'Enter' && this.$route.name === 'signup' ? this.signin() : false, // ev.key === 'Enter' && this.$route.name === 'signup' ? this.signin() : false,
); // );
if (!this.module) return this.$router.push('/welcome'); // if (!this.module) return this.$router.push('/welcome');
// },
},
computed: { computed: {
login: { login: {
get: function () { get: function () {
@@ -255,20 +266,25 @@ export default {
return this.errors.length > 0 ? true : false; return this.errors.length > 0 ? true : false;
}, },
async signin() { async signin() {
if (this.checkError()) return; this.isLoaded = true;
if (this.checkError()) {
this.isLoaded = false;
return;
}
let conn = this.$findapi('login'); let conn = this.$findapi('login');
conn.params.filter = { username: this.username, password: this.password }; conn.params.filter = { username: this.username, password: this.password };
let result = await this.$getapi([conn]); let result = await this.$getapi([conn]);
if (result === 'error') { if (result === 'error') {
this.isLoaded = false;
return this.$dialog( return this.$dialog(
`${ `${
this.isVietnamese this.isVietnamese
? 'Đã xảy ra lỗi. Vui lòng thử lại hoặc liên hệ số hotline để được hỗ trợ.' ? `Đã xảy ra lỗi. Vui lòng thử lại hoặc liên hệ số hotline: ${this.company.phone.hotline} để được hỗ trợ.`
: 'An error occurred. Please try again or contact the hotline for support.' : `An error occurred. Please try again or contact the hotline: ${this.company.phone.hotline} for support.`
}`, }`,
`${this.isVietnamese ? 'Lỗi kết nối' : 'Connection error'}`, `${this.isVietnamese ? 'Lỗi kết nối' : 'Connection error'}`,
'Error', 'Error',
10, 20,
); );
} }
let data = result.find((v) => v.name === 'login').data.rows; let data = result.find((v) => v.name === 'login').data.rows;
@@ -296,7 +312,10 @@ export default {
return this.errors.length > 0 ? true : false; return this.errors.length > 0 ? true : false;
}, },
async fillData(data) { async fillData(data) {
if (this.invalidLogin(data)) return; if (this.invalidLogin(data)) {
this.isLoaded = false;
return;
}
//check permision //check permision
if (this.module !== 'website') { if (this.module !== 'website') {
let userapps = await this.$getdata('userapps', { user: data.id, apps__code: this.module }, undefined, true); let userapps = await this.$getdata('userapps', { user: data.id, apps__code: this.module }, undefined, true);
@@ -398,7 +417,7 @@ export default {
width: 100%; width: 100%;
height: 46px; height: 46px;
background-color: #1f3a3d; /* primary from logo */ background-color: #16a34a; /* primary from logo */
color: #ffffff; color: #ffffff;
border: none; border: none;
@@ -412,7 +431,7 @@ export default {
} }
.wrapper-login .btn-primary:hover { .wrapper-login .btn-primary:hover {
background-color: #2c5054; background-color: #15803d;
} }
.wrapper-login .btn-primary:active { .wrapper-login .btn-primary:active {
@@ -431,7 +450,7 @@ export default {
.wrapper-login .reset-link { .wrapper-login .reset-link {
font-size: 14px; font-size: 14px;
font-weight: 500; font-weight: 500;
color: #3f6e73; color: #16a34a;
text-decoration: none; text-decoration: none;
transition: all 0.2s ease; transition: all 0.2s ease;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 901 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 901 KiB