Init config #68
|
@ -26,12 +26,9 @@ module.exports = {
|
||||||
// 'plugin:vue/vue3-strongly-recommended', // Priority B: Strongly Recommended (Improving Readability)
|
// 'plugin:vue/vue3-strongly-recommended', // Priority B: Strongly Recommended (Improving Readability)
|
||||||
// 'plugin:vue/vue3-recommended', // Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead)
|
// 'plugin:vue/vue3-recommended', // Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead)
|
||||||
|
|
||||||
'standard'
|
'standard',
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
plugins: ['vue', 'prettier'],
|
plugins: ['vue', 'prettier'],
|
||||||
|
|
||||||
globals: {
|
globals: {
|
||||||
|
@ -78,6 +75,7 @@ module.exports = {
|
||||||
rules: {
|
rules: {
|
||||||
semi: 'off',
|
semi: 'off',
|
||||||
indent: ['error', 4, { SwitchCase: 1 }],
|
indent: ['error', 4, { SwitchCase: 1 }],
|
||||||
|
'space-before-function-paren': 'off',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -3,7 +3,7 @@ module.exports = {
|
||||||
tabWidth: 4,
|
tabWidth: 4,
|
||||||
useTabs: false,
|
useTabs: false,
|
||||||
singleQuote: true,
|
singleQuote: true,
|
||||||
trailingComma: 'all',
|
|
||||||
bracketSpacing: true,
|
bracketSpacing: true,
|
||||||
arrowParens: 'avoid',
|
arrowParens: 'avoid',
|
||||||
|
trailingComma: 'none'
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,14 +4,7 @@
|
||||||
"editor.bracketPairColorization.enabled": true,
|
"editor.bracketPairColorization.enabled": true,
|
||||||
"editor.guides.bracketPairs": true,
|
"editor.guides.bracketPairs": true,
|
||||||
"editor.formatOnSave": true,
|
"editor.formatOnSave": true,
|
||||||
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||||
"editor.codeActionsOnSave": [
|
"editor.codeActionsOnSave": ["source.fixAll.eslint"],
|
||||||
"source.fixAll.eslint"
|
"eslint.validate": ["javascript", "javascriptreact", "typescript", "vue"]
|
||||||
],
|
|
||||||
"eslint.validate": [
|
|
||||||
"javascript",
|
|
||||||
"javascriptreact",
|
|
||||||
"typescript",
|
|
||||||
"vue"
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { defineComponent } from 'vue'
|
import { defineComponent } from 'vue';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'App'
|
name: 'App'
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -30,5 +30,5 @@
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'LoginLayout'
|
name: 'LoginLayout'
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -62,7 +62,9 @@
|
||||||
class="q-pl-lg"
|
class="q-pl-lg"
|
||||||
>
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ subitem.description }}</QItemLabel>
|
<QItemLabel>
|
||||||
|
{{ subitem.description }}
|
||||||
|
</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
</QList>
|
</QList>
|
||||||
|
@ -165,15 +167,15 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { defineComponent, ref } from 'vue'
|
import { defineComponent, ref } from 'vue';
|
||||||
import { userStore } from 'stores/user'
|
import { userStore } from 'stores/user';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'MainLayout',
|
name: 'MainLayout',
|
||||||
props: {},
|
props: {},
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
const leftDrawerOpen = ref(false)
|
const leftDrawerOpen = ref(false);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
user: userStore(),
|
user: userStore(),
|
||||||
|
@ -181,52 +183,52 @@ export default defineComponent({
|
||||||
essentialLinks: ref(null),
|
essentialLinks: ref(null),
|
||||||
leftDrawerOpen,
|
leftDrawerOpen,
|
||||||
toggleLeftDrawer() {
|
toggleLeftDrawer() {
|
||||||
leftDrawerOpen.value = !leftDrawerOpen.value
|
leftDrawerOpen.value = !leftDrawerOpen.value;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
async mounted() {
|
async mounted() {
|
||||||
this.$refs.actions.appendChild(this.$actions)
|
this.$refs.actions.appendChild(this.$actions);
|
||||||
await this.user.loadData()
|
await this.user.loadData();
|
||||||
await this.$app.loadConfig()
|
await this.$app.loadConfig();
|
||||||
await this.fetchData()
|
await this.fetchData();
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
async fetchData() {
|
async fetchData() {
|
||||||
const sections = await this.$jApi.query('SELECT * FROM myMenu')
|
const sections = await this.$jApi.query('SELECT * FROM myMenu');
|
||||||
|
|
||||||
const sectionMap = new Map()
|
const sectionMap = new Map();
|
||||||
for (const section of sections) {
|
for (const section of sections) {
|
||||||
sectionMap.set(section.id, section)
|
sectionMap.set(section.id, section);
|
||||||
}
|
}
|
||||||
|
|
||||||
const sectionTree = []
|
const sectionTree = [];
|
||||||
for (const section of sections) {
|
for (const section of sections) {
|
||||||
const parent = section.parentFk
|
const parent = section.parentFk;
|
||||||
if (parent) {
|
if (parent) {
|
||||||
const parentSection = sectionMap.get(parent)
|
const parentSection = sectionMap.get(parent);
|
||||||
if (!parentSection) continue
|
if (!parentSection) continue;
|
||||||
let childs = parentSection.childs
|
let childs = parentSection.childs;
|
||||||
if (!childs) {
|
if (!childs) {
|
||||||
childs = parentSection.childs = []
|
childs = parentSection.childs = [];
|
||||||
}
|
}
|
||||||
childs.push(section)
|
childs.push(section);
|
||||||
} else {
|
} else {
|
||||||
sectionTree.push(section)
|
sectionTree.push(section);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.essentialLinks = sectionTree
|
this.essentialLinks = sectionTree;
|
||||||
},
|
},
|
||||||
|
|
||||||
async logout() {
|
async logout() {
|
||||||
this.user.logout()
|
this.user.logout();
|
||||||
this.$router.push('/login')
|
this.$router.push('/login');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<i18n lang="yaml">
|
<i18n lang="yaml">
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
<div class="q-pa-sm row items-start">
|
<div class="q-pa-sm row items-start">
|
||||||
<div class="new-card q-pa-sm" v-for="myNew in news" :key="myNew.id">
|
<div class="new-card q-pa-sm" v-for="myNew in news" :key="myNew.id">
|
||||||
<QCard>
|
<QCard>
|
||||||
<QImg :src="`${$app.imageUrl}/news/full/${myNew.image}`"> </QImg>
|
<QImg :src="`${$app.imageUrl}/news/full/${myNew.image}`">
|
||||||
|
</QImg>
|
||||||
<QCardSection>
|
<QCardSection>
|
||||||
<div class="text-h5">{{ myNew.title }}</div>
|
<div class="text-h5">{{ myNew.title }}</div>
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
|
@ -50,16 +51,16 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
news: []
|
news: []
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
this.news = await this.$jApi.query(
|
this.news = await this.$jApi.query(
|
||||||
`SELECT title, text, image, id
|
`SELECT title, text, image, id
|
||||||
FROM news
|
FROM news
|
||||||
ORDER BY priority, created DESC`
|
ORDER BY priority, created DESC`
|
||||||
)
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<i18n lang="yaml">
|
<i18n lang="yaml">
|
||||||
|
|
|
@ -50,7 +50,9 @@
|
||||||
name="cancel"
|
name="cancel"
|
||||||
class="cursor-pointer"
|
class="cursor-pointer"
|
||||||
:title="$t('deleteFilter')"
|
:title="$t('deleteFilter')"
|
||||||
@click="$router.push({ params: { category: null } })"
|
@click="
|
||||||
|
$router.push({ params: { category: null } })
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="categories">
|
<div class="categories">
|
||||||
|
@ -81,7 +83,9 @@
|
||||||
clearable
|
clearable
|
||||||
:label="$t('family')"
|
:label="$t('family')"
|
||||||
@filter="filterType"
|
@filter="filterType"
|
||||||
@input="$router.push({ params: { type: type && type.id } })"
|
@input="
|
||||||
|
$router.push({ params: { type: type && type.id } })
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
<QSelect
|
<QSelect
|
||||||
v-model="order"
|
v-model="order"
|
||||||
|
@ -162,7 +166,8 @@
|
||||||
:disable="disableScroll"
|
:disable="disableScroll"
|
||||||
>
|
>
|
||||||
<div class="q-pa-md row justify-center q-gutter-md">
|
<div class="q-pa-md row justify-center q-gutter-md">
|
||||||
<QSpinner v-if="isLoading" color="primary" size="50px"> </QSpinner>
|
<QSpinner v-if="isLoading" color="primary" size="50px">
|
||||||
|
</QSpinner>
|
||||||
<div
|
<div
|
||||||
v-if="items && !items.length"
|
v-if="items && !items.length"
|
||||||
class="text-subtitle1 text-grey-7 q-pa-md"
|
class="text-subtitle1 text-grey-7 q-pa-md"
|
||||||
|
@ -188,7 +193,9 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="tags q-pt-xs">
|
<div class="tags q-pt-xs">
|
||||||
<div v-for="tag in item.tags" :key="tag.tagFk">
|
<div v-for="tag in item.tags" :key="tag.tagFk">
|
||||||
<span class="text-grey-7">{{ tag.tag.name }}</span>
|
<span class="text-grey-7">{{
|
||||||
|
tag.tag.name
|
||||||
|
}}</span>
|
||||||
{{ tag.value }}
|
{{ tag.value }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -199,7 +206,9 @@
|
||||||
item.available
|
item.available
|
||||||
}}</span>
|
}}</span>
|
||||||
{{ $t('from') }}
|
{{ $t('from') }}
|
||||||
<span class="price">{{ currency(item.buy?.price3) }}</span>
|
<span class="price">{{
|
||||||
|
currency(item.buy?.price3)
|
||||||
|
}}</span>
|
||||||
</div>
|
</div>
|
||||||
<QBtn
|
<QBtn
|
||||||
icon="add_shopping_cart"
|
icon="add_shopping_cart"
|
||||||
|
@ -230,7 +239,9 @@
|
||||||
</div>
|
</div>
|
||||||
</QImg>
|
</QImg>
|
||||||
<QCardSection>
|
<QCardSection>
|
||||||
<div class="text-uppercase text-subtitle1 text-grey-7 ellipsize">
|
<div
|
||||||
|
class="text-uppercase text-subtitle1 text-grey-7 ellipsize"
|
||||||
|
>
|
||||||
{{ item.subName }}
|
{{ item.subName }}
|
||||||
</div>
|
</div>
|
||||||
<div class="text-grey-7">#{{ item.id }}</div>
|
<div class="text-grey-7">#{{ item.id }}</div>
|
||||||
|
@ -332,11 +343,11 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { date, currency } from 'src/lib/filters.js'
|
import { date, currency } from 'src/lib/filters.js';
|
||||||
import { date as qdate } from 'quasar'
|
import { date as qdate } from 'quasar';
|
||||||
import axios from 'axios'
|
import axios from 'axios';
|
||||||
|
|
||||||
const CancelToken = axios.CancelToken
|
const CancelToken = axios.CancelToken;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'HederaCatalog',
|
name: 'HederaCatalog',
|
||||||
|
@ -395,10 +406,10 @@ export default {
|
||||||
value: 'available'
|
value: 'available'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.$app.useRightDrawer = true
|
this.$app.useRightDrawer = true;
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
this.categories = await this.$jApi.query(
|
this.categories = await this.$jApi.query(
|
||||||
|
@ -407,32 +418,32 @@ export default {
|
||||||
JOIN vn.itemCategoryL10n l ON l.id = c.id
|
JOIN vn.itemCategoryL10n l ON l.id = c.id
|
||||||
WHERE c.display
|
WHERE c.display
|
||||||
ORDER BY display`
|
ORDER BY display`
|
||||||
)
|
);
|
||||||
this.onRouteChange(this.$route)
|
this.onRouteChange(this.$route);
|
||||||
},
|
},
|
||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
this.clearTimeoutAndRequest()
|
this.clearTimeoutAndRequest();
|
||||||
},
|
},
|
||||||
beforeRouteUpdate(to, from, next) {
|
beforeRouteUpdate(to, from, next) {
|
||||||
this.onRouteChange(to)
|
this.onRouteChange(to);
|
||||||
next()
|
next();
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
categories() {
|
categories() {
|
||||||
this.refreshTitle()
|
this.refreshTitle();
|
||||||
},
|
},
|
||||||
orgTypes() {
|
orgTypes() {
|
||||||
this.refreshTitle()
|
this.refreshTitle();
|
||||||
},
|
},
|
||||||
order() {
|
order() {
|
||||||
this.loadItems()
|
this.loadItems();
|
||||||
},
|
},
|
||||||
date() {
|
date() {
|
||||||
this.loadItems()
|
this.loadItems();
|
||||||
},
|
},
|
||||||
async category(value) {
|
async category(value) {
|
||||||
this.orgTypes = []
|
this.orgTypes = [];
|
||||||
if (!value) return
|
if (!value) return;
|
||||||
|
|
||||||
const res = await this.$jApi.execQuery(
|
const res = await this.$jApi.execQuery(
|
||||||
`CALL myBasket_getAvailable;
|
`CALL myBasket_getAvailable;
|
||||||
|
@ -446,104 +457,104 @@ export default {
|
||||||
ORDER BY t.\`order\`, l.name;
|
ORDER BY t.\`order\`, l.name;
|
||||||
DROP TEMPORARY TABLE tmp.itemAvailable;`,
|
DROP TEMPORARY TABLE tmp.itemAvailable;`,
|
||||||
{ category: value }
|
{ category: value }
|
||||||
)
|
);
|
||||||
res.fetch()
|
res.fetch();
|
||||||
this.orgTypes = res.fetchData()
|
this.orgTypes = res.fetchData();
|
||||||
},
|
},
|
||||||
search(value) {
|
search(value) {
|
||||||
const location = { params: this.$route.params }
|
const location = { params: this.$route.params };
|
||||||
if (value) location.query = { search: value }
|
if (value) location.query = { search: value };
|
||||||
this.$router.push(location)
|
this.$router.push(location);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
date,
|
date,
|
||||||
currency,
|
currency,
|
||||||
onViewModeClick() {
|
onViewModeClick() {
|
||||||
this.viewMode = this.viewMode === 'list' ? 'grid' : 'list'
|
this.viewMode = this.viewMode === 'list' ? 'grid' : 'list';
|
||||||
},
|
},
|
||||||
onRouteChange(route) {
|
onRouteChange(route) {
|
||||||
let { category, type } = route.params
|
let { category, type } = route.params;
|
||||||
|
|
||||||
category = parseInt(category) || null
|
category = parseInt(category) || null;
|
||||||
type = parseInt(type) || null
|
type = parseInt(type) || null;
|
||||||
|
|
||||||
this.category = category
|
this.category = category;
|
||||||
this.typeId = category ? type : null
|
this.typeId = category ? type : null;
|
||||||
this.search = route.query.search || ''
|
this.search = route.query.search || '';
|
||||||
this.tags = []
|
this.tags = [];
|
||||||
|
|
||||||
this.refreshTitle()
|
this.refreshTitle();
|
||||||
this.loadItems()
|
this.loadItems();
|
||||||
},
|
},
|
||||||
refreshTitle() {
|
refreshTitle() {
|
||||||
let title = this.$t(this.$router.currentRoute.value.name)
|
let title = this.$t(this.$router.currentRoute.value.name);
|
||||||
let subtitle
|
let subtitle;
|
||||||
|
|
||||||
if (this.category) {
|
if (this.category) {
|
||||||
const category =
|
const category =
|
||||||
this.categories.find((i) => i.id === this.category) || {}
|
this.categories.find(i => i.id === this.category) || {};
|
||||||
title = category.name
|
title = category.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.typeId) {
|
if (this.typeId) {
|
||||||
this.type = this.orgTypes.find((i) => i.id === this.typeId)
|
this.type = this.orgTypes.find(i => i.id === this.typeId);
|
||||||
subtitle = title
|
subtitle = title;
|
||||||
title = this.type && this.type.name
|
title = this.type && this.type.name;
|
||||||
} else {
|
} else {
|
||||||
this.type = null
|
this.type = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$app.$patch({ title, subtitle })
|
this.$app.$patch({ title, subtitle });
|
||||||
},
|
},
|
||||||
clearTimeoutAndRequest() {
|
clearTimeoutAndRequest() {
|
||||||
if (this.timeout) {
|
if (this.timeout) {
|
||||||
clearTimeout(this.timeout)
|
clearTimeout(this.timeout);
|
||||||
this.timeout = null
|
this.timeout = null;
|
||||||
}
|
}
|
||||||
if (this.source) {
|
if (this.source) {
|
||||||
this.source.cancel()
|
this.source.cancel();
|
||||||
this.source = null
|
this.source = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
loadItemsDelayed() {
|
loadItemsDelayed() {
|
||||||
this.clearTimeoutAndRequest()
|
this.clearTimeoutAndRequest();
|
||||||
this.timeout = setTimeout(() => this.loadItems(), 500)
|
this.timeout = setTimeout(() => this.loadItems(), 500);
|
||||||
},
|
},
|
||||||
loadItems() {
|
loadItems() {
|
||||||
this.items = null
|
this.items = null;
|
||||||
this.isLoading = true
|
this.isLoading = true;
|
||||||
this.limit = this.pageSize
|
this.limit = this.pageSize;
|
||||||
this.disableScroll = false
|
this.disableScroll = false;
|
||||||
this.isLoading = false
|
this.isLoading = false;
|
||||||
// this.loadItemsBase().finally(() => (this.isLoading = false))
|
// this.loadItemsBase().finally(() => (this.isLoading = false))
|
||||||
},
|
},
|
||||||
onLoad(index, done) {
|
onLoad(index, done) {
|
||||||
if (this.isLoading) return done()
|
if (this.isLoading) return done();
|
||||||
this.limit += this.pageSize
|
this.limit += this.pageSize;
|
||||||
done()
|
done();
|
||||||
// this.loadItemsBase().finally(done)
|
// this.loadItemsBase().finally(done)
|
||||||
},
|
},
|
||||||
loadItemsBase() {
|
loadItemsBase() {
|
||||||
this.clearTimeoutAndRequest()
|
this.clearTimeoutAndRequest();
|
||||||
|
|
||||||
if (!(this.category || this.typeId || this.search)) {
|
if (!(this.category || this.typeId || this.search)) {
|
||||||
this.tags = []
|
this.tags = [];
|
||||||
return Promise.resolve(true)
|
return Promise.resolve(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
const tagFilter = []
|
const tagFilter = [];
|
||||||
|
|
||||||
for (const tag of this.tags) {
|
for (const tag of this.tags) {
|
||||||
if (tag.hasFilter) {
|
if (tag.hasFilter) {
|
||||||
tagFilter.push({
|
tagFilter.push({
|
||||||
tagFk: tag.id,
|
tagFk: tag.id,
|
||||||
values: tag.filter
|
values: tag.filter
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.source = CancelToken.source()
|
this.source = CancelToken.source();
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
dated: this.orderDate,
|
dated: this.orderDate,
|
||||||
|
@ -553,103 +564,107 @@ export default {
|
||||||
order: this.order.value,
|
order: this.order.value,
|
||||||
limit: this.limit,
|
limit: this.limit,
|
||||||
tagFilter
|
tagFilter
|
||||||
}
|
};
|
||||||
const config = {
|
const config = {
|
||||||
params,
|
params,
|
||||||
cancelToken: this.source.token
|
cancelToken: this.source.token
|
||||||
}
|
};
|
||||||
return this.$axios
|
return this.$axios
|
||||||
.get('Items/catalog', config)
|
.get('Items/catalog', config)
|
||||||
.then((res) => this.onItemsGet(res))
|
.then(res => this.onItemsGet(res))
|
||||||
.catch((err) => this.onItemsError(err))
|
.catch(err => this.onItemsError(err))
|
||||||
.finally(() => (this.cancel = null))
|
.finally(() => (this.cancel = null));
|
||||||
},
|
},
|
||||||
onItemsError(err) {
|
onItemsError(err) {
|
||||||
if (err.__CANCEL__) return
|
if (err.__CANCEL__) return;
|
||||||
this.disableScroll = true
|
this.disableScroll = true;
|
||||||
throw err
|
throw err;
|
||||||
},
|
},
|
||||||
onItemsGet(res) {
|
onItemsGet(res) {
|
||||||
for (const tag of res.data.tags) {
|
for (const tag of res.data.tags) {
|
||||||
tag.uid = this.uid++
|
tag.uid = this.uid++;
|
||||||
|
|
||||||
if (tag.filter) {
|
if (tag.filter) {
|
||||||
tag.hasFilter = true
|
tag.hasFilter = true;
|
||||||
tag.useRange = tag.filter.max || tag.filter.min
|
tag.useRange = tag.filter.max || tag.filter.min;
|
||||||
} else {
|
} else {
|
||||||
tag.useRange = tag.isQuantitative && tag.values.length > this.maxTags
|
tag.useRange =
|
||||||
this.resetTagFilter(tag)
|
tag.isQuantitative && tag.values.length > this.maxTags;
|
||||||
|
this.resetTagFilter(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag.values) {
|
if (tag.values) {
|
||||||
tag.initialCount = this.maxTags
|
tag.initialCount = this.maxTags;
|
||||||
if (Array.isArray(tag.filter)) {
|
if (Array.isArray(tag.filter)) {
|
||||||
tag.initialCount = Math.max(tag.initialCount, tag.filter.length)
|
tag.initialCount = Math.max(
|
||||||
|
tag.initialCount,
|
||||||
|
tag.filter.length
|
||||||
|
);
|
||||||
}
|
}
|
||||||
tag.showCount = tag.initialCount
|
tag.showCount = tag.initialCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.items = res.data.items
|
this.items = res.data.items;
|
||||||
this.tags = res.data.tags
|
this.tags = res.data.tags;
|
||||||
this.disableScroll = this.items.length < this.limit
|
this.disableScroll = this.items.length < this.limit;
|
||||||
},
|
},
|
||||||
onRangeChange(tag, delay) {
|
onRangeChange(tag, delay) {
|
||||||
tag.hasFilter = true
|
tag.hasFilter = true;
|
||||||
|
|
||||||
if (!delay) this.loadItems()
|
if (!delay) this.loadItems();
|
||||||
else this.loadItemsDelayed()
|
else this.loadItemsDelayed();
|
||||||
},
|
},
|
||||||
onCheck(tag) {
|
onCheck(tag) {
|
||||||
tag.hasFilter = tag.filter.length > 0
|
tag.hasFilter = tag.filter.length > 0;
|
||||||
this.loadItems()
|
this.loadItems();
|
||||||
},
|
},
|
||||||
resetTagFilter(tag) {
|
resetTagFilter(tag) {
|
||||||
tag.hasFilter = false
|
tag.hasFilter = false;
|
||||||
|
|
||||||
if (tag.useRange) {
|
if (tag.useRange) {
|
||||||
tag.filter = {
|
tag.filter = {
|
||||||
min: tag.min,
|
min: tag.min,
|
||||||
max: tag.max
|
max: tag.max
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
tag.filter = []
|
tag.filter = [];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onResetTagFilterClick(tag) {
|
onResetTagFilterClick(tag) {
|
||||||
this.resetTagFilter(tag)
|
this.resetTagFilter(tag);
|
||||||
this.loadItems()
|
this.loadItems();
|
||||||
},
|
},
|
||||||
filterType(val, update) {
|
filterType(val, update) {
|
||||||
if (val === '') {
|
if (val === '') {
|
||||||
update(() => {
|
update(() => {
|
||||||
this.types = this.orgTypes
|
this.types = this.orgTypes;
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
update(() => {
|
update(() => {
|
||||||
const needle = val.toLowerCase()
|
const needle = val.toLowerCase();
|
||||||
this.types = this.orgTypes.filter(
|
this.types = this.orgTypes.filter(
|
||||||
(type) => type.name.toLowerCase().indexOf(needle) > -1
|
type => type.name.toLowerCase().indexOf(needle) > -1
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
showItem(item) {
|
showItem(item) {
|
||||||
this.item = item
|
this.item = item;
|
||||||
this.showItemDialog = true
|
this.showItemDialog = true;
|
||||||
|
|
||||||
const conf = this.$state.catalogConfig
|
const conf = this.$state.catalogConfig;
|
||||||
const params = {
|
const params = {
|
||||||
dated: this.orderDate,
|
dated: this.orderDate,
|
||||||
addressFk: conf.addressFk,
|
addressFk: conf.addressFk,
|
||||||
agencyModeFk: conf.agencyModeFk
|
agencyModeFk: conf.agencyModeFk
|
||||||
}
|
};
|
||||||
this.$axios
|
this.$axios
|
||||||
.get(`Items/${item.id}/calcCatalog`, { params })
|
.get(`Items/${item.id}/calcCatalog`, { params })
|
||||||
.then((res) => (this.lots = res.data))
|
.then(res => (this.lots = res.data));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<i18n lang="yaml">
|
<i18n lang="yaml">
|
||||||
|
|
|
@ -63,24 +63,34 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { date, currency } from 'src/lib/filters.js'
|
import { date, currency } from 'src/lib/filters.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'OrdersPendingIndex',
|
name: 'OrdersPendingIndex',
|
||||||
data() {
|
data() {
|
||||||
const curYear = new Date().getFullYear()
|
const curYear = new Date().getFullYear();
|
||||||
const years = []
|
const years = [];
|
||||||
|
|
||||||
for (let year = curYear - 5; year <= curYear; year++) {
|
for (let year = curYear - 5; year <= curYear; year++) {
|
||||||
years.push(year)
|
years.push(year);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
columns: [
|
columns: [
|
||||||
{ name: 'ref', label: 'serial', field: 'ref', align: 'left' },
|
{ name: 'ref', label: 'serial', field: 'ref', align: 'left' },
|
||||||
{ name: 'issued', label: 'issued', field: 'issued', align: 'left' },
|
{
|
||||||
|
name: 'issued',
|
||||||
|
label: 'issued',
|
||||||
|
field: 'issued',
|
||||||
|
align: 'left'
|
||||||
|
},
|
||||||
{ name: 'amount', label: 'amount', field: 'amount' },
|
{ name: 'amount', label: 'amount', field: 'amount' },
|
||||||
{ name: 'hasPdf', label: 'download', field: 'hasPdf', align: 'center' }
|
{
|
||||||
|
name: 'hasPdf',
|
||||||
|
label: 'download',
|
||||||
|
field: 'hasPdf',
|
||||||
|
align: 'center'
|
||||||
|
}
|
||||||
],
|
],
|
||||||
pagination: {
|
pagination: {
|
||||||
rowsPerPage: 0
|
rowsPerPage: 0
|
||||||
|
@ -88,16 +98,16 @@ export default {
|
||||||
year: curYear,
|
year: curYear,
|
||||||
years,
|
years,
|
||||||
invoices: null
|
invoices: null
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
async mounted() {
|
async mounted() {
|
||||||
await this.loadData()
|
await this.loadData();
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
async year() {
|
async year() {
|
||||||
await this.loadData()
|
await this.loadData();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -109,7 +119,7 @@ export default {
|
||||||
const params = {
|
const params = {
|
||||||
from: new Date(this.year, 0),
|
from: new Date(this.year, 0),
|
||||||
to: new Date(this.year, 11, 31, 23, 59, 59)
|
to: new Date(this.year, 11, 31, 23, 59, 59)
|
||||||
}
|
};
|
||||||
this._invoices = await this.$jApi.query(
|
this._invoices = await this.$jApi.query(
|
||||||
`SELECT id, ref, issued, amount, hasPdf
|
`SELECT id, ref, issued, amount, hasPdf
|
||||||
FROM myInvoice
|
FROM myInvoice
|
||||||
|
@ -117,7 +127,7 @@ export default {
|
||||||
ORDER BY issued DESC
|
ORDER BY issued DESC
|
||||||
LIMIT 500`,
|
LIMIT 500`,
|
||||||
params
|
params
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
invoiceUrl(id) {
|
invoiceUrl(id) {
|
||||||
|
@ -128,10 +138,10 @@ export default {
|
||||||
invoice: id,
|
invoice: id,
|
||||||
access_token: this.$user.token
|
access_token: this.$user.token
|
||||||
}).toString()
|
}).toString()
|
||||||
)
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<i18n lang="yaml">
|
<i18n lang="yaml">
|
||||||
|
|
|
@ -5,7 +5,12 @@
|
||||||
<span class="amount" :class="{ negative: debt < 0 }">
|
<span class="amount" :class="{ negative: debt < 0 }">
|
||||||
{{ currency(debt || 0) }}
|
{{ currency(debt || 0) }}
|
||||||
</span>
|
</span>
|
||||||
<QIcon name="info" :title="$t('paymentInfo')" class="info" size="24px" />
|
<QIcon
|
||||||
|
name="info"
|
||||||
|
:title="$t('paymentInfo')"
|
||||||
|
class="info"
|
||||||
|
size="24px"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<QBtn
|
<QBtn
|
||||||
icon="payments"
|
icon="payments"
|
||||||
|
@ -88,8 +93,8 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { date, currency } from 'src/lib/filters.js'
|
import { date, currency } from 'src/lib/filters.js';
|
||||||
import { tpvStore } from 'stores/tpv'
|
import { tpvStore } from 'stores/tpv';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'OrdersPendingIndex',
|
name: 'OrdersPendingIndex',
|
||||||
|
@ -98,14 +103,14 @@ export default {
|
||||||
orders: null,
|
orders: null,
|
||||||
debt: 0,
|
debt: 0,
|
||||||
tpv: tpvStore()
|
tpv: tpvStore()
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
async mounted() {
|
async mounted() {
|
||||||
await this.tpv.check(this.$route)
|
await this.tpv.check(this.$route);
|
||||||
|
|
||||||
this.orders = await this.$jApi.query('CALL myTicket_list(NULL, NULL)')
|
this.orders = await this.$jApi.query('CALL myTicket_list(NULL, NULL)');
|
||||||
this.debt = await this.$jApi.getValue('SELECT -myClient_getDebt(NULL)')
|
this.debt = await this.$jApi.getValue('SELECT -myClient_getDebt(NULL)');
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -113,22 +118,22 @@ export default {
|
||||||
currency,
|
currency,
|
||||||
|
|
||||||
async onPayClick() {
|
async onPayClick() {
|
||||||
let amount = -this.debt
|
let amount = -this.debt;
|
||||||
amount = amount <= 0 ? null : amount
|
amount = amount <= 0 ? null : amount;
|
||||||
|
|
||||||
let defaultAmountStr = ''
|
let defaultAmountStr = '';
|
||||||
if (amount !== null) {
|
if (amount !== null) {
|
||||||
defaultAmountStr = amount
|
defaultAmountStr = amount;
|
||||||
}
|
}
|
||||||
amount = prompt(this.$t('amountToPay'), defaultAmountStr)
|
amount = prompt(this.$t('amountToPay'), defaultAmountStr);
|
||||||
|
|
||||||
if (amount != null) {
|
if (amount != null) {
|
||||||
amount = parseFloat(amount.replace(',', '.'))
|
amount = parseFloat(amount.replace(',', '.'));
|
||||||
await this.tpv.pay(amount)
|
await this.tpv.pay(amount);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<i18n lang="yaml">
|
<i18n lang="yaml">
|
||||||
|
|
|
@ -16,10 +16,12 @@
|
||||||
<QCardSection>
|
<QCardSection>
|
||||||
<div class="text-h6">{{ $t('shippingInformation') }}</div>
|
<div class="text-h6">{{ $t('shippingInformation') }}</div>
|
||||||
<div>
|
<div>
|
||||||
{{ $t('preparation') }} {{ date(ticket.shipped, 'ddd, MMMM Do') }}
|
{{ $t('preparation') }}
|
||||||
|
{{ date(ticket.shipped, 'ddd, MMMM Do') }}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{{ $t('delivery') }} {{ date(ticket.shipped, 'ddd, MMMM Do') }}
|
{{ $t('delivery') }}
|
||||||
|
{{ date(ticket.shipped, 'ddd, MMMM Do') }}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{{ $t(ticket.method != 'PICKUP' ? 'agency' : 'warehouse') }}
|
{{ $t(ticket.method != 'PICKUP' ? 'agency' : 'warehouse') }}
|
||||||
|
@ -31,7 +33,9 @@
|
||||||
<div>{{ ticket.nickname }}</div>
|
<div>{{ ticket.nickname }}</div>
|
||||||
<div>{{ ticket.street }}</div>
|
<div>{{ ticket.street }}</div>
|
||||||
<div>
|
<div>
|
||||||
{{ ticket.postalCode }} {{ ticket.city }} ({{ ticket.province }})
|
{{ ticket.postalCode }} {{ ticket.city }} ({{
|
||||||
|
ticket.province
|
||||||
|
}})
|
||||||
</div>
|
</div>
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<QSeparator inset />
|
<QSeparator inset />
|
||||||
|
@ -39,7 +43,9 @@
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection avatar>
|
<QItemSection avatar>
|
||||||
<QAvatar size="68px">
|
<QAvatar size="68px">
|
||||||
<img :src="`${$app.imageUrl}/catalog/200x200/${row.image}`" />
|
<img
|
||||||
|
:src="`${$app.imageUrl}/catalog/200x200/${row.image}`"
|
||||||
|
/>
|
||||||
</QAvatar>
|
</QAvatar>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
|
@ -75,7 +81,7 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { date, currency } from 'src/lib/filters.js'
|
import { date, currency } from 'src/lib/filters.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'OrdersConfirmedView',
|
name: 'OrdersConfirmedView',
|
||||||
|
@ -86,26 +92,29 @@ export default {
|
||||||
rows: null,
|
rows: null,
|
||||||
services: null,
|
services: null,
|
||||||
packages: null
|
packages: null
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
async mounted() {
|
async mounted() {
|
||||||
const params = {
|
const params = {
|
||||||
ticket: parseInt(this.$route.params.id)
|
ticket: parseInt(this.$route.params.id)
|
||||||
}
|
};
|
||||||
this.ticket = await this.$jApi.getObject(
|
this.ticket = await this.$jApi.getObject(
|
||||||
'CALL myTicket_get(#ticket)',
|
'CALL myTicket_get(#ticket)',
|
||||||
params
|
params
|
||||||
)
|
);
|
||||||
this.rows = await this.$jApi.query('CALL myTicket_getRows(#ticket)', params)
|
this.rows = await this.$jApi.query(
|
||||||
|
'CALL myTicket_getRows(#ticket)',
|
||||||
|
params
|
||||||
|
);
|
||||||
this.services = await this.$jApi.query(
|
this.services = await this.$jApi.query(
|
||||||
'CALL myTicket_getServices(#ticket)',
|
'CALL myTicket_getServices(#ticket)',
|
||||||
params
|
params
|
||||||
)
|
);
|
||||||
this.packages = await this.$jApi.query(
|
this.packages = await this.$jApi.query(
|
||||||
'CALL myTicket_getPackages(#ticket)',
|
'CALL myTicket_getPackages(#ticket)',
|
||||||
params
|
params
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -113,12 +122,12 @@ export default {
|
||||||
currency,
|
currency,
|
||||||
|
|
||||||
discountSubtotal(line) {
|
discountSubtotal(line) {
|
||||||
return line.quantity * line.price
|
return line.quantity * line.price;
|
||||||
},
|
},
|
||||||
|
|
||||||
subtotal(line) {
|
subtotal(line) {
|
||||||
const discount = line.discount
|
const discount = line.discount;
|
||||||
return this.discountSubtotal(line) * ((100 - discount) / 100)
|
return this.discountSubtotal(line) * ((100 - discount) / 100);
|
||||||
},
|
},
|
||||||
|
|
||||||
onPrintClick() {
|
onPrintClick() {
|
||||||
|
@ -126,11 +135,11 @@ export default {
|
||||||
access_token: this.$user.token,
|
access_token: this.$user.token,
|
||||||
recipientId: this.$user.id,
|
recipientId: this.$user.id,
|
||||||
type: 'deliveryNote'
|
type: 'deliveryNote'
|
||||||
})
|
});
|
||||||
window.open(
|
window.open(
|
||||||
`/api/Tickets/${this.ticket.id}/delivery-note-pdf?${params.toString()}`
|
`/api/Tickets/${this.ticket.id}/delivery-note-pdf?${params.toString()}`
|
||||||
)
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
<div>
|
<div>
|
||||||
<div style="font-size: 30vh">404</div>
|
<div style="font-size: 30vh">404</div>
|
||||||
|
|
||||||
<div class="text-h2" style="opacity: 0.4">Oops. Nothing here...</div>
|
<div class="text-h2" style="opacity: 0.4">
|
||||||
|
Oops. Nothing here...
|
||||||
|
</div>
|
||||||
|
|
||||||
<QBtn
|
<QBtn
|
||||||
class="q-mt-xl"
|
class="q-mt-xl"
|
||||||
|
@ -21,9 +23,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { defineComponent } from 'vue'
|
import { defineComponent } from 'vue';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'ErrorNotFound'
|
name: 'ErrorNotFound'
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -9,9 +9,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { defineComponent } from 'vue'
|
import { defineComponent } from 'vue';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'IndexPage'
|
name: 'IndexPage'
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -60,11 +60,17 @@
|
||||||
<div class="footer text-center">
|
<div class="footer text-center">
|
||||||
<p>
|
<p>
|
||||||
{{ $t('notACustomerYet') }}
|
{{ $t('notACustomerYet') }}
|
||||||
<a href="//verdnatura.es/register/" target="_blank" class="link">
|
<a
|
||||||
|
href="//verdnatura.es/register/"
|
||||||
|
target="_blank"
|
||||||
|
class="link"
|
||||||
|
>
|
||||||
{{ $t('signUp') }}
|
{{ $t('signUp') }}
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
<p class="contact">{{ $t('loginPhone') }} · {{ $t('loginMail') }}</p>
|
<p class="contact">
|
||||||
|
{{ $t('loginPhone') }} · {{ $t('loginMail') }}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -116,7 +122,7 @@ a {
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { userStore } from 'stores/user'
|
import { userStore } from 'stores/user';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'VnLogin',
|
name: 'VnLogin',
|
||||||
|
@ -128,7 +134,7 @@ export default {
|
||||||
password: '',
|
password: '',
|
||||||
remember: false,
|
remember: false,
|
||||||
showPwd: true
|
showPwd: true
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
|
@ -136,21 +142,21 @@ export default {
|
||||||
this.$q.notify({
|
this.$q.notify({
|
||||||
message: this.$t('emailConfirmedSuccessfully'),
|
message: this.$t('emailConfirmedSuccessfully'),
|
||||||
type: 'positive'
|
type: 'positive'
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
if (this.$route.params.email) {
|
if (this.$route.params.email) {
|
||||||
this.email = this.$route.params.email
|
this.email = this.$route.params.email;
|
||||||
this.$refs.password.focus()
|
this.$refs.password.focus();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
async onLogin() {
|
async onLogin() {
|
||||||
await this.user.login(this.email, this.password, this.remember)
|
await this.user.login(this.email, this.password, this.remember);
|
||||||
this.$router.push('/')
|
this.$router.push('/');
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<i18n lang="yaml">
|
<i18n lang="yaml">
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<QInput
|
<QInput
|
||||||
v-model="email"
|
v-model="email"
|
||||||
:label="$t('user')"
|
:label="$t('user')"
|
||||||
:rules="[(val) => !!val || $t('inputEmail')]"
|
:rules="[val => !!val || $t('inputEmail')]"
|
||||||
autofocus
|
autofocus
|
||||||
/>
|
/>
|
||||||
<div class="q-mt-lg">
|
<div class="q-mt-lg">
|
||||||
|
@ -66,22 +66,22 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
email: ''
|
email: ''
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async onSend() {
|
async onSend() {
|
||||||
const params = {
|
const params = {
|
||||||
email: this.email
|
email: this.email
|
||||||
}
|
};
|
||||||
await this.$axios.post('Users/reset', params)
|
await this.$axios.post('Users/reset', params);
|
||||||
this.$q.notify({
|
this.$q.notify({
|
||||||
message: this.$t('weHaveSentEmailToRecover'),
|
message: this.$t('weHaveSentEmailToRecover'),
|
||||||
type: 'positive'
|
type: 'positive'
|
||||||
})
|
});
|
||||||
this.$router.push('/login')
|
this.$router.push('/login');
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<i18n lang="yaml">
|
<i18n lang="yaml">
|
||||||
|
|
|
@ -23,7 +23,9 @@
|
||||||
>
|
>
|
||||||
<template v-slot:append>
|
<template v-slot:append>
|
||||||
<QIcon
|
<QIcon
|
||||||
:name="showPwd ? 'visibility_off' : 'visibility'"
|
:name="
|
||||||
|
showPwd ? 'visibility_off' : 'visibility'
|
||||||
|
"
|
||||||
class="cursor-pointer"
|
class="cursor-pointer"
|
||||||
@click="showPwd = !showPwd"
|
@click="showPwd = !showPwd"
|
||||||
/>
|
/>
|
||||||
|
@ -33,13 +35,18 @@
|
||||||
v-model="repeatPassword"
|
v-model="repeatPassword"
|
||||||
:label="$t('repeatPassword')"
|
:label="$t('repeatPassword')"
|
||||||
:type="showRpPwd ? 'password' : 'text'"
|
:type="showRpPwd ? 'password' : 'text'"
|
||||||
:rules="[(value) => value == password || $t('repeatPasswordError')]"
|
:rules="[
|
||||||
|
value =>
|
||||||
|
value == password || $t('repeatPasswordError')
|
||||||
|
]"
|
||||||
hint=""
|
hint=""
|
||||||
filled
|
filled
|
||||||
>
|
>
|
||||||
<template v-slot:append>
|
<template v-slot:append>
|
||||||
<QIcon
|
<QIcon
|
||||||
:name="showRpPwd ? 'visibility_off' : 'visibility'"
|
:name="
|
||||||
|
showRpPwd ? 'visibility_off' : 'visibility'
|
||||||
|
"
|
||||||
class="cursor-pointer"
|
class="cursor-pointer"
|
||||||
@click="showRpPwd = !showRpPwd"
|
@click="showRpPwd = !showRpPwd"
|
||||||
/>
|
/>
|
||||||
|
@ -73,27 +80,27 @@ export default {
|
||||||
repeatPassword: '',
|
repeatPassword: '',
|
||||||
showPwd: true,
|
showPwd: true,
|
||||||
showRpPwd: true
|
showRpPwd: true
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async onRegister() {
|
async onRegister() {
|
||||||
const headers = {
|
const headers = {
|
||||||
Authorization: this.$route.query.access_token
|
Authorization: this.$route.query.access_token
|
||||||
}
|
};
|
||||||
await this.$axios.post(
|
await this.$axios.post(
|
||||||
'users/reset-password',
|
'users/reset-password',
|
||||||
{
|
{
|
||||||
newPassword: this.password
|
newPassword: this.password
|
||||||
},
|
},
|
||||||
{ headers }
|
{ headers }
|
||||||
)
|
);
|
||||||
|
|
||||||
this.$q.notify({
|
this.$q.notify({
|
||||||
message: this.$t('passwordResetSuccessfully'),
|
message: this.$t('passwordResetSuccessfully'),
|
||||||
type: 'positive'
|
type: 'positive'
|
||||||
})
|
});
|
||||||
this.$router.push('/login')
|
this.$router.push('/login');
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia';
|
||||||
import { api, jApi } from 'boot/axios'
|
import { api, jApi } from 'boot/axios';
|
||||||
|
|
||||||
export const userStore = defineStore('user', {
|
export const userStore = defineStore('user', {
|
||||||
state: () => {
|
state: () => {
|
||||||
const token =
|
const token =
|
||||||
sessionStorage.getItem('vnToken') || localStorage.getItem('vnToken')
|
sessionStorage.getItem('vnToken') ||
|
||||||
|
localStorage.getItem('vnToken');
|
||||||
|
|
||||||
return {
|
return {
|
||||||
token,
|
token,
|
||||||
|
@ -12,50 +13,50 @@ export const userStore = defineStore('user', {
|
||||||
name: null,
|
name: null,
|
||||||
nickname: null,
|
nickname: null,
|
||||||
isGuest: false
|
isGuest: false
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
getters: {
|
getters: {
|
||||||
loggedIn: (state) => state.token != null
|
loggedIn: state => state.token != null
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
async login(user, password, remember) {
|
async login(user, password, remember) {
|
||||||
const params = { user, password }
|
const params = { user, password };
|
||||||
const res = await api.post('Accounts/login', params)
|
const res = await api.post('Accounts/login', params);
|
||||||
|
|
||||||
if (remember) {
|
if (remember) {
|
||||||
localStorage.setItem('vnToken', res.data.token)
|
localStorage.setItem('vnToken', res.data.token);
|
||||||
} else {
|
} else {
|
||||||
sessionStorage.setItem('vnToken', res.data.token)
|
sessionStorage.setItem('vnToken', res.data.token);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$patch({
|
this.$patch({
|
||||||
token: res.data.token,
|
token: res.data.token,
|
||||||
name: user
|
name: user
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
async logout() {
|
async logout() {
|
||||||
if (this.token != null) {
|
if (this.token != null) {
|
||||||
try {
|
try {
|
||||||
await api.post('Accounts/logout')
|
await api.post('Accounts/logout');
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
localStorage.removeItem('vnToken')
|
localStorage.removeItem('vnToken');
|
||||||
sessionStorage.removeItem('vnToken')
|
sessionStorage.removeItem('vnToken');
|
||||||
}
|
}
|
||||||
this.$reset()
|
this.$reset();
|
||||||
},
|
},
|
||||||
|
|
||||||
async loadData() {
|
async loadData() {
|
||||||
const userData = await jApi.getObject(
|
const userData = await jApi.getObject(
|
||||||
'SELECT id, nickname FROM account.myUser'
|
'SELECT id, nickname FROM account.myUser'
|
||||||
)
|
);
|
||||||
|
|
||||||
this.$patch({
|
this.$patch({
|
||||||
id: userData.id,
|
id: userData.id,
|
||||||
nickname: userData.nickname
|
nickname: userData.nickname
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
Loading…
Reference in New Issue