Преглед изворни кода

更改编辑框大小、页面样式

Rmengdi пре 2 месеци
родитељ
комит
37607f2f60
5 измењених фајлова са 1106 додато и 957 уклоњено
  1. 4 4
      src/styles/lib/highlight.less
  2. 805 705
      src/views/chat/index.vue
  3. 9 12
      src/views/mj/aiGptInput.vue
  4. 176 145
      src/views/mj/aiSider.vue
  5. 112 91
      src/views/store/appList.vue

+ 4 - 4
src/styles/lib/highlight.less

@@ -1416,20 +1416,20 @@ position: relative;
 					background-color: #e8eaf1;
 					border: none;
 				}
-				width: 80%;
+				width: 90%;
 				margin: 15px 0px 0 26px;
 			}
 			.send{
 				float: right;
 				cursor: pointer;
-				// width: 94px;
-				height: 24px;
+				width: 50px;
+				height: 50px;
 				border-radius: 12px;
 				background-color: #0084FF;
 				position: absolute;
 				right: 23px;
 				bottom: 22px;
-				line-height: 24px;
+				line-height: 46px;
 				color: #fff;
 				padding: 0 10px;
 				svg{

Разлика између датотеке није приказан због своје велике величине
+ 805 - 705
src/views/chat/index.vue


+ 9 - 12
src/views/mj/aiGptInput.vue

@@ -327,7 +327,7 @@ function handleClear() {
 		>
 			<div class="top-bar" v-if="!isMobile">
 				<div class="left" v-if="st">
-					<div
+					<!-- <div
 						v-if="homeStore.myData.local != 'draw'"
 						class="chage-model-select"
 						@click="st.isShow = true"
@@ -345,12 +345,9 @@ function handleClear() {
 							}}</span>
 						</template>
 						<SvgIcon icon="icon-park-outline:right" />
-					</div>
-					<n-dropdown
-						trigger="hover"
-						:options="drOption"
-						@select="handleSelectASR"
-					>
+					</div> -->
+					<!-- @select="handleSelectASR" -->
+					<n-dropdown trigger="hover" :options="drOption">
 						<div class="relative; w-[22px]" style="margin: 0 25px">
 							<div
 								class="absolute bottom-[14px] left-[31px]"
@@ -368,7 +365,7 @@ function handleClear() {
 							<IconSvg icon="voice" width="22px" height="22px"></IconSvg>
 						</div>
 					</n-dropdown>
-					<n-tooltip trigger="hover">
+					<!-- <n-tooltip trigger="hover">
 						<template #trigger>
 							<SvgIcon
 								icon="line-md:uploading-loop"
@@ -394,7 +391,7 @@ function handleClear() {
 						icon="screenshot"
 						width="22px"
 						height="22px"
-					></IconSvg>
+					></IconSvg> -->
 				</div>
 				<IconSvg
 					@click="handleClear"
@@ -543,8 +540,8 @@ function handleClear() {
 				</template>
 			</NAutoComplete>
 			<div class="send" @click="handleSubmit" v-if="!isMobile">
-				<IconSvg icon="send" width="16px" height="15px"></IconSvg>
-				|
+				<IconSvg icon="send" width="30px" height="40px"></IconSvg>
+				<!-- |
 				<IconSvg icon="money" width="14px" height="24px"></IconSvg>
 				<NPopover trigger="hover">
 					<template #trigger>
@@ -559,7 +556,7 @@ function handleClear() {
 							}}</NButton>
 						</p>
 					</div>
-				</NPopover>
+				</NPopover> -->
 			</div>
 			<!-- translate-y-[-8px]       -->
 		</div>

+ 176 - 145
src/views/mj/aiSider.vue

@@ -1,168 +1,201 @@
 <script setup lang="ts">
-import { computed, defineAsyncComponent, ref, onMounted, Component, h } from "vue";
-import { IconSvg, PromptStore, SvgIcon } from '@/components/common'
-import { getConfigKey } from '@/api/user';
-import { useBasicLayout } from '@/hooks/useBasicLayout'
-const { isMobile } = useBasicLayout()
-import { removeToken } from '@/store/modules/auth/helper'
-import { NTooltip, useMessage, NAvatar, NPopover, NMenu, NIcon } from 'naive-ui'
-import { homeStore, useChatStore } from '@/store'
-import { loginOut, getUserInfo } from '@/api/user'
-import { UserData } from "@/typings/user"
-import { defaultSetting, UserInfo } from '@/store/modules/user/helper'
-import { useRouter } from 'vue-router'
+import {
+	computed,
+	defineAsyncComponent,
+	ref,
+	onMounted,
+	Component,
+	h,
+} from "vue";
+import { IconSvg, PromptStore, SvgIcon } from "@/components/common";
+import { getConfigKey } from "@/api/user";
+import { useBasicLayout } from "@/hooks/useBasicLayout";
+const { isMobile } = useBasicLayout();
+import { removeToken } from "@/store/modules/auth/helper";
+import {
+	NTooltip,
+	useMessage,
+	NAvatar,
+	NPopover,
+	NMenu,
+	NIcon,
+} from "naive-ui";
+import { homeStore, useChatStore } from "@/store";
+import { loginOut, getUserInfo } from "@/api/user";
+import { UserData } from "@/typings/user";
+import { defaultSetting, UserInfo } from "@/store/modules/user/helper";
+import { useRouter } from "vue-router";
 import { getToken } from "@/store/modules/auth/helper";
 import to from "await-to-js";
 import {
-  Settings as settings,
-  Storefront as storefront,
-  LogOut as out
-} from '@vicons/ionicons5'
+	Settings as settings,
+	Storefront as storefront,
+	LogOut as out,
+} from "@vicons/ionicons5";
 
-const chatStore = useChatStore()
+const chatStore = useChatStore();
 //import gallery from '@/views/gallery/index.vue'
 
-const Setting = defineAsyncComponent(() => import('@/components/common/Setting/index.vue'))
-
+const Setting = defineAsyncComponent(
+	() => import("@/components/common/Setting/index.vue")
+);
 
-const st = ref({ 'show': false, showImg: false, menu: [], active: 'chat' })
-const router1 = useRouter()
-const userInfo = ref<UserInfo>(defaultSetting().userInfo)
-const message = useMessage()
-const show = ref(false)
-const urouter = useRouter() //
+const st = ref({ show: false, showImg: false, menu: [], active: "chat" });
+const router1 = useRouter();
+const userInfo = ref<UserInfo>(defaultSetting().userInfo);
+const message = useMessage();
+const show = ref(false);
+const urouter = useRouter(); //
 const isLogin = computed(() => {
-  return localStorage.getItem('TOKEN')
+	return localStorage.getItem("TOKEN");
 });
 
-import { router } from '@/router'
+import { router } from "@/router";
 
 const goHome = computed(() => {
-  return router.currentRoute.value.name
+	return router.currentRoute.value.name;
 });
 
 onMounted(() => {
-  getLogo();
-  getLoginUserInfo();
+	getLogo();
+	getLoginUserInfo();
 });
 
 /**
  * 获取默认头像
  */
 async function getLogo() {
-  const [err1, res1] = await to(getConfigKey("logoImage"));
-  if (err1) {
-    console.error("获取配置失败", err1.message);
-  } else {
-    userInfo.value.avatar = res1.msg;
-  }
+	const [err1, res1] = await to(getConfigKey("logoImage"));
+	if (err1) {
+		console.error("获取配置失败", err1.message);
+	} else {
+		userInfo.value.avatar = res1.msg;
+	}
 }
 
 /**
  * 获取当前登录用户信息
  */
 async function getLoginUserInfo() {
-  // 用户未登录,不需要获取用户信息
-  if (!getToken()) {
-    return
-  }
-  const [err, newUserInfo] = await to(getUserInfo<UserData>());
-  if (err) {
-    // message.error(err.toString())
-    console.log(err.toString())
-  }
-  if (newUserInfo) {
-    if (newUserInfo.data.user.avatar) {
-      userInfo.value.avatar = newUserInfo.data.user.avatar;
-    }
-    userInfo.value.name = newUserInfo.data.user.nickName;
-    userInfo.value.userBalance = newUserInfo.data.user.userBalance;
-    userInfo.value.userName = newUserInfo.data.user.userName;
-    isLogin.value = true
-  }
+	// 用户未登录,不需要获取用户信息
+	if (!getToken()) {
+		return;
+	}
+	const [err, newUserInfo] = await to(getUserInfo<UserData>());
+	if (err) {
+		// message.error(err.toString())
+		console.log(err.toString());
+	}
+	if (newUserInfo) {
+		if (newUserInfo.data.user.avatar) {
+			userInfo.value.avatar = newUserInfo.data.user.avatar;
+		}
+		userInfo.value.name = newUserInfo.data.user.nickName;
+		userInfo.value.userBalance = newUserInfo.data.user.userBalance;
+		userInfo.value.userName = newUserInfo.data.user.userName;
+		isLogin.value = true;
+	}
 }
 
-const chatId = computed(() => chatStore.active ?? '1002');/**
+const chatId = computed(() => chatStore.active ?? "1002");
+/**
  * 退出登录
  */
 async function handleReset() {
-  await loginOut()
-  // 删除用户token
-  removeToken();
-  // 跳转到登录页面
-  router1.push('/login')
+	await loginOut();
+	// 删除用户token
+	removeToken();
+	// 跳转到登录页面
+	router1.push("/login");
 }
 
 async function longin() {
-  // 跳转到登录页面
-  router1.push('/login')
+	// 跳转到登录页面
+	router1.push("/login");
 }
 
 function renderIcon(icon: Component) {
-  return () => h(NIcon, null, { default: () => h(icon) })
+	return () => h(NIcon, null, { default: () => h(icon) });
 }
 
 const menuOptions = ref([
-  {
-    label: '账号设置',
-    key: 'accountSettings',
-    icon: renderIcon(settings)
-  },
-  {
-    label: '购买套餐',
-    key: 'buy',
-    icon: renderIcon(storefront)
-  },
-  {
-    label: '退出账号',
-    key: 'logout',
-    icon: renderIcon(out)
-  }
-])
+	{
+		label: "账号设置",
+		key: "accountSettings",
+		icon: renderIcon(settings),
+	},
+	{
+		label: "购买套餐",
+		key: "buy",
+		icon: renderIcon(storefront),
+	},
+	{
+		label: "退出账号",
+		key: "logout",
+		icon: renderIcon(out),
+	},
+]);
 
 const handleSelect = (key: string) => {
-  if (key === 'accountSettings') {
-    st.value.show = true
-  } else if (key === 'logout') {
-    handleReset()
-  } else if (key === 'buy') {
-    show.value = true
-  }
-}
+	if (key === "accountSettings") {
+		st.value.show = true;
+	} else if (key === "logout") {
+		handleReset();
+	} else if (key === "buy") {
+		show.value = true;
+	}
+};
 </script>
 <template>
-
-
-  <div class="flex-shrink-0 w-[60px] z-[1000]  h-full" v-if="!isMobile" data-tauri-drag-region>
-    <div
-      class="flex h-full select-none flex-col items-center justify-between bg-[#e8eaf1] px-2 pt-4 pb-8 dark:bg-[#25272d]">
-      <div class="flex flex-col space-y-4 flex-1 " data-tauri-drag-region>
-        <a @click="st.active = 'chat'; urouter.push(`/chat`)"
-          class="router-link-active router-link-exact-active h-12 w-12 cursor-pointer rounded-xl bg-white duration-300 dark:bg-[#34373c] hover:bg-[#bbb] dark:hover:bg-[#555]">
-          <n-tooltip placement="right" trigger="hover">
-            <template #trigger>
-              <div class="flex h-full justify-center items-center py-1 flex-col "
-                :class="[goHome == 'Chat' ? 'active' : '']">
-                <SvgIcon icon="ri:wechat-line" class="text-3xl  flex-1"></SvgIcon>
-              </div>
-            </template>
-            对话
-          </n-tooltip>
-        </a>
-
-        <a @click="urouter.push(`/store`)"
-          class=" router-link-exact-active h-12 w-12 cursor-pointer rounded-xl bg-white duration-300 dark:bg-[#34373c] hover:bg-[#bbb] dark:hover:bg-[#555]">
-          <n-tooltip placement="right" trigger="hover">
-            <template #trigger>
-              <div class="flex h-full justify-center items-center   py-1 flex-col">
-                <SvgIcon icon="ri:apps-fill" class="text-3xl flex-1"></SvgIcon>
-              </div>
-            </template>
-            应用中心
-          </n-tooltip>
-        </a>
-
-        <a
+	<div
+		class="flex-shrink-0 w-[60px] z-[1000] h-full"
+		v-if="!isMobile"
+		data-tauri-drag-region
+	>
+		<div
+			class="flex h-full select-none flex-col items-center justify-between bg-[#e8eaf1] px-2 pt-4 pb-8 dark:bg-[#25272d]"
+		>
+			<div class="flex flex-col space-y-4 flex-1" data-tauri-drag-region>
+				<a
+					@click="
+						st.active = 'chat';
+						urouter.push(`/chat`);
+					"
+					class="router-link-active router-link-exact-active h-12 w-12 cursor-pointer rounded-xl bg-white duration-300 dark:bg-[#34373c] hover:bg-[#bbb] dark:hover:bg-[#555]"
+				>
+					<n-tooltip placement="right" trigger="hover">
+						<template #trigger>
+							<div
+								class="flex h-full justify-center items-center py-1 flex-col"
+								:class="[goHome == 'Chat' ? 'active' : '']"
+							>
+								<SvgIcon
+									icon="ri:wechat-line"
+									class="text-3xl flex-1"
+								></SvgIcon>
+							</div>
+						</template>
+						对话
+					</n-tooltip>
+				</a>
+
+				<a
+					@click="urouter.push(`/store`)"
+					class="router-link-exact-active h-12 w-12 cursor-pointer rounded-xl bg-white duration-300 dark:bg-[#34373c] hover:bg-[#bbb] dark:hover:bg-[#555]"
+				>
+					<n-tooltip placement="right" trigger="hover">
+						<template #trigger>
+							<div
+								class="flex h-full justify-center items-center py-1 flex-col"
+							>
+								<SvgIcon icon="ri:apps-fill" class="text-3xl flex-1"></SvgIcon>
+							</div>
+						</template>
+						应用中心
+					</n-tooltip>
+				</a>
+
+				<!-- <a
           class=" router-link-exact-active h-12 w-12 cursor-pointer rounded-xl bg-white duration-300 dark:bg-[#34373c] hover:bg-[#bbb] dark:hover:bg-[#555]">
           <n-tooltip placement="right" trigger="hover">
             <template #trigger>
@@ -172,33 +205,31 @@ const handleSelect = (key: string) => {
             </template>
             插件市场
           </n-tooltip>
-        </a>
-      </div>
+        </a> -->
+			</div>
 
-      <div class="flex flex-col  space-y-2 ">
-        <!-- <NAvatar  v-show="isLogin"  size="large"  round  :src="userInfo.avatar"   v-if="userInfo.avatar"  :fallback-src="defaultAvatar"
+			<div class="flex flex-col space-y-2">
+				<!-- <NAvatar  v-show="isLogin"  size="large"  round  :src="userInfo.avatar"   v-if="userInfo.avatar"  :fallback-src="defaultAvatar"
          class=" cursor-pointer"  /> -->
 
-        <n-popover trigger="click" :show-arrow="false">
-          <template #trigger>
-            <n-avatar v-show="isLogin" size="large" round :src="userInfo.avatar" />
-          </template>
-          <n-menu :options="menuOptions" @select="handleSelect" />
-        </n-popover>
-
-        <div v-show="!isLogin" class="user-bottom" @click="longin">
-          <n-button tertiary type="info">
-            登录
-          </n-button>
-        </div>
-
-      </div>
-
-      
-    </div>
-    
-  </div>
-  <Setting v-if="st.show" v-model:visible="st.show" />
-  <PromptStore v-model:visible="show"></PromptStore>
-  
+				<n-popover trigger="click" :show-arrow="false">
+					<template #trigger>
+						<n-avatar
+							v-show="isLogin"
+							size="large"
+							round
+							:src="userInfo.avatar"
+						/>
+					</template>
+					<n-menu :options="menuOptions" @select="handleSelect" />
+				</n-popover>
+
+				<div v-show="!isLogin" class="user-bottom" @click="longin">
+					<n-button tertiary type="info"> 登录 </n-button>
+				</div>
+			</div>
+		</div>
+	</div>
+	<Setting v-if="st.show" v-model:visible="st.show" />
+	<PromptStore v-model:visible="show"></PromptStore>
 </template>

+ 112 - 91
src/views/store/appList.vue

@@ -1,132 +1,153 @@
 <script setup lang="ts">
-import { ref, computed, onMounted } from 'vue';
-import { NButton, NCard, NAvatar, NPagination, useMessage,NDivider,NTabs, NTabPane,NIcon} from 'naive-ui';
-import { getAppList, Character, copyRoleList } from '@/api/store';
-import to from 'await-to-js';
-import { t } from '@/locales';
-import { useRouter } from 'vue-router'
-import { useAppStore, useChatStore, homeStore } from '@/store'
+import { ref, computed, onMounted } from "vue";
+import {
+	NButton,
+	NCard,
+	NAvatar,
+	NPagination,
+	useMessage,
+	NDivider,
+	NTabs,
+	NTabPane,
+	NIcon,
+} from "naive-ui";
+import { getAppList, Character, copyRoleList } from "@/api/store";
+import to from "await-to-js";
+import { t } from "@/locales";
+import { useRouter } from "vue-router";
+import { useAppStore, useChatStore, homeStore } from "@/store";
 const allData = ref<Character[]>([]);
 const currentPage = ref(1);
 const pageSize = ref(9);
 const message = useMessage();
-const router = useRouter()
+const router = useRouter();
 
 onMounted(async () => {
-  const [err, result] = await to(getAppList());
-  if (err) {
-    message.error(err.message);
-  } else {
-    allData.value = result.data;
-  }
+	const [err, result] = await to(getAppList());
+	if (err) {
+		message.error(err.message);
+	} else {
+		// allData.value = result.data;
+		allData.value = result.data.filter((item) => {
+			return item.name == "知识库";
+		});
+	}
 });
 
 const tableData = computed(() => {
-  const start = (currentPage.value - 1) * pageSize.value;
-  return allData.value.slice(start, start + pageSize.value);
+	const start = (currentPage.value - 1) * pageSize.value;
+	return allData.value.slice(start, start + pageSize.value);
 });
 
 const totalItems = computed(() => {
-  return allData.value ? allData.value.length : 0;
+	return allData.value ? allData.value.length : 0;
 });
 
-
-const appStore = useAppStore()
-const chatStore = useChatStore()
+const appStore = useAppStore();
+const chatStore = useChatStore();
 
 function playApp(url: string) {
-  appStore.setIsChat(false)
-  // 跳转到应用
-  router.push(url)
+	appStore.setIsChat(false);
+	// 跳转到应用
+	router.push(url);
 }
 
 async function handleActionButtonClick(item: Character) {
-  const [err] = await to(copyRoleList(item));
-  if (err) {
-    message.error(err.message);
-  } else {
-    message.success(t('voice.collectionSuccessful'));
-  }
+	const [err] = await to(copyRoleList(item));
+	if (err) {
+		message.error(err.message);
+	} else {
+		message.success(t("voice.collectionSuccessful"));
+	}
 }
-
 </script>
 
 <template>
-  <div class="flex h-full flex-col role-card">
-    <n-tabs type="line" class="tab-bar">
-      <n-tab-pane name="officialRecommend" tab="官网推荐" />
-      <n-tab-pane name="writingAssist" tab="辅助写作" />
-      <n-tab-pane name="socialEntertainment" tab="社交娱乐" />
-      <n-tab-pane name="myFollow" tab="我的关注" />
-    </n-tabs>
-
-    <main class="flex-1 overflow-hidden " style="margin-left: 20px;">
-      <div class="card-container">
-        <n-card v-for="item in tableData" :key="item.id" class="card-item" bordered hoverable>
-          <div class="flex justify-between">
-            <div>
-              <h3>{{ item.name }}</h3>
-              <p class="ellipsis" :title="item.description">{{ item.description || '——' }}</p>
-            </div>
-            <!-- <n-avatar :size="48" :src="item.avatar" /> -->
-           
-            <n-icon size="48">
-              <img :src="item.avatar" alt="Icon" />
-            </n-icon>
-          </div>
-          <n-divider />
-          <div class="flex justify-between mt-4 button-list">
-            <n-button  secondary round type="info" @click="playApp(item.appUrl)">
-              立即体验
-            </n-button>
-            <n-button  secondary round  type="primary">
-              关注
-              <!-- {{ $t('voice.collection') }} -->
-            </n-button>
-          </div>
-        </n-card>
-      </div>
-      <n-pagination :page="currentPage" :page-size="pageSize" :item-count="totalItems"
-        @update:page="currentPage = $event" class="pagination voice-pagination" />
-    </main>
-  </div>
+	<div class="flex h-full flex-col role-card">
+		<n-tabs type="line" class="tab-bar">
+			<n-tab-pane name="officialRecommend" tab="官网推荐" />
+			<n-tab-pane name="writingAssist" tab="辅助写作" />
+			<!-- <n-tab-pane name="socialEntertainment" tab="社交娱乐" /> -->
+			<n-tab-pane name="myFollow" tab="我的关注" />
+		</n-tabs>
+
+		<main class="flex-1 overflow-hidden" style="margin-left: 20px">
+			<div class="card-container">
+				<n-card
+					v-for="item in tableData"
+					:key="item.id"
+					class="card-item"
+					bordered
+					hoverable
+				>
+					<div class="flex justify-between">
+						<div>
+							<h3>{{ item.name }}</h3>
+							<p class="ellipsis" :title="item.description">
+								{{ item.description || "——" }}
+							</p>
+						</div>
+						<!-- <n-avatar :size="48" :src="item.avatar" /> -->
+
+						<n-icon size="48">
+							<img :src="item.avatar" alt="Icon" />
+						</n-icon>
+					</div>
+					<n-divider />
+					<div class="flex justify-between mt-4 button-list">
+						<n-button secondary round type="info" @click="playApp(item.appUrl)">
+							立即体验
+						</n-button>
+						<n-button secondary round type="primary">
+							关注
+							<!-- {{ $t('voice.collection') }} -->
+						</n-button>
+					</div>
+				</n-card>
+			</div>
+			<n-pagination
+				:page="currentPage"
+				:page-size="pageSize"
+				:item-count="totalItems"
+				@update:page="currentPage = $event"
+				class="pagination voice-pagination"
+			/>
+		</main>
+	</div>
 </template>
-  
+
 <style scoped>
 .card-container {
-  display: flex;
-  flex-wrap: wrap;
-  justify-content: flex-start; /* 修改为左边对齐 */
+	display: flex;
+	flex-wrap: wrap;
+	justify-content: flex-start; /* 修改为左边对齐 */
 }
 
 .card-item {
-  width: calc(26%);
-  margin: 12px;
-  border-radius: 10px;
-  height: 28vh;
+	width: calc(26%);
+	margin: 12px;
+	border-radius: 10px;
+	height: 28vh;
 }
 
 .pagination {
-  position: absolute;
-  right: 10px;
-  bottom: 10px;
+	position: absolute;
+	right: 10px;
+	bottom: 10px;
 }
 
 .ellipsis {
-  overflow: hidden;
-  text-overflow: ellipsis;
-  white-space: nowrap;
-  width: 200px; /* Adjust width as needed */
+	overflow: hidden;
+	text-overflow: ellipsis;
+	white-space: nowrap;
+	width: 200px; /* Adjust width as needed */
 }
 
 .tab-bar {
-  margin: 20px 0 20px 20px; /* 上下边距20px,左边边距20px */
-  padding: 10px; /* 添加内边距 */
-  border-radius: 8px; /* 添加圆角 */
-  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* 添加阴影 */
-  transition: all 0.3s ease; /* 添加动效过渡 */
+	margin: 20px 0 20px 20px; /* 上下边距20px,左边边距20px */
+	padding: 10px; /* 添加内边距 */
+	border-radius: 8px; /* 添加圆角 */
+	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* 添加阴影 */
+	transition: all 0.3s ease; /* 添加动效过渡 */
 }
-
-
 </style>
-  

Неке датотеке нису приказане због велике количине промена