From 7dd5407bbea916d32227695cef398368910d724b Mon Sep 17 00:00:00 2001 From: muwoo <2424880409@qq.com> Date: Mon, 23 Aug 2021 11:13:25 +0800 Subject: [PATCH] =?UTF-8?q?bugfix:=20=E4=BF=AE=E5=A4=8D=E8=B6=85=E7=BA=A7?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E6=B5=85=E6=8B=B7=E8=B4=9D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 ++- static/plugins/superPanel/index.js | 4 +++- static/utils.js | 25 ++++++++++++++++++++++++- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index e8d6b21..7c4a1e5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rubick2", - "version": "0.0.3-beta.4", + "version": "0.0.3-beta.5", "author": "muwoo <2424880409@qq.com>", "description": "An electron-vue project", "license": null, @@ -81,6 +81,7 @@ "robotjs": "git+https://github.com/Toinane/robotjs.git", "semver": "^7.3.5", "sudo-prompt": "^9.2.1", + "systeminformation": "^5.8.0", "unzip": "^0.1.11", "uuid": "^8.3.2", "vue": "^2.5.16", diff --git a/static/plugins/superPanel/index.js b/static/plugins/superPanel/index.js index 8b7148f..de0b64f 100644 --- a/static/plugins/superPanel/index.js +++ b/static/plugins/superPanel/index.js @@ -4,6 +4,7 @@ const path = require('path'); const fs = require('fs'); const { spawn } = require ('child_process'); const mineType = require("mime-types"); +const {extend} = require('../../utils'); new Vue({ el: '#app', @@ -116,7 +117,8 @@ new Vue({ this.targetOptions = this.options.common; } else { // 有文件选择 - this.targetOptions = JSON.parse(JSON.stringify(this.options.selected)); + this.targetOptions = []; + extend(this.targetOptions, this.options.selected, true); // 检测上传 (this.selectData.optionPlugin || []).forEach(plugin => { plugin.features.forEach(fe => { diff --git a/static/utils.js b/static/utils.js index 581fb21..a2b6024 100644 --- a/static/utils.js +++ b/static/utils.js @@ -20,8 +20,31 @@ function getData(path, defaultValue) { } } +const isArray = Array.isArray || + function(object){ return object instanceof Array } + +function isPlainObject(obj) { + return isObject(obj) && Object.getPrototypeOf(obj) == Object.prototype +} + +function isObject(obj) { return typeof obj == "object" } + + +function extend(target, source, deep) { + for (let key in source) + if (deep && (isPlainObject(source[key]) || isArray(source[key]))) { + if (isPlainObject(source[key]) && !isPlainObject(target[key])) + target[key] = {} + if (isArray(source[key]) && !isArray(target[key])) + target[key] = [] + extend(target[key], source[key], deep) + } + else if (source[key] !== undefined) target[key] = source[key] +} + module.exports = { getlocalDataFile, saveData, - getData + getData, + extend }