optimize size
This commit is contained in:
1 parent
277ef9a325
commit
5f20de55e7
36 files changed
+386
-104
No files matched your search
@@ -35,6 +35,7 @@ import phpTemplate from '@/assets/templates/php.tpl';
|
||||
import javaTemplate from '@/assets/templates/java.tpl';
|
||||
import CodeSnippet from '../common/CodeSnippet.vue';
|
||||
import queryString from 'query-string';
|
||||
import { ElImage } from 'element-plus';
|
||||
|
||||
interface IOption {
|
||||
name: ILang;
|
||||
@@ -69,7 +70,8 @@ interface IRenderData {
|
||||
export default defineComponent({
|
||||
name: 'ApiCode',
|
||||
components: {
|
||||
CodeSnippet
|
||||
CodeSnippet,
|
||||
ElImage
|
||||
},
|
||||
props: {
|
||||
api: {
|
||||
|
||||
@@ -58,7 +58,12 @@
|
||||
:allow-create="true"
|
||||
:placeholder="$t('common.title.placeholderOfSelect')"
|
||||
>
|
||||
<el-option :label="appliedApplication?.api_key" :value="appliedApplication?.api_key" class="select-option">
|
||||
<el-option
|
||||
v-if="appliedApplication?.api_key"
|
||||
: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>
|
||||
</el-option>
|
||||
@@ -86,6 +91,7 @@ import { ISchema } from '@/operators/api/models';
|
||||
import { IService } from '@/operators/service/models';
|
||||
import { IApplication } from '@/operators';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import { ElPopover, ElInput, ElSelect, ElButton, ElTooltip, ElOption } from 'element-plus';
|
||||
|
||||
interface IData {
|
||||
value: {
|
||||
@@ -96,7 +102,13 @@ interface IData {
|
||||
export default defineComponent({
|
||||
name: 'ApiForm',
|
||||
components: {
|
||||
FontAwesomeIcon
|
||||
FontAwesomeIcon,
|
||||
ElPopover,
|
||||
ElInput,
|
||||
ElSelect,
|
||||
ElButton,
|
||||
ElTooltip,
|
||||
ElOption
|
||||
},
|
||||
props: {
|
||||
schema: {
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
import { defineComponent } from 'vue';
|
||||
import { IResponse } from '@/operators/api/models';
|
||||
import CodeSnippet from '../common/CodeSnippet.vue';
|
||||
import { ElCollapse, ElCollapseItem, ElTag } from 'element-plus';
|
||||
|
||||
interface IData {
|
||||
value: {
|
||||
@@ -63,7 +64,10 @@ interface IData {
|
||||
export default defineComponent({
|
||||
name: 'ApiResult',
|
||||
components: {
|
||||
CodeSnippet
|
||||
CodeSnippet,
|
||||
ElCollapse,
|
||||
ElCollapseItem,
|
||||
ElTag
|
||||
},
|
||||
props: {
|
||||
responses: {
|
||||
|
||||
@@ -21,11 +21,14 @@ import { defineComponent } from 'vue';
|
||||
import axios, { Method } from 'axios';
|
||||
import urlJoin from 'url-join';
|
||||
import CodeSnippet from '../common/CodeSnippet.vue';
|
||||
import { ElButton, ElSkeleton } from 'element-plus';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ApiTry',
|
||||
components: {
|
||||
CodeSnippet
|
||||
CodeSnippet,
|
||||
ElButton,
|
||||
ElSkeleton
|
||||
},
|
||||
props: {
|
||||
api: {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
{{ api?.title }}
|
||||
</div>
|
||||
<div class="url">
|
||||
<el-tag class="method" size="mini" type="primary" effect="dark">{{ api?.request?.method }}</el-tag>
|
||||
<el-tag class="method" effect="dark">{{ api?.request?.method }}</el-tag>
|
||||
<span v-if="api?.endpoint && api?.path" class="endpoint">{{ urlJoin(api?.endpoint, api?.path) }}</span>
|
||||
</div>
|
||||
<div class="introduction">
|
||||
@@ -59,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 { ElSkeleton, ElDivider, ElTag } from 'element-plus';
|
||||
|
||||
export interface IData {
|
||||
formValue: IForm;
|
||||
@@ -69,7 +70,10 @@ export default defineComponent({
|
||||
name: 'ApiUsage',
|
||||
components: {
|
||||
ApiForm,
|
||||
ApiResult
|
||||
ApiResult,
|
||||
ElSkeleton,
|
||||
ElDivider,
|
||||
ElTag
|
||||
},
|
||||
props: {
|
||||
api: {
|
||||
|
||||
@@ -22,9 +22,15 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElContainer, ElRow, ElCol } from 'element-plus';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'BottomFooter',
|
||||
components: {
|
||||
ElContainer,
|
||||
ElRow,
|
||||
ElCol
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
|
||||
@@ -8,9 +8,14 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { ElBreadcrumb, ElBreadcrumbItem } from 'element-plus';
|
||||
import { defineComponent } from 'vue';
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
ElBreadcrumb,
|
||||
ElBreadcrumbItem
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
items: this.$route.matched
|
||||
|
||||
@@ -9,11 +9,13 @@
|
||||
import { defineComponent } from 'vue';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import copy from 'copy-to-clipboard';
|
||||
import { ElTooltip } from 'element-plus';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CopyToClipboard',
|
||||
components: {
|
||||
FontAwesomeIcon
|
||||
FontAwesomeIcon,
|
||||
ElTooltip
|
||||
},
|
||||
props: {
|
||||
content: {
|
||||
|
||||
@@ -10,11 +10,14 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import VueMarkdown from './VueMarkdown.vue';
|
||||
import { ElDivider, ElSkeleton } from 'element-plus';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ApiCode',
|
||||
components: {
|
||||
VueMarkdown
|
||||
VueMarkdown,
|
||||
ElDivider,
|
||||
ElSkeleton
|
||||
},
|
||||
props: {
|
||||
content: {
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElPagination } from 'element-plus';
|
||||
|
||||
interface IData {
|
||||
loaded: boolean;
|
||||
@@ -21,6 +22,9 @@ interface IData {
|
||||
|
||||
export default defineComponent({
|
||||
name: 'Pagination',
|
||||
components: {
|
||||
ElPagination
|
||||
},
|
||||
props: {
|
||||
total: {
|
||||
type: Number,
|
||||
@@ -50,7 +54,7 @@ export default defineComponent({
|
||||
}, 1000);
|
||||
},
|
||||
methods: {
|
||||
onPageChange(val: number, oldVal: number): void {
|
||||
onPageChange(val: number): void {
|
||||
// if not finished loading, ignore the wrong emit event
|
||||
if (!this.loaded) {
|
||||
return;
|
||||
|
||||
@@ -5,9 +5,13 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElAlert } from 'element-plus';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'SuccessInfo',
|
||||
components: {
|
||||
ElAlert
|
||||
},
|
||||
props: {
|
||||
show: {
|
||||
type: Boolean,
|
||||
|
||||
@@ -43,9 +43,32 @@ import { defineComponent } from 'vue';
|
||||
import defaultAvatar from '@/assets/images/avatar.png';
|
||||
import { getAuthBaseUrl } from '@/utils';
|
||||
import { ROUTE_AUTH_LOGIN, ROUTE_CONSOLE_ROOT, ROUTE_INDEX } from '@/router';
|
||||
|
||||
import {
|
||||
ElContainer,
|
||||
ElAside,
|
||||
ElMain,
|
||||
ElCol,
|
||||
ElRow,
|
||||
ElDropdown,
|
||||
ElMenu,
|
||||
ElMenuItem,
|
||||
ElDropdownItem,
|
||||
ElButton
|
||||
} from 'element-plus';
|
||||
export default defineComponent({
|
||||
name: 'TopHeader',
|
||||
components: {
|
||||
ElContainer,
|
||||
ElAside,
|
||||
ElMain,
|
||||
ElCol,
|
||||
ElRow,
|
||||
ElDropdown,
|
||||
ElMenu,
|
||||
ElMenuItem,
|
||||
ElDropdownItem,
|
||||
ElButton
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
defaultAvatar
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
import { defineComponent } from 'vue';
|
||||
import { Clock, User, Postcard } from '@element-plus/icons-vue';
|
||||
import { ROUTE_CONSOLE_APPLICATION_LIST, ROUTE_CONSOLE_ORDER_LIST, ROUTE_INDEX } from '@/router';
|
||||
import { ElRow, ElCol, ElIcon } from 'element-plus';
|
||||
|
||||
interface ILink {
|
||||
key: string;
|
||||
@@ -51,7 +52,10 @@ export default defineComponent({
|
||||
components: {
|
||||
Clock,
|
||||
Postcard,
|
||||
User
|
||||
User,
|
||||
ElRow,
|
||||
ElCol,
|
||||
ElIcon
|
||||
},
|
||||
data(): IData {
|
||||
return {
|
||||
|
||||
@@ -16,6 +16,7 @@ import { defineComponent } from 'vue';
|
||||
import { IDocument, IDocumentListResponse } from '@/operators/document/models';
|
||||
import DocumentListItem from './ListItem.vue';
|
||||
import { documentOperator } from '@/operators/document';
|
||||
import { ElSkeleton } from 'element-plus';
|
||||
|
||||
interface IData {
|
||||
documents: IDocument[];
|
||||
@@ -27,7 +28,8 @@ interface IData {
|
||||
export default defineComponent({
|
||||
name: 'DocumentList',
|
||||
components: {
|
||||
DocumentListItem
|
||||
DocumentListItem,
|
||||
ElSkeleton
|
||||
},
|
||||
data(): IData {
|
||||
return {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<el-link type="primary" class="link" :underline="false">
|
||||
<span class="name">{{ document?.api?.title }}</span>
|
||||
</el-link>
|
||||
<el-tag v-if="document?.api?.request?.method" type="primary" class="method" effect="dark">
|
||||
<el-tag v-if="document?.api?.request?.method" type="" class="method" effect="dark">
|
||||
{{ document?.api?.request?.method }}
|
||||
</el-tag>
|
||||
</div>
|
||||
@@ -18,9 +18,14 @@
|
||||
import { defineComponent } from 'vue';
|
||||
import { IDocument } from '@/operators/document/models';
|
||||
import { ROUTE_DOCUMENT_DETAIL } from '@/router';
|
||||
import { ElLink, ElTag } from 'element-plus';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ApiListItem',
|
||||
components: {
|
||||
ElLink,
|
||||
ElTag
|
||||
},
|
||||
props: {
|
||||
document: {
|
||||
type: Object as () => IDocument,
|
||||
|
||||
@@ -5,11 +5,14 @@
|
||||
{{ application?.service?.title }}
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('application.field.amount')">
|
||||
<el-input-number v-model="form.amount" :min="1" :max="10" controls-position="right" />
|
||||
<el-input-number v-model="form.amount" :min="1" :max="10000" controls-position="right" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('service.field.price')">
|
||||
<service-price :price="application?.service?.price" />
|
||||
</el-form-item>
|
||||
<el-divider />
|
||||
<el-form-item :label="$t('application.field.shouldPayPrice')">
|
||||
<span class="price">¥{{ getPrice().toFixed(2) }}</span>
|
||||
<span :class="{ price: true, unfree: price > 0 }">¥{{ price.toFixed(2) }}</span>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
@@ -28,9 +31,20 @@ import { IApplication, IOrderDetailResponse, orderOperator } from '@/operators';
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { ROUTE_CONSOLE_ORDER_DETAIL } from '@/router';
|
||||
import { ElDialog, ElForm, ElFormItem, ElButton, ElInputNumber, ElDivider } from 'element-plus';
|
||||
import ServicePrice from '@/components/service/Price.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CreateOrderDialog',
|
||||
components: {
|
||||
ElDialog,
|
||||
ElForm,
|
||||
ElFormItem,
|
||||
ElButton,
|
||||
ElInputNumber,
|
||||
ElDivider,
|
||||
ServicePrice
|
||||
},
|
||||
props: {
|
||||
application: {
|
||||
type: Object as () => IApplication,
|
||||
@@ -46,12 +60,18 @@ export default defineComponent({
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
amount: 1
|
||||
amount: 1000
|
||||
},
|
||||
creating: false
|
||||
};
|
||||
},
|
||||
mounted() {},
|
||||
computed: {
|
||||
price() {
|
||||
if (this.application.service?.price && this.form.amount)
|
||||
return this.form.amount * this.application.service?.price;
|
||||
return 0;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onCreateOrder() {
|
||||
if (!this.application?.id) {
|
||||
@@ -77,11 +97,6 @@ export default defineComponent({
|
||||
ElMessage.error(this.$t('order.message.createFailed'));
|
||||
this.creating = false;
|
||||
});
|
||||
},
|
||||
getPrice() {
|
||||
if (this.application.service?.price && this.form.amount)
|
||||
return this.form.amount * this.application.service?.price;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -91,5 +106,8 @@ export default defineComponent({
|
||||
.price {
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
.unfree {
|
||||
color: #ff5441;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,45 @@
|
||||
<template>
|
||||
<div class="price-text">
|
||||
<span v-if="price > 0" class="unfree">¥{{ price }} / {{ $t('service.unit.usage') }}</span>
|
||||
<span v-else class="free">
|
||||
{{ $t('service.message.free') }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent } from 'vue';
|
||||
export default defineComponent({
|
||||
name: 'ServicePrice',
|
||||
props: {
|
||||
price: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: 0
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.price-text {
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
.unfree {
|
||||
color: #ff5441;
|
||||
|
||||
.value {
|
||||
font-weight: bold;
|
||||
color: #ff5441;
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
.unit {
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
.free {
|
||||
color: #29c287;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user