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