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 }