Add dynamic service (#160)
Co-authored-by: Germey <germey@acedata.cloud>
This commit is contained in:
1 parent
0bf5981139
commit
aaf4452932
2 files changed
+34
-1
No files matched your search
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"type": "patch",
|
||||||
|
"comment": "add dynamic services",
|
||||||
|
"packageName": "@acedatacloud/nexior",
|
||||||
|
"email": "germey@acedata.cloud",
|
||||||
|
"dependentChangeType": "patch"
|
||||||
|
}
|
||||||
@@ -103,6 +103,7 @@ import { SUNO_SERVICE_ID } from '@/constants/suno';
|
|||||||
import { QRART_SERVICE_ID } from '@/constants/qrart';
|
import { QRART_SERVICE_ID } from '@/constants/qrart';
|
||||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||||
import { ROUTE_CONSOLE_APPLICATION_EXTRA, ROUTE_CONSOLE_ORDER_DETAIL } from '@/router';
|
import { ROUTE_CONSOLE_APPLICATION_EXTRA, ROUTE_CONSOLE_ORDER_DETAIL } from '@/router';
|
||||||
|
import { HEADSHOTS_SERVICE_ID, LUMA_SERVICE_ID } from '@/constants';
|
||||||
|
|
||||||
interface ISubscription {
|
interface ISubscription {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -147,6 +148,9 @@ export default defineComponent({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
site() {
|
||||||
|
return this.$store.getters.site;
|
||||||
|
},
|
||||||
applicationId() {
|
applicationId() {
|
||||||
return this.$route.params?.id?.toString();
|
return this.$route.params?.id?.toString();
|
||||||
},
|
},
|
||||||
@@ -173,7 +177,9 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
for (const item of items) {
|
for (const item of items) {
|
||||||
|
console.log('item', item);
|
||||||
const pkgs = this.getPackages(item.duration);
|
const pkgs = this.getPackages(item.duration);
|
||||||
|
console.log('pkgs', pkgs);
|
||||||
if (pkgs) {
|
if (pkgs) {
|
||||||
item.price = pkgs.reduce((acc, pkg) => acc + pkg.price, 0);
|
item.price = pkgs.reduce((acc, pkg) => acc + pkg.price, 0);
|
||||||
}
|
}
|
||||||
@@ -192,7 +198,26 @@ export default defineComponent({
|
|||||||
return items;
|
return items;
|
||||||
},
|
},
|
||||||
serviceIds(): string[] {
|
serviceIds(): string[] {
|
||||||
return [CHAT_SERVICE_ID, MIDJOURNEY_SERVICE_ID, SUNO_SERVICE_ID, QRART_SERVICE_ID];
|
let result = [];
|
||||||
|
const features = this.$store.getters.site.features;
|
||||||
|
console.log('features', features);
|
||||||
|
const keys = Object.keys(features) || [];
|
||||||
|
for (const key of keys) {
|
||||||
|
if (features[key] && features[key].enabled && features[key].service_id) {
|
||||||
|
result.push(features[key].service_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (result.length > 0) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
CHAT_SERVICE_ID,
|
||||||
|
MIDJOURNEY_SERVICE_ID,
|
||||||
|
SUNO_SERVICE_ID,
|
||||||
|
QRART_SERVICE_ID,
|
||||||
|
LUMA_SERVICE_ID,
|
||||||
|
HEADSHOTS_SERVICE_ID
|
||||||
|
];
|
||||||
},
|
},
|
||||||
applicationIds(): string[] {
|
applicationIds(): string[] {
|
||||||
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
||||||
@@ -263,6 +288,7 @@ export default defineComponent({
|
|||||||
id: this.serviceIds
|
id: this.serviceIds
|
||||||
});
|
});
|
||||||
this.services = data.items;
|
this.services = data.items;
|
||||||
|
console.log('services', this.services);
|
||||||
},
|
},
|
||||||
async onFetchApplications() {
|
async onFetchApplications() {
|
||||||
const { data } = await applicationOperator.getAll({
|
const { data } = await applicationOperator.getAll({
|
||||||
|
|||||||
Reference in new issue
Block a user