chenyincheng
2023-04-11 80356c3725c01cfd87aefcd3f0925327571a89d9
添加请求日志
1个文件已添加
3个文件已修改
16个文件已删除
54 ■■■■ 已修改文件
electron/main/index.ts 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
electron/preload/logger.js 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
imgs/1680587384111.png 补丁 | 查看 | 原始文档 | blame | 历史
imgs/1680589271767.png 补丁 | 查看 | 原始文档 | blame | 历史
imgs/1680608445486.png 补丁 | 查看 | 原始文档 | blame | 历史
imgs/1680609046076.png 补丁 | 查看 | 原始文档 | blame | 历史
imgs/1680609212124.png 补丁 | 查看 | 原始文档 | blame | 历史
imgs/1680610408538.png 补丁 | 查看 | 原始文档 | blame | 历史
imgs/1680828560435.png 补丁 | 查看 | 原始文档 | blame | 历史
imgs/1680914855901.png 补丁 | 查看 | 原始文档 | blame | 历史
imgs/1680933878096.png 补丁 | 查看 | 原始文档 | blame | 历史
imgs/1680933976408.png 补丁 | 查看 | 原始文档 | blame | 历史
imgs/1680934635391.png 补丁 | 查看 | 原始文档 | blame | 历史
imgs/1680935056407.png 补丁 | 查看 | 原始文档 | blame | 历史
imgs/1680935808005.png 补丁 | 查看 | 原始文档 | blame | 历史
imgs/1680939161444.png 补丁 | 查看 | 原始文档 | blame | 历史
imgs/1681110331043.png 补丁 | 查看 | 原始文档 | blame | 历史
imgs/1681116576217.png 补丁 | 查看 | 原始文档 | blame | 历史
package.json 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/home/index.vue 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
electron/main/index.ts
@@ -1,6 +1,8 @@
import { app, BrowserWindow, shell, ipcMain,Menu } from 'electron'
import { release } from 'os'
import { join } from 'path'
import logger from '../preload/logger.js'
import fs from 'fs'
import iconv from 'iconv-lite'
//koa----
@@ -61,7 +63,7 @@
async function createWindow() {
  win = new BrowserWindow({
    title: 'Main window',
    fullscreen: true,// 开启默认全屏
    // fullscreen: true,// 开启默认全屏
    // autoHideMenuBar:true, //关闭菜单栏
    webPreferences: {
      preload: splash,
@@ -132,6 +134,12 @@
    // childWindow.webContents.openDevTools({ mode: "undocked", activate: true })
  }
})
// 主进程处理日志定义
ipcMain.handle('logger', async(event, arg) => {  //与渲染进程通信
  return new Promise((resolve, reject) => {
    logger.info(arg)
  })
})
// 渲染端发送消息到主进程
ipcMain.on("winClose",()=>{
  win?.close()
electron/preload/logger.js
New file
@@ -0,0 +1,30 @@
import logger from 'electron-log'
import {app} from 'electron'
logger.transports.file.level = 'debug'
logger.transports.file.maxSize = 1002430 // 10M
logger.transports.file.format = '[{y}-{m}-{d} {h}:{i}:{s}.{ms}] [{level}]{scope} {text}'
let date = new Date()
date = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
logger.transports.file.file = app.getPath('userData') + '\\electron_log\\app\\' + date + '.log'
export default {
  info (param) {
    logger.info(param)
  },
  warn (param) {
    logger.warn(param)
  },
  error (param) {
    logger.error(param)
  },
  debug (param) {
    logger.debug(param)
  },
  verbose (param) {
    logger.verbose(param)
  },
  silly (param) {
    logger.silly(param)
  }
}
imgs/1680587384111.png
Binary files differ
imgs/1680589271767.png
Binary files differ
imgs/1680608445486.png
Binary files differ
imgs/1680609046076.png
imgs/1680609212124.png
Binary files differ
imgs/1680610408538.png
Binary files differ
imgs/1680828560435.png
Binary files differ
imgs/1680914855901.png
Binary files differ
imgs/1680933878096.png
Binary files differ
imgs/1680933976408.png
Binary files differ
imgs/1680934635391.png
Binary files differ
imgs/1680935056407.png
Binary files differ
imgs/1680935808005.png
Binary files differ
imgs/1680939161444.png
Binary files differ
imgs/1681110331043.png
Binary files differ
imgs/1681116576217.png
Binary files differ
package.json
@@ -48,6 +48,7 @@
    "@alicloud/viapi-utils": "^1.0.0",
    "@types/tracking": "^1.1.30",
    "axios": "^0.27.2",
    "electron-log": "^4.4.8",
    "electron-store": "^8.0.2",
    "element-plus": "^2.2.6",
    "iconv-lite": "^0.6.3",
src/views/home/index.vue
@@ -212,9 +212,6 @@
        }
        // 没有找到患者
        else if (patientInfo.value.name === '') {
          // speech.value?.speak({ text: "没有找到患者,请重新刷卡" }).then(() => {
          //   console.log("播报完成...")
          // })
          if (isUseFaceRecogService.value) {
            state.dialogVisible = true
          }
@@ -227,9 +224,6 @@
          speech.value?.speak({ text: `${patientInfo.value.name}今日没有排班,不能自助签到` }).then(() => {
            console.log("播报完成...")
          })
          // if (isUseFaceRecogService.value) {
          //   state.dialogVisible = true
          // }
          return
        }
      }
@@ -333,18 +327,23 @@
    const sundMode= (mode:any)=>{
      state.fasongNum++
      // const res= await updatePatient(mode)
      ipcRenderer.invoke('logger', `患者结果上传,第${state.fasongNum}次`)
      ipcRenderer.invoke('logger', '参数:'+JSON.stringify(mode))
      updatePatient(mode).then(re=>{
        ElMessage.success('结果发送成功')
        ipcRenderer.invoke('logger', '结果上传成功')
        setTimeout(() => {
          fuxuan()
        },5000)
        return false
      }).catch(re=>{
        ElMessage('结果发送失败')
        ipcRenderer.invoke('logger', `结果发送失败:第${state.fasongNum}次,3秒后重新发送`)
        if(state.fasongNum<3){
          setTimeout(sundMode,1000);
          setTimeout(sundMode,5000);
        }
        else{
          ipcRenderer.invoke('logger', '3次结果上传都失败放弃本次请求')
          return false
        }
      })