提交 99044d15 authored 作者: caicai's avatar caicai

系统命令

上级 48021385
...@@ -179,6 +179,39 @@ class IpcEvents { ...@@ -179,6 +179,39 @@ class IpcEvents {
} }
}) })
// system\settingCenter\lockScreen\restart\shutdown
ipcMain.on("run_type", (e, data) => {
const typePro = {
system: "ukui-control-center -m about", //关于系统
settingCenter: "ukui-control-center", //设置中心
lockScreen: "dm-tool lock", //锁定
restart: "reboot", //重启
shutdown: "shutdown -t 3600", //关机
};
// 子进程名称
let workerProcess;
runExec(typePro[data])
function runExec (cmdStr) {
workerProcess = exec(cmdStr)
// 打印正常的后台可执行程序输出
workerProcess.stdout.on('data', function (data) {
console.log('stdout: ' + data)
})
// 打印错误的后台可执行程序输出
workerProcess.stderr.on('data', function (data) {
console.log('stderr: ' + data)
})
// 退出之后的输出
workerProcess.on('close', function (code) {
console.log('out code:' + code)
})
}
})
// mac-获取前台应用程序 // mac-获取前台应用程序
ipcMain.on("getfrontApp", (e, data) => { ipcMain.on("getfrontApp", (e, data) => {
console.log('获取前台应用程序') console.log('获取前台应用程序')
......
...@@ -21,7 +21,7 @@ export const windowsCfg = { ...@@ -21,7 +21,7 @@ export const windowsCfg = {
route: '', // 页面路由URL '/manage?id=123' route: '', // 页面路由URL '/manage?id=123'
resizable: true, //是否支持调整窗口大小 resizable: true, //是否支持调整窗口大小
maximize: false, //是否最大化 maximize: false, //是否最大化
backgroundColor:'#eee', //窗口背景色 // backgroundColor:'#eee', //窗口背景色
data: null, //数据 data: null, //数据
isMultiWindow: false, //是否支持多开窗口 (如果为false,当窗体存在,再次创建不会新建一个窗体 只focus显示即可,,如果为true,即使窗体存在,也可以新建一个) isMultiWindow: false, //是否支持多开窗口 (如果为false,当窗体存在,再次创建不会新建一个窗体 只focus显示即可,,如果为true,即使窗体存在,也可以新建一个)
isMainWin: false, //是否主窗口(当为true时会替代当前主窗口) isMainWin: false, //是否主窗口(当为true时会替代当前主窗口)
...@@ -71,7 +71,7 @@ class MainWindow { ...@@ -71,7 +71,7 @@ class MainWindow {
return { return {
width: wh[0], width: wh[0],
height: wh[1], height: wh[1],
backgroundColor: '#f00', // backgroundColor: '#f00',
// autoHideMenuBar: true, // autoHideMenuBar: true,
// titleBarStyle: "hidden", // titleBarStyle: "hidden",
resizable: true, resizable: true,
...@@ -81,7 +81,7 @@ class MainWindow { ...@@ -81,7 +81,7 @@ class MainWindow {
show: false, show: false,
fullscreen:false, fullscreen:false,
fullscreenable:false, fullscreenable:false,
backgroundColor: '#00000000', //透明颜色 // backgroundColor: '#00000000', //透明颜色
transparent:true, //透明开启 transparent:true, //透明开启
webPreferences: { webPreferences: {
contextIsolation: false, //上下文隔离 contextIsolation: false, //上下文隔离
......
...@@ -237,6 +237,7 @@ html { ...@@ -237,6 +237,7 @@ html {
body { body {
margin: 0; margin: 0;
font-size: 14px !important; font-size: 14px !important;
background-color: rgba(0,0,0,0.25);
} }
.container { .container {
font-size: 20px; font-size: 20px;
......
...@@ -3,6 +3,11 @@ ...@@ -3,6 +3,11 @@
<el-aside width="200px" class="manage_aside"> <el-aside width="200px" class="manage_aside">
<div class="aside_top"> <div class="aside_top">
<!-- <div>开始</div> --> <!-- <div>开始</div> -->
<div class="aside_item" @click="openWin('system')">关于系统</div>
<div class="aside_item" @click="openWin('settingCenter')">设置中心</div>
<div class="aside_item" @click="openWin('lockScreen')">锁屏</div>
<div class="aside_item" @click="openWin('restart')">重启</div>
<div class="aside_item" @click="openWin('shutdown')">关机</div>
</div> </div>
<div class="aside_bottom"> <div class="aside_bottom">
<div class="aside_item" @click="changeTap('school')" :class="{ 'active': current === 'school' }"> <div class="aside_item" @click="changeTap('school')" :class="{ 'active': current === 'school' }">
...@@ -99,6 +104,29 @@ export default { ...@@ -99,6 +104,29 @@ export default {
if(this.current === tabType) return; if(this.current === tabType) return;
this.current = tabType; this.current = tabType;
}, },
openWin(type) {
// system\settingCenter\lockScreen\restart\shutdown
if(type === 'restart' || type === 'shutdown') {
const remote=this.$electron.remote;
remote.dialog.showMessageBox({
type:'none',
title: '提示',
textWidth:500,
defaultId:1,
message: `\n确认${type === '\n restart' ? '重启':'关机'}吗? \n`,
buttons:['取消','确认']
}).then((result) => {
let response = result.response; //点击的索引
if(response == 1) {
this.ipcRenderer.send('run_type',type);
}
}).catch(err => {
console.log(err)
})
return;
}
this.ipcRenderer.send('run_type',type);
},
} }
} }
</script> </script>
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论