Merge branch 'main' of https://git.nianxx.cn/duanshuwen/zn-ai into feature/lishaohua
This commit is contained in:
@@ -7,6 +7,7 @@ export enum IPC_EVENTS {
|
||||
WINDOW_CLOSE = 'window-close',
|
||||
IS_WINDOW_MAXIMIZED = 'is-window-maximized',
|
||||
APP_SET_FRAMELESS = 'app:set-frameless',
|
||||
APP_LOAD_PAGE = 'app:load-page',
|
||||
TAB_CREATE = 'tab:create',
|
||||
TAB_LIST = 'tab:list',
|
||||
TAB_NAVIGATE = 'tab:navigate',
|
||||
|
||||
@@ -90,6 +90,10 @@ class WindowService {
|
||||
ipcMain.on(IPC_EVENTS.WINDOW_MINIMIZE, handleMinimizeWindow);
|
||||
ipcMain.on(IPC_EVENTS.WINDOW_MAXIMIZE, handleMaximizeWindow);
|
||||
ipcMain.handle(IPC_EVENTS.IS_WINDOW_MAXIMIZED, handleIsWindowMaximized);
|
||||
ipcMain.handle(IPC_EVENTS.APP_LOAD_PAGE, (e: IpcMainInvokeEvent, page: string) => {
|
||||
const win = BrowserWindow.fromWebContents(e.sender);
|
||||
if (win) this._loadPage(win, page);
|
||||
});
|
||||
}
|
||||
|
||||
public static getInstance(): WindowService {
|
||||
@@ -211,12 +215,16 @@ class WindowService {
|
||||
}
|
||||
}
|
||||
|
||||
private _loadWindowTemplate(window: BrowserWindow, name: WindowNames) {
|
||||
// 检查是否存在开发服务器 URL,若存在则表示处于开发环境
|
||||
private _loadPage(window: BrowserWindow, pageName: string) {
|
||||
if (MAIN_WINDOW_VITE_DEV_SERVER_URL) {
|
||||
return window.loadURL(`${MAIN_WINDOW_VITE_DEV_SERVER_URL}${'/html/' + (name === 'main' ? '' : name)}`);
|
||||
return window.loadURL(`${MAIN_WINDOW_VITE_DEV_SERVER_URL}/html/${pageName}.html`);
|
||||
}
|
||||
window.loadFile(path.join(__dirname, `../renderer/${MAIN_WINDOW_VITE_NAME}/html/${name === 'main' ? 'login' : name}.html`));
|
||||
window.loadFile(path.join(__dirname, `../renderer/${MAIN_WINDOW_VITE_NAME}/html/${pageName}.html`));
|
||||
}
|
||||
|
||||
private _loadWindowTemplate(window: BrowserWindow, name: WindowNames) {
|
||||
const page = name === 'main' ? 'login' : name;
|
||||
this._loadPage(window, page);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@ const api: WindowApi = {
|
||||
viewIsReady: () => ipcRenderer.send(IPC_EVENTS.RENDERER_IS_READY),
|
||||
|
||||
app: {
|
||||
setFrameless: (route?: string) => ipcRenderer.invoke(IPC_EVENTS.APP_SET_FRAMELESS, route)
|
||||
setFrameless: (route?: string) => ipcRenderer.invoke(IPC_EVENTS.APP_SET_FRAMELESS, route),
|
||||
loadPage: (page: string) => ipcRenderer.invoke(IPC_EVENTS.APP_LOAD_PAGE, page)
|
||||
},
|
||||
|
||||
tabs: {
|
||||
|
||||
@@ -16,6 +16,7 @@ export function authOauth2TokenUsingPost({
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Authorization': 'Basic Y3VzdG9tUEM6Y3VzdG9tUEM=',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
|
||||
@@ -8,23 +8,23 @@
|
||||
<native-tooltip :content="t('window.minimize')">
|
||||
<button v-show="isMinimizable" class="flex items-center justify-center cursor-pointer w-[40px] h-[40px]"
|
||||
@click="minimizeWindow">
|
||||
<iconify-icon icon="material-symbols:check-indeterminate-small" color="#ffffff" :width="btnSize"
|
||||
<iconify-icon icon="material-symbols:check-indeterminate-small" color="#525866" :width="btnSize"
|
||||
:height="btnSize" />
|
||||
</button>
|
||||
</native-tooltip>
|
||||
<native-tooltip :content="isMaximized ? t('window.restore') : t('window.maximize')">
|
||||
<button v-show="isMaximizable" class="flex items-center justify-center cursor-pointer w-[40px] h-[40px]"
|
||||
@click="maximizeWindow">
|
||||
<iconify-icon icon="material-symbols:chrome-maximize-outline-sharp" color="#ffffff" :width="btnSize"
|
||||
<iconify-icon icon="material-symbols:chrome-maximize-outline-sharp" color="#525866" :width="btnSize"
|
||||
:height="btnSize" v-show="!isMaximized" />
|
||||
<iconify-icon icon="material-symbols:chrome-restore-outline-sharp" color="#ffffff" :width="btnSize"
|
||||
<iconify-icon icon="material-symbols:chrome-restore-outline-sharp" color="#525866" :width="btnSize"
|
||||
:height="btnSize" v-show="isMaximized" />
|
||||
</button>
|
||||
</native-tooltip>
|
||||
<native-tooltip :content="t('window.close')">
|
||||
<button v-show="isClosable" class="flex items-center justify-center cursor-pointer w-[40px] h-[40px]"
|
||||
@click="handleClose">
|
||||
<iconify-icon icon="material-symbols:close" color="#ffffff" :width="btnSize" :height="btnSize" />
|
||||
<iconify-icon icon="material-symbols:close" color="#525866" :width="btnSize" :height="btnSize" />
|
||||
</button>
|
||||
</native-tooltip>
|
||||
</div>
|
||||
@@ -71,6 +71,6 @@ function handleClose() {
|
||||
|
||||
<style scoped>
|
||||
.title-bar {
|
||||
background-color: rgba(255, 255, 255, 0.2);
|
||||
background-color: rgba(239, 246, 255, 0.8);
|
||||
}
|
||||
</style>
|
||||
|
||||
18
src/renderer/components/Layout/index.vue
Normal file
18
src/renderer/components/Layout/index.vue
Normal file
@@ -0,0 +1,18 @@
|
||||
<template>
|
||||
<main class="bg-white box-border w-full h-screen flex pt-[8px] pb-[8px] pl-[8px] ">
|
||||
<div class="flex-1 flex gap-[8px]">
|
||||
<div class="flex-1 h-full">
|
||||
|
||||
</div>
|
||||
|
||||
<TaskList />
|
||||
</div>
|
||||
|
||||
<SideMenus />
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="Layout">
|
||||
import TaskList from '@renderer/components/TaskList/index.vue'
|
||||
import SideMenus from '@renderer/components/SideMenus/index.vue'
|
||||
</script>
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="w-[80px] h-full box-border flex flex-col items-center justify-center">
|
||||
<div :class="['flex flex-col gap-[16px]', { 'mt-auto mb-[8px] shrink-1': item.id === 7 }]"
|
||||
<div class="w-[80px] h-full box-border flex flex-col items-center pb-[8px]">
|
||||
<div :class="['flex flex-col gap-[16px]', { 'mt-auto mb-[8px] shrink-1': item.id === 4 }]"
|
||||
v-for="(item) in menus" :key="item.id">
|
||||
<div :class="['cursor-pointer flex flex-col items-center justify-center']" @click="handleClick(item)">
|
||||
<div :class="['box-border rounded-[16px] p-[8px]', { 'bg-white': item.id === currentId }]">
|
||||
@@ -23,9 +23,9 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { menus } from '@constant/menus'
|
||||
import { useRouter } from "vue-router";
|
||||
import { useRouter } from "vue-router"
|
||||
|
||||
const router = useRouter();
|
||||
const router = useRouter()
|
||||
const currentId = ref(1)
|
||||
|
||||
const handleClick = async (item: any) => {
|
||||
@@ -1,12 +1,4 @@
|
||||
/*
|
||||
* @Author: kongbeiwu lishaohua-520@qq.com
|
||||
* @Date: 2025-12-21 23:02:06
|
||||
* @LastEditors: kongbeiwu lishaohua-520@qq.com
|
||||
* @LastEditTime: 2025-12-22 00:42:49
|
||||
* @FilePath: /project/zn-ai/src/renderer/constant/menus.ts
|
||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
*/
|
||||
import { RiHomeLine, RiFileEditLine, RiFileListLine, RiHotelLine, RiChatQuoteLine, RiBarChartBoxAiLine, RiMoreLine, RiSettingsLine } from '@remixicon/vue'
|
||||
import { RiHomeLine, RiFileEditLine, RiApps2AiLine, RiSettingsLine } from '@remixicon/vue'
|
||||
|
||||
// 菜单列表申明
|
||||
export interface MenuItem {
|
||||
@@ -27,56 +19,24 @@ export const menus: MenuItem[] = [
|
||||
activeColor: '#2B7FFF',
|
||||
url: '/home',
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
{
|
||||
id: 2,
|
||||
name: '知识库',
|
||||
icon: RiFileEditLine,
|
||||
color: '#525866',
|
||||
activeColor: '#2B7FFF',
|
||||
url: '/knowledge',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '订单',
|
||||
icon: RiFileListLine,
|
||||
color: '#525866',
|
||||
activeColor: '#2B7FFF',
|
||||
url: '/order',
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: '库存',
|
||||
icon: RiHotelLine,
|
||||
name: '任务中心',
|
||||
icon: RiApps2AiLine,
|
||||
color: '#525866',
|
||||
activeColor: '#2B7FFF',
|
||||
url: '/stock',
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: '评价',
|
||||
icon: RiChatQuoteLine,
|
||||
color: '#525866',
|
||||
activeColor: '#2B7FFF',
|
||||
url: '/rate',
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: '数据看板',
|
||||
icon: RiBarChartBoxAiLine,
|
||||
color: '#525866',
|
||||
activeColor: '#2B7FFF',
|
||||
url: '/dashboard',
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: '更多',
|
||||
icon: RiMoreLine,
|
||||
color: '#525866',
|
||||
activeColor: '#2B7FFF',
|
||||
url: '/more',
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: '设置',
|
||||
icon: RiSettingsLine,
|
||||
color: '#525866',
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
<template>
|
||||
<div class="bg box-border w-full h-screen flex pt-[8px] pb-[8px] pl-[8px] ">
|
||||
<div class="flex-1 flex gap-[8px]">
|
||||
<div class="flex-1 h-full">
|
||||
<router-view v-slot="{ Component, route }">
|
||||
<transition name="fade-transform" mode="out-in">
|
||||
<keep-alive>
|
||||
<component :is="Component" :key="route.path" />
|
||||
</keep-alive>
|
||||
</transition>
|
||||
</router-view>
|
||||
</div>
|
||||
|
||||
<TaskList />
|
||||
</div>
|
||||
|
||||
<Menus />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="Layout">
|
||||
import TaskList from '@renderer/components/TaskList/index.vue'
|
||||
import Menus from '@renderer/components/Menus/index.vue'
|
||||
</script>
|
||||
@@ -3,8 +3,12 @@ import { createPinia } from "pinia"
|
||||
import errorHandler from "@utils/errorHandler"
|
||||
import router from "./router"
|
||||
import App from "./App.vue"
|
||||
|
||||
// 引入 Element Plus 组件库
|
||||
import ElementPlus from 'element-plus'
|
||||
import locale from 'element-plus/es/locale/lang/zh-cn'
|
||||
|
||||
// 引入 i18n 插件
|
||||
import i18n from './i18n'
|
||||
// import './permission'
|
||||
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
/*
|
||||
* @Author: kongbeiwu lishaohua-520@qq.com
|
||||
* @Date: 2025-12-22 01:28:13
|
||||
* @LastEditors: kongbeiwu lishaohua-520@qq.com
|
||||
* @LastEditTime: 2025-12-22 01:31:48
|
||||
* @FilePath: /project/zn-ai/src/renderer/router/index.ts
|
||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
*/
|
||||
import { createRouter, createMemoryHistory } from "vue-router";
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: "/",
|
||||
component: () => import("@renderer/views/login/index.vue"),
|
||||
name: "Login",
|
||||
meta: { requiresAuth: false },
|
||||
}
|
||||
path: '/',
|
||||
redirect: '/home'
|
||||
},
|
||||
{
|
||||
path: "/home",
|
||||
component: () => import("@renderer/views/home/index.vue"),
|
||||
name: "Home",
|
||||
meta: { requiresAuth: true },
|
||||
},
|
||||
];
|
||||
|
||||
const router = createRouter({
|
||||
@@ -29,24 +25,4 @@ const router = createRouter({
|
||||
},
|
||||
});
|
||||
|
||||
// router.beforeEach((to: any, from: any, next: any) => {
|
||||
// const token = localStorage.getItem("token");
|
||||
// if (to.meta && (to.meta as any).requiresAuth && !token) {
|
||||
// next({ path: "/login" });
|
||||
// return;
|
||||
// }
|
||||
|
||||
// if (token && to.path === "/login") {
|
||||
// next({ path: "/home" });
|
||||
// return;
|
||||
// }
|
||||
|
||||
// if (token && to.path === "/") {
|
||||
// next({ path: "/home" });
|
||||
// return;
|
||||
// }
|
||||
|
||||
// next();
|
||||
// });
|
||||
|
||||
export default router;
|
||||
|
||||
@@ -6,7 +6,8 @@ import { getToken } from '@utils/auth'
|
||||
import { tansParams } from '@utils/tansParams'
|
||||
|
||||
// 获取.env中的服务地址
|
||||
const { VITE_SERVICE_URL } = (import.meta as any).env
|
||||
const { VITE_SERVICE_URL, DEV } = (import.meta as any).env
|
||||
console.log("🚀 ~ DEV:", DEV)
|
||||
|
||||
// 是否显示重新登录
|
||||
export let isRelogin = { show: false }
|
||||
@@ -15,7 +16,7 @@ axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
|
||||
|
||||
// 创建axios对象
|
||||
const instance = axios.create({
|
||||
baseURL: VITE_SERVICE_URL,
|
||||
baseURL: DEV ? '/ingress' : VITE_SERVICE_URL,
|
||||
// 超时
|
||||
timeout: 10000
|
||||
})
|
||||
|
||||
40
src/renderer/views/home/index.ts
Normal file
40
src/renderer/views/home/index.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { createApp, type Plugin } from "vue"
|
||||
import errorHandler from '@utils/errorHandler'
|
||||
|
||||
// 引入 Element Plus 组件库
|
||||
import ElementPlus from 'element-plus'
|
||||
import locale from 'element-plus/es/locale/lang/zh-cn'
|
||||
|
||||
// 引入 i18n 插件
|
||||
import i18n from '@renderer/i18n'
|
||||
|
||||
import Home from './index.vue'
|
||||
|
||||
// 样式文件隔离
|
||||
import '@renderer/styles/index.css'
|
||||
import 'element-plus/dist/index.css'
|
||||
|
||||
// 引入全局组件
|
||||
import HeaderBar from '@components/HeaderBar/index.vue'
|
||||
import DragRegion from '@components/DragRegion/index.vue'
|
||||
import Layout from '@components/Layout/index.vue'
|
||||
|
||||
const components: Plugin = (app) => {
|
||||
app.component('HeaderBar', HeaderBar);
|
||||
app.component('DragRegion', DragRegion);
|
||||
app.component('Layout', Layout);
|
||||
}
|
||||
|
||||
// 创建 Vue 应用实例
|
||||
const app = createApp(Home);
|
||||
const pinia = createPinia();
|
||||
|
||||
// 使用 Pinia 状态管理
|
||||
app.use(pinia);
|
||||
app.use(ElementPlus, { locale })
|
||||
app.use(components)
|
||||
app.use(i18n)
|
||||
app.use(errorHandler)
|
||||
|
||||
// 挂载应用到 DOM
|
||||
app.mount("#app");
|
||||
@@ -1,6 +1,12 @@
|
||||
<template>
|
||||
<div>
|
||||
首页
|
||||
<div class="bg h-screen flex flex-col">
|
||||
<header-bar>
|
||||
<drag-region class="w-full" />
|
||||
</header-bar>
|
||||
|
||||
<layout>
|
||||
|
||||
</layout>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -1,16 +1,38 @@
|
||||
import '@renderer/styles/index.css'
|
||||
|
||||
import { createApp, type Plugin } from "vue"
|
||||
import errorHandler from '@utils/errorHandler'
|
||||
|
||||
// 引入 Element Plus 组件库
|
||||
import ElementPlus from 'element-plus'
|
||||
import locale from 'element-plus/es/locale/lang/zh-cn'
|
||||
|
||||
// 引入 i18n 插件
|
||||
import i18n from '@renderer/i18n'
|
||||
import HeaderBar from '@renderer/components/HeaderBar/index.vue'
|
||||
import DragRegion from '@renderer/components/DragRegion/index.vue'
|
||||
|
||||
import Login from './index.vue'
|
||||
|
||||
createApp(Login)
|
||||
.use(i18n)
|
||||
.use(createPinia())
|
||||
.use(errorHandler)
|
||||
.component('HeaderBar', HeaderBar)
|
||||
.component('DragRegion', DragRegion)
|
||||
.mount('#app')
|
||||
// 样式文件隔离
|
||||
import '@renderer/styles/index.css'
|
||||
import 'element-plus/dist/index.css'
|
||||
|
||||
// 引入全局组件
|
||||
import HeaderBar from '@components/HeaderBar/index.vue'
|
||||
import DragRegion from '@components/DragRegion/index.vue'
|
||||
|
||||
const components: Plugin = (app) => {
|
||||
app.component('HeaderBar', HeaderBar);
|
||||
app.component('DragRegion', DragRegion);
|
||||
}
|
||||
|
||||
// 创建 Vue 应用实例
|
||||
const app = createApp(Login);
|
||||
const pinia = createPinia();
|
||||
|
||||
// 使用 Pinia 状态管理
|
||||
app.use(pinia);
|
||||
app.use(ElementPlus, { locale })
|
||||
app.use(components)
|
||||
app.use(i18n)
|
||||
app.use(errorHandler)
|
||||
|
||||
// 挂载应用到 DOM
|
||||
app.mount("#app");
|
||||
|
||||
@@ -32,7 +32,8 @@
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<div class="text-[14px] text-gray-600">密码</div>
|
||||
<el-input class="h-[40px]" v-model.trim="form.password" placeholder="请输入密码" clearable autocomplete="off">
|
||||
<el-input class="h-[40px]" v-model.trim="form.password" type="password" placeholder="请输入密码" clearable
|
||||
autocomplete="off">
|
||||
<template #prefix>
|
||||
<RiKey2Fill size="20px" color="#99A0AE" />
|
||||
</template>
|
||||
@@ -75,12 +76,12 @@
|
||||
</el-form>
|
||||
|
||||
<!-- Copy Right -->
|
||||
<div class="text-[14px] text-gray-500 text-center mt-auto">
|
||||
<!-- <div class="text-[14px] text-gray-500 text-center mt-auto">
|
||||
© 2025 贵州智念科技服务有限公司 版权所有
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<img class="w-[540px]" src="@assets/images/login/logo.png" />
|
||||
<!-- <img class="w-[540px]" src="@assets/images/login/logo.png" /> -->
|
||||
</main>
|
||||
</div>
|
||||
</template>
|
||||
@@ -122,8 +123,7 @@ const onSubmit = async () => {
|
||||
|
||||
try {
|
||||
userStore.login(form).then(() => {
|
||||
// window.location.href = 'index.html'
|
||||
console.log(form)
|
||||
window.api.app.loadPage('index');
|
||||
})
|
||||
} finally {
|
||||
getVerifyCode()
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
<template>
|
||||
<div>更多</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
</script>
|
||||
40
src/renderer/views/task/index.ts
Normal file
40
src/renderer/views/task/index.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { createApp, type Plugin } from "vue"
|
||||
import errorHandler from '@utils/errorHandler'
|
||||
|
||||
// 引入 Element Plus 组件库
|
||||
import ElementPlus from 'element-plus'
|
||||
import locale from 'element-plus/es/locale/lang/zh-cn'
|
||||
|
||||
// 引入 i18n 插件
|
||||
import i18n from '@renderer/i18n'
|
||||
|
||||
import Task from './index.vue'
|
||||
|
||||
// 样式文件隔离
|
||||
import '@renderer/styles/index.css'
|
||||
import 'element-plus/dist/index.css'
|
||||
|
||||
// 引入全局组件
|
||||
import HeaderBar from '@components/HeaderBar/index.vue'
|
||||
import DragRegion from '@components/DragRegion/index.vue'
|
||||
import Layout from '@components/Layout/index.vue'
|
||||
|
||||
const components: Plugin = (app) => {
|
||||
app.component('HeaderBar', HeaderBar);
|
||||
app.component('DragRegion', DragRegion);
|
||||
app.component('Layout', Layout);
|
||||
}
|
||||
|
||||
// 创建 Vue 应用实例
|
||||
const app = createApp(Task);
|
||||
const pinia = createPinia();
|
||||
|
||||
// 使用 Pinia 状态管理
|
||||
app.use(pinia);
|
||||
app.use(ElementPlus, { locale })
|
||||
app.use(components)
|
||||
app.use(i18n)
|
||||
app.use(errorHandler)
|
||||
|
||||
// 挂载应用到 DOM
|
||||
app.mount("#app");
|
||||
15
src/renderer/views/task/index.vue
Normal file
15
src/renderer/views/task/index.vue
Normal file
@@ -0,0 +1,15 @@
|
||||
<template>
|
||||
<div class="bg-gray-100 h-screen flex flex-col">
|
||||
<header-bar>
|
||||
<drag-region class="w-full" />
|
||||
</header-bar>
|
||||
|
||||
<layout>
|
||||
|
||||
</layout>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user