Base Login
This commit is contained in:
83
layouts/colud.vue
Normal file
83
layouts/colud.vue
Normal file
@@ -0,0 +1,83 @@
|
||||
<template>
|
||||
<Nuxt v-if="ready" />
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
ready: false,
|
||||
tasks: [],
|
||||
timerTask: undefined
|
||||
}
|
||||
},
|
||||
head() {
|
||||
return {title: 'Cloud'}
|
||||
},
|
||||
async created() {
|
||||
let connlist = this.$readyapi(['moneyunit', 'datatype', 'filterchoice', 'colorchoice', 'textalign', 'placement', 'sex', 'legaltype',
|
||||
'colorscheme', 'filtertype', 'sorttype', 'tablesetting', 'settingchoice', 'menuchoice', 'settingtype', 'settingclass', 'runtype',
|
||||
'usertype', 'dbtype'])
|
||||
let filter = connlist.filter(v=>!v.ready)
|
||||
if(filter.length>0) {
|
||||
let rs = await this.$getapi(filter)
|
||||
this.ready = true
|
||||
if(!this.$store.state.login) this.$router.push('/signin')
|
||||
} else {
|
||||
this.ready = true
|
||||
if(!this.$store.state.login) this.$router.push('/signin')
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth
|
||||
if(this.$empty(this.viewport)) {
|
||||
if(width<=768) this.viewport = 1 //'mobile'
|
||||
else if(width>=769 && width<=1023) this.viewport = 2 //'tablet'
|
||||
else if(width>=1024 && width<=1215) this.viewport = 3 //'desktop'
|
||||
else if(width>=1216 && width<=1407) this.viewport = 4 //'widescreen'
|
||||
else if(width>=1408) this.viewport = 5 //'fullhd'
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
login: {
|
||||
get: function() {return this.$store.state.login},
|
||||
set: function(val) {this.$store.commit("updateLogin", {login: val})}
|
||||
},
|
||||
language: {
|
||||
get: function() {return this.$store.state.language},
|
||||
set: function(val) {this.$store.commit("updateLanguage", {language: val})}
|
||||
},
|
||||
common: {
|
||||
get: function() {return this.$store.state.common},
|
||||
set: function(val) {this.$store.commit("updateCommon", {common: val})}
|
||||
},
|
||||
tablesetting: {
|
||||
get: function() {return this.$store.state.tablesetting},
|
||||
set: function(val) {this.$store.commit("updateTable", {tablesetting: val})}
|
||||
},
|
||||
dialog: {
|
||||
get: function() {return this.$store.state['dialog']},
|
||||
set: function(val) {this.$store.commit('updateStore', {name: 'dialog', data: val})}
|
||||
},
|
||||
sshlist: {
|
||||
get: function() {return this.$store.state.sshlist},
|
||||
set: function(val) {this.$store.commit("updateSshlist", {sshlist: val})}
|
||||
},
|
||||
viewport: {
|
||||
get: function() {return this.$store.state.viewport},
|
||||
set: function(val) {this.$store.commit("updateViewPort", {viewport: val})}
|
||||
},
|
||||
taskstoday: {
|
||||
get: function() {return this.$store.state['taskstoday']},
|
||||
set: function(val) {this.$store.commit('updateStore', {name: 'taskstoday', data: val})}
|
||||
},
|
||||
datatask: {
|
||||
get: function() {return this.$store.state['datatask']},
|
||||
set: function(val) {this.$store.commit('updateStore', {name: 'datatask', data: val})}
|
||||
},
|
||||
showmodal: {
|
||||
get: function() {return this.$store.state['showmodal']},
|
||||
set: function(val) {this.$store.commit('updateStore', {name: 'showmodal', data: val})}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
84
layouts/default.vue
Normal file
84
layouts/default.vue
Normal file
@@ -0,0 +1,84 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<Nuxt v-if="ready" />
|
||||
<Modal @close="showmodal = undefined" v-bind="showmodal" v-if="showmodal"></Modal>
|
||||
<SnackBar @close="snackbar = undefined" v-bind="snackbar" v-if="snackbar" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
ready: false,
|
||||
company: this.$companyInfo(),
|
||||
};
|
||||
},
|
||||
head() {
|
||||
return {
|
||||
title: `${this.company.name}`,
|
||||
};
|
||||
},
|
||||
async created() {
|
||||
let connlist = this.$readyapi(['registermethod', 'authmethod', 'usertype', 'authstatus', 'common']);
|
||||
let filter = connlist.filter((v) => !v.ready);
|
||||
let result = filter.length > 0 ? await this.$getapi(filter) : undefined;
|
||||
if (this.result === 'error') {
|
||||
this.$dialog({
|
||||
width: '500px',
|
||||
icon: 'mdi mdi-alert-circle',
|
||||
content: 'Đã có lỗi xảy ra khi kết nối dữ liệu. Vui lòng thử lại sau ít phút',
|
||||
type: 'is-danger',
|
||||
progress: true,
|
||||
duration: 6,
|
||||
});
|
||||
} else this.ready = true;
|
||||
},
|
||||
mounted() {
|
||||
var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
|
||||
if (this.$empty(this.ismobile)) this.ismobile = width < 1024 ? true : false;
|
||||
if (this.$empty(this.viewport)) {
|
||||
if (width <= 768) this.viewport = 1; //'mobile'
|
||||
else if (width >= 769 && width <= 1023) this.viewport = 2; //'tablet'
|
||||
else if (width >= 1024 && width <= 1215) this.viewport = 3; //'desktop'
|
||||
else if (width >= 1216 && width <= 1407) this.viewport = 4; //'widescreen'
|
||||
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.iframe) this.$store.commit('updateStore', { name: 'iframe', data: this.$route.query.iframe });
|
||||
},
|
||||
computed: {
|
||||
ismobile: {
|
||||
get: function () {
|
||||
return this.$store.state.ismobile;
|
||||
},
|
||||
set: function (val) {
|
||||
this.$store.commit('updateIsMobile', { ismobile: val });
|
||||
},
|
||||
},
|
||||
showmodal: {
|
||||
get: function () {
|
||||
return this.$store.state['showmodal'];
|
||||
},
|
||||
set: function (val) {
|
||||
this.$store.commit('updateStore', { name: 'showmodal', data: val });
|
||||
},
|
||||
},
|
||||
snackbar: {
|
||||
get: function () {
|
||||
return this.$store.state['snackbar'];
|
||||
},
|
||||
set: function (val) {
|
||||
this.$store.commit('updateStore', { name: 'snackbar', data: val });
|
||||
},
|
||||
},
|
||||
viewport: {
|
||||
get: function () {
|
||||
return this.$store.state.viewport;
|
||||
},
|
||||
set: function (val) {
|
||||
this.$store.commit('updateViewPort', { viewport: val });
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user