Update application UX (#232)
This commit is contained in:
1 parent
26ad4cf011
commit
83a5746874
14 files changed
+155
-118
No files matched your search
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"type": "patch",
|
||||
"comment": "update wallet ux",
|
||||
"packageName": "@acedatacloud/nexior",
|
||||
"email": "cqc@cuiqingcai.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
||||
@@ -1,43 +1,59 @@
|
||||
<template>
|
||||
<el-descriptions :column="1" class="flex flex-col">
|
||||
<el-descriptions-item v-if="application.scope === 'Individual'" :label="$t('application.field.serviceName')">{{
|
||||
application.service?.title
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('application.field.id')">
|
||||
<span>{{ application.id }}</span>
|
||||
<copy-to-clipboard v-if="application.id" :content="application.id" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('application.field.type')">
|
||||
<el-tag v-if="application.type === 'Period'" effect="dark" round>
|
||||
{{ $t('application.type.period') }}
|
||||
</el-tag>
|
||||
<el-tag v-if="application.type === 'Usage'" effect="dark" round>
|
||||
{{ $t('application.type.usage') }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="application.type === 'Period'" :label="$t('application.field.expiredAt')">
|
||||
{{ $dayjs.format(application.expired_at) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('application.field.remainingAmount')">
|
||||
{{ application?.remaining_amount?.toFixed(6) }}
|
||||
{{ $t(`service.unit.` + (application?.service?.unit || 'credit') + 's') }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<div>
|
||||
<div class="flex flex-col">
|
||||
<el-icon class="check"><check /></el-icon>
|
||||
<div class="icon">
|
||||
<font-awesome-icon icon="fa-solid fa-wallet" />
|
||||
</div>
|
||||
<div class="text-left">
|
||||
<p class="description">
|
||||
<span v-if="!application.service">{{ $t('application.title.globalBalance') }}</span>
|
||||
<span v-else>{{ $t('application.title.applicationBalance', { service: application.service?.title }) }}</span>
|
||||
</p>
|
||||
<p class="value">
|
||||
{{ application?.remaining_amount?.toFixed(6) }}
|
||||
{{ $t(`service.unit.` + (application?.service?.unit || 'credit') + 's') }}
|
||||
</p>
|
||||
<p class="description2">
|
||||
<span v-if="application.type === 'Period'">
|
||||
{{ $t('application.field.expiredAt') }}: {{ $dayjs.format(application.expired_at) }}
|
||||
</span>
|
||||
<span v-else>
|
||||
{{ $t('application.message.neverExpire') }}
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col justify-center align-middle gap-2">
|
||||
<div class="flex">
|
||||
<el-button size="small" round @click="onGoUsage">
|
||||
{{ $t('application.button.usage') }}
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<el-button type="primary" round size="small" @click="onBuyMore">
|
||||
{{ $t('application.button.buyMore') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { IApplication } from '@/models';
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElTag, ElDescriptions, ElDescriptionsItem } from 'element-plus';
|
||||
import CopyToClipboard from '@/components/common/CopyToClipboard.vue';
|
||||
import { ElButton, ElIcon } from 'element-plus';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import { ROUTE_CONSOLE_APPLICATION_EXTRA, ROUTE_CONSOLE_USAGE_LIST } from '@/router';
|
||||
import { Check } from '@element-plus/icons-vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ApplicationInfo',
|
||||
components: {
|
||||
ElTag,
|
||||
CopyToClipboard,
|
||||
ElDescriptions,
|
||||
ElDescriptionsItem
|
||||
FontAwesomeIcon,
|
||||
ElButton,
|
||||
Check,
|
||||
ElIcon
|
||||
},
|
||||
props: {
|
||||
application: {
|
||||
@@ -52,19 +68,83 @@ export default defineComponent({
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onGoUsage() {
|
||||
this.$router.push({
|
||||
name: ROUTE_CONSOLE_USAGE_LIST,
|
||||
query: {
|
||||
application_id: this.application.id
|
||||
}
|
||||
});
|
||||
},
|
||||
onBuyMore() {
|
||||
// open in new tab for this url
|
||||
const url = this.$router.resolve({
|
||||
name: ROUTE_CONSOLE_APPLICATION_EXTRA,
|
||||
params: {
|
||||
id: this.application.id
|
||||
}
|
||||
}).href;
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.info {
|
||||
font-size: 13px;
|
||||
color: var(--el-text-color-primary);
|
||||
text-align: center;
|
||||
line-height: 28px;
|
||||
.item {
|
||||
cursor: pointer;
|
||||
padding: 20px;
|
||||
width: 400px;
|
||||
background-color: var(--el-bg-color);
|
||||
border-radius: 15px;
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
&.active {
|
||||
.check {
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
.subtitle {
|
||||
font-size: 12px;
|
||||
|
||||
.check {
|
||||
color: var(--el-color-white);
|
||||
font-size: 20px;
|
||||
background-color: var(--el-color-primary);
|
||||
border-radius: 50%;
|
||||
padding: 5px;
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.icon {
|
||||
height: 40px;
|
||||
width: 40px;
|
||||
line-height: 40px;
|
||||
border-radius: 50%;
|
||||
background-color: var(--el-bg-color-page);
|
||||
text-align: center;
|
||||
margin-bottom: 10px;
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
|
||||
.value {
|
||||
font-weight: 600;
|
||||
font-size: 30px;
|
||||
}
|
||||
.description {
|
||||
color: var(--el-text-color-regular);
|
||||
font-size: 14px;
|
||||
}
|
||||
.description2 {
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,34 +1,22 @@
|
||||
<template>
|
||||
<div class="status">
|
||||
<el-dialog v-model="showInfo" width="600px">
|
||||
<el-dialog v-model="showInfo">
|
||||
<div v-if="application">
|
||||
<p class="text-left mb-4">
|
||||
<p class="text-center mb-4">
|
||||
{{ $t('application.message.applicationSelection') }}
|
||||
</p>
|
||||
<div class="applications flex flex-col gap-2 mb-6">
|
||||
<div
|
||||
<div class="flex flex-col gap-4 mb-6 justify-center items-center overflow-y-auto">
|
||||
<application-info
|
||||
v-for="(app, index) in applications"
|
||||
:key="index"
|
||||
:class="{
|
||||
item: true,
|
||||
active: application?.id === app.id
|
||||
}"
|
||||
:application="app"
|
||||
@click="onSelectApplication(app)"
|
||||
>
|
||||
<el-icon class="icon"><check /></el-icon>
|
||||
<application-info :application="app" :show-type="true" :show-id="true" />
|
||||
<el-button round type="primary" @click.stop="onBuyMore(application)">{{
|
||||
$t('common.button.buyMore')
|
||||
}}</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<span class="actions">
|
||||
<api-price
|
||||
v-if="showPrice && application?.service?.apis?.[0]?.price"
|
||||
class="price inline-block"
|
||||
:price="application?.service?.apis?.[0]?.price"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<el-button circle @click="showInfo = true">
|
||||
@@ -39,11 +27,9 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElButton, ElIcon, ElDialog, ElTooltip } from 'element-plus';
|
||||
import { ElButton, ElDialog } from 'element-plus';
|
||||
import { IApplicationType, IApplication, IService } from '@/models';
|
||||
import { ROUTE_CONSOLE_APPLICATION_EXTRA, ROUTE_CONSOLE_APPLICATION_SUBSCRIBE } from '@/router';
|
||||
import ApiPrice from '@/components/api/Price.vue';
|
||||
import { Check } from '@element-plus/icons-vue';
|
||||
import ApplicationInfo from './Info.vue';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
|
||||
@@ -56,12 +42,9 @@ export default defineComponent({
|
||||
name: 'ApplicationStatus',
|
||||
components: {
|
||||
ElButton,
|
||||
Check,
|
||||
ElDialog,
|
||||
FontAwesomeIcon,
|
||||
ApplicationInfo,
|
||||
ApiPrice,
|
||||
ElIcon
|
||||
ApplicationInfo
|
||||
},
|
||||
props: {
|
||||
application: {
|
||||
@@ -113,49 +96,3 @@ export default defineComponent({
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.applications {
|
||||
.item {
|
||||
cursor: pointer;
|
||||
padding: 20px;
|
||||
background-color: var(--el-bg-color);
|
||||
border-radius: 15px;
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
.icon {
|
||||
visibility: hidden;
|
||||
}
|
||||
&.active {
|
||||
.icon {
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 30px;
|
||||
.icon {
|
||||
color: var(--el-color-white);
|
||||
font-size: 20px;
|
||||
background-color: var(--el-color-primary);
|
||||
border-radius: 50%;
|
||||
padding: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.actions {
|
||||
margin: 0 5px;
|
||||
display: inline-block;
|
||||
@media (max-width: 767px) {
|
||||
display: block;
|
||||
margin: 5px auto 0 auto;
|
||||
width: fit-content;
|
||||
}
|
||||
.el-button {
|
||||
border-radius: 20px;
|
||||
}
|
||||
}
|
||||
.btn-apply {
|
||||
border-radius: 20px;
|
||||
}
|
||||
</style>
|
||||
@@ -105,7 +105,7 @@ export default defineComponent({
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
$width: 300px;
|
||||
$width: 200px;
|
||||
$padding-left: 10px;
|
||||
.side-panel {
|
||||
padding-left: $padding-left;
|
||||
|
||||
@@ -123,6 +123,7 @@
|
||||
"message": "价格",
|
||||
"description": "用户应支付的申请的额外价格。"
|
||||
},
|
||||
|
||||
"message.alreadyApplied": {
|
||||
"message": "您已经申请了此服务,请查看控制台",
|
||||
"description": "当用户已经申请了此服务时向用户显示的消息。"
|
||||
@@ -211,6 +212,10 @@
|
||||
"message": "修改成功",
|
||||
"description": "当修改成功时向用户显示的消息。"
|
||||
},
|
||||
"message.neverExpire": {
|
||||
"message": "永不过期",
|
||||
"description": "当申请永不过期时向用户显示的消息。"
|
||||
},
|
||||
"title.buyService": {
|
||||
"message": "购买服务",
|
||||
"description": "当用户想要购买服务时页面的标题。"
|
||||
@@ -226,5 +231,13 @@
|
||||
"title.manageApplication": {
|
||||
"message": "申请管理",
|
||||
"description": "当用户想要管理申请时页面的标题。"
|
||||
},
|
||||
"title.applicationBalance": {
|
||||
"message": "专属积分 - {service}",
|
||||
"description": "当用户查看申请余额时向用户显示的消息。"
|
||||
},
|
||||
"title.globalBalance": {
|
||||
"message": "通用余额",
|
||||
"description": "当用户查看通用余额时向用户显示的消息。"
|
||||
}
|
||||
}
|
||||
@@ -302,7 +302,7 @@ export default defineComponent({
|
||||
|
||||
.panel {
|
||||
padding: 30px;
|
||||
width: calc(100% - 300px);
|
||||
width: calc(100% - 200px);
|
||||
background-color: var(--el-bg-color-page);
|
||||
|
||||
.el-card {
|
||||
|
||||
@@ -229,7 +229,7 @@ export default defineComponent({
|
||||
<style lang="scss" scoped>
|
||||
.panel {
|
||||
padding: 30px;
|
||||
width: calc(100% - 300px);
|
||||
width: calc(100% - 200px);
|
||||
background-color: var(--el-bg-color-page);
|
||||
|
||||
.title {
|
||||
|
||||
@@ -306,7 +306,7 @@ export default defineComponent({
|
||||
.panel {
|
||||
padding: 30px;
|
||||
overflow: scroll;
|
||||
width: calc(100% - 300px);
|
||||
width: calc(100% - 200px);
|
||||
background-color: var(--el-bg-color-page);
|
||||
|
||||
.card {
|
||||
|
||||
@@ -267,7 +267,7 @@ export default defineComponent({
|
||||
|
||||
.panel {
|
||||
padding: 30px;
|
||||
width: calc(100% - 300px);
|
||||
width: calc(100% - 200px);
|
||||
background-color: var(--el-bg-color-page);
|
||||
.el-card {
|
||||
min-height: 500px;
|
||||
|
||||
@@ -201,7 +201,7 @@ export default defineComponent({
|
||||
<style lang="scss" scoped>
|
||||
.panel {
|
||||
padding: 30px;
|
||||
width: calc(100% - 300px);
|
||||
width: calc(100% - 200px);
|
||||
background-color: var(--el-bg-color-page);
|
||||
|
||||
.title {
|
||||
|
||||
@@ -279,7 +279,7 @@ export default defineComponent({
|
||||
<style lang="scss" scoped>
|
||||
.panel {
|
||||
padding: 30px;
|
||||
width: calc(100% - 300px);
|
||||
width: calc(100% - 200px);
|
||||
background-color: var(--el-bg-color-page);
|
||||
|
||||
.title {
|
||||
|
||||
@@ -166,7 +166,7 @@ export default defineComponent({
|
||||
|
||||
.panel {
|
||||
padding: 30px;
|
||||
width: calc(100% - 300px);
|
||||
width: calc(100% - 200px);
|
||||
background-color: var(--el-bg-color-page);
|
||||
height: 100%;
|
||||
overflow-y: scroll;
|
||||
|
||||
@@ -428,7 +428,7 @@ export default defineComponent({
|
||||
|
||||
.panel {
|
||||
padding: 30px;
|
||||
width: calc(100% - 300px);
|
||||
width: calc(100% - 200px);
|
||||
background-color: var(--el-bg-color-page);
|
||||
height: 100%;
|
||||
overflow-y: scroll;
|
||||
|
||||
@@ -148,7 +148,7 @@ export default defineComponent({
|
||||
|
||||
.panel {
|
||||
padding: 30px;
|
||||
width: calc(100% - 300px);
|
||||
width: calc(100% - 200px);
|
||||
background-color: var(--el-bg-color-page);
|
||||
height: 100%;
|
||||
overflow-y: scroll;
|
||||
|
||||
Reference in new issue
Block a user