refine imports and styles

This commit is contained in:
AceDataCloud committed 2023-01-25 12:28:56 +08:00
1 parent f538780b91
commit c9010effbb
47 files changed
+303 -337

No files matched your search

-2
View File
@@ -36,8 +36,6 @@ import javaTemplate from '@/assets/templates/java.tpl';
import CodeSnippet from '../common/CodeSnippet.vue';
import queryString from 'query-string';
console.log('pythonTemplate', pythonTemplate);
interface IOption {
name: ILang;
icon: string;
+1 -2
View File
@@ -84,7 +84,7 @@
import { defineComponent } from 'vue';
import { ISchema } from '@/operators/api/models';
import { IService } from '@/operators/service/models';
import { applicationOperator, IApplication, IApplicationListResponse } from '@/operators';
import { IApplication } from '@/operators';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
interface IData {
@@ -140,7 +140,6 @@ export default defineComponent({
},
methods: {
onChange(key: string, val: string) {
console.log('key', key, val);
this.value[key] = val;
},
onRefreshApplications() {
+1 -4
View File
@@ -71,14 +71,11 @@ export default defineComponent({
required: true
}
},
// emits: ['change'],
data(): IData {
return {
value: {}
};
},
watch: {},
methods: {}
}
});
</script>
-1
View File
@@ -54,7 +54,6 @@ export default defineComponent({
params: { ...this.form.queries },
data: { ...this.form.body }
};
console.debug('config of testing', config);
axios(config)
.then((response) => {
this.loading = false;
-1
View File
@@ -59,7 +59,6 @@ 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;
-182
View File
@@ -1,182 +0,0 @@
<template>
<el-card v-if="application && service" shadow="hover" class="card">
<div class="item">
<div class="icon">
<font-awesome-icon v-if="service.icon" :icon="service.icon" />
</div>
<div class="main">
<div class="title">
<router-link
:to="{
name: 'service-detail',
params: {
id: service.id
}
}"
>
{{ service.title }}
</router-link>
</div>
<div class="key">
<span class="label">{{ $t('application.field.apiKey') }}</span>
<span class="value">{{ application.api_key }}</span>
<span class="copy">
<font-awesome-icon icon="fa-regular fa-copy" />
</span>
</div>
<div class="remaining-count">
<span class="label">{{ $t('application.field.remainingCount') }}</span>
<span class="value">{{ application.remaining_count }}</span>
</div>
<div class="links">
<div class="link">
<font-awesome-icon icon="fa-regular fa-file-lines" class="label" />
<span class="text">{{ $t('application.button.document') }}</span>
</div>
</div>
</div>
<div class="operations">
<div class="operation">
<router-link
:to="{
name: 'service-detail',
params: {
id: service.id
}
}"
>
<el-button type="danger">
{{ $t('application.button.buyMore') }}
</el-button>
</router-link>
</div>
</div>
</div>
</el-card>
</template>
<script lang="ts">
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
import {
applicationOperator,
IApplication,
IApplicationDetailResponse,
IService,
IServiceDetailResponse,
serviceOperator
} from '@/operators';
import { defineComponent } from 'vue';
interface IData {
loading: boolean;
service: IService | undefined;
}
export default defineComponent({
name: 'ApplicationPreviewCard',
components: {
FontAwesomeIcon
},
props: {
application: {
type: Object as () => IApplication,
required: true
}
},
data(): IData {
return {
loading: false,
service: undefined
};
},
mounted() {
if (this.application?.service_id)
serviceOperator.get(this.application.service_id).then(({ data: data }: { data: IServiceDetailResponse }) => {
this.service = data;
this.loading = false;
});
},
methods: {}
});
</script>
<style lang="scss" scoped>
.card {
margin-bottom: 20px;
.item {
height: 200px;
display: flex;
$icon-size: 150px;
$icon-font-size: 50px;
.icon {
width: $icon-size;
height: $icon-size;
line-height: $icon-size;
font-size: $icon-font-size;
text-align: center;
margin: auto 0;
color: var(--el-color-primary);
}
.main {
padding: 0 15px;
position: relative;
flex-grow: 1;
.title {
font-size: 20px;
font-weight: 500;
margin-bottom: 10px;
}
.key {
font-size: 14px;
margin-bottom: 5px;
.label {
font-weight: 600;
}
.value {
display: inline-block;
margin-left: 5px;
}
.copy {
display: inline-block;
margin-left: 5px;
color: #666;
cursor: pointer;
}
}
.remaining-count {
font-size: 14px;
margin-bottom: 5px;
.label {
font-weight: 600;
}
.value {
display: inline-block;
margin-left: 5px;
}
}
.links {
position: absolute;
bottom: 5px;
left: 20px;
.link {
color: #666;
.label {
color: var(--el-color-primary);
}
.text {
cursor: pointer;
display: inline-block;
margin-left: 5px;
}
}
}
}
.operations {
display: flex;
flex-direction: column;
justify-content: center;
}
}
}
</style>
+1
View File
@@ -18,6 +18,7 @@ export default defineComponent({
default: ''
}
},
emits: ['update:show'],
watch: {
show(val, oldVal) {
if (val) {
+29 -8
View File
@@ -17,12 +17,14 @@
$t('common.button.login')
}}</el-button>
</div>
<div v-else class="mt-3 pr-10 float-right">
<div v-else class="float-right">
<div class="console" @click="onConsole">
{{ $t('common.button.console') }}
</div>
<el-dropdown trigger="click">
<img :src="user?.avatar || defaultAvatar" class="avatar" />
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="onConsole">{{ $t('common.button.console') }}</el-dropdown-item>
<el-dropdown-item @click="onProfile">{{ $t('common.button.profile') }}</el-dropdown-item>
<el-dropdown-item @click="onVerify">{{ $t('common.button.verify') }}</el-dropdown-item>
<el-dropdown-item @click="onLogout">{{ $t('common.button.logout') }}</el-dropdown-item>
@@ -39,6 +41,9 @@
<script lang="ts">
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';
export default defineComponent({
name: 'TopHeader',
data() {
@@ -61,28 +66,32 @@ export default defineComponent({
},
onHome() {
this.$router.push({
name: 'home'
name: ROUTE_INDEX
});
},
onLogin() {
this.$router.push({
name: 'login'
name: ROUTE_AUTH_LOGIN
});
},
onProfile() {
window.location.href = 'https://auth.test.zhishuyun.com/user/profile';
const authBaseUrl = getAuthBaseUrl();
window.open(`${authBaseUrl}/user/profile`, '_blank');
},
onVerify() {
window.location.href = 'https://auth.test.zhishuyun.com/user/verify';
const authBaseUrl = getAuthBaseUrl();
window.open(`${authBaseUrl}/user/verify`, '_blank');
},
onConsole() {
this.$router.push({
name: 'console-application-list'
name: ROUTE_CONSOLE_ROOT
});
},
onLogout() {
this.$store.dispatch('resetAuth');
this.$router.push('/');
this.$router.push({
name: ROUTE_INDEX
});
}
}
});
@@ -123,6 +132,18 @@ $height: 60px;
height: 40px;
border-radius: 50%;
cursor: pointer;
margin-top: 10px;
margin-right: 20px;
margin-left: 10px;
}
.console {
color: white;
height: 60px;
line-height: 60px;
margin: 0 10px;
font-size: 14px;
display: inline-block;
cursor: pointer;
}
}
</style>
+3 -1
View File
@@ -6,6 +6,7 @@
import { defineComponent } from 'vue';
import { ElMessageBox } from 'element-plus';
import { authOperator, ITokenResponse } from '@/operators';
import { getAuthBaseUrl } from '@/utils';
export default defineComponent({
name: 'VerificationAlert',
@@ -53,7 +54,8 @@ export default defineComponent({
closeOnHashChange: false
})
.then(() => {
window.open('https://auth.test.zhishuyun.com/user/verify?redirect=' + window.location.href + '?refresh=1');
const authBaseUrl = getAuthBaseUrl();
window.open(`${authBaseUrl}/user/verify?redirect=` + window.location.href + '?refresh=1');
})
.catch(() => {});
}
-2
View File
@@ -1,7 +1,6 @@
<script lang="ts">
import type { PropType } from 'vue';
import { defineComponent, computed, h } from 'vue';
import MarkdownIt, { Options as MarkdownItOptions } from 'markdown-it';
export default defineComponent({
@@ -19,7 +18,6 @@ export default defineComponent({
},
setup(props, { attrs }) {
const md = new MarkdownIt(props.options);
const content = computed(() => {
const src = props.source;
return md?.render(src);
-5
View File
@@ -1,5 +0,0 @@
import TopHeader from './TopHeader.vue';
import Breadcrumb from './Breadcrumb.vue';
import SuccessInfo from './SuccessInfo.vue';
import Pagination from './Pagination.vue';
export { TopHeader, Breadcrumb, SuccessInfo, Pagination };
+4 -3
View File
@@ -33,6 +33,7 @@
<script lang="ts">
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';
interface ILink {
key: string;
@@ -58,13 +59,13 @@ export default defineComponent({
{
key: 'profile',
text: this.$t('console.menu.orderList'),
name: 'console-order-list',
name: ROUTE_CONSOLE_ORDER_LIST,
icon: 'user'
},
{
key: 'verify',
text: this.$t('console.menu.applicationList'),
name: 'console-application-list',
name: ROUTE_CONSOLE_APPLICATION_LIST,
icon: 'postcard'
}
]
@@ -79,7 +80,7 @@ export default defineComponent({
methods: {
onHome() {
this.$router.push({
name: 'home'
name: ROUTE_INDEX
});
}
}
+4 -3
View File
@@ -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="request-method" effect="dark">
<el-tag v-if="document?.api?.request?.method" type="primary" class="method" effect="dark">
{{ document?.api?.request?.method }}
</el-tag>
</div>
@@ -17,6 +17,7 @@
<script lang="ts">
import { defineComponent } from 'vue';
import { IDocument } from '@/operators/document/models';
import { ROUTE_DOCUMENT_DETAIL } from '@/router';
export default defineComponent({
name: 'ApiListItem',
@@ -29,7 +30,7 @@ export default defineComponent({
methods: {
onClick() {
this.$router.push({
name: 'document-detail',
name: ROUTE_DOCUMENT_DETAIL,
params: {
id: this.document.id
}
@@ -60,7 +61,7 @@ $height: 35px;
display: flex;
}
}
.request-method {
.method {
position: absolute;
right: 10px;
top: 5px;
+2 -1
View File
@@ -27,6 +27,7 @@
import { IApplication, IOrderDetailResponse, orderOperator } from '@/operators';
import { defineComponent } from 'vue';
import { ElMessage } from 'element-plus';
import { ROUTE_CONSOLE_ORDER_DETAIL } from '@/router';
export default defineComponent({
name: 'CreateOrderDialog',
@@ -66,7 +67,7 @@ export default defineComponent({
this.creating = false;
const order = data;
this.$router.push({
name: 'console-order-detail',
name: ROUTE_CONSOLE_ORDER_DETAIL,
params: {
id: order.id
}