panqiuyao 8 ay önce
ebeveyn
işleme
785a37f244

+ 3 - 3
electron/config/config.default.js

@@ -32,10 +32,10 @@ module.exports = (appInfo) => {
   //  fullscreen: true,
    // titleBarStyle: 'hiddenInset', // 部分系统可能需要自定义标题栏样式
     webPreferences: {
-      //webSecurity: false,
+      webSecurity: false,
       contextIsolation: false, // false -> 可在渲染进程中使用electron的api,true->需要bridge.js(contextBridge)
       nodeIntegration: true,
-      //preload: path.join(appInfo.baseDir, 'preload', 'bridge.js'),
+      preload: path.join(appInfo.baseDir, 'preload', 'bridge.js'),
     },
     show: false,
     icon: path.join(appInfo.home, 'public', 'images', 'logo-32.png'),
@@ -90,7 +90,7 @@ module.exports = (appInfo) => {
    * 内置http服务
    */
   config.httpServer = {
-    enable: false,
+    enable: true,
     https: {
       enable: false,
       key: '/public/ssl/localhost+1.key',

+ 6 - 1
electron/controller/utils.js

@@ -2,6 +2,7 @@
 
 const { Controller } = require('ee-core');
 const { shell  } = require('electron');
+const Addon = require('ee-core/addon');
 const { dialog } = require('electron');
 const fs = require('fs');
 const path = require('path');
@@ -39,14 +40,18 @@ class UtilsController extends Controller {
 
 
   async openMain (config) {
+
+
     if( this.app.electron[config.id]) return;
     const win = new BrowserWindow({
       ...config,
 
       webPreferences: {
+        webSecurity: false,
         contextIsolation: false, // false -> 可在渲染进程中使用electron的api,true->需要bridge.js(contextBridge)
         nodeIntegration: true,
-        preload: path.join('../preload/bridge.js'),
+        preload: path.join('../preload/preload.js','../preload/bridge.js'),
+
       },
     });
     win.loadURL(config.url); // 设置窗口的 URL

+ 1 - 1
frontend/.env.development

@@ -1,2 +1,2 @@
 NODE_ENV=development
-API_HOST = //dev2.pubdata.cn
+API_HOST =  dev2.pubdata.cn

+ 1 - 1
frontend/.env.production

@@ -1,3 +1,3 @@
 NODE_ENV=production
-API_HOST = //dev.valimart.net
+API_HOST = http://dev.valimart.net
 

+ 2 - 1
frontend/package.json

@@ -20,8 +20,9 @@
     "vue-router": "4.5.0"
   },
   "devDependencies": {
-    "@types/node": "22.13.5",
+    "@rollup/plugin-replace": "^6.0.2",
     "@types/crypto-js": "4.1.1",
+    "@types/node": "22.13.5",
     "@vitejs/plugin-vue": "5.2.1",
     "@vue/tsconfig": "0.7.0",
     "sass-embedded": "^1.85.1",

+ 1 - 1
frontend/src/apis/user.ts

@@ -1,4 +1,4 @@
-import { GET,POST ,UPLOAD } from "@/utils/http";
+import { GET,POST  } from "@/utils/http";
 import type { UserRequest } from "@/apis/types/user";
 
 export async function getUserInfo(data:UserRequest){

+ 4 - 4
frontend/src/components/upload/index.vue

@@ -7,7 +7,7 @@
       <div class="add-text">添加</div>
     </div>
     <div v-if="base64Image" class="image-out">
-      <img class="el-upload-list__item-thumbnail" :src="base64Image" alt="" />
+      <img class="el-upload-list__item-thumbnail" :src="'file:///'+base64Image" alt="" />
       <span class="el-upload-list__item-actions">
         <span  @click="handlePictureCardPreview(base64Image)">
           <el-icon><zoom-in /></el-icon>
@@ -102,7 +102,7 @@ const disabled = ref(false)
 const handleRemove = () => {
   filePath.value = ''
   base64Image.value = ''
-  emit('input' , '' ) 
+  emit('input' , '' )
 }
 
 const handlePictureCardPreview = (base64Image) => {
@@ -122,9 +122,9 @@ function openImage() {
   clientStore.ipc.send(icpList.utils.openImage);
   clientStore.ipc.on(icpList.utils.openImage, async (event, result) => {
     filePath.value = result.filePath
-    base64Image.value = result.base64Image
+    base64Image.value = result.filePath
     clientStore.ipc.removeAllListeners(icpList.utils.openImage);
-    emit('input' ,result.filePath) 
+    emit('input' ,result.filePath)
   })
 }
 </script>

+ 3 - 7
frontend/src/router/index.ts

@@ -1,12 +1,11 @@
-import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
+import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";
 
 import { authGuard } from './plugins/authGuard'
 
-
 const routes: RouteRecordRaw[] = [
     {
         path: "/",
-        redirect: "/photography/check"
+        redirect: "/home"
     },
     {
         path: "/home",
@@ -49,11 +48,8 @@ const routes: RouteRecordRaw[] = [
     },
 ];
 
-
-
-
 const router = createRouter({
-    history: createWebHistory(),
+    history: createWebHashHistory(), // 修改: 将 createWebHistory 改为 createWebHashHistory
     routes
 });
 

+ 2 - 0
frontend/src/utils/http.ts

@@ -24,7 +24,9 @@ function loadingClose(requestId: string) {
  */
 const service = axios.create({
     timeout: 5000, // 设置请求超时时间
+    baseURL: '__API__',
 });
+console.log('__API__');
 
 // 请求拦截器
 service.interceptors.request.use(

+ 3 - 2
frontend/src/views/Home/index.vue

@@ -116,6 +116,7 @@ let interval:any = null
 function showVideo(){
   if(clientStore.isClient){
 
+
     clientStore.ipc.removeAllListeners(icpList.camera.PreviewShow);
 
     clientStore.ipc.send(icpList.camera.PreviewShow);
@@ -247,7 +248,7 @@ function openSeeting(){
     height: 630,
     frame: true,
     id:"seeting",
-    url:"http://localhost:3000/setting"
+    url:"http://localhost:3000/#/setting"
   }
   clientStore.ipc.send(icpList.utils.openMain,params);
 }
@@ -259,7 +260,7 @@ function openTplSeeting(){
     height: 650,
     frame: true,
     id:"photographyDetail",
-    url:"http://localhost:3000/photography/detail"
+    url:"http://localhost:3000/#/photography/detail"
   }
   clientStore.ipc.send(icpList.utils.openMain,params);
 }

+ 56 - 37
frontend/vite.config.ts

@@ -1,52 +1,71 @@
-import { defineConfig } from 'vite'
+import { defineConfig,loadEnv } from 'vite'
 import vue from '@vitejs/plugin-vue'
+import replace from '@rollup/plugin-replace'
 import path from 'path'
 
 // https://vite.dev/config/
-export default defineConfig({
-  // 插件配置,这里使用了Vue插件,以便支持Vue项目的构建
-  plugins: [vue()],
+export default ({mode, command})=> {
+  const env = loadEnv(mode, process.cwd(), 'API_') as Record<
+      'API_HOST',
+      string
+      >
+  return defineConfig({
+    // 插件配置,这里使用了Vue插件,以便支持Vue项目的构建
+    plugins: [
+        vue(),
+      /* 替换字符串 */
+      replace({
+        preventAssignment: true,
+        __API__: `${command === 'build' ? env.API_HOST : ''}`,
+      }),
+    ],
+    base: './', // 确保相对路径正确
+    build: {
+      outDir: 'dist',
+      assetsDir: 'assets',
+    },
 
 
-  /**
-   * 配置对象,用于定义 CSS 预处理器的选项。
-   * 通过此配置可以预导入公共样式文件,确保全局样式在所有 SCSS 文件中可用。
-   */
-  css: {
-    preprocessorOptions: {
-      scss: {
-        additionalData: `
+    /**
+     * 配置对象,用于定义 CSS 预处理器的选项。
+     * 通过此配置可以预导入公共样式文件,确保全局样式在所有 SCSS 文件中可用。
+     */
+    css: {
+      preprocessorOptions: {
+        scss: {
+          additionalData: `
           @use '@/styles/color.scss' as *;
           @use '@/styles/index.scss' as *;
         ` // 可选:预导入公共样式
+        }
       }
-    }
-  },
+    },
 
-  // 解析配置,用于配置模块查找和解析行为
-  resolve: {
-    // 定义解析文件的扩展名,这允许导入这些文件时省略扩展名
-    extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
+    // 解析配置,用于配置模块查找和解析行为
+    resolve: {
+      // 定义解析文件的扩展名,这允许导入这些文件时省略扩展名
+      extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
 
-    // 路径别名配置,这里定义了'@'符号指向项目的src目录
-    // 这有助于减少路径引用的复杂性,提高代码的可读性和可维护性
-    alias: {
-      '@': path.resolve(__dirname, './src'),
+      // 路径别名配置,这里定义了'@'符号指向项目的src目录
+      // 这有助于减少路径引用的复杂性,提高代码的可读性和可维护性
+      alias: {
+        '@': path.resolve(__dirname, './src'),
+      },
     },
-  },
-  // 配置服务器相关设置
-  server: {
-    // 设置服务器监听的端口
-    port: 3000,
-    // 配置代理设置,用于开发环境中代理API请求
-    proxy: {
-      // 当请求以'/api'开头时,将其代理到目标服务器
-      '/api': {
-        // 目标服务器的地址
-        target: 'http://dev2.pubdata.cn',
-        // 允许更改目标服务器的来源
-        changeOrigin: true
+    // 配置服务器相关设置
+    server: {
+      // 设置服务器监听的端口
+      port: 3000,
+      // 配置代理设置,用于开发环境中代理API请求
+      proxy: {
+        // 当请求以'/api'开头时,将其代理到目标服务器
+        '/api': {
+          // 目标服务器的地址
+          target: 'http://dev2.pubdata.cn',
+          // 允许更改目标服务器的来源
+          changeOrigin: true
+        },
       },
     },
-  },
-})
+  })
+}

+ 0 - 1
public/dist/assets/Index-630507e4.js

@@ -1 +0,0 @@
-import{_ as a,o as t,c as s,a as e}from"./index-94991f0a.js";const o={data:()=>({})},c={id:"hero"},n=[e('<h1 class="tagline" data-v-505540b8><span class="accent" data-v-505540b8>Electron-Egg</span></h1><p class="description" data-v-505540b8> A fast, desktop software development framework </p><p class="actions" data-v-505540b8><a class="setup" href="https://www.kaka996.com/" target="_blank" data-v-505540b8>Get Started</a></p>',3)];const d=a(o,[["render",function(a,e,o,d,r,p){return t(),s("section",c,n)}],["__scopeId","data-v-505540b8"]]);export{d as default};

+ 0 - 1
public/dist/assets/Index-812274cb.css

@@ -1 +0,0 @@
-section[data-v-505540b8]{padding:42px 32px}#hero[data-v-505540b8]{padding:150px 32px;text-align:center;height:100%}.tagline[data-v-505540b8]{font-size:52px;line-height:1.25;font-weight:700;letter-spacing:-1.5px;max-width:960px;margin:0 auto}html:not(.dark) .accent[data-v-505540b8],.dark .tagline[data-v-505540b8]{background:-webkit-linear-gradient(315deg,#42d392 25%,#647eff);background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent}.description[data-v-505540b8]{max-width:960px;line-height:1.5;color:var(--vt-c-text-2);transition:color .5s;font-size:22px;margin:24px auto 40px}.actions a[data-v-505540b8]{font-size:16px;display:inline-block;background-color:var(--vt-c-bg-mute);padding:8px 18px;font-weight:500;border-radius:8px;transition:background-color .5s,color .5s;text-decoration:none}.actions .setup[data-v-505540b8]{color:var(--vt-c-text-code);background:-webkit-linear-gradient(315deg,#42d392 25%,#647eff)}.actions .setup[data-v-505540b8]:hover{background-color:var(--vt-c-gray-light-4);transition-duration:.2s}

Dosya farkı çok büyük olduğundan ihmal edildi
+ 0 - 0
public/dist/assets/index-94991f0a.js


+ 0 - 1
public/dist/assets/index-b7b2ffb7.css

@@ -1 +0,0 @@
-#app{font-family:Avenir,Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-align:center;color:#2c3e50;height:100%}

+ 8 - 101
public/dist/index.html

@@ -1,107 +1,14 @@
-<!DOCTYPE html>
-<html lang="zh-CN">
+<!doctype html>
+<html lang="en">
   <head>
-    <meta charset="utf-8">
-    <meta http-equiv="X-UA-Compatible" content="IE=edge">
-    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, maximum-scale=1.0, minimum-scale=1.0" />
-    <title></title>
-    <!-- 优化:vue渲染未完成之前,先加一个css动画 -->
-    <style>
-      #loadingPage {
-        background-color: #dedede;
-        font-size: 12px;
-      }
-      .base {
-        height: 9em;
-        left: 50%;
-        margin: -7.5em;
-        padding: 3em;
-        position: absolute;
-        top: 50%;
-        width: 9em;
-        transform: rotateX(45deg) rotateZ(45deg);
-        transform-style: preserve-3d;
-      }
-      .cube,
-      .cube:after,
-      .cube:before {
-        content: '';
-        float: left;
-        height: 3em;
-        position: absolute;
-        width: 3em;
-      }
-      /* Top */
-      .cube {
-        background-color: #06cf68;
-        position: relative;
-        transform: translateZ(3em);
-        transform-style: preserve-3d;
-        transition: .25s;
-        box-shadow: 13em 13em 1.5em rgba(0, 0, 0, 0.1);
-        animation: anim 1s infinite;
-      }
-      .cube:after {
-        background-color: #05a151;
-        transform: rotateX(-90deg) translateY(3em);
-        transform-origin: 100% 100%;
-      }
-      .cube:before {
-        background-color: #026934;
-        transform: rotateY(90deg) translateX(3em);
-        transform-origin: 100% 0;
-      }
-      .cube:nth-child(1) {
-        animation-delay: 0.05s;
-      }
-      .cube:nth-child(2) {
-        animation-delay: 0.1s;
-      }
-      .cube:nth-child(3) {
-        animation-delay: 0.15s;
-      }
-      .cube:nth-child(4) {
-        animation-delay: 0.2s;
-      }
-      .cube:nth-child(5) {
-        animation-delay: 0.25s;
-      }
-      .cube:nth-child(6) {
-        animation-delay: 0.3s;
-      }
-      .cube:nth-child(7) {
-        animation-delay: 0.35s;
-      }
-      .cube:nth-child(8) {
-        animation-delay: 0.4s;
-      }
-      .cube:nth-child(9) {
-        animation-delay: 0.45s;
-      }
-      @keyframes anim {
-        50% {
-          transform: translateZ(0.5em);
-        }
-      }
-    </style>
-    <script type="module" crossorigin src="./assets/index-94991f0a.js"></script>
-    <link rel="stylesheet" href="./assets/index-b7b2ffb7.css">
+    <meta charset="UTF-8" />
+    <link rel="icon" type="image/svg+xml" href="./vite.svg" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <title>Vite + Vue + TS</title>
+    <script type="module" crossorigin src="./assets/index-6PwDCeNx.js"></script>
+    <link rel="stylesheet" crossorigin href="./assets/index-CfZ73FPC.css">
   </head>
   <body>
-    <div id="loadingPage">
-      <div class='base'>
-        <div class='cube'></div>
-        <div class='cube'></div>
-        <div class='cube'></div>
-        <div class='cube'></div>
-        <div class='cube'></div>
-        <div class='cube'></div>
-        <div class='cube'></div>
-        <div class='cube'></div>
-        <div class='cube'></div>
-      </div>
-    </div>
     <div id="app"></div>
-    
   </body>
 </html>

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor