提交 1c51b652 authored 作者: caicai's avatar caicai

显示所有应用

上级 87f609d4
...@@ -6,11 +6,29 @@ class AppEvents { ...@@ -6,11 +6,29 @@ class AppEvents {
this.windowManager = appManager.windowManager this.windowManager = appManager.windowManager
app.on('activate', () => { app.on('activate', () => {
console.log('\n app activate!', new Date().getTime() )
if (this.windowManager.mainWindow.win === null) { if (this.windowManager.mainWindow.win === null) {
console.log('Main window is null!') console.log('Main window is null!')
} }
}) })
app.on('browser-window-blur', () => {
console.log('\n app browser-window-blur!', new Date().getTime() )
})
app.on('browser-window-focus', () => {
console.log('app browser-window-focus!', new Date().getTime() )
})
app.on('continue-activit', () => {
console.log('\n app continue-activit!', new Date().getTime() )
})
app.on('did-become-active', () => {
console.log('\n app did-become-active!', new Date().getTime() )
})
/* 在Electron加载前需要进行初始化 /* 在Electron加载前需要进行初始化
Before electron app is ready, we should initial */ Before electron app is ready, we should initial */
app.on('ready', async () => { app.on('ready', async () => {
......
...@@ -108,7 +108,6 @@ class IpcEvents { ...@@ -108,7 +108,6 @@ class IpcEvents {
// 获取app列表 // 获取app列表
ipcMain.on("getApps", (e, data) => { ipcMain.on("getApps", (e, data) => {
let apps = this.store.get("apps"); let apps = this.store.get("apps");
// console.log(apps)
this.store.set("currentMode", "modeJianYue"); this.store.set("currentMode", "modeJianYue");
e.sender.send("appsList", apps) e.sender.send("appsList", apps)
}) })
...@@ -140,7 +139,7 @@ class IpcEvents { ...@@ -140,7 +139,7 @@ class IpcEvents {
this.store.set("apps", apps); this.store.set("apps", apps);
e.sender.send("base64Info", {url:src,index}); e.sender.send("base64Info", {url:src,index});
} catch (error) { } catch (error) {
console.error(error)
} }
}) })
......
...@@ -11,7 +11,7 @@ import { protocol } from 'electron' ...@@ -11,7 +11,7 @@ import { protocol } from 'electron'
//热加载 //热加载
try { try {
require('electron-reloader')(module); // require('electron-reloader')(module);
} catch {} } catch {}
// Scheme must be registered before the app is ready // Scheme must be registered before the app is ready
......
...@@ -40,7 +40,7 @@ class SoftList { ...@@ -40,7 +40,7 @@ class SoftList {
const iconPaths = stdout.toString().split('\n').filter(path => path && path.trim() !== ''); const iconPaths = stdout.toString().split('\n').filter(path => path && path.trim() !== '');
return iconPaths; return iconPaths;
} catch (error) { } catch (error) {
// console.error(`命令执行失败: ${error}`); console.error(`命令执行失败: ${error}`);
return null; return null;
} }
} }
...@@ -50,6 +50,7 @@ class SoftList { ...@@ -50,6 +50,7 @@ class SoftList {
let locolorIcon = ''; let locolorIcon = '';
let hiMax = 0; let hiMax = 0;
let loMax = 0; let loMax = 0;
if(!iconList) return icon;
iconList.forEach(v => { iconList.forEach(v => {
if(v && typeof v =='string' && v.indexOf('/hicolor/')>0) { if(v && typeof v =='string' && v.indexOf('/hicolor/')>0) {
let str = v.replace('/usr/share/icons/hicolor/','') let str = v.replace('/usr/share/icons/hicolor/','')
...@@ -150,7 +151,7 @@ class SoftList { ...@@ -150,7 +151,7 @@ class SoftList {
this.store.set('apps', newApps); this.store.set('apps', newApps);
this.mainWindow.win.webContents.send("appsList", newApps); this.mainWindow.win.webContents.send("appsList", newApps);
} catch (error) { } catch (error) {
// console.error(error) console.error(error)
} }
}); });
} }
...@@ -283,7 +284,7 @@ class SoftList { ...@@ -283,7 +284,7 @@ class SoftList {
src = `data:image/png;base64,${imageBase64}`; src = `data:image/png;base64,${imageBase64}`;
src = src.replace(/[\r\n]/g, ''); src = src.replace(/[\r\n]/g, '');
} catch (error) { } catch (error) {
console.error( error )
} }
return src; return src;
} }
......
...@@ -15,7 +15,7 @@ export default { ...@@ -15,7 +15,7 @@ export default {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
margin-top: 24px; margin-top: 24px;
padding: 30px 40px 18px; padding: 30px 20px 18px;
background: linear-gradient(180deg, #FFFFFF 0%, rgba(255,255,255,0.5) 100%); background: linear-gradient(180deg, #FFFFFF 0%, rgba(255,255,255,0.5) 100%);
box-shadow: 0px 4px 4px 0px rgba(10,78,141,0.1); box-shadow: 0px 4px 4px 0px rgba(10,78,141,0.1);
border-radius: 20px 20px 20px 20px; border-radius: 20px 20px 20px 20px;
......
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
:data-appname="appItem.name" :data-appname="appItem.name"
class="app_item" class="app_item"
@click="tapApp(appItem)"> @click="tapApp(appItem)">
<img :src="appItem.icon" alt="" class="img" v-if="appItem.icon && appItem.icon.indexOf('.png') == -1"> <img :src="appItem.icon" alt="" class="img" v-if="appItem.icon && appItem.icon.indexOf('.png') == -1">
<span class="app_name">{{ appItem.name }}</span> <span class="app_name">{{ appItem.name }}</span>
</div> </div>
</div> </div>
<div v-if="mode === 'modeJianYue'" class="group1_wrap"> <div v-if="mode === 'modeJianYue'" class="group1_wrap">
...@@ -149,6 +149,7 @@ export default { ...@@ -149,6 +149,7 @@ export default {
} }
} }
.app_item { .app_item {
position: relative;
margin: 0 4px; margin: 0 4px;
flex-shrink: 0; flex-shrink: 0;
width: 36px; width: 36px;
...@@ -159,10 +160,15 @@ export default { ...@@ -159,10 +160,15 @@ export default {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
font-size: 10px; font-size: 10px;
overflow: hidden; // overflow: hidden;
text-align: left; text-align: left;
cursor: pointer; cursor: pointer;
flex-wrap: wrap; flex-wrap: wrap;
&:hover {
.app_name {
display: block;
}
}
} }
.img { .img {
flex-shrink: 0; flex-shrink: 0;
...@@ -170,8 +176,18 @@ export default { ...@@ -170,8 +176,18 @@ export default {
// width: 36px; // width: 36px;
} }
.app_name { .app_name {
display: none;
position: absolute;
top: -10px;
left: -20px;
border-radius: 4px;
padding:4px;
width: max-content;
background-color: #333;
word-break: normal;
font-size: 14px; font-size: 14px;
color: #fff; color: #fff;
z-index: 99;
} }
.yun_img { .yun_img {
width: 58px; width: 58px;
......
...@@ -42,6 +42,7 @@ import { ...@@ -42,6 +42,7 @@ import {
Tabs, Tabs,
TabPane, TabPane,
Tree, Tree,
Tooltip,
Upload, Upload,
Dialog, Dialog,
Breadcrumb, Breadcrumb,
...@@ -76,6 +77,7 @@ Vue.use(RouterTab); ...@@ -76,6 +77,7 @@ Vue.use(RouterTab);
Vue.use(ace); Vue.use(ace);
Vue.use(componentsInstall) Vue.use(componentsInstall)
Vue.use(Tooltip);
Vue.use(Button); Vue.use(Button);
Vue.use(Col); Vue.use(Col);
Vue.use(Drawer); Vue.use(Drawer);
......
...@@ -178,6 +178,7 @@ export default { ...@@ -178,6 +178,7 @@ export default {
this.appList.forEach((item, index) => { this.appList.forEach((item, index) => {
// console.log(item.icon) // console.log(item.icon)
if (item.icon && item.icon.indexOf("data:image/png") == -1) { if (item.icon && item.icon.indexOf("data:image/png") == -1) {
// console.log('getBase64', index)
this.ipcRenderer.send("getBase64", { imagePath: item.icon, index }); this.ipcRenderer.send("getBase64", { imagePath: item.icon, index });
} }
}); });
...@@ -186,7 +187,7 @@ export default { ...@@ -186,7 +187,7 @@ export default {
this.ipcRenderer.on("appsList_update", (event, list) => { this.ipcRenderer.on("appsList_update", (event, list) => {
console.log("刷新app列表", list); console.log("刷新app列表", list);
// this.appList = list; this.appList = list;
// this.getPinyin(); // this.getPinyin();
}); });
......
...@@ -71,21 +71,21 @@ export default { ...@@ -71,21 +71,21 @@ export default {
methods: { methods: {
getAppList() { getAppList() {
//获取app列表 //获取app列表
console.log('getAppList') console.log('getAppList 2')
this.ipcRenderer.send("getApps"); this.ipcRenderer.send("getApps");
}, },
ipcOn() { ipcOn() {
// 获取到app列表 // 获取到app列表
this.ipcRenderer.on("appsList", (event, list) => { this.ipcRenderer.on("appsList", (event, list) => {
console.log("获取到app列表", list); console.log("获取到app列表 2", list);
this.listObj.lastest = list; this.listObj.lastest = list;
this.appList = list; this.appList = list;
this.appList.forEach((item, index) => { // this.appList.forEach((item, index) => {
// console.log(item.icon) // // console.log(item.icon)
if (item.icon && item.icon.indexOf("data:image/png") == -1) { // if (item.icon && item.icon.indexOf("data:image/png") == -1) {
this.ipcRenderer.send("getBase64", { imagePath: item.icon, index }); // this.ipcRenderer.send("getBase64", { imagePath: item.icon, index });
} // }
}); // });
// this.getPinyin(); // this.getPinyin();
}); });
} }
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论