Skip to content

Commit

Permalink
update console
Browse files Browse the repository at this point in the history
  • Loading branch information
Germey committed Dec 31, 2023
1 parent 244e8d6 commit a497f8d
Show file tree
Hide file tree
Showing 34 changed files with 1,713 additions and 112 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "zhishuyun-ai",
"name": "zhishuyun-hub",
"version": "0.1.0",
"scripts": {
"start": "cross-env NODE_ENV=$npm_config_env vite --host",
Expand Down Expand Up @@ -28,7 +28,6 @@
"@types/mustache": "^4.2.2",
"@types/qs": "^6.9.9",
"@types/uuid": "^8.3.4",
"@zhishuyun/data": "^0.1.0",
"axios": "^0.22.0",
"codemirror": "^6.0.1",
"copy-to-clipboard": "^3.3.3",
Expand Down
4 changes: 2 additions & 2 deletions src/components/chat/InputBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export default defineComponent({
.el-upload-list {
position: absolute;
width: 400px;
bottom: 40px;
bottom: 45px;
}
}
</style>
Expand All @@ -155,7 +155,7 @@ export default defineComponent({
border-radius: 10px;
background: none;
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.1);
top: 50px;
top: 30px;
.upload {
display: inline-block;
&.disabled {
Expand Down
15 changes: 11 additions & 4 deletions src/components/common/ApiStatus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
{{ application?.remaining_amount }}
</span>
<span class="actions">
<el-button size="small" type="primary" @click="onBuy">{{ $t('common.button.buyMore') }}</el-button>
<el-button size="small" type="primary" @click="onBuyMore(application)">{{
$t('common.button.buyMore')
}}</el-button>
</span>
</div>
<div v-else class="text-center info">
Expand All @@ -36,6 +38,7 @@ import { IApplicationType } from '@/operators';
import { apiOperator } from '@/operators/api/operator';
import { IApiDetailResponse, IApi } from '@/operators/api';
import { ERROR_CODE_DUPLICATION } from '@/constants/errorCode';
import { ROUTE_CONSOLE_APPLICATION_BUY } from '@/router';
export interface IData {
confirming: boolean;
Expand Down Expand Up @@ -83,9 +86,13 @@ export default defineComponent({
this.api = data;
});
},
onBuy() {
const url = `https://data.zhishuyun.com/console/applications/${this.application?.id}/buy`;
window.open(url, '_blank');
onBuyMore(application: IApplication) {
this.$router.push({
name: ROUTE_CONSOLE_APPLICATION_BUY,
params: {
id: application.id
}
});
},
onApply() {
applicationOperator
Expand Down
12 changes: 11 additions & 1 deletion src/components/common/Navigator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,19 @@
@click="$router.push(link.route)"
>
<font-awesome-icon :icon="link.icon" />
<!-- <img :src="link.image" class="image" :alt="link.icon" /> -->
</el-button>
</el-tooltip>
</div>
</div>
<div class="middle"></div>
<div class="bottom">
<div class="link">
<el-tooltip effect="dark" :content="$t('common.nav.console')" placement="right">
<el-button class="button" @click="onConsole">
<font-awesome-icon icon="fa-solid fa-compass" />
</el-button>
</el-tooltip>
</div>
<div class="link">
<el-tooltip effect="dark" :content="$t('common.nav.logOut')" placement="right">
<el-button class="button" @click="onLogout">
Expand All @@ -38,6 +44,7 @@ import {
ROUTE_CHAT_CONVERSATION,
ROUTE_CHAT_CONVERSATION_NEW,
ROUTE_CHAT_INDEX,
ROUTE_CONSOLE_ROOT,
ROUTE_MIDJOURNEY_HISTORY,
ROUTE_MIDJOURNEY_INDEX
} from '@/router/constants';
Expand Down Expand Up @@ -78,6 +85,9 @@ export default defineComponent({
console.debug('logout');
this.$store.dispatch('common/resetToken');
this.$router.push({ name: ROUTE_AUTH_LOGIN });
},
onConsole() {
this.$router.push({ name: ROUTE_CONSOLE_ROOT });
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/Price.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="price-text">
<span v-if="price > 0" class="unfree"
>¥{{ price }} {{ unit ? ` / ${unit}` : '' }}{{ start ? $t('common.message.startPrice') : ''
}}{{ $t('service.message.fromPrice') }}
}}{{ $t('common.message.startPrice') }}
</span>
<span v-else class="free">
{{ $t('common.message.free') }}
Expand Down
157 changes: 157 additions & 0 deletions src/components/console/SidePanel.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
<template>
<div class="side-panel">
<div>
<img src="@/assets/images/logo2.svg" class="logo" @click="onHome" />
</div>
<div class="links">
<a
v-for="(link, linkIndex) in links"
:key="linkIndex"
:class="{ link: true, active: $route.name === link.name }"
@click="onNavigate(link)"
>
<span class="icon">
<font-awesome-icon :icon="link.icon" class="text-sm" />
</span>
<span class="text">{{ link.text }}</span>
<span class="outer">
<font-awesome-icon
v-if="!link.name && link.href"
icon="fa-solid fa-up-right-from-square"
class="text-sm ml-2"
/>
</span>
<span class="suffix"> </span>
</a>
</div>
</div>
</template>

<script lang="ts">
import { defineComponent } from 'vue';
import { ROUTE_CONSOLE_APPLICATION_LIST, ROUTE_CONSOLE_ORDER_LIST, ROUTE_INDEX } from '@/router';
import { ElRow, ElCol } from 'element-plus';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
interface ILink {
key: string;
text: string;
name?: string;
href?: string;
icon: string;
admin?: boolean;
}
export default defineComponent({
name: 'Navigator',
components: {
FontAwesomeIcon
},
computed: {
active() {
return this.$route.matched[0].path;
},
user() {
return this.$store.getters.user;
},
links(): ILink[] {
let links: ILink[] = [
{
key: 'application-list',
text: this.$t('console.menu.applicationList'),
name: ROUTE_CONSOLE_APPLICATION_LIST,
icon: 'fa-solid fa-cube'
},
{
key: 'order-list',
text: this.$t('console.menu.orderList'),
name: ROUTE_CONSOLE_ORDER_LIST,
icon: 'fa-solid fa-store'
}
];
return links;
}
},
mounted() {},
methods: {
onHome() {
this.$router.push({
name: ROUTE_INDEX
});
},
onNavigate(link: ILink) {
if (link.name) {
this.$router.push({
name: link.name
});
} else if (link.href) {
window.open(link.href, '_blank');
}
}
}
});
</script>

<style lang="scss" scoped>
$width: 250px;
$padding-left: 10px;
.side-panel {
padding-left: $padding-left;
width: $width;
padding-top: 50px;
border-right: 1px solid var(--el-border-color);
height: 100%;
}
.logo {
width: 100%;
height: 60px;
cursor: pointer;
margin-bottom: 50px;
}
.links {
width: $width;
.link {
$height: 40px;
height: $height;
display: block;
width: calc(100% - #{$padding-left});
border-radius: 6px;
cursor: pointer;
margin-bottom: 5px;
position: relative;
color: #444;
line-height: $height;
padding-left: 10px;
.suffix {
width: 3px;
height: $height;
position: absolute;
right: -5px;
margin-right: 5px;
border-radius: 3px;
display: inline-block;
}
.icon {
width: 16px;
height: 16px;
display: inline-block;
position: relative;
margin-right: 10px;
transform: translateY(-2%);
}
.text {
font-size: 14px;
}
&.active {
.suffix {
background-color: var(--el-color-primary);
}
}
&:hover {
background-color: #ebedf1;
}
}
}
</style>
Loading

0 comments on commit a497f8d

Please sign in to comment.