Ver código fonte

客户端信息修改

FinalYu 2 anos atrás
pai
commit
e4aa52fe0f

BIN
chuanyi_client2/build/icons/1024x1024.png


BIN
chuanyi_client2/build/icons/128x128.png


BIN
chuanyi_client2/build/icons/16x16.png


BIN
chuanyi_client2/build/icons/24x24.png


BIN
chuanyi_client2/build/icons/256x256.png


BIN
chuanyi_client2/build/icons/32x32.png


BIN
chuanyi_client2/build/icons/48x48.png


BIN
chuanyi_client2/build/icons/512x512.png


BIN
chuanyi_client2/build/icons/64x64.png


BIN
chuanyi_client2/build/icons/icon.icns


BIN
chuanyi_client2/build/icons/icon.ico


Diferenças do arquivo suprimidas por serem muito extensas
+ 571 - 55
chuanyi_client2/package-lock.json


+ 4 - 2
chuanyi_client2/package.json

@@ -1,18 +1,20 @@
 {
-  "name": "chuanyi_client",
-  "version": "0.1.0",
+  "name": "cqcy",
+  "version": "1.0.0",
   "private": true,
   "scripts": {
     "serve": "vue-cli-service serve",
     "build": "vue-cli-service build",
     "electron:build": "vue-cli-service electron:build",
     "electron:serve": "vue-cli-service electron:serve",
+    "electron:generate-icons": "electron-icon-builder --input=./public/logo.png --output=build --flatten",
     "postinstall": "electron-builder install-app-deps",
     "postuninstall": "electron-builder install-app-deps"
   },
   "main": "background.js",
   "dependencies": {
     "axios": "^0.27.2",
+    "electron-icon-builder": "^2.0.1",
     "element-ui": "^2.15.10",
     "file-saver": "^2.0.5",
     "font-awesome": "^4.7.0",

BIN
chuanyi_client2/public/logo.png


+ 56 - 3
chuanyi_client2/src/background.js

@@ -1,6 +1,6 @@
 'use strict'
 
-import { app, protocol, BrowserWindow } from 'electron'
+import { app, protocol, BrowserWindow, Menu } from 'electron'
 import { createProtocol } from 'vue-cli-plugin-electron-builder/lib'
 import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'
 const isDevelopment = process.env.NODE_ENV !== 'production'
@@ -10,13 +10,30 @@ protocol.registerSchemesAsPrivileged([
   { scheme: 'app', privileges: { secure: true, standard: true } }
 ])
 
+function creatMenuWin(name) {
+  return new BrowserWindow({
+    title: name ? name : '川仪READOPC报表软件',
+    width: 300,
+    height: 300,
+    resizable: false,
+    movable: false,
+    minimizable: false,
+    maximizable: false,
+    webPreferences: {
+      nodeIntegration: true
+    }
+  })
+}
+
 async function createWindow() {
   // Create the browser window.
   const win = new BrowserWindow({
     width: 800,
     height: 600,
+    // false表示去掉顶部的导航以及最大化、最小化、关闭按钮
+    frame: true,
     webPreferences: {
-      
+      webSecurity: false,
       // Use pluginOptions.nodeIntegration, leave this alone
       // See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info
       nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION,
@@ -24,6 +41,42 @@ async function createWindow() {
     }
   })
 
+  // 开启调试模式
+  // win.webContents.openDevTools()
+  // 去掉顶部菜单
+  // win.setMenu(null)
+  // 菜单模板设置
+  let templateMenu = [
+    {
+      label: '首页'
+    },
+    {
+      label: '帮助',
+      submenu: [
+        {
+          label: '检查更新',
+          click: () => {
+          }
+        }
+      ]
+    },
+    {
+      label: '关于',
+      click: () => {
+        let winForAbout = creatMenuWin('关于')
+        // 去掉顶部菜单
+        winForAbout.setMenu(null)
+        winForAbout.loadFile('yellow.html')
+        winForAbout.on('closed', () => {
+          winForAbout = null
+        })
+      }
+    },
+  ]
+  // 加载菜单
+  let m = Menu.buildFromTemplate(templateMenu)
+  Menu.setApplicationMenu(m)
+
   if (process.env.WEBPACK_DEV_SERVER_URL) {
     // Load the url of the dev server if in development mode
     await win.loadURL(process.env.WEBPACK_DEV_SERVER_URL)
@@ -31,7 +84,7 @@ async function createWindow() {
   } else {
     createProtocol('app')
     // Load the home.html when not in development
-    win.loadURL('app://./home.html')
+    win.loadURL('app://./index.html')
   }
 }
 

+ 2 - 2
chuanyi_client2/src/router/index.js

@@ -28,7 +28,7 @@ const routes = [
     {
         path: '/login',
         name: 'login',
-        component: () => import('@/views/login'),
+        component: () => import('@/views/login')
     },
     {
         path: '/',
@@ -53,7 +53,7 @@ const routes = [
 ]
 
 const createRouter = () => new VueRouter({
-    mode: 'history',
+    mode: 'hash',
     scrollBehavior: () => ({
         y: 0
     }),

+ 30 - 15
chuanyi_client2/src/utils/auth.js

@@ -3,58 +3,73 @@ import Cookies from 'js-cookie'
 const TOKEN_KEY = 'C_TOKEN'
 
 export function getToken() {
-    return Cookies.get(TOKEN_KEY)
+    // return Cookies.get(TOKEN_KEY)
+    return localStorage.getItem(TOKEN_KEY)
 }
 
 export function setToken(token) {
-    return Cookies.set(TOKEN_KEY, token)
+    // return Cookies.set(TOKEN_KEY, token)
+    return localStorage.setItem(TOKEN_KEY, token)
 }
 
 export function removeToken() {
-    return Cookies.remove(TOKEN_KEY)
+    // return Cookies.remove(TOKEN_KEY)
+    return localStorage.removeItem(TOKEN_KEY)
 }
 
 const UID_KEY = 'C_UID'
 
 export function getUid() {
-    return Cookies.get(UID_KEY)
+    // return Cookies.get(UID_KEY)
+    return localStorage.getItem(UID_KEY)
 }
 
 export function setUid(id) {
-    return Cookies.set(UID_KEY, id)
+    // return Cookies.set(UID_KEY, id)
+    return localStorage.setItem(UID_KEY, id)
 }
 
 export function removeUid() {
-    return Cookies.remove(UID_KEY)
+    // return Cookies.remove(UID_KEY)
+    return localStorage.removeItem(UID_KEY)
 }
 
 const USERNAME_KEY = 'C_USERNAME'
 
 export function getUsername() {
-    return Cookies.get(USERNAME_KEY)
+    // return Cookies.get(USERNAME_KEY)
+    return localStorage.getItem(USERNAME_KEY)
 }
 
 export function setUsername(name) {
-    return Cookies.set(USERNAME_KEY, name)
+    // return Cookies.set(USERNAME_KEY, name)
+    return localStorage.setItem(USERNAME_KEY, name)
 }
 
 export function removeUsername() {
-    return Cookies.remove(USERNAME_KEY)
+    // return Cookies.remove(USERNAME_KEY)
+    return localStorage.removeItem(USERNAME_KEY)
 }
 
 const PUB_KEY = 'PUB_KEY'
 
 export function getPubKey() {
-    return Cookies.get(PUB_KEY)
+    // return Cookies.get(PUB_KEY)
+    return localStorage.getItem(PUB_KEY)
 }
 
 export function setPubKey(name) {
-    return Cookies.set(PUB_KEY, name)
+    // return Cookies.set(PUB_KEY, name)
+    return localStorage.setItem(PUB_KEY, name)
 }
 
 export function removeAll() {
-    Cookies.remove(TOKEN_KEY)
-    Cookies.remove(UID_KEY)
-    Cookies.remove(USERNAME_KEY)
-    Cookies.remove(PUB_KEY)
+    // Cookies.remove(TOKEN_KEY)
+    // Cookies.remove(UID_KEY)
+    // Cookies.remove(USERNAME_KEY)
+    // Cookies.remove(PUB_KEY)
+    localStorage.removeItem(TOKEN_KEY)
+    localStorage.removeItem(UID_KEY)
+    localStorage.removeItem(USERNAME_KEY)
+    localStorage.removeItem(PUB_KEY)
 }

+ 1 - 1
chuanyi_client2/src/views/login.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="login">
     <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
-      <h3 class="title">川仪READOPC</h3>
+      <h3 class="title">川仪READOPC报表软件</h3>
       <el-form-item prop="username">
         <el-input
             v-model="loginForm.username"

+ 12 - 2
chuanyi_client2/vue.config.js

@@ -5,7 +5,7 @@ function resolve(dir) {
     return path.join(__dirname, dir)
 }
 
-const name = process.env.VUE_APP_TITLE || '川仪READOPC' // 网页标题
+const name = process.env.VUE_APP_TITLE || '川仪READOPC报表软件' // 网页标题
 
 const port = process.env.port || process.env.npm_config_port || 81 // 端口
 
@@ -21,7 +21,7 @@ module.exports = {
     // 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
     assetsDir: 'static',
     lintOnSave: process.env.NODE_ENV === 'development',
-    productionSourceMap: false,
+    productionSourceMap: true,
     devServer: {
         port: port,
         // open: true,
@@ -59,5 +59,15 @@ module.exports = {
             })
             .end()
 
+    },
+    pluginOptions: {
+        electronBuilder: {
+            customFileProtocol: './',
+            builderOptions: {
+                "win": {
+                    "icon": "build/icons/icon.ico"
+                }
+            }
+        }
     }
 }

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff