20 Commits

Author SHA1 Message Date
kongbeiwu
854bb0bb4c feat: 任务列表更新 2025-12-28 16:07:32 +08:00
kongbeiwu
9cbf239cd3 Merge branch 'main' of https://git.nianxx.cn/duanshuwen/zn-ai into feature/lishaohua 2025-12-28 10:40:41 +08:00
duanshuwen
5caa9a5a4b feat: 新增任务中心页面|右侧菜单调整 2025-12-22 22:56:00 +08:00
DEV_DSW
3396c35bbb feat: 首页调整 2025-12-22 16:34:15 +08:00
DEV_DSW
3b02e08be6 feat: 合并代码 2025-12-22 11:40:43 +08:00
DEV_DSW
6ea7a611df feat: 更新.gitignore 2025-12-22 11:33:50 +08:00
DEV_DSW
c467f54dab feat: 登录接口联调 2025-12-22 11:24:40 +08:00
f7cc822441 Merge pull request 'feature/lishaohua' (#2) from feature/lishaohua into main
Reviewed-on: #2
2025-12-22 01:43:16 +08:00
duanshuwen
72d1869f40 feat: 登录接口环境调试 2025-12-21 22:48:23 +08:00
duanshuwen
2fb6a0d7e9 feat: 登录接口对接 2025-12-21 22:31:16 +08:00
duanshuwen
ef4280e05d feat: 隐藏登录界面未设计功能入口 2025-12-21 20:18:57 +08:00
duanshuwen
062a389c3a feat: 样式调整 2025-12-20 00:02:47 +08:00
duanshuwen
e6fa999137 feat: 登录也加载异常问题处理 2025-12-19 23:12:14 +08:00
duanshuwen
4b4e955b17 feat: 新增加载动画 2025-12-19 22:48:28 +08:00
duanshuwen
0d6ffdef83 feat: 调整项目结构 2025-12-19 13:10:08 +08:00
DEV_DSW
6778c57a0e feat: 新增主进程功能 2025-12-18 16:52:25 +08:00
DEV_DSW
69a8e9472f feat: 重写日志服务 2025-12-18 14:48:38 +08:00
DEV_DSW
8dec7d676e feat: 新增窗口头部组件 2025-12-18 14:35:04 +08:00
duanshuwen
9bfcc49411 feat: 登录验证码接口联调 2025-12-17 22:58:04 +08:00
DEV_DSW
d6578463e3 feat: 新增环境配置文件 2025-12-17 16:53:39 +08:00
27 changed files with 253 additions and 195 deletions

4
.env Normal file
View File

@@ -0,0 +1,4 @@
APIFOX_PROJECT_ID = 7574669
APIFOX_ACCESS_TOKEN = APS-20xZ4VqkdY1I1GC63EPVJHbJGsM4VMqy
VITE_SERVICE_URL = http://8.138.234.141/ingress

1
.gitignore vendored
View File

@@ -58,7 +58,6 @@ typings/
.yarn-integrity .yarn-integrity
# dotenv environment variables file # dotenv environment variables file
.env
.env.test .env.test
# parcel-bundler cache (https://parceljs.org/) # parcel-bundler cache (https://parceljs.org/)

3
global.d.ts vendored
View File

@@ -60,7 +60,8 @@ declare global {
isWindowMaximized: () => Promise<boolean>, isWindowMaximized: () => Promise<boolean>,
viewIsReady: () => void viewIsReady: () => void
app: { app: {
setFrameless: (route?: string) => void setFrameless: (route?: string) => void,
loadPage: (page: string) => void
}, },
tabs: { tabs: {
create: (url?: string) => void, create: (url?: string) => void,

View File

@@ -11,6 +11,6 @@
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>
<script type="module" src="../src/renderer/main.ts"></script> <script type="module" src="../src/renderer/views/home/index.ts"></script>
</body> </body>
</html> </html>

16
html/task.html Normal file
View File

@@ -0,0 +1,16 @@
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>NIANXX</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta
http-equiv="Content-Security-Policy"
content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' http://8.138.234.141; connect-src 'self' http://8.138.234.141 https://api.iconify.design"
/>
</head>
<body>
<div id="app"></div>
<script type="module" src="../src/renderer/views/task/index.ts"></script>
</body>
</html>

43
package-lock.json generated
View File

@@ -1631,47 +1631,6 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/@humanwhocodes/config-array": {
"version": "0.13.0",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz",
"integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==",
"deprecated": "Use @eslint/config-array instead",
"dev": true,
"license": "Apache-2.0",
"peer": true,
"dependencies": {
"@humanwhocodes/object-schema": "^2.0.3",
"debug": "^4.3.1",
"minimatch": "^3.0.5"
},
"engines": {
"node": ">=10.10.0"
}
},
"node_modules/@humanwhocodes/module-importer": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz",
"integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==",
"dev": true,
"license": "Apache-2.0",
"peer": true,
"engines": {
"node": ">=12.22"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/nzakas"
}
},
"node_modules/@humanwhocodes/object-schema": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz",
"integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==",
"deprecated": "Use @eslint/object-schema instead",
"dev": true,
"license": "BSD-3-Clause",
"peer": true
},
"node_modules/@iconify-json/material-symbols": { "node_modules/@iconify-json/material-symbols": {
"version": "1.2.50", "version": "1.2.50",
"resolved": "https://registry.npmmirror.com/@iconify-json/material-symbols/-/material-symbols-1.2.50.tgz", "resolved": "https://registry.npmmirror.com/@iconify-json/material-symbols/-/material-symbols-1.2.50.tgz",
@@ -7502,7 +7461,7 @@
}, },
"node_modules/js-base64": { "node_modules/js-base64": {
"version": "3.7.8", "version": "3.7.8",
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.8.tgz", "resolved": "https://registry.npmmirror.com/js-base64/-/js-base64-3.7.8.tgz",
"integrity": "sha512-hNngCeKxIUQiEUN3GPJOkz4wF/YvdUdbNL9hsBcMQTkKzboD7T/q3OYOuuPZLUE6dBxSGpwhk5mwuDud7JVAow==", "integrity": "sha512-hNngCeKxIUQiEUN3GPJOkz4wF/YvdUdbNL9hsBcMQTkKzboD7T/q3OYOuuPZLUE6dBxSGpwhk5mwuDud7JVAow==",
"license": "BSD-3-Clause" "license": "BSD-3-Clause"
}, },

View File

@@ -7,6 +7,7 @@ export enum IPC_EVENTS {
WINDOW_CLOSE = 'window-close', WINDOW_CLOSE = 'window-close',
IS_WINDOW_MAXIMIZED = 'is-window-maximized', IS_WINDOW_MAXIMIZED = 'is-window-maximized',
APP_SET_FRAMELESS = 'app:set-frameless', APP_SET_FRAMELESS = 'app:set-frameless',
APP_LOAD_PAGE = 'app:load-page',
TAB_CREATE = 'tab:create', TAB_CREATE = 'tab:create',
TAB_LIST = 'tab:list', TAB_LIST = 'tab:list',
TAB_NAVIGATE = 'tab:navigate', TAB_NAVIGATE = 'tab:navigate',

View File

@@ -90,6 +90,10 @@ class WindowService {
ipcMain.on(IPC_EVENTS.WINDOW_MINIMIZE, handleMinimizeWindow); ipcMain.on(IPC_EVENTS.WINDOW_MINIMIZE, handleMinimizeWindow);
ipcMain.on(IPC_EVENTS.WINDOW_MAXIMIZE, handleMaximizeWindow); ipcMain.on(IPC_EVENTS.WINDOW_MAXIMIZE, handleMaximizeWindow);
ipcMain.handle(IPC_EVENTS.IS_WINDOW_MAXIMIZED, handleIsWindowMaximized); 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 { public static getInstance(): WindowService {
@@ -211,12 +215,16 @@ class WindowService {
} }
} }
private _loadWindowTemplate(window: BrowserWindow, name: WindowNames) { private _loadPage(window: BrowserWindow, pageName: string) {
// 检查是否存在开发服务器 URL若存在则表示处于开发环境
if (MAIN_WINDOW_VITE_DEV_SERVER_URL) { 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);
} }

View File

@@ -16,7 +16,8 @@ const api: WindowApi = {
viewIsReady: () => ipcRenderer.send(IPC_EVENTS.RENDERER_IS_READY), viewIsReady: () => ipcRenderer.send(IPC_EVENTS.RENDERER_IS_READY),
app: { 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: { tabs: {

View File

@@ -16,6 +16,7 @@ export function authOauth2TokenUsingPost({
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded', 'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': 'Basic Y3VzdG9tUEM6Y3VzdG9tUEM=',
}, },
data: body, data: body,
...(options || {}), ...(options || {}),

View File

@@ -8,23 +8,23 @@
<native-tooltip :content="t('window.minimize')"> <native-tooltip :content="t('window.minimize')">
<button v-show="isMinimizable" class="flex items-center justify-center cursor-pointer w-[40px] h-[40px]" <button v-show="isMinimizable" class="flex items-center justify-center cursor-pointer w-[40px] h-[40px]"
@click="minimizeWindow"> @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" /> :height="btnSize" />
</button> </button>
</native-tooltip> </native-tooltip>
<native-tooltip :content="isMaximized ? t('window.restore') : t('window.maximize')"> <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]" <button v-show="isMaximizable" class="flex items-center justify-center cursor-pointer w-[40px] h-[40px]"
@click="maximizeWindow"> @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" /> :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" /> :height="btnSize" v-show="isMaximized" />
</button> </button>
</native-tooltip> </native-tooltip>
<native-tooltip :content="t('window.close')"> <native-tooltip :content="t('window.close')">
<button v-show="isClosable" class="flex items-center justify-center cursor-pointer w-[40px] h-[40px]" <button v-show="isClosable" class="flex items-center justify-center cursor-pointer w-[40px] h-[40px]"
@click="handleClose"> @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> </button>
</native-tooltip> </native-tooltip>
</div> </div>
@@ -71,6 +71,6 @@ function handleClose() {
<style scoped> <style scoped>
.title-bar { .title-bar {
background-color: rgba(255, 255, 255, 0.2); background-color: rgba(239, 246, 255, 0.8);
} }
</style> </style>

View 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>

View File

@@ -1,6 +1,6 @@
<template> <template>
<div class="w-[80px] h-full box-border flex flex-col items-center justify-center"> <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 === 7 }]" <div :class="['flex flex-col gap-[16px]', { 'mt-auto mb-[8px] shrink-1': item.id === 4 }]"
v-for="(item) in menus" :key="item.id"> v-for="(item) in menus" :key="item.id">
<div :class="['cursor-pointer flex flex-col items-center justify-center']" @click="handleClick(item)"> <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 }]"> <div :class="['box-border rounded-[16px] p-[8px]', { 'bg-white': item.id === currentId }]">
@@ -23,9 +23,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue' import { ref } from 'vue'
import { menus } from '@constant/menus' 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 currentId = ref(1)
const handleClick = async (item: any) => { const handleClick = async (item: any) => {

View File

@@ -2,7 +2,7 @@
* @Author: kongbeiwu lishaohua-520@qq.com * @Author: kongbeiwu lishaohua-520@qq.com
* @Date: 2025-12-21 23:02:06 * @Date: 2025-12-21 23:02:06
* @LastEditors: kongbeiwu lishaohua-520@qq.com * @LastEditors: kongbeiwu lishaohua-520@qq.com
* @LastEditTime: 2025-12-22 00:34:30 * @LastEditTime: 2025-12-28 11:09:00
* @FilePath: /project/zn-ai/src/renderer/components/TaskList/Card.vue * @FilePath: /project/zn-ai/src/renderer/components/TaskList/Card.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
--> -->
@@ -10,8 +10,11 @@
<div v-for="item in task" :key="item.id" <div v-for="item in task" :key="item.id"
class="border border-solid border-[#E5E8EE] rounded-[12px] p-[12px] mb-[12px] task"> class="border border-solid border-[#E5E8EE] rounded-[12px] p-[12px] mb-[12px] task">
<div class="flex items-center pb-[12px]" style="border-bottom: 1px dashed #E5E8EE;"> <div class="flex items-center pb-[12px]" style="border-bottom: 1px dashed #E5E8EE;">
<img class="w-[24px] h-[24px] rounded-[8px]] mr-[4px]" src="@assets/images/task/xc.png" /> <!-- <img class="w-[24px] h-[24px] rounded-[8px]] mr-[4px]" src="@assets/images/task/xc.png" /> -->
<div class="text-[16px] text-[#171717] font-bold mr-[8px]">{{ item.name }}</div> <div
class="w-[24px] h-[24px] rounded-[4px] bg-[#EFF6FF] text-[#2B7FFF] text-[14px] font-bold border border-solid border-[#BEDBFF] flex justify-center items-center">
{{ item.name[0] }}</div>
<div class="text-[16px] text-[#171717] font-bold mr-[8px] ml-[4px]">{{ item.name }}</div>
<div class="pl-[8px] pr-[8px] text-[12px] rounded-[100px]" :class="item.statusColor">{{ <div class="pl-[8px] pr-[8px] text-[12px] rounded-[100px]" :class="item.statusColor">{{
item.statusText }}</div> item.statusText }}</div>
</div> </div>
@@ -20,7 +23,8 @@
<div class="text-[14px]" :class="`text-[${item.color}]`" :style="{ color: item.color }">{{ item.des }}</div> <div class="text-[14px]" :class="`text-[${item.color}]`" :style="{ color: item.color }">{{ item.des }}</div>
</div> </div>
<div class="mt-[24px]"> <div class="mt-[24px]">
<button class="w-[100%] h-[40px] bg-[#2B7FFF] text-white text-[14px] rounded-[12px]">{{ item.statusColor !== 'error' ? '查看' : '处理' }}</button> <button class="w-[100%] h-[40px] bg-[#2B7FFF] text-white text-[14px] rounded-[12px]">{{ item.statusColor !==
'error' ? '查看' : '处理' }}</button>
</div> </div>
</div> </div>
</template> </template>
@@ -36,14 +40,17 @@ import { task } from '@constant/task'
z-index: 1; z-index: 1;
transition: all .2s linear; transition: all .2s linear;
} }
.task .success { .task .success {
background-color: #E0FAEC; background-color: #E0FAEC;
color: #1FC16B; color: #1FC16B;
} }
.task .error { .task .error {
background-color: #FFEBEC; background-color: #FFEBEC;
color: #FB3748; color: #FB3748;
} }
.task .warning { .task .warning {
background-color: #FFF3EB; background-color: #FFF3EB;
color: #FA7319; color: #FA7319;
@@ -53,5 +60,4 @@ import { task } from '@constant/task'
z-index: 2; z-index: 2;
box-shadow: 0 10px 20px rgba(0, 0, 0, .1); box-shadow: 0 10px 20px rgba(0, 0, 0, .1);
transform: translate3d(0, -2px, 0); transform: translate3d(0, -2px, 0);
} }</style>
</style>

View File

@@ -1,12 +1,4 @@
/* import { RiHomeLine, RiFileEditLine, RiApps2AiLine, RiSettingsLine } from '@remixicon/vue'
* @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'
// 菜单列表申明 // 菜单列表申明
export interface MenuItem { export interface MenuItem {
@@ -27,56 +19,24 @@ export const menus: MenuItem[] = [
activeColor: '#2B7FFF', activeColor: '#2B7FFF',
url: '/home', url: '/home',
}, },
{ {
id: 8, id: 2,
name: '知识库', name: '知识库',
icon: RiFileEditLine, icon: RiFileEditLine,
color: '#525866', color: '#525866',
activeColor: '#2B7FFF', activeColor: '#2B7FFF',
url: '/knowledge', url: '/knowledge',
}, },
{
id: 2,
name: '订单',
icon: RiFileListLine,
color: '#525866',
activeColor: '#2B7FFF',
url: '/order',
},
{ {
id: 3, id: 3,
name: '库存', name: '任务中心',
icon: RiHotelLine, icon: RiApps2AiLine,
color: '#525866', color: '#525866',
activeColor: '#2B7FFF', activeColor: '#2B7FFF',
url: '/stock', url: '/stock',
}, },
{ {
id: 4, 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: '设置', name: '设置',
icon: RiSettingsLine, icon: RiSettingsLine,
color: '#525866', color: '#525866',

View File

@@ -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>

View File

@@ -3,8 +3,12 @@ import { createPinia } from "pinia"
import errorHandler from "@utils/errorHandler" import errorHandler from "@utils/errorHandler"
import router from "./router" import router from "./router"
import App from "./App.vue" import App from "./App.vue"
// 引入 Element Plus 组件库
import ElementPlus from 'element-plus' import ElementPlus from 'element-plus'
import locale from 'element-plus/es/locale/lang/zh-cn' import locale from 'element-plus/es/locale/lang/zh-cn'
// 引入 i18n 插件
import i18n from './i18n' import i18n from './i18n'
// import './permission' // import './permission'

View File

@@ -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"; import { createRouter, createMemoryHistory } from "vue-router";
const routes = [ const routes = [
{ {
path: "/", path: '/',
component: () => import("@renderer/views/login/index.vue"), redirect: '/home'
name: "Login", },
meta: { requiresAuth: false }, {
} path: "/home",
component: () => import("@renderer/views/home/index.vue"),
name: "Home",
meta: { requiresAuth: true },
},
]; ];
const router = createRouter({ 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; export default router;

View File

@@ -6,7 +6,8 @@ import { getToken } from '@utils/auth'
import { tansParams } from '@utils/tansParams' import { tansParams } from '@utils/tansParams'
// 获取.env中的服务地址 // 获取.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 } export let isRelogin = { show: false }
@@ -15,7 +16,7 @@ axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
// 创建axios对象 // 创建axios对象
const instance = axios.create({ const instance = axios.create({
baseURL: VITE_SERVICE_URL, baseURL: DEV ? '/ingress' : VITE_SERVICE_URL,
// 超时 // 超时
timeout: 10000 timeout: 10000
}) })

View 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");

View File

@@ -1,6 +1,12 @@
<template> <template>
<div> <div class="bg h-screen flex flex-col">
首页 <header-bar>
<drag-region class="w-full" />
</header-bar>
<layout>
</layout>
</div> </div>
</template> </template>

View File

@@ -1,16 +1,38 @@
import '@renderer/styles/index.css' import { createApp, type Plugin } from "vue"
import errorHandler from '@utils/errorHandler' 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 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' import Login from './index.vue'
createApp(Login) // 样式文件隔离
.use(i18n) import '@renderer/styles/index.css'
.use(createPinia()) import 'element-plus/dist/index.css'
.use(errorHandler)
.component('HeaderBar', HeaderBar) // 引入全局组件
.component('DragRegion', DragRegion) import HeaderBar from '@components/HeaderBar/index.vue'
.mount('#app') 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");

View File

@@ -32,7 +32,8 @@
</el-form-item> </el-form-item>
<el-form-item prop="password"> <el-form-item prop="password">
<div class="text-[14px] text-gray-600">密码</div> <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> <template #prefix>
<RiKey2Fill size="20px" color="#99A0AE" /> <RiKey2Fill size="20px" color="#99A0AE" />
</template> </template>
@@ -75,12 +76,12 @@
</el-form> </el-form>
<!-- Copy Right --> <!-- 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 贵州智念科技服务有限公司 版权所有 © 2025 贵州智念科技服务有限公司 版权所有
</div> </div> -->
</div> </div>
<img class="w-[540px]" src="@assets/images/login/logo.png" /> <!-- <img class="w-[540px]" src="@assets/images/login/logo.png" /> -->
</main> </main>
</div> </div>
</template> </template>
@@ -122,8 +123,7 @@ const onSubmit = async () => {
try { try {
userStore.login(form).then(() => { userStore.login(form).then(() => {
// window.location.href = 'index.html' window.api.app.loadPage('index');
console.log(form)
}) })
} finally { } finally {
getVerifyCode() getVerifyCode()

View File

@@ -1,7 +0,0 @@
<template>
<div>更多</div>
</template>
<script setup lang="ts">
</script>

View 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");

View 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>

View File

@@ -25,6 +25,8 @@ export default defineConfig(async () => {
resolve(__dirname, 'html/index.html'), resolve(__dirname, 'html/index.html'),
resolve(__dirname, 'html/dialog.html'), resolve(__dirname, 'html/dialog.html'),
resolve(__dirname, 'html/setting.html'), resolve(__dirname, 'html/setting.html'),
resolve(__dirname, 'html/login.html'),
resolve(__dirname, 'html/task.html'),
] ]
} }
}, },
@@ -44,5 +46,14 @@ export default defineConfig(async () => {
"@locales": resolve(__dirname, "locales"), "@locales": resolve(__dirname, "locales"),
}, },
}, },
server: {
proxy: {
'/ingress': {
target: 'http://8.138.234.141',
changeOrigin: true,
},
},
},
} }
}); });