add refresh application

This commit is contained in:
AceDataCloud committed 2023-01-23 14:21:12 +08:00
1 parent a5514e8e3e
commit 7c07d453e8
8 files changed
+63 -24

No files matched your search

+4
View File
@@ -43,3 +43,7 @@ body {
}
}
}
.color-primary {
color: var(--el-color-primary);
}
+44 -16
View File
@@ -13,26 +13,48 @@
</div>
<div class="right">
<div v-if="itemKey === 'api_key'">
<el-popover v-if="!isApplied" placement="bottom" :width="200" trigger="focus">
<p>{{ $t('application.message.notApplied') }}</p>
<el-button
size="small"
type="primary"
@click="
$router.push({
<el-popover v-if="!isApplied" placement="bottom" :width="200" trigger="click">
<p class="text-center mb-2">
<small>{{ $t('application.message.notApplied') }}</small>
</p>
<p class="text-center">
<router-link
:to="{
name: 'service-detail',
params: {
id: service?.id
}
})
"
>{{ $t('common.button.apply') }}</el-button
>
}"
class="inline-block"
target="_blank"
>
<el-button size="small" type="primary">{{ $t('common.button.apply') }}</el-button>
</router-link>
<el-button v-if="false" size="small" class="inline-block ml-2" @click="onRefreshApplications()">{{
$t('common.button.refresh')
}}</el-button>
</p>
<template #reference>
<el-input v-model="value[itemKey?.toString()]" />
<div>
<el-input
v-model="value[itemKey?.toString()]"
:placeholder="$t('common.title.placeholderOfSelect')"
class="inline-block w-4/5"
/>
<font-awesome-icon
icon="fa-solid fa-rotate-right"
class="inline-block text-sm cursor-pointer ml-1 color-primary"
@click="$emit('refresh-applications')"
/>
</div>
</template>
</el-popover>
<el-select v-else v-model="value[itemKey?.toString()]" clearable :placeholder="$t('common.title.select')">
<el-select
v-else
v-model="value[itemKey?.toString()]"
clearable
:placeholder="$t('common.title.placeholderOfSelect')"
>
<el-option :label="appliedApplication?.api_key" :value="appliedApplication?.api_key" class="select-option">
<span class="select-option-main">{{ appliedApplication?.api_key }}</span>
<span class="select-option-description">{{ $t('application.message.yourApplication') }}</span>
@@ -44,7 +66,7 @@
v-if="item?.enum"
v-model="value[itemKey?.toString()]"
clearable
:placeholder="$t('common.title.select')"
:placeholder="$t('common.title.placeholderOfSelect')"
>
<el-option v-for="e in item?.enum" :key="e" :label="e" :value="e" />
</el-select>
@@ -60,7 +82,7 @@ import { defineComponent } from 'vue';
import { ISchema } from '@/operators/api/models';
import { IService } from '@/operators/service/models';
import { applicationOperator, IApplication, IApplicationListResponse } from '@/operators';
import application from '@/i18n/zh/application';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
interface IData {
value: {
@@ -70,6 +92,9 @@ interface IData {
export default defineComponent({
name: 'ApiForm',
components: {
FontAwesomeIcon
},
props: {
schema: {
type: Object as () => ISchema | undefined,
@@ -84,7 +109,7 @@ export default defineComponent({
required: true
}
},
emits: ['update:form'],
emits: ['update:form', 'refresh-applications'],
data(): IData {
return {
value: {}
@@ -114,6 +139,9 @@ export default defineComponent({
onChange(key: string, val: string) {
console.log('key', key, val);
this.value[key] = val;
},
onRefreshApplications() {
this.$emit('refresh-applications');
}
}
});
+3 -1
View File
@@ -1,7 +1,9 @@
<template>
<div class="wrapper">
<div class="operation">
<el-button class="btn-try" type="primary" @click="onTry">{{ $t('common.button.try') }}</el-button>
<el-button class="btn-try" type="primary" :loading="loading" @click="onTry">{{
$t('common.button.try')
}}</el-button>
</div>
<div v-if="responseData" class="result">
<div class="title">{{ $t('api.entity.response') }}</div>
+2
View File
@@ -23,6 +23,7 @@
:schema="api?.request?.queries"
:service="api?.service"
:applications="applications"
@refresh-applications="getApplications"
/>
</div>
<div class="headers">
@@ -58,6 +59,7 @@ import ApiResult from './Result.vue';
import urlJoin from 'url-join';
import { applicationOperator } from '@/operators/application/operator';
import { IApplication, IApplicationListResponse } from '@/operators/application/models';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
export interface IData {
formValue: IForm;
+5 -4
View File
@@ -90,10 +90,11 @@ export default defineComponent({
};
},
mounted() {
serviceOperator.get(this.application.service_id).then(({ data: data }: { data: IServiceDetailResponse }) => {
this.service = data;
this.loading = false;
});
if (this.application?.service_id)
serviceOperator.get(this.application.service_id).then(({ data: data }: { data: IServiceDetailResponse }) => {
this.service = data;
this.loading = false;
});
},
methods: {}
});
+3 -1
View File
@@ -17,5 +17,7 @@ export default {
learn: '学习',
buy: '购买',
try: '测试',
startForFree: '免费体验'
startForFree: '免费体验',
apply: '申请',
refresh: '刷新'
};
+1 -1
View File
@@ -1,5 +1,5 @@
export default {
orderDescription: '知数云课程订单',
documentIntroduction: '文档介绍',
select: '请选择'
placeholderOfSelect: '请选择'
};
+1 -1
View File
@@ -4,8 +4,8 @@ import router from './router/index';
import store from './store/index';
import ElementPlus from 'element-plus';
import i18n from './i18n/index';
import './assets/css/tailwind.css';
import './assets/scss/style.scss';
import './assets/css/tailwind.css';
import dayjs from './plugins/dayjs';
import './plugins/font-awesome';