Browse Source

feat: window exe

chenlei 1 năm trước cách đây
commit
cd44a45dff
46 tập tin đã thay đổi với 12795 bổ sung0 xóa
  1. 2 0
      .gitignore
  2. 1 0
      code/css/app.526a2fa4.css
  3. 1 0
      code/css/chunk-vendors.ab7a1d01.css
  4. 4435 0
      code/data.json
  5. 45 0
      code/echarts-v5.4.3.js
  6. BIN
      code/fonts/SOURCEHANSANSCN-BOLD.4278d4c3.OTF
  7. BIN
      code/fonts/SOURCEHANSANSCN-LIGHT.0268b474.OTF
  8. BIN
      code/fonts/SOURCEHANSANSCN-REGULAR.d31c45a8.OTF
  9. 170 0
      code/getCity-data.json
  10. BIN
      code/icon.png
  11. BIN
      code/img/banner.59e546d6.jpg
  12. BIN
      code/img/ben_iknow.aad5e30f.png
  13. BIN
      code/img/bg.65b15f07.jpg
  14. BIN
      code/img/bg_travel_entry.7285c2b8.png
  15. BIN
      code/img/btn_back.5f6aa962.png
  16. BIN
      code/img/btn_by_grade.34b7549d.png
  17. BIN
      code/img/btn_by_theme.c1cc6764.png
  18. BIN
      code/img/btn_chinese_active.8329854c.png
  19. BIN
      code/img/btn_chinese_normal.93c41595.png
  20. BIN
      code/img/btn_history_active.8a59d868.png
  21. BIN
      code/img/btn_history_normal.7c6d59b1.png
  22. BIN
      code/img/btn_left.1f45fe77.png
  23. BIN
      code/img/btn_museum_normal.5ad0748e.png
  24. BIN
      code/img/btn_q&a.689a00a5.png
  25. BIN
      code/img/btn_right.33a1ef58.png
  26. BIN
      code/img/btn_scenery_active.569c9322.png
  27. BIN
      code/img/btn_scenery_normal.41c9cf44.png
  28. BIN
      code/img/btn_search_active.63525b9f.png
  29. BIN
      code/img/btn_search_normal.aedbe0be.png
  30. BIN
      code/img/heart.50b77c87.png
  31. BIN
      code/img/icon_cancel.6fffbcd5.png
  32. BIN
      code/img/icon_drag.8bb967f3.png
  33. BIN
      code/img/pop_person.37eb493d.jpg
  34. BIN
      code/img/pop_scenery.57a0d3a2.png
  35. BIN
      code/img/title.61982b58.png
  36. 1 0
      code/index.html
  37. 1 0
      code/js/app.090501a9.js
  38. 13 0
      code/js/chunk-vendors.17375089.js
  39. BIN
      code/logo.png
  40. 10 0
      code/open-keyboard.js
  41. 1938 0
      code/pageCityList-data.json
  42. 4 0
      code/travelApiOriginConfig.js
  43. 86 0
      main.js
  44. 6048 0
      package-lock.json
  45. 39 0
      package.json
  46. 1 0
      preload.js

+ 2 - 0
.gitignore

@@ -0,0 +1,2 @@
+/node_modules
+/builder

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 0
code/css/app.526a2fa4.css


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 0
code/css/chunk-vendors.ab7a1d01.css


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 4435 - 0
code/data.json


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 45 - 0
code/echarts-v5.4.3.js


BIN
code/fonts/SOURCEHANSANSCN-BOLD.4278d4c3.OTF


BIN
code/fonts/SOURCEHANSANSCN-LIGHT.0268b474.OTF


BIN
code/fonts/SOURCEHANSANSCN-REGULAR.d31c45a8.OTF


+ 170 - 0
code/getCity-data.json

@@ -0,0 +1,170 @@
+[
+        {
+            "createTime": null,
+            "creatorId": null,
+            "creatorName": "",
+            "display": 1,
+            "id": 34,
+            "name": "省直",
+            "parentId": 9,
+            "sort": null,
+            "type": "city",
+            "updateTime": null
+        },
+        {
+            "createTime": null,
+            "creatorId": null,
+            "creatorName": "",
+            "display": 1,
+            "id": 35,
+            "name": "南京市",
+            "parentId": 9,
+            "sort": null,
+            "type": "city",
+            "updateTime": null
+        },
+        {
+            "createTime": null,
+            "creatorId": null,
+            "creatorName": "",
+            "display": 1,
+            "id": 36,
+            "name": "无锡市",
+            "parentId": 9,
+            "sort": null,
+            "type": "city",
+            "updateTime": null
+        },
+        {
+            "createTime": null,
+            "creatorId": null,
+            "creatorName": "",
+            "display": 1,
+            "id": 37,
+            "name": "徐州市",
+            "parentId": 9,
+            "sort": null,
+            "type": "city",
+            "updateTime": null
+        },
+        {
+            "createTime": null,
+            "creatorId": null,
+            "creatorName": "",
+            "display": 1,
+            "id": 38,
+            "name": "常州市",
+            "parentId": 9,
+            "sort": null,
+            "type": "city",
+            "updateTime": null
+        },
+        {
+            "createTime": null,
+            "creatorId": null,
+            "creatorName": "",
+            "display": 1,
+            "id": 39,
+            "name": "苏州市",
+            "parentId": 9,
+            "sort": null,
+            "type": "city",
+            "updateTime": null
+        },
+        {
+            "createTime": null,
+            "creatorId": null,
+            "creatorName": "",
+            "display": 1,
+            "id": 40,
+            "name": "南通市",
+            "parentId": 9,
+            "sort": null,
+            "type": "city",
+            "updateTime": null
+        },
+        {
+            "createTime": null,
+            "creatorId": null,
+            "creatorName": "",
+            "display": 1,
+            "id": 41,
+            "name": "连云港市",
+            "parentId": 9,
+            "sort": null,
+            "type": "city",
+            "updateTime": null
+        },
+        {
+            "createTime": null,
+            "creatorId": null,
+            "creatorName": "",
+            "display": 1,
+            "id": 42,
+            "name": "淮安市",
+            "parentId": 9,
+            "sort": null,
+            "type": "city",
+            "updateTime": null
+        },
+        {
+            "createTime": null,
+            "creatorId": null,
+            "creatorName": "",
+            "display": 1,
+            "id": 43,
+            "name": "盐城市",
+            "parentId": 9,
+            "sort": null,
+            "type": "city",
+            "updateTime": null
+        },
+        {
+            "createTime": null,
+            "creatorId": null,
+            "creatorName": "",
+            "display": 1,
+            "id": 44,
+            "name": "扬州市",
+            "parentId": 9,
+            "sort": null,
+            "type": "city",
+            "updateTime": null
+        },
+        {
+            "createTime": null,
+            "creatorId": null,
+            "creatorName": "",
+            "display": 1,
+            "id": 45,
+            "name": "镇江市",
+            "parentId": 9,
+            "sort": null,
+            "type": "city",
+            "updateTime": null
+        },
+        {
+            "createTime": null,
+            "creatorId": null,
+            "creatorName": "",
+            "display": 1,
+            "id": 46,
+            "name": "泰州市",
+            "parentId": 9,
+            "sort": null,
+            "type": "city",
+            "updateTime": null
+        },
+        {
+            "createTime": null,
+            "creatorId": null,
+            "creatorName": "",
+            "display": 1,
+            "id": 47,
+            "name": "宿迁市",
+            "parentId": 9,
+            "sort": null,
+            "type": "city",
+            "updateTime": null
+        }
+    ]

BIN
code/icon.png


BIN
code/img/banner.59e546d6.jpg


BIN
code/img/ben_iknow.aad5e30f.png


BIN
code/img/bg.65b15f07.jpg


BIN
code/img/bg_travel_entry.7285c2b8.png


BIN
code/img/btn_back.5f6aa962.png


BIN
code/img/btn_by_grade.34b7549d.png


BIN
code/img/btn_by_theme.c1cc6764.png


BIN
code/img/btn_chinese_active.8329854c.png


BIN
code/img/btn_chinese_normal.93c41595.png


BIN
code/img/btn_history_active.8a59d868.png


BIN
code/img/btn_history_normal.7c6d59b1.png


BIN
code/img/btn_left.1f45fe77.png


BIN
code/img/btn_museum_normal.5ad0748e.png


BIN
code/img/btn_q&a.689a00a5.png


BIN
code/img/btn_right.33a1ef58.png


BIN
code/img/btn_scenery_active.569c9322.png


BIN
code/img/btn_scenery_normal.41c9cf44.png


BIN
code/img/btn_search_active.63525b9f.png


BIN
code/img/btn_search_normal.aedbe0be.png


BIN
code/img/heart.50b77c87.png


BIN
code/img/icon_cancel.6fffbcd5.png


BIN
code/img/icon_drag.8bb967f3.png


BIN
code/img/pop_person.37eb493d.jpg


BIN
code/img/pop_scenery.57a0d3a2.png


BIN
code/img/title.61982b58.png


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 0
code/index.html


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 0
code/js/app.090501a9.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 13 - 0
code/js/chunk-vendors.17375089.js


BIN
code/logo.png


+ 10 - 0
code/open-keyboard.js

@@ -0,0 +1,10 @@
+const { exec } = window.require("child_process");
+const os = window.require("os");
+
+function openVirtualKeyBoard() {
+  if (os.platform() === "win32") {
+    exec("osk.exe");
+  } else {
+    exec("onboard");
+  }
+};

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1938 - 0
code/pageCityList-data.json


+ 4 - 0
code/travelApiOriginConfig.js

@@ -0,0 +1,4 @@
+var VUE_APP_API_URL_PREFIX = 'http://127.0.0.1:18080/' // 非空值会覆盖.env.xxx中的同名变量
+var VUE_APP_TRAVELLIST_EXCLUDE_IDS = ['761695ff-b273-48c0-a04e-b3a6c33a5b6e'] // 排除景区id
+// 右侧边栏菜单 chinese-语文 history-历史 museum-云上博物 travel-景区 search-搜索
+var VUE_APP_MENUS = ['chinese', 'history', 'museum', 'travel', 'search']

+ 86 - 0
main.js

@@ -0,0 +1,86 @@
+// Modules to control application life and create native browser window
+const {
+  app,
+  BrowserWindow,
+  globalShortcut,
+} = require("electron");
+
+// const httpServer = require("http-server");
+const path = require('path')
+
+let port = 11086;
+
+// const server = httpServer.createServer({
+//   // root:__dirname
+//   root: "./",
+// });
+
+// server.listen(port);
+
+// Keep a global reference of the window object, if you don't, the window will
+// be closed automatically when the JavaScript object is garbage collected.
+let mainWindow;
+
+function createWindow() {
+  // Create the browser window.
+  mainWindow = new BrowserWindow({
+    fullscreen: true, // 设置全屏
+    width: 1920,
+    height: 1000,
+    icon: path.join(__dirname, './code/icon.png'),
+    webPreferences: {
+      preload: path.join(__dirname, './preload.js'),
+      nodeIntegration: false,
+      webSecurity: false,
+      contextIsolation: false,
+    },
+  });
+
+  mainWindow.setMenu(null)
+  // `http://localhost:${port}/code/index.html`
+  let url = path.join('file://', __dirname, '/code/index.html')
+  mainWindow.loadURL(url, {
+    userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36",
+  });
+  
+  // Emitted when the window is closed.
+  mainWindow.on("closed", function () {
+    // Dereference the window object, usually you would store windows
+    // in an array if your app supports multi windows, this is the time
+    // when you should delete the corresponding element.
+    mainWindow = null;
+  });
+
+  // mainWindow.webContents.openDevTools()
+  globalShortcut.register("CommandOrControl+Shift+i", () => {
+    mainWindow.webContents.openDevTools();
+  });
+}
+
+
+
+// 保证每次都是无缓存状态
+app.commandLine.appendSwitch("--disable-http-cache");
+
+
+// This method will be called when Electron has finished
+// initialization and is ready to create browser windows.
+// Some APIs can only be used after this event occurs.
+app.on("ready", createWindow);
+
+// Quit when all windows are closed.
+app.on("window-all-closed", function () {
+  // On OS X it is common for applications and their menu bar
+  // to stay active until the user quits explicitly with Cmd + Q
+  if (process.platform !== "darwin") {
+    app.quit();
+  }
+});
+
+app.on("activate", function () {
+  // On OS X it's common to re-create a window in the app when the
+  // dock icon is clicked and there are no other windows open.
+  if (mainWindow === null) {
+    createWindow();
+  }
+});

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 6048 - 0
package-lock.json


+ 39 - 0
package.json

@@ -0,0 +1,39 @@
+{
+  "name": "code",
+  "version": "1.1.5",
+  "description": "",
+  "main": "main.js",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1",
+    "serve": "electron .",
+    "build": "electron-builder --win --x64"
+  },
+  "build": {
+    "productName": "知识图谱",
+    "appId": "com.scene.app",
+    "asar": false, 
+    "directories": {
+      "output": "builder"
+    },
+    "win": {
+      "icon": "./code/icon.png",
+      "target": [
+        "zip"
+      ]
+    },
+    "files": [
+      "code/**/*",
+      "main.js",
+      "preload.js"
+    ]
+  },
+  "author": "",
+  "license": "ISC",
+  "devDependencies": {
+    "electron": "^14.0.1",
+    "electron-builder": "^22.14.13"
+  },
+  "dependencies": {
+    "http-server": "^13.0.2"
+  }
+}

+ 1 - 0
preload.js

@@ -0,0 +1 @@
+window.require = require