Fix mj hover price (#263)
This commit is contained in:
1 parent
196ee79fcc
commit
3d32b84e9f
2 files changed
+19
-1
No files matched your search
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"type": "patch",
|
||||||
|
"comment": "fix mj hover",
|
||||||
|
"packageName": "@acedatacloud/nexior",
|
||||||
|
"email": "1348977728@qq.com",
|
||||||
|
"dependentChangeType": "patch"
|
||||||
|
}
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
:key="actionKey"
|
:key="actionKey"
|
||||||
class="box-item"
|
class="box-item"
|
||||||
effect="dark"
|
effect="dark"
|
||||||
:content="descriptionMapping[action]"
|
:content="getActionDescriptionWithPrice(action, modelValue?.request?.mode)"
|
||||||
placement="top-start"
|
placement="top-start"
|
||||||
>
|
>
|
||||||
<el-button
|
<el-button
|
||||||
@@ -322,6 +322,7 @@ import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
|||||||
import CopyToClipboard from '@/components/common/CopyToClipboard.vue';
|
import CopyToClipboard from '@/components/common/CopyToClipboard.vue';
|
||||||
import ImageWrapper from '@/components/common/ImageWrapper.vue';
|
import ImageWrapper from '@/components/common/ImageWrapper.vue';
|
||||||
import VideoPlayer from '@/components/common/VideoPlayer.vue';
|
import VideoPlayer from '@/components/common/VideoPlayer.vue';
|
||||||
|
import { getConsumption } from '@/utils';
|
||||||
interface IData {
|
interface IData {
|
||||||
midjourneyImagineState: typeof MidjourneyImagineState;
|
midjourneyImagineState: typeof MidjourneyImagineState;
|
||||||
actionMapping: Record<MidjourneyImagineAction, string>;
|
actionMapping: Record<MidjourneyImagineAction, string>;
|
||||||
@@ -421,9 +422,19 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
config() {
|
config() {
|
||||||
return this.$store.state.midjourney?.config;
|
return this.$store.state.midjourney?.config;
|
||||||
|
},
|
||||||
|
service() {
|
||||||
|
return this.$store.state.midjourney?.service;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getActionDescriptionWithPrice(action: string, mode?: string): string {
|
||||||
|
// @ts-ignore
|
||||||
|
const baseDescription = this.descriptionMapping[action];
|
||||||
|
const price = getConsumption({ ...this.config, action: action, mode: mode }, this.service?.metadata?.price);
|
||||||
|
const unit = this.$t(`service.unit.${this.service?.unit || 'credits'}`);
|
||||||
|
return `${baseDescription} (${price} ${unit})`;
|
||||||
|
},
|
||||||
onCustom(action: string) {
|
onCustom(action: string) {
|
||||||
if (this.modelValue?.type === 'imagine') {
|
if (this.modelValue?.type === 'imagine') {
|
||||||
this.$emit('custom', {
|
this.$emit('custom', {
|
||||||
|
|||||||
Reference in new issue
Block a user