Skip to content

Commit

Permalink
Add dynamic service (#160)
Browse files Browse the repository at this point in the history
Co-authored-by: Germey <[email protected]>
  • Loading branch information
Germey and Germey authored Dec 28, 2024
1 parent 0bf5981 commit aaf4452
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "add dynamic services",
"packageName": "@acedatacloud/nexior",
"email": "[email protected]",
"dependentChangeType": "patch"
}
28 changes: 27 additions & 1 deletion src/pages/console/subscription/Buy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ import { SUNO_SERVICE_ID } from '@/constants/suno';
import { QRART_SERVICE_ID } from '@/constants/qrart';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
import { ROUTE_CONSOLE_APPLICATION_EXTRA, ROUTE_CONSOLE_ORDER_DETAIL } from '@/router';
import { HEADSHOTS_SERVICE_ID, LUMA_SERVICE_ID } from '@/constants';
interface ISubscription {
name: string;
Expand Down Expand Up @@ -147,6 +148,9 @@ export default defineComponent({
};
},
computed: {
site() {
return this.$store.getters.site;
},
applicationId() {
return this.$route.params?.id?.toString();
},
Expand All @@ -173,7 +177,9 @@ export default defineComponent({
}
];
for (const item of items) {
console.log('item', item);
const pkgs = this.getPackages(item.duration);
console.log('pkgs', pkgs);
if (pkgs) {
item.price = pkgs.reduce((acc, pkg) => acc + pkg.price, 0);
}
Expand All @@ -192,7 +198,26 @@ export default defineComponent({
return items;
},
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[] {
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
Expand Down Expand Up @@ -263,6 +288,7 @@ export default defineComponent({
id: this.serviceIds
});
this.services = data.items;
console.log('services', this.services);
},
async onFetchApplications() {
const { data } = await applicationOperator.getAll({
Expand Down

0 comments on commit aaf4452

Please sign in to comment.