[pricelist][fix] cordova loading pictures

This commit is contained in:
Tim Gröger 2021-04-16 16:50:58 +02:00
parent 52ae8fce29
commit c76da59290
4 changed files with 24 additions and 10 deletions

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<widget id="de.wu5.flaschengeist" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <widget id="de.wu5.flaschengeist" version="2.0.0-alpha.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Flaschengeist</name> <name>Flaschengeist</name>
<description>Dynamischen Managementsystem für Studentenclubs</description> <description>Modular student club administration system</description>
<author email="dev@cordova.apache.org" href="http://cordova.io"> <author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team Apache Cordova Team
</author> </author>

View File

@ -1,8 +1,9 @@
/* eslint-disable */
// THIS FEATURE-FLAG FILE IS AUTOGENERATED, // THIS FEATURE-FLAG FILE IS AUTOGENERATED,
// REMOVAL OR CHANGES WILL CAUSE RELATED TYPES TO STOP WORKING // REMOVAL OR CHANGES WILL CAUSE RELATED TYPES TO STOP WORKING
import 'quasar/dist/types/feature-flag'; import "quasar/dist/types/feature-flag";
declare module 'quasar/dist/types/feature-flag' { declare module "quasar/dist/types/feature-flag" {
interface QuasarFeatureFlags { interface QuasarFeatureFlags {
cordova: true; cordova: true;
} }

View File

@ -35,9 +35,7 @@
<q-card> <q-card>
<q-img <q-img
style="max-height: 256px" style="max-height: 256px"
:src=" :src="image(props.row.uuid)"
props.row.uuid ? `/api/pricelist/picture/${props.row.uuid}?size=400` : 'no-image.svg'
"
> >
<div <div
v-if="!public && !nodetails && editable" v-if="!public && !nodetails && editable"
@ -158,6 +156,7 @@ import { sort } from '../utils/sort';
import { DeleteObjects } from 'src/plugins/pricelist/utils/utils'; import { DeleteObjects } from 'src/plugins/pricelist/utils/utils';
import { hasPermission } from 'src/utils/permission'; import { hasPermission } from 'src/utils/permission';
import { PERMISSIONS } from 'src/plugins/pricelist/permissions'; import { PERMISSIONS } from 'src/plugins/pricelist/permissions';
import config from 'src/config';
export default defineComponent({ export default defineComponent({
name: 'CalculationTable', name: 'CalculationTable',
@ -476,6 +475,13 @@ export default defineComponent({
return false; return false;
} }
function image(uuid: string | undefined) {
if (uuid) {
return `${config.baseURL}/pricelist/picture/${uuid}?size=256`;
}
return 'no-image.svg';
}
return { return {
drinks: computed(() => store.drinks), drinks: computed(() => store.drinks),
pagination, pagination,
@ -502,6 +508,7 @@ export default defineComponent({
newDrink, newDrink,
hasPermission, hasPermission,
PERMISSIONS, PERMISSIONS,
image
}; };
}, },
}); });

View File

@ -18,9 +18,7 @@
<q-img <q-img
style="max-height: 256px" style="max-height: 256px"
loading="lazy" loading="lazy"
:src=" :src="image(props.row.uuid)"
props.row.uuid ? `/api/pricelist/picture/${props.row.uuid}?size=256` : 'no-image.svg'
"
placeholder-src="no-image.svg" placeholder-src="no-image.svg"
> >
<div class="absolute-bottom-right justify-end"> <div class="absolute-bottom-right justify-end">
@ -62,6 +60,7 @@ import BuildManualVolume from '../components/BuildManual/BuildManualVolume.vue';
import SearchInput from '../components/SearchInput.vue'; import SearchInput from '../components/SearchInput.vue';
import { filter, Search } from '../utils/filter'; import { filter, Search } from '../utils/filter';
import { sort } from '../utils/sort'; import { sort } from '../utils/sort';
import config from 'src/config';
export default defineComponent({ export default defineComponent({
name: 'Reciepts', name: 'Reciepts',
components: { BuildManual, BuildManualVolume, SearchInput }, components: { BuildManual, BuildManualVolume, SearchInput },
@ -155,12 +154,19 @@ export default defineComponent({
const search = ref<Search>({ value: '', key: '', label: '' }); const search = ref<Search>({ value: '', key: '', label: '' });
const search_keys = computed(() => columns_drinks.filter((column) => column.filterable)); const search_keys = computed(() => columns_drinks.filter((column) => column.filterable));
function image(uuid: string | undefined) {
if (uuid) {
return `${config.baseURL}/pricelist/picture/${uuid}?size=256`;
}
return 'no-image.svg';
}
return { return {
drinks, drinks,
options: [...columns_drinks, ...columns_volumes, ...columns_prices], options: [...columns_drinks, ...columns_volumes, ...columns_prices],
search, search,
filter, filter,
search_keys, search_keys,
image,
}; };
}, },
}); });