xklr/wly преди 5 месеца
родител
ревизия
4cc6a7c447
променени са 7 файла, в които са добавени 93 реда и са изтрити 14 реда
  1. 3 9
      package.json
  2. 2 2
      src/main/main.js
  3. 2 2
      src/main/windows/indexwin.js
  4. 39 0
      src/renderer/pages/version/index.vue
  5. 1 0
      src/renderer/pages/version/versionInfo.json
  6. 35 0
      src/renderer/utils/timeTrans.js
  7. 11 1
      vue.config.js

+ 3 - 9
package.json

@@ -1,11 +1,11 @@
 {
   "name": "doctor-xklr",
   "productName": "星空路人-医生端",
-  "version": "1.2.8",
+  "version": "1.2.9",
   "private": false,
   "author": "wly",
   "scripts": {
-    "build": "vue-cli-service electron:build",
+    "build": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service electron:build",
     "serve": "vue-cli-service electron:serve",
     "test:unit": "vue-cli-service test:unit",
     "test:e2e": "vue-cli-service test:e2e",
@@ -13,11 +13,6 @@
     "log": "conventional-changelog --config ./node_modules/vue-cli-plugin-commitlint/lib/log -i CHANGELOG.md -s -r 0",
     "electron:build": "vue-cli-service electron:build",
     "electron:serve": "vue-cli-service electron:serve",
-    "postinstall": "electron-builder install-app-deps",
-    "postuninstall": "electron-builder install-app-deps",
-    "patch": "npm version patch && git push origin master && git push origin --tags",
-    "minor": "npm version minor && git push origin master && git push origin --tags",
-    "major": "npm version major && git push origin master && git push origin --tags",
     "release": "vue-cli-service electron:build --publish always",
     "lint": "vue-cli-service lint",
     "prettier": "npx prettier --write ./src ./test",
@@ -103,6 +98,5 @@
   },
   "husky": {
     "hooks": {}
-  },
-  "__npminstall_done": false
+  }
 }

+ 2 - 2
src/main/main.js

@@ -35,8 +35,8 @@ async function createWindow() {
     height: 80, //悬浮窗口的高度 比实际DIV的高度要多2px 因为有1px的边框
     icon: iconSrc,
     show: true,
-    skipTaskbar: true, // 任务栏中不显示窗口
-    autoHideMenuBar: false,// 任务栏中不显示窗口
+    skipTaskbar: isdev, // 任务栏中不显示窗口
+    autoHideMenuBar: false,
     transparent: true, //设置透明
     resizable: isdev,
     frame: false,

+ 2 - 2
src/main/windows/indexwin.js

@@ -25,7 +25,7 @@ const createIndexwin = function (BrowserWindow) {
         // minimizable: false,
         // maximizable: false,
         // enableLargerThanScreen: false,
-        skipTaskbar: false, // 任务栏中不显示窗口
+        skipTaskbar: true, // 任务栏中不显示窗口
         autoHideMenuBar: false,
         transparent: true,
         resizable: true,
@@ -33,7 +33,7 @@ const createIndexwin = function (BrowserWindow) {
         hasShadow: process.platform !== "darwin", //不显示阴影
         alwaysOnTop: true,
         webPreferences: {
-            devTools: isdev,
+            devTools: false,
             sandbox: false,
             enableRemoteModule: true,
             nodeIntegration: true,

+ 39 - 0
src/renderer/pages/version/index.vue

@@ -0,0 +1,39 @@
+<template>
+  <div class="text-dark mt-2" style="font-size: 12px;padding:0 10px;">
+    <div>系统信息</div>
+    <el-card :body-style="{ padding: '10px' }" class="mt-1">
+      <div >
+        版本: <el-tag size="mini">v{{ versionInfo.version }}</el-tag>
+      </div>
+      <div class="mt-2">
+        更新时间: <el-tag size="mini">{{ versionInfo.buildTime }}</el-tag>
+      </div>
+      <div class="mt-2 text-center">
+        <el-button type="text" size="mini">检查更新</el-button>
+      </div>
+    </el-card>
+    <div style="width: 100%;font-size: 10px;position:absolute;bottom:15px;left:50%;transform: translate(-50%, 50%);">
+      <Footer />
+    </div>
+  </div>
+</template>
+
+<script>
+import Footer from '@/components/footer/index.vue'
+import {timeTrans } from '@/utils/common'
+import versionInfo from "./versionInfo.json";
+const package1 = require('@/../../package.json');
+console.log(package1)
+export default {
+  name: 'Version',
+  components: {
+    Footer
+  },
+  data() {
+    return {
+      versionInfo,
+    }
+  }
+}
+</script>
+<style lang="less" ></style>

+ 1 - 0
src/renderer/pages/version/versionInfo.json

@@ -0,0 +1 @@
+{"buildTime":"2024-06-20","version":"1.2.9"}

+ 35 - 0
src/renderer/utils/timeTrans.js

@@ -0,0 +1,35 @@
+module.exports = function timeTrans({
+  time,
+  format
+}) {
+  let timer = time || new Date();
+  let date = new Date(timer);
+  let obj = {
+    Y: '',
+    M: '',
+    D: '',
+    h: '',
+    m: '',
+    s: ''
+  }
+  obj.Y = date.getFullYear();
+  obj.M = date.getMonth() + 1;
+  obj.M = obj.M < 10 ? "0" + obj.M : obj.M;
+  obj.D = date.getDate();
+  obj.D = obj.D < 10 ? "0" + obj.D : obj.D;
+  obj.h = date.getHours();
+  obj.h = obj.h < 10 ? "0" + obj.h : obj.h;
+  obj.m = date.getMinutes();
+  obj.m = obj.m < 10 ? "0" + obj.m : obj.m;
+  obj.s = date.getSeconds();
+  obj.s = obj.s < 10 ? "0" + obj.s : obj.s;
+  if (format) {
+    let str = '';
+    for (let index in format) {
+      str += `${obj[format[index]] || format[index]}`;
+    }
+    return str;
+  } else {
+    return `${obj.Y}-${obj.M}-${obj.D}`
+  }
+}

+ 11 - 1
vue.config.js

@@ -1,6 +1,16 @@
 const path = require('path')
 const package = require('./package.json')
+const timeTrans = require('./src/renderer/utils/timeTrans')
 const isDevelopment = process.env.NODE_ENV == "development"
+const fs = require('fs');
+const versionInfo = {
+    "buildTime": timeTrans({}),
+    "version": package.version
+}
+fs.writeFile("./src/renderer/pages/version/versionInfo.json", JSON.stringify(versionInfo),
+    err => {console.log('project build: at ' + versionInfo.buildTime + "\r\n");}
+)
+
 function resolve(dir) {
     return path.join(__dirname, dir);
 }
@@ -172,7 +182,7 @@ module.exports = {
                     // 创建开始菜单图标
                     createStartMenuShortcut: true,
                     perMachine: false,
-                    artifactName: `${package.productName}-${package.version}.exe`,
+                    artifactName: `${package.productName}-${package.version}${timeTrans({format:'YMDh'})}.exe`,
                     // "deleteAppDataOnUninstall": true,
                     //  "runAfterFinish": true,
                     //  "differentialPackage": true