diff --git a/electron/config/config.default.js b/electron/config/config.default.js
index 77a50ed..5ae2766 100644
--- a/electron/config/config.default.js
+++ b/electron/config/config.default.js
@@ -50,7 +50,7 @@ module.exports = (appInfo) => {
minWidth: 800,
minHeight: 650,
webPreferences: {
- //webSecurity: false, // 跨域问题 -> 打开注释
+ webSecurity: false,
contextIsolation: false, // false -> 可在渲染进程中使用electron的api,true->需要bridge.js(contextBridge)
nodeIntegration: true,
//preload: path.join(appInfo.baseDir, 'preload', 'bridge.js'),
diff --git a/electron/controller/os.js b/electron/controller/os.js
index b84d82d..ca72d3f 100644
--- a/electron/controller/os.js
+++ b/electron/controller/os.js
@@ -93,6 +93,24 @@ class OsController extends Controller {
return true;
}
+ /**
+ * 选择图片
+ */
+ selectPic() {
+ const filePaths = dialog.showOpenDialogSync({
+ title: 'select pic',
+ properties: ['openFile'],
+ filters: [
+ { name: 'Images', extensions: ['jpg', 'png', 'gif'] },
+ ]
+ });
+ if (_.isEmpty(filePaths)) {
+ return null
+ }
+
+ return filePaths[0];
+ }
+
/**
* 加载视图内容
*/
diff --git a/frontend/src/api/main.js b/frontend/src/api/main.js
index 5c2b93f..6df32c9 100644
--- a/frontend/src/api/main.js
+++ b/frontend/src/api/main.js
@@ -31,6 +31,7 @@ const ipcApiRoute = {
messageShow: 'controller.os.messageShow',
messageShowConfirm: 'controller.os.messageShowConfirm',
selectFolder: 'controller.os.selectFolder',
+ selectPic: 'controller.os.selectPic',
openDirectory: 'controller.os.openDirectory',
loadViewContent: 'controller.os.loadViewContent',
removeViewContent: 'controller.os.removeViewContent',
diff --git a/frontend/src/router/routerMap.js b/frontend/src/router/routerMap.js
index d6ef311..32fabe3 100644
--- a/frontend/src/router/routerMap.js
+++ b/frontend/src/router/routerMap.js
@@ -80,6 +80,11 @@ const constantRouterMap = [
name: 'OsFileIndex',
component: () => import('@/views/os/file/Index.vue')
},
+ {
+ path: '/os/file/pic',
+ name: 'OsFilePic',
+ component: () => import('@/views/os/file/Pic.vue')
+ },
{
path: '/os/windowview/index',
name: 'OsWindowViewIndex',
diff --git a/frontend/src/router/subMenu.js b/frontend/src/router/subMenu.js
index f03ea9b..fd18143 100644
--- a/frontend/src/router/subMenu.js
+++ b/frontend/src/router/subMenu.js
@@ -106,7 +106,13 @@ export default {
title: '系统主题',
pageName: 'OsThemeIndex',
params: {}
- },
+ },
+ 'menu_110' : {
+ icon: 'profile',
+ title: '图片',
+ pageName: 'OsFilePic',
+ params: {}
+ },
},
hardware: {
'menu_100' : {
diff --git a/frontend/src/views/os/file/Pic.vue b/frontend/src/views/os/file/Pic.vue
new file mode 100644
index 0000000..51fe399
--- /dev/null
+++ b/frontend/src/views/os/file/Pic.vue
@@ -0,0 +1,53 @@
+
+
+
+
+
+
\ No newline at end of file