...
 
Commits (8)
    https://gitcode.net/codechina_dev/quicker/-/commit/f6c032eea40f425af39d90330da20a7b867b45e8 Merge branch 'feature/ding' into 'master' 2021-12-24T21:15:17+08:00  璃白  18511759309@163.com Feature/ding See merge request weixin_43881430/quicker!1 https://gitcode.net/codechina_dev/quicker/-/commit/f9f92df6cc4ab73c11625b28b91f925fc392d38c Merge branch 'feature/ding' into 'master' 2021-12-28T18:37:20+08:00  璃白  18511759309@163.com Feature/ding See merge request weixin_43881430/quicker!2 https://gitcode.net/codechina_dev/quicker/-/commit/ff849c20531d79830d3d0d72cdf867b36ae01f07 fix:优化界面 2022-01-05T14:23:18+08:00 layyback 18511759309@163.com https://gitcode.net/codechina_dev/quicker/-/commit/bc8fb1970fe4c41c2070b498158eb586687beaf1 Merge branch 'feature/ding' of https://gitcode.net/weixin_43881430/quicker in... 2022-01-05T14:26:54+08:00 璃白 18511759309@163.com https://gitcode.net/codechina_dev/quicker/-/commit/cd5899bde535cfcc4908e615e98eb3dd7adf188c fix:适配windows 2022-01-05T15:03:29+08:00 璃白 18511759309@163.com https://gitcode.net/codechina_dev/quicker/-/commit/4fb64a9b760767902a7f87519e6482ce124863ba fix:优化高度 2022-01-05T16:04:19+08:00 layyback 18511759309@163.com https://gitcode.net/codechina_dev/quicker/-/commit/49656e8543339e199b70e0fb7297301ddfb8b2bd feat:自动隐藏窗口 2022-01-05T16:06:11+08:00 layyback 18511759309@163.com https://gitcode.net/codechina_dev/quicker/-/commit/fe64686200fab6398a9fd073bb21dbd130d63d62 fix:优化显示隐藏逻辑 2022-01-05T18:09:03+08:00 layyback 18511759309@163.com
{
"name": "Quicker",
"version": "0.0.2",
"version": "0.0.3",
"author": "libai",
"description": "An electron-vue project",
"license": null,
......
......@@ -61,20 +61,22 @@ module.exports = () => {
});
};
let createWindow = () => {
let createWindow = mainWindow => {
console.log("create window");
session.defaultSession.cookies
.get({
url: url
})
.then((cookies, err) => {
console.log("cookies", cookies);
// console.log("cookies", cookies);
});
win = new BrowserWindow({
frame: true,
autoHideMenuBar: true,
title: false,
parent: mainWindow,
modal: true,
width: 460,
height: 400,
show: false,
......@@ -103,7 +105,7 @@ module.exports = () => {
});
// 打包后,失焦隐藏
win.on("blur", () => {
// win.hide();
win.close();
});
win.webContents.on("did-stop-loading", () => {
win.webContents.insertCSS(
......@@ -120,7 +122,7 @@ module.exports = () => {
.quicker_loading { height: 100vh; }
`
);
win.openDevTools()
win.openDevTools();
win.show();
});
};
......
......@@ -15,13 +15,14 @@ module.exports = () => {
: `file://${__dirname}/index.html`;
win = new BrowserWindow({
height: 82, // client_height
height: 74, // client_height
useContentSize: true,
resizable: true,
width: 920,
frame: false,
frame: false,
backgroundColor: "#fff",
title: "拉比克",
show: false,
show: true,
skipTaskbar: true,
webPreferences: {
webSecurity: false,
......@@ -50,12 +51,13 @@ module.exports = () => {
}
);
win.once("ready-to-show", () => win.show());
// win.once("ready-to-show", () => win.show());
win.on("closed", () => {
win = undefined;
});
win.on("blur", () => {
// win.hide();
const childWindows = win.getChildWindows();
if (!childWindows.length) win.hide();
});
};
......
......@@ -63,7 +63,7 @@ global.opConfig = {
) {
opConfig.config = defaultConfig[platform];
fs.writeFileSync(configPath, JSON.stringify(opConfig.config));
}
}
return opConfig.config;
} catch (e) {
opConfig.config = defaultConfig[platform];
......
......@@ -217,7 +217,9 @@ class Listener {
console.log("win", win);
if (win === null || win === undefined) {
login.createWindow();
login.createWindow(mainWindow);
} else {
win.show()
}
});
}
......
<template>
<div id="app" @mousedown="drag">
<a-layout id="components-layout">
<a-layout id="components-layout" :class="[{ mac: isMac }]">
<div v-if="!searchType" class="rubick-select">
<div v-if="selected" class="tag-container">
<template v-if="isWebview">
......@@ -39,9 +39,7 @@
<a-input
id="search"
:placeholder="
subPlaceHolder && selected && selected.key === 'plugin-container'
? subPlaceHolder
: 'Hello, Quicker'
subPlaceHolder && selected ? subPlaceHolder : 'Hello, Quicker'
"
@mousedown.stop="dragWhenInput"
class="main-input"
......@@ -91,7 +89,7 @@
:src="userInfo.UserAvatar"
alt=""
/>
<a-icon v-else class="icon-more" type="more" />
<a-icon v-else class="icon-more" type="appstore" />
</div>
</div>
</a-input>
......@@ -157,7 +155,7 @@
</template>
<script>
import quickApps from "./pages/quick-apps/app-list.vue";
import { mapActions, mapMutations, mapState } from "vuex";
import { mapActions, mapMutations, mapState, mapGetters } from "vuex";
import { ipcRenderer, remote, clipboard } from "electron";
import {
getWindowHeight,
......@@ -394,7 +392,7 @@ export default {
});
this.setHideOnBlur(true);
ipcRenderer.send("changeWindowSize-rubick", {
height: getWindowHeight([])
height: getWindowHeight([], this.dingApp)
});
if (this.$router.history.current.fullPath !== "/home") {
// 该if是为了避免跳转到相同路由而报错。
......@@ -488,6 +486,10 @@ export default {
"userInfo",
"pluginLoading"
]),
...mapGetters("main", ["dingApp"]),
isMac() {
return commonConst.macOS();
},
isWebview() {
return this.pluginInfo.subType === "webview";
},
......@@ -540,7 +542,7 @@ body {
}
#app {
padding: 10px;
padding: 6px;
box-sizing: border-box;
}
......@@ -548,6 +550,9 @@ body {
overflow: auto;
// margin-top: 14px;
background: #fff;
&.mac {
-webkit-app-region: drag;
}
::-webkit-scrollbar {
width: 0;
}
......@@ -605,14 +610,13 @@ body {
border: none;
box-shadow: none;
}
.options {
position: absolute;
top:82px;
top: 78px;
left: 0;
width: 100%;
z-index: 99;
max-height: calc(~"100vh - 96px"); // client_height
max-height: calc(~"100vh - 86px"); // client_height
overflow: auto;
padding: 0 14px;
box-sizing: border-box;
......@@ -630,7 +634,7 @@ body {
}
}
.rubick-select-subMenu {
-webkit-app-region: drag;
// -webkit-app-region: drag;
background: #eee;
height: 50px;
padding-left: 200px;
......@@ -667,6 +671,7 @@ body {
font-size: 26px;
font-weight: bold;
cursor: pointer;
color: #999;
}
.loading {
position: absolute;
......
const WINDOW_MAX_HEIGHT = 800;
const WINDOW_MIN_HEIGHT = 82; // client_height
const WINDOW_MIN_HEIGHT = 74; // client_height
const WINDOW_MIN_HEIGHT_WITH_APP = 126; // client_height
const PRE_ITEM_HEIGHT = 60;
const SYSTEM_PLUGINS = [
......@@ -55,4 +56,4 @@ const SYSTEM_PLUGINS = [
const APP_FINDER_PATH = process.platform === 'darwin' ? ['/System/Applications', '/Applications', '/System/Library/PreferencePanes'] : [];
export { WINDOW_MAX_HEIGHT, WINDOW_MIN_HEIGHT, PRE_ITEM_HEIGHT, SYSTEM_PLUGINS, APP_FINDER_PATH };
export { WINDOW_MAX_HEIGHT, WINDOW_MIN_HEIGHT, WINDOW_MIN_HEIGHT_WITH_APP, PRE_ITEM_HEIGHT, SYSTEM_PLUGINS, APP_FINDER_PATH };
import {
WINDOW_MAX_HEIGHT,
WINDOW_MIN_HEIGHT,
WINDOW_MIN_HEIGHT_WITH_APP,
PRE_ITEM_HEIGHT,
SYSTEM_PLUGINS
} from "./constans";
......@@ -22,9 +23,10 @@ const store = new Store();
getApp.init();
const fileLists = getApp.fileLists;
function getWindowHeight(searchList) {
function getWindowHeight(searchList, dingAppList = []) {
if (!searchList) return WINDOW_MAX_HEIGHT;
if (!searchList.length) return WINDOW_MIN_HEIGHT;
if (!searchList.length)
return dingAppList.length ? WINDOW_MIN_HEIGHT_WITH_APP : WINDOW_MIN_HEIGHT;
return searchList.length * PRE_ITEM_HEIGHT + WINDOW_MIN_HEIGHT + 5 >
WINDOW_MAX_HEIGHT
? WINDOW_MAX_HEIGHT
......@@ -51,6 +53,11 @@ function existOrNot(path) {
});
}
function isMdFile(str) {
if (!str) return false;
return /\.md$/i.test(str);
}
const appPath = getLocalDataFile();
async function downloadZip(downloadRepoUrl, name) {
......@@ -208,5 +215,6 @@ export {
downloadZip,
downloadZipFromGitCode,
fileLists,
debounce
debounce,
isMdFile
};
......@@ -39,6 +39,7 @@ export default {
};
},
mounted() {
this.setSubPlaceHolder("按 ⌫ 键退出插件");
this.webview = document.querySelector("webview");
// if (!this.webview) return;
this.webview.addEventListener("dom-ready", () => {
......@@ -53,7 +54,6 @@ export default {
pluginLoading: false
});
});
this.setSubPlaceHolder("Hello, Quicker");
this.webview.addEventListener("ipc-message", event => {
if (event.channel === "insertCSS") {
this.webview.addEventListener("dom-ready", () => {
......@@ -172,6 +172,6 @@ export default {
<style lang="less">
#webview {
width: 100%;
height: calc(~"100vh - 84px");
height: calc(~"100vh - 74px");
}
</style>
......@@ -35,13 +35,14 @@
<script>
import app from "./components/app.vue";
import { shell, ipcRenderer } from "electron";
import { mapState, mapMutations, mapActions } from "vuex";
import { mapState, mapMutations, mapActions, mapGetters } from "vuex";
export default {
components: {
app
},
computed: {
...mapState("main", ["mode", "installs", "userInfo", "devPlugins"]),
...mapGetters("main", ["dingApp"]),
isEditMode() {
return this.mode === "edit";
},
......@@ -55,13 +56,6 @@ export default {
url: "https://yre5673znb.feishu.cn/docs/doccnMnLv3iZ3epFvjXprnPum3b",
icon: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg95.699pic.com%2Felement%2F40053%2F1100.png_860.png%21%2Ffw%2F562&refer=http%3A%2F%2Fimg95.699pic.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1642577880&t=84032418744ad3e05d175dd6dd309c99"
};
},
dingApp() {
return [
...this.devPlugins.filter(plugin => {
return plugin.ding === true;
})
];
}
},
created() {
......@@ -85,7 +79,7 @@ export default {
// alert(123)
if (!this.isHome) return;
ipcRenderer.send("changeWindowSize-rubick", {
height: this.dingApp.length ? 126 : 82
height: this.dingApp.length ? 126 : 74
});
},
helpDoc() {
......
......@@ -40,7 +40,7 @@ export default {
bottom: -10px;
transition: all 0.3s;
box-shadow: 4px 4px 4px rgba(0, 0, 0, 0.1);
-webkit-app-region: no-drag;
// -webkit-app-region: no-drag;
z-index: 2;
}
.app_name {
......
......@@ -149,7 +149,7 @@ export default {
</script>
<style lang="less" scoped>
webview {
height: calc(~"100vh - 84px");
height: calc(~"100vh - 112px");
width: 100%;
}
.ant-tabs {
......
......@@ -4,7 +4,7 @@
<a-menu :selectedKeys="current" mode="horizontal" @select="changePath">
<a-menu-item key="market">
<a-icon type="appstore" />
<a-badge :dot="showUpdateBadge"> 插件中心 </a-badge>
<a-badge :dot="showUpdateBadge"> 插件市场 </a-badge>
</a-menu-item>
<a-menu-item key="plugin">
<a-icon type="heart" />
......@@ -31,7 +31,11 @@ export default {
name: "search",
methods: {
...mapActions("main", ["onSearch", "showMainUI"]),
...mapMutations("main", ["commonUpdate", "changeMode"]),
...mapMutations("main", [
"commonUpdate",
"changeMode",
"setSubPlaceHolder"
]),
changePath({ key }) {
this.$router.push({ path: `/home/${key}` });
this.commonUpdate({
......@@ -44,6 +48,9 @@ export default {
}
}
},
mounted() {
this.setSubPlaceHolder("按 ⌫ 键退出");
},
computed: {
...mapState("main", [
"showMain",
......
......@@ -142,7 +142,7 @@ export default {
<style lang="less">
.dev-container {
height: calc(~'100vh - 110px');
// height: calc(~'100vh - 80px');
width: 100%;
.ant-menu-item {
height: 60px !important;
......
......@@ -112,7 +112,8 @@ import api from "../../../assets/api";
import { mapActions, mapMutations, mapState } from "vuex";
import marked from "marked";
import { shell } from "electron";
import path from "path";
import axios from "axios";
import { isMdFile } from "../../../assets/common/utils";
const rendererMD = new marked.Renderer();
export default {
......@@ -129,24 +130,28 @@ export default {
this.getPlugins();
// this.bannerList = bannerRes.result;
},
methods: {
getPlugins() {
api.getPlugins().then(async ({ data: res }) => {
res.forEach(async plugin => {
const pluginItem = await this.getPluginDetail(plugin);
const pluginItem = await this.getPluginDetail(plugin.name);
this.pluginList.push(pluginItem);
});
});
},
async getPluginDetail(plugin) {
async getPluginDetail(name) {
const {
data: { version, pluginName, description, logo }
} = await api.getPluginDetail(plugin.name);
plugin.pluginName = pluginName;
plugin.description = description;
plugin.version = version;
plugin.logo = `https://gitlab.com/layyback/quicker-market/-/raw/master/plugins/${plugin.name}/${logo}`;
data: plugin
} = await api.getPluginDetail(name);
if (plugin.detail && isMdFile(plugin.detail)) {
const { readme } = await axios.get(
`https://gitlab.com/layyback/quicker-market/-/raw/master/plugins/${plugin.name}/${plugin.detail}`
);
plugin.readme = readme;
} else {
plugin.readme = plugin.detail;
}
plugin.logo = `https://gitlab.com/layyback/quicker-market/-/raw/master/plugins/${plugin.name}/${plugin.logo}`;
// plugin.logo = `https://gitcode.net/weixin_43881430/quicker-market/-/raw/master/plugins/${plugin.name}/${logo}`;
plugin.downloadUrl = `https://gitlab.com/api/v4/projects/layyback%2Fquicker-market/repository/archive.zip?path=plugins%2F${plugin.name}`;
// plugin.downloadUrl =
......@@ -180,8 +185,6 @@ export default {
plugin => plugin.name === item.name && plugin.type === "prod"
);
if (!plugin) return "download";
console.log(plugin, item);
if (plugin && plugin.version !== item.version) {
this.changeUpdateBadge(true);
return "update";
......@@ -227,7 +230,9 @@ export default {
smartypants: false
});
try {
return marked(this.currentSelect.detail);
console.log(123, this.currentSelect);
return marked(this.currentSelect.readme);
} catch (e) {
return "暂无描述信息";
}
......
......@@ -142,7 +142,7 @@ export default {
<style lang="less">
.dev-container {
height: calc(~"100vh - 110px");
height: calc(~"100vh - 124px");
overflow: auto;
.dev-detail {
display: flex;
......
......@@ -68,7 +68,8 @@
<div class="settings-item-li">
<div class="label">开机启动</div>
<a-switch
v-model:checked="config.perf.common.start"
:default-checked="config.perf.common.start"
@change="changeStart"
checked-children="开"
un-checked-children="关"
></a-switch>
......@@ -76,7 +77,8 @@
<div class="settings-item-li">
<div class="label">空格执行</div>
<a-switch
v-model:checked="config.perf.common.space"
:default-checked="config.perf.common.space"
@change="changeSpace"
checked-children="开"
un-checked-children="关"
></a-switch>
......@@ -87,7 +89,8 @@
<div class="settings-item-li">
<div class="label">搜索启动应用&文件</div>
<a-switch
v-model:checked="config.perf.local.search"
:default-checked="config.perf.local.search"
@change="changeSearch"
checked-children="开"
un-checked-children="关"
></a-switch>
......@@ -210,6 +213,18 @@ export default {
created() {},
methods: {
...mapMutations("main", ["setUserInfo"]),
changeStart(v) {
this.config.perf.common.start = v;
this.saveConfig();
},
changeSpace(v) {
this.config.perf.common.space = v;
this.saveConfig();
},
changeSearch(v) {
this.config.perf.local.search = v;
this.saveConfig();
},
login() {
this.signLoading = true;
setTimeout(() => {
......@@ -279,17 +294,12 @@ export default {
},
changeGlobalValue(index, value) {
this.$set(this.config.global[index], "value", value);
}
},
watch: {
config: {
deep: true,
handler() {
opConfig.set("perf", this.config.perf);
opConfig.set("superPanel", this.config.superPanel);
opConfig.set("global", this.config.global);
ipcRenderer.send("re-register");
}
},
saveConfig() {
opConfig.set("perf", this.config.perf);
opConfig.set("superPanel", this.config.superPanel);
opConfig.set("global", this.config.global);
ipcRenderer.send("re-register");
}
}
};
......@@ -298,7 +308,7 @@ export default {
<style lang="less">
@import "../../../assets/style/varable.less";
.pg-settings {
height: calc(~"100vh - 128px");
height: calc(~"100vh - 120px");
overflow: auto;
.dev-detail {
height: 100%;
......
......@@ -172,6 +172,16 @@ const state = {
})()
};
const getters = {
dingApp(state, getters) {
return [
...state.devPlugins.filter(plugin => {
return plugin.ding === true;
})
];
}
};
const mutations = {
changeMode(state, val) {
state.mode = val;
......@@ -442,7 +452,7 @@ const actions = {
options
});
ipcRenderer.send("changeWindowSize-rubick", {
height: getWindowHeight(state.options)
height: getWindowHeight(state.options, getters.dingApp)
});
},
async downloadPlugin({ commit }, payload) {
......@@ -510,8 +520,6 @@ const actions = {
if (index !== -1) {
devPlugins[index] = pluginConfig;
}
console.log(111, devPlugins);
commit("commonUpdate", {
devPlugins: devPlugins
});
......@@ -580,6 +588,7 @@ const actions = {
export default {
namespaced: true,
state,
getters,
mutations,
actions
};