Refine console ux detail (#233)

This commit is contained in:
Germey authored and GitHub committed 2025-07-27 02:08:41 +08:00
1 parent 9019629c42
commit ffea198d14
15 files changed
+315 -393

No files matched your search

+2 -2
View File
@@ -26,12 +26,12 @@
</div>
<div class="flex flex-col justify-center align-middle gap-2">
<div class="flex">
<el-button size="small" round @click="onGoUsage">
<el-button size="small" round @click.stop="onGoUsage">
{{ $t('application.button.usage') }}
</el-button>
</div>
<div class="flex">
<el-button type="primary" round size="small" @click="onBuyMore">
<el-button type="primary" round size="small" @click.stop="onBuyMore">
{{ $t('application.button.buyMore') }}
</el-button>
</div>
+7 -35
View File
@@ -4,45 +4,17 @@
<script lang="ts">
import { getCookie } from 'typescript-cookie';
import { isOfficial } from '@/utils';
import { defineComponent } from 'vue';
export default {
export default defineComponent({
emits: ['click'],
data() {
return {
url1: 'https://cdn.acedata.cloud/logo.png/thumb_450x_',
url2: 'https://cdn.acedata.cloud/logo2.png/thumb_450x_',
dark: getCookie('THEME') === 'dark',
url: '',
isOfficial: isOfficial(),
interval: undefined as number | undefined
};
},
watch: {
computed: {
dark() {
this.updateUrl();
}
},
mounted() {
this.interval = window.setInterval(this.checkCookie, 500);
this.updateUrl();
},
unmounted() {
if (this.interval) {
clearInterval(this.interval);
}
},
methods: {
checkCookie() {
this.dark = getCookie('THEME') === 'dark';
return getCookie('THEME') === 'dark';
},
updateUrl() {
if (this.isOfficial) {
this.url = this.dark ? this.url2 : this.url1;
} else {
this.url = this.$store.state.site?.logo || '';
}
url() {
return this.$store.state.site?.favicon;
}
}
};
});
</script>
-20
View File
@@ -1,20 +0,0 @@
<template>
<img :src="url" class="logo tiny" @click="$emit('click')" />
</template>
<script lang="ts">
import { getCookie } from 'typescript-cookie';
import { defineComponent } from 'vue';
export default defineComponent({
emits: ['click'],
computed: {
dark() {
return getCookie('THEME') === 'dark';
},
url() {
return this.$store.state.site?.favicon;
}
}
});
</script>
+15 -47
View File
@@ -1,8 +1,8 @@
<template>
<div :direction="direction" class="navigator">
<div class="top">
<div v-if="direction === 'column'">
<logo-tiny @click="onHome" />
<div class="w-full flex justify-center">
<logo v-if="direction === 'column'" @click.stop="onHome" />
</div>
<div
v-for="(link, linkIndex) in links"
@@ -44,14 +44,14 @@ import {
ROUTE_KLING_HISTORY
} from '@/router/constants';
import { CHAT_MODEL_ICON_CHATGPT, CHAT_MODEL_ICON_DEEPSEEK, CHAT_MODEL_ICON_GROK } from '@/constants/chat';
import LogoTiny from './LogoTiny.vue';
import Logo from './Logo.vue';
import UserCenter from '@/components/user/Center.vue';
export default defineComponent({
name: 'Navigator',
components: {
ElImage,
LogoTiny,
Logo,
ElTooltip,
UserCenter
},
@@ -267,53 +267,21 @@ export default defineComponent({
}
&[direction='column'] {
flex-direction: column;
.el-menu {
width: 150px;
border-right: none;
background: none;
.el-menu-item {
height: 50px;
color: var(--el-text-color-primary);
&.active,
&:hover,
&:focus {
background-color: var(--el-button-hover-bg-color);
color: var(--el-color-primary);
}
}
}
.chevron {
position: absolute;
right: -12px;
top: 50%;
transform: translateY(-50%) scale(0.8);
z-index: 10;
}
.logo {
width: 80%;
max-height: 50px;
cursor: pointer;
margin: 10px auto 20px auto;
display: block;
&.tiny {
margin: 0 auto 10px auto;
width: 40px;
height: 40px;
}
}
.top,
.bottom {
.top {
flex: 1;
display: flex;
flex-direction: column;
padding-top: 10px;
min-width: 60px;
width: 60px;
gap: 15px;
.logo {
width: 40px;
height: 40px;
cursor: pointer;
}
.link {
width: 100%;
height: 40px;
margin-bottom: 10px;
.avatar {
display: block;
margin: auto;
@@ -325,9 +293,9 @@ export default defineComponent({
}
}
}
.bottom {
position: absolute;
bottom: 0;
height: 50px;
display: flex;
flex-direction: column;
width: 100%;
+8 -11
View File
@@ -1,5 +1,5 @@
<template>
<div class="side-panel">
<div class="side">
<div class="links">
<a
v-for="(link, linkIndex) in links"
@@ -107,29 +107,26 @@ export default defineComponent({
<style lang="scss" scoped>
$width: 200px;
$padding-left: 10px;
.side-panel {
.side {
padding-left: $padding-left;
width: $width;
padding-top: 50px;
height: 100%;
}
.logo {
width: 100%;
cursor: pointer;
margin-bottom: 30px;
}
.links {
width: $width;
width: $width - $padding-left;
display: flex;
flex-direction: column;
position: relative;
gap: 5px;
.link {
$height: 40px;
height: $height;
display: block;
width: calc(100% - #{$padding-left});
width: 100%;
border-radius: 6px;
cursor: pointer;
margin-bottom: 5px;
position: relative;
color: var(--el-text-color-primary);
line-height: $height;
+94
View File
@@ -0,0 +1,94 @@
<template>
<el-dialog :model-value="visible" :title="$t('application.title.buyService')" width="500px" center>
<p class="text-center">
{{ $t('order.message.buyInExternalUrl') }}
</p>
</el-dialog>
</template>
<script lang="ts">
import { IOrder, IOrderDetailResponse, OrderState } from '@/models';
import { defineComponent } from 'vue';
import { ElDialog } from 'element-plus';
import { orderOperator } from '@/operators';
interface IData {
refreshTimer: number | undefined;
}
export default defineComponent({
name: 'PayOrderDialog',
components: {
ElDialog
},
props: {
modelValue: {
type: Object as () => IOrder,
required: true
},
visible: {
type: Boolean,
required: false,
default: false
}
},
emits: ['hide', 'update:modelValue'],
data(): IData {
return {
refreshTimer: undefined
};
},
watch: {
visible: {
handler(val) {
if (val && this.modelValue.pay_url) {
window.open(this.modelValue.pay_url, '_blank');
}
}
}
},
mounted() {
this.onRefresh();
},
unmounted() {
if (this.refreshTimer) {
clearTimeout(this.refreshTimer);
}
},
methods: {
onRefresh() {
if (!this.modelValue.id) {
console.error('id does not exist');
return;
}
orderOperator
.refresh(this.modelValue.id)
.then(({ data: data }: { data: IOrderDetailResponse }) => {
// if not paid, check for next loop
if (data.state !== OrderState.PAID) {
setTimeout(() => {
this.onRefresh();
}, 2000);
} else {
// paid, just notify parent, and hide the dialog
this.$emit('hide');
}
this.$emit('update:modelValue', data);
})
.catch(() => {
setTimeout(() => {
this.onRefresh();
}, 5000);
});
}
}
});
</script>
<style lang="scss" scoped>
.paycodes {
padding: 30px 0;
width: 500px;
margin: auto;
}
</style>