Add support for mobile nav (#64)

Co-authored-by: AceDataCloud <office@acedata.cloud>
This commit is contained in:
GermeyandAceDataCloud authored and GitHub committed 2024-07-01 17:00:08 +00:00
1 parent ecd274fcc0
commit 674ffb6770
154 files changed
+2434 -1704

No files matched your search

+2 -10
View File
@@ -3,7 +3,6 @@
<template #chat>
<model-selector2 class="selector" />
<application-status
class="status"
:initializing="initializing"
:application="application"
:need-apply="needApply"
@@ -290,18 +289,17 @@ export default defineComponent({
margin-bottom: 10px;
position: absolute;
left: 10px;
top: 5px;
top: 10px;
}
.dialogue {
flex: 1;
width: 100%;
margin: 15px auto;
overflow-y: auto;
position: relative;
padding: 0 calc(50% - 400px);
.messages {
padding-top: 30px;
padding-top: 10px;
.message {
margin-bottom: 15px;
}
@@ -310,10 +308,4 @@ export default defineComponent({
.bottom {
width: 100%;
}
@media (max-width: 767px) {
.status {
margin-top: 20px;
}
}
</style>
+3 -3
View File
@@ -87,7 +87,7 @@ export default defineComponent({
);
},
set(messages: any[]) {
console.log('set messages', messages);
console.debug('set messages', messages);
}
},
repository(): IChatdocRepository | undefined {
@@ -116,7 +116,7 @@ export default defineComponent({
}
},
async mounted() {
console.log('start get conversations');
console.debug('start get conversations');
this.loading = true;
this.$store.dispatch('chatdoc/getConversations', { repositoryId: this.repositoryId }).finally(() => {
this.loading = false;
@@ -196,7 +196,7 @@ export default defineComponent({
});
this.answering = false;
if (!this.conversationId) {
console.log('push to conversation', conversationId);
console.debug('push to conversation', conversationId);
await this.$router.push({
name: ROUTE_CHATDOC_CONVERSATION,
params: {
-3
View File
@@ -107,9 +107,6 @@ export default defineComponent({
},
async mounted() {},
methods: {
onCreate() {
console.log('onCreate');
},
onClick(repository: IChatdocRepository) {
this.$router.push({
name: ROUTE_CHATDOC_MANAGE,
+6
View File
@@ -239,4 +239,10 @@ export default defineComponent({
bottom: 40px;
z-index: 1000;
}
@media (max-width: 767px) {
.help {
top: 40px;
}
}
</style>
+6
View File
@@ -224,4 +224,10 @@ export default defineComponent({
bottom: 40px;
z-index: 1000;
}
@media (max-width: 767px) {
.help {
top: 40px;
}
}
</style>
+10 -4
View File
@@ -7,8 +7,8 @@
<h2 class="title">{{ $t('common.title.allUsages') }}</h2>
</el-col>
</el-row>
<el-row class="mb-4">
<el-col :span="8">
<el-row>
<el-col :md="8" :sm="12" class="mb-4">
<span class="inline-block mr-3"> {{ $t('usage.field.application') }} </span>
<el-select
v-model="applicationId"
@@ -19,7 +19,7 @@
<el-option v-for="item in applications" :key="item.id" :label="item.service?.title" :value="item?.id" />
</el-select>
</el-col>
<el-col :span="8">
<el-col :md="8" :sm="12" class="mb-4">
<span class="inline-block mr-3"> {{ $t('usage.field.api') }} </span>
<el-select v-model="apiId" :placeholder="$t('usage.field.api')" clearable @change="onApiChange">
<el-option v-for="item in apis" :key="item?.id" :label="item?.title" :value="item?.id" />
@@ -298,7 +298,7 @@ export default defineComponent({
color: var(--el-text-color-primary);
}
.el-table {
height: calc(100vh - 350px);
height: calc(100vh - 430px);
margin-bottom: 50px;
.el-button {
border-radius: 20px;
@@ -317,4 +317,10 @@ export default defineComponent({
bottom: 40px;
z-index: 1000;
}
@media (max-width: 767px) {
.help {
top: 40px;
}
}
</style>
+1 -2
View File
@@ -10,7 +10,6 @@
:application="application"
:service="service"
:need-apply="needApply"
class="mb-4"
@refresh="onGetApplication"
/>
<task-list @custom="onCustom" @refresh="onGetApplication" />
@@ -274,7 +273,7 @@ export default defineComponent({
},
async onSyncTasks() {
await this.$store.dispatch('midjourney/getImagineTasks', {
limit: 50,
limit: 30,
offset: 0
});
}
+253
View File
@@ -0,0 +1,253 @@
<template>
<div class="profile">
<div class="info">
<el-image :src="user.avatar" fit="cover" class="avatar" />
<h2>
{{ user.username }}
</h2>
<div :style="{ backgroundImage: 'url(' + user.avatar + ')' }" class="background" />
</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="suffix">
<font-awesome-icon icon="fa-solid fa-chevron-right" class="text-sm" />
</span>
</a>
</div>
<locale-selector :visible="operating.locale == true" @close="operating.locale = false" />
<dark-selector :visible="operating.dark == true" @close="operating.dark = false" />
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { ElImage } from 'element-plus';
import {
ROUTE_CONSOLE_APPLICATION_LIST,
ROUTE_CONSOLE_ORDER_LIST,
ROUTE_CONSOLE_USAGE_LIST,
ROUTE_DISTRIBUTION_INDEX,
ROUTE_INDEX,
ROUTE_SITE_INDEX
} from '@/router';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
import { getBaseUrlAuth, getBaseUrlPlatform } from '@/utils';
import LocaleSelector from '@/components/common/LocaleSelector.vue';
import DarkSelector from '@/components/common/DarkSelector.vue';
interface ILink {
key: string;
text: string;
name?: string;
href?: string;
icon: string;
admin?: boolean;
callback?: () => void;
}
export default defineComponent({
name: 'ProfileIndex',
components: {
ElImage,
FontAwesomeIcon,
LocaleSelector,
DarkSelector
},
data() {
return {
operating: {
locale: false,
dark: false
}
};
},
computed: {
user() {
return this.$store.getters.user;
},
links(): ILink[] {
let links: ILink[] = [
{
key: 'profile',
text: this.$t('console.menu.userProfile'),
href: `${getBaseUrlAuth()}/user/profile`,
icon: 'fa-regular fa-user'
},
{
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'
},
{
key: 'usage-list',
text: this.$t('console.menu.usageList'),
name: ROUTE_CONSOLE_USAGE_LIST,
icon: 'fa-solid fa-rotate-left'
},
{
key: 'distribution-index',
text: this.$t('console.menu.distributionIndex'),
name: ROUTE_DISTRIBUTION_INDEX,
icon: 'fa-solid fa-coins'
},
{
key: 'site-index',
text: this.$t('common.nav.site'),
name: ROUTE_SITE_INDEX,
icon: 'fa-solid fa-gear'
},
{
key: 'dark-setting',
text: this.$t('common.nav.darkMode'),
icon: 'fa-solid fa-moon',
callback: () => {
this.operating.dark = true;
}
},
{
key: 'locale-setting',
text: this.$t('common.nav.locale'),
icon: 'fa-solid fa-language',
callback: () => {
this.operating.locale = true;
}
},
{
key: 'developerPlatform',
text: this.$t('console.menu.developerPlatform'),
href: getBaseUrlPlatform(),
icon: 'fa-solid fa-laptop-code'
},
{
key: 'logout',
text: this.$t('common.nav.logOut'),
icon: 'fa-solid fa-arrow-right-from-bracket',
callback: async () => {
await this.$store.dispatch('resetAll');
await this.$store.dispatch('chat/resetAll');
await this.$store.dispatch('midjourney/resetAll');
await this.$store.dispatch('chatdoc/resetAll');
await this.$store.dispatch('qrart/resetAll');
}
}
];
return links;
}
},
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');
} else if (link.callback) {
link.callback();
}
}
}
});
</script>
<style lang="scss" scoped>
.profile {
display: flex;
flex-direction: column;
}
.info {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
padding: 50px 0 20px 0;
height: 200px !important;
overflow: hidden;
position: relative;
.background {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: -1;
background-repeat: no-repeat;
background-size: cover;
background-position: center;
filter: blur(15px) brightness(0.7);
}
.avatar {
width: 50px;
height: 50px;
border-radius: 50%;
}
h2 {
font-size: 18px;
}
}
</style>
<style lang="scss" scoped>
$width: 100%;
$padding-left: 10px;
.links {
width: $width;
flex: 1;
padding: 20px;
.link {
$height: 40px;
height: $height;
display: block;
width: 100%;
cursor: pointer;
margin-bottom: 5px;
position: relative;
color: var(--el-text-color-primary);
line-height: $height;
.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;
}
}
}
</style>