提交 22a6d957 编写于 作者: 郭维嘉

feat:添加创建仓库

上级 e6dfe828
...@@ -63,6 +63,8 @@ function startRenderer () { ...@@ -63,6 +63,8 @@ function startRenderer () {
compiler, compiler,
{ {
contentBase: path.join(__dirname, '../'), contentBase: path.join(__dirname, '../'),
disableHostCheck: true,
host: 'quicker.csdn.net',
quiet: true, quiet: true,
hot: true, hot: true,
before (app, ctx) { before (app, ctx) {
...@@ -74,7 +76,7 @@ function startRenderer () { ...@@ -74,7 +76,7 @@ function startRenderer () {
} }
) )
server.listen(9080) server.listen(5501)
}) })
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>rubick2</title> <title>Quicker</title>
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"> <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<% if (htmlWebpackPlugin.options.nodeModules) { %> <% if (htmlWebpackPlugin.options.nodeModules) { %>
<!-- Add `node_modules/` to global paths so `require` works properly in development --> <!-- Add `node_modules/` to global paths so `require` works properly in development -->
......
...@@ -11,14 +11,14 @@ module.exports = () => { ...@@ -11,14 +11,14 @@ module.exports = () => {
let createWindow = (opts) => { let createWindow = (opts) => {
const winURL = const winURL =
process.env.NODE_ENV === "development" process.env.NODE_ENV === "development"
? `http://localhost:9080` ? `http://quicker.csdn.net:5501`
: `file://${__dirname}/index.html`; : `file://${__dirname}/index.html`;
win = new BrowserWindow({ win = new BrowserWindow({
height: 60, height: 186,
useContentSize: true, useContentSize: true,
resizable: true, resizable: true,
width: 800, width: 920,
frame: false, frame: false,
title: "拉比克", title: "拉比克",
show: false, show: false,
......
...@@ -10,7 +10,7 @@ module.exports = () => { ...@@ -10,7 +10,7 @@ module.exports = () => {
let createWindow = (opts) => { let createWindow = (opts) => {
const winURL = const winURL =
process.env.NODE_ENV === "development" process.env.NODE_ENV === "development"
? `http://localhost:9080/#/plugin` ? `http://quicker.csdn.net:5501/#/plugin`
: `${__dirname}/index.html`; : `${__dirname}/index.html`;
win = new BrowserWindow({ win = new BrowserWindow({
height: 600, height: 600,
......
...@@ -369,12 +369,12 @@ class Listener { ...@@ -369,12 +369,12 @@ class Listener {
changeSize(mainWindow) { changeSize(mainWindow) {
// 修改窗口尺寸 // 修改窗口尺寸
ipcMain.on("changeWindowSize-rubick", (event, arg) => { ipcMain.on("changeWindowSize-rubick", (event, arg) => {
mainWindow.setSize(arg.width || 800, arg.height); mainWindow.setSize(arg.width || 920, arg.height);
}); });
} }
changePos(mainWindow) { changePos(mainWindow) {
// 修改窗口尺寸 // 修改窗口位置
ipcMain.on("changeWindowPos-rubick", (event, arg) => { ipcMain.on("changeWindowPos-rubick", (event, arg) => {
mainWindow.setPosition(arg.x, arg.y); mainWindow.setPosition(arg.x, arg.y);
}); });
......
<template> <template>
<div @mousedown="drag"> <div id="app" @mousedown="drag">
<!-- <quick-apps /> --> <quick-apps />
<a-layout id="components-layout"> <a-layout id="components-layout">
<div v-if="!searchType" class="rubick-select"> <div v-if="!searchType" class="rubick-select">
<div v-if="selected" class="tag-container"> <div v-if="selected" class="tag-container">
...@@ -10,21 +10,19 @@ ...@@ -10,21 +10,19 @@
<img <img
class="logo" class="logo"
style="display: inline-block" style="display: inline-block"
:src="logoSrc" :src="searchLogo"
alt="" alt=""
srcset="" srcset=""
/> />
<a-icon type="down" /> <a-icon type="down" />
</a> </a>
<a-menu slot="overlay"> <a-menu slot="overlay">
<a-menu-item @click="changeSearch(1)"> <a-menu-item
<a href="javascript:;">CSDN</a> v-for="(item, index) in searchOptions"
</a-menu-item> :key="index"
<a-menu-item @click="changeSearch(2)"> @click="handleSearch(item)"
<a href="javascript:;">百度</a> >
</a-menu-item> <a href="javascript:;">{{ item.name }}</a>
<a-menu-item @click="changeSearch(3)">
<a href="javascript:;">Google</a>
</a-menu-item> </a-menu-item>
</a-menu> </a-menu>
</a-dropdown> </a-dropdown>
...@@ -44,7 +42,7 @@ ...@@ -44,7 +42,7 @@
:placeholder=" :placeholder="
subPlaceHolder && selected && selected.key === 'plugin-container' subPlaceHolder && selected && selected.key === 'plugin-container'
? subPlaceHolder ? subPlaceHolder
: 'Hello Quicker, Welcome to CSDN' : 'Hello, Quicker'
" "
@mousedown.stop="dragWhenInput" @mousedown.stop="dragWhenInput"
class="main-input" class="main-input"
...@@ -79,6 +77,7 @@ ...@@ -79,6 +77,7 @@
/> />
</a-spin> </a-spin>
<img <img
referrer="no-referrer"
v-if="userInfo" v-if="userInfo"
class="icon-tool" class="icon-tool"
:src="userInfo.UserAvatar" :src="userInfo.UserAvatar"
...@@ -88,7 +87,12 @@ ...@@ -88,7 +87,12 @@
</div> </div>
<!-- 用户头像 --> <!-- 用户头像 -->
<div v-else class="logo"> <div v-else class="logo">
<img v-if="userInfo" :src="userInfo.UserAvatar" alt="" /> <img
v-if="userInfo"
referrer="no-referrer"
:src="userInfo.UserAvatar"
alt=""
/>
<img v-else src="./assets/imgs/quicker.png" /> <img v-else src="./assets/imgs/quicker.png" />
</div> </div>
</div> </div>
...@@ -153,7 +157,7 @@ ...@@ -153,7 +157,7 @@
</div> </div>
</template> </template>
<script> <script>
// import quickApps from "./pages/quick-apps/app-list.vue"; import quickApps from "./pages/quick-apps/app-list.vue";
import { mapActions, mapMutations, mapState } from "vuex"; import { mapActions, mapMutations, mapState } from "vuex";
import { ipcRenderer, remote, clipboard } from "electron"; import { ipcRenderer, remote, clipboard } from "electron";
import { import {
...@@ -167,14 +171,16 @@ const opConfig = remote.getGlobal("opConfig"); ...@@ -167,14 +171,16 @@ const opConfig = remote.getGlobal("opConfig");
const { Menu, MenuItem } = remote; const { Menu, MenuItem } = remote;
export default { export default {
// components: { quickApps }, components: { quickApps },
data() { data() {
return { return {
query: this.$route.query, query: this.$route.query,
searchFn: null, searchFn: null,
config: { ...opConfig.get() }, config: { ...opConfig.get() },
currentSelect: 0, currentSelect: 0,
logoSrc: "https://gitcode.net/uploads/-/system/group/avatar/42/0_csdn.png" searchLogo:
"https://gitcode.net/uploads/-/system/group/avatar/42/0_csdn.png",
searchPath: "https://so.csdn.net/so/search?q="
}; };
}, },
created() { created() {
...@@ -252,25 +258,9 @@ export default { ...@@ -252,25 +258,9 @@ export default {
methods: { methods: {
...mapActions("main", ["onSearch", "showMainUI", "openPlugin"]), ...mapActions("main", ["onSearch", "showMainUI", "openPlugin"]),
...mapMutations("main", ["changeWebviewPath", "commonUpdate"]), ...mapMutations("main", ["changeWebviewPath", "commonUpdate"]),
changeSearch(key) { handleSearch(item) {
switch (key) { this.searchLogo = item.icon;
case 1: this.searchPath = item.path;
this.logoSrc =
"https://gitcode.net/uploads/-/system/group/avatar/42/0_csdn.png";
this.changeWebviewPath("https://so.csdn.net/so/search?q=csdn");
break;
case 2:
this.logoSrc =
"https://img0.baidu.com/it/u=3653818396,394239711&fm=253&fmt=auto&app=120&f=PNG?w=200&h=200";
this.changeWebviewPath("https://www.baidu.com/s?&wd=csdn");
break;
case 3:
this.logoSrc =
"https://img0.baidu.com/it/u=2038001520,891240548&fm=26&fmt=auto";
break;
default:
break;
}
}, },
shouldPaste(e) { shouldPaste(e) {
let filePath = ""; let filePath = "";
...@@ -329,6 +319,15 @@ export default { ...@@ -329,6 +319,15 @@ export default {
this.searchFn(v); this.searchFn(v);
}, },
targetSearch(action) { targetSearch(action) {
// 如果是webview
if (this.isWebview) {
this.changeWebviewPath(this.searchPath + this.searchValue);
if (this.showOptions) {
const item = this.options[this.currentSelect];
item.click(this.$router);
}
return;
}
// 在插件界面唤起搜索功能 // 在插件界面唤起搜索功能
if ( if (
(this.selected && this.selected.key === "plugin-container") || (this.selected && this.selected.key === "plugin-container") ||
...@@ -439,12 +438,12 @@ export default { ...@@ -439,12 +438,12 @@ export default {
label: "隐藏插件" label: "隐藏插件"
} }
]; ];
if (type !== "separate") { // if (type !== "separate") {
pluginMenu.unshift({ // pluginMenu.unshift({
label: "分离窗口", // label: "分离窗口",
click: this.newWindow // click: this.newWindow
}); // });
} // }
let menu = Menu.buildFromTemplate(pluginMenu); let menu = Menu.buildFromTemplate(pluginMenu);
menu.popup(); menu.popup();
return; return;
...@@ -478,6 +477,7 @@ export default { ...@@ -478,6 +477,7 @@ export default {
"current", "current",
"options", "options",
"selected", "selected",
"searchOptions",
"searchValue", "searchValue",
"subPlaceHolder", "subPlaceHolder",
"pluginInfo", "pluginInfo",
...@@ -495,7 +495,7 @@ export default { ...@@ -495,7 +495,7 @@ export default {
}, },
searchType() { searchType() {
return this.pluginInfo.searchType ? "subWindow" : ""; return this.pluginInfo.searchType ? "subWindow" : "";
}, }
// userInfo() { // userInfo() {
// return this.config.userInfo; // return this.config.userInfo;
// } // }
...@@ -514,24 +514,53 @@ export default { ...@@ -514,24 +514,53 @@ export default {
}; };
</script> </script>
<style lang="less"> <style lang="less">
@import "./assets/style/varable.less";
.fade-enter-active {
transition: all 0.3s ease;
}
.fade-leave-active {
transition: all 0.3s cubic-bezier(1, 0.5, 0.8, 1);
}
.fade-enter, .fade-leave-to
/* .fade-leave-active for below version 2.1.8 */ {
transform: translateY(-40px);
opacity: 0;
}
* { * {
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
body {
overflow: hidden;
}
#app {
padding: 4px 14px;
box-sizing: border-box;
}
#components-layout { #components-layout {
padding-top: 60px;
height: 100vh;
overflow: auto; overflow: auto;
margin-top: 14px;
background: #fff;
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 0; width: 0;
} }
} }
.rubick-select {
border: 1px solid @border-color;
box-sizing: border-box;
border-radius: 8px;
padding-left: 14px;
}
.rubick-select, .rubick-select,
.rubick-select-subMenu { .rubick-select-subMenu {
display: flex; display: flex;
padding-left: 10px; // padding-left: 10px;
background: #fff; background: #fff;
position: fixed; // position: fixed;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
...@@ -570,12 +599,14 @@ export default { ...@@ -570,12 +599,14 @@ export default {
.options { .options {
position: absolute; position: absolute;
top: 62px; top: 178px;
left: 0; left: 0;
width: 100%; width: 100%;
z-index: 99; z-index: 99;
max-height: calc(~"100vh - 60px"); max-height: calc(~"100vh - 186px");
overflow: auto; overflow: auto;
padding: 0 14px;
box-sizing: border-box;
.op-item { .op-item {
padding: 0 10px; padding: 0 10px;
height: 60px; height: 60px;
......
const WINDOW_MAX_HEIGHT = 600; const WINDOW_MAX_HEIGHT = 800;
const WINDOW_MIN_HEIGHT = 60; const WINDOW_MIN_HEIGHT = 186;
const PRE_ITEM_HEIGHT = 60; const PRE_ITEM_HEIGHT = 60;
const SYSTEM_PLUGINS = [ const SYSTEM_PLUGINS = [
......
const { ipcRenderer } = require("electron");
window.ipcRenderer = ipcRenderer;
\ No newline at end of file
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
:preload="preload" :preload="preload"
></webview> ></webview>
<!-- 聚合搜索 --> <!-- 聚合搜索 -->
<search-bowser v-else-if="isWebview" :src="webviewPath" :preload="preload"> <search-bowser v-else-if="isWebview" :src="webviewPath">
</search-bowser> </search-bowser>
<!-- 本地插件 --> <!-- 本地插件 -->
<div v-else> <div v-else>
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
import path from "path"; import path from "path";
import { mapMutations, mapState } from "vuex"; import { mapMutations, mapState } from "vuex";
import { remote, ipcRenderer, shell } from "electron"; import { remote, ipcRenderer, shell } from "electron";
import { getWindowHeight } from "../../assets/common/utils";
import searchBowser from "../search-bowser/index.vue"; import searchBowser from "../search-bowser/index.vue";
const currentWindow = remote.getCurrentWindow(); const currentWindow = remote.getCurrentWindow();
...@@ -160,6 +159,6 @@ export default { ...@@ -160,6 +159,6 @@ export default {
<style lang="less"> <style lang="less">
#webview { #webview {
width: 100%; width: 100%;
height: calc(~"100vh - 60px"); height: calc(~"100vh - 180px");
} }
</style> </style>
<template> <template>
<div class="appList"> <div class="appList">
<template v-for="(item, index) in installs" :key="index"> <template v-for="(item, index) in installs">
<div :class="['app_item', mode]" @click="clickApp(item, index)"> <div
<el-badge v-if="item.showTag" :value="resolveAppTag(item.tag)"> :key="index"
:class="['app_item', mode]"
@click="clickApp(item, index)"
>
<a-badge v-if="item.showTag" :count="resolveAppTag(item.tag)">
<app :info="item" @getAppUrl="$emit('getAppUrl', $event)" /> <app :info="item" @getAppUrl="$emit('getAppUrl', $event)" />
</el-badge> </a-badge>
<app v-else :info="item" /> <app v-else :info="item" />
</div> </div>
</template> </template>
...@@ -18,7 +22,7 @@ export default { ...@@ -18,7 +22,7 @@ export default {
app app
}, },
computed: { computed: {
...mapState(["mode", "installs"]), ...mapState("main", ["mode", "installs"]),
isEditMode() { isEditMode() {
return this.mode === "edit"; return this.mode === "edit";
} }
...@@ -126,7 +130,7 @@ export default { ...@@ -126,7 +130,7 @@ export default {
}; };
}, },
methods: { methods: {
...mapMutations(["uninstallApp", "saveUninstalls"]), ...mapMutations("main", ["uninstallApp", "saveUninstalls"]),
clickApp(item, index) { clickApp(item, index) {
if (this.isEditMode) { if (this.isEditMode) {
this.uninstallApp(index); this.uninstallApp(index);
...@@ -144,6 +148,7 @@ export default { ...@@ -144,6 +148,7 @@ export default {
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@import '../../assets/style/varable.less';
@keyframes shake { @keyframes shake {
from, from,
to { to {
...@@ -167,11 +172,11 @@ export default { ...@@ -167,11 +172,11 @@ export default {
} }
.edit { .edit {
:deep(.app_icon) { /deep/.app_icon {
animation: shake 2s infinite; animation: shake 2s infinite;
} }
&:nth-child(even) { &:nth-child(even) {
:deep(.app_icon) { /deep/.app_icon {
animation-delay: 0.2s; animation-delay: 0.2s;
} }
} }
...@@ -182,7 +187,9 @@ export default { ...@@ -182,7 +187,9 @@ export default {
justify-content: space-between; justify-content: space-between;
align-items: flex-end; align-items: flex-end;
margin: 0 auto; margin: 0 auto;
:deep(.app_item) { padding: 0 10px;
box-sizing: border-box;
/deep/.app_item {
cursor: pointer; cursor: pointer;
position: relative; position: relative;
&.view:hover { &.view:hover {
...@@ -191,7 +198,7 @@ export default { ...@@ -191,7 +198,7 @@ export default {
z-index: 4; z-index: 4;
} }
.app_name, .app_name,
.el-badge__content { .ant-badge-count {
opacity: 1; opacity: 1;
top: 10px; top: 10px;
} }
...@@ -213,18 +220,19 @@ export default { ...@@ -213,18 +220,19 @@ export default {
} }
&.edit { &.edit {
pointer-events: none; pointer-events: none;
.el-badge__content { .ant-badge-count {
pointer-events: auto; pointer-events: auto;
opacity: 1; opacity: 1;
top: 30px; top: 30px;
cursor: pointer; cursor: pointer;
} }
} }
.el-badge__content { .ant-badge-count {
opacity: 0; opacity: 0;
transition: all 0.3s; transition: all 0.3s;
top: 0px; top: 0px;
z-index: 4; z-index: 4;
background: @primary-color;
} }
} }
} }
......
<template> <template>
<div <div>
:style="{
background: `#fff url(${info?.icon}) center / cover no-repeat`
}"
:class="['app_icon']"
></div>
<div :class="['app_name']">{{ info?.name }}</div>
<div class="app_menu">
<!-- <el-tooltip
v-for="(item, index) in info.subMenu"
:key="index"
:content="item.name"
placement="bottom"
effect="light"
> -->
<div <div
v-for="(item, index) in info.subMenu" :style="{
:key="index" background: `#fff url(${info && info.icon}) center / cover no-repeat`
class="menu" }"
:style="{ background: `url(${item.icon}) center/cover no-repeat` }" :class="['app_icon']"
@click="$emit('getAppUrl', item.url)"
></div> ></div>
<!-- </el-tooltip> --> <div :class="['app_name']">{{ info && info.name }}</div>
<div class="app_menu">
<div
v-for="(item, index) in info.subMenu"
:key="index"
class="menu"
:style="{ background: `url(${item.icon}) center/cover no-repeat` }"
@click="$emit('getAppUrl', item.url)"
></div>
</div>
</div> </div>
</template> </template>
<script> <script>
...@@ -32,7 +26,6 @@ export default { ...@@ -32,7 +26,6 @@ export default {
default: () => {} default: () => {}
} }
}, },
emits: ["getAppUrl"],
data() { data() {
return {}; return {};
} }
......
<template> <template>
<!-- <div class="search_bowser"> --> <!-- <div class="search_bowser"> -->
<a-tabs size="small" v-model="activeTab" type="editable-card" @edit="onEdit"> <a-tabs
<a-tab-pane size="small"
v-for="tab in tabs" :hideAdd="true"
:key="tab.key" v-model="activeTab"
:tab="tab.title" type="editable-card"
:closable="true" @edit="onEdit"
> >
<webview <a-tab-pane
v-open v-for="tab in tabs"
:src="tab.src" :key="tab.key"
:preload="preload" :tab="tab.title"
disablewebsecurity :closable="true"
></webview> >
</a-tab-pane> <webview
</a-tabs> v-open
:src="tab.src"
:preload="preload"
disablewebsecurity
nodeIntegration
></webview>
</a-tab-pane>
</a-tabs>
<!-- </div> --> <!-- </div> -->
</template> </template>
<script> <script>
import { mapState } from "vuex";
const path = require("path");
export default { export default {
props: { props: {
src: { src: {
type: String, type: String,
default: "" default: ""
},
preload: {
type: String,
default: ""
} }
}, },
watch: {
src: {
handler: function (val) {
const key = `newTab${this.newTabIndex++}`;
this.tabs.push({
title: "搜索" + this.searchValue,
key,
src: val
});
this.activeTab = key;
}
}
},
computed: {
...mapState("main", ["searchValue"])
},
data() { data() {
const tabs = [{ title: "搜索", key: "111", src: this.src }]; const tabs = [{ title: "搜索", key: "111", src: this.src }];
return { return {
// webview: null, // webview: null,
newTabIndex: 0, newTabIndex: 0,
tabs, tabs,
activeTab: tabs[0].key activeTab: tabs[0].key,
preload: `File://${path.resolve(
__dirname,
"../../assets/common/preload.js"
)}`
}; };
}, },
// mounted() {
// setTimeout(() => {
// this.webview = document.querySelector("webview");
// this.webview.addEventListener("new-window", e => {
// console.log(e);
// const key = `newTab${this.newTabIndex++}`;
// // const title = e.
// this.tabs.push({
// title: "csdn",
// key,
// src: e.url
// });
// this.activeTab = key;
// });
// }, 0);
// },
directives: { directives: {
open: { open: {
inserted: (el, binding, vnode) => { inserted: (el, binding, vnode) => {
el.addEventListener("new-window", e => { el.addEventListener("new-window", e => {
console.log(e); console.log(e);
const _this = vnode.context; const _this = vnode.context;
const key = `newTab${_this.newTabIndex++}`; const key = `newTab${_this.newTabIndex++}`;
const title = el.getTitle() const title = el.getTitle();
// const title = e. // const title = e.
_this.tabs.push({ _this.tabs.push({
title, title,
...@@ -72,6 +81,9 @@ export default { ...@@ -72,6 +81,9 @@ export default {
}); });
_this.activeTab = key; _this.activeTab = key;
}); });
el.addEventListener("dom-ready", e => {
el.openDevTools();
});
} }
} }
}, },
...@@ -114,7 +126,7 @@ export default { ...@@ -114,7 +126,7 @@ export default {
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
webview { webview {
height: calc(~"100vh - 100px"); height: calc(~"100vh - 220px");
width: 100%; width: 100%;
} }
.ant-tabs { .ant-tabs {
......
...@@ -3,7 +3,11 @@ ...@@ -3,7 +3,11 @@
<div class="dev-detail"> <div class="dev-detail">
<div class="user-panel"> <div class="user-panel">
<template v-if="userInfo"> <template v-if="userInfo">
<a-avatar :size="64" :src="userInfo.UserAvatar" /> <a-avatar
referrer="no-referrer"
:size="64"
:src="userInfo.UserAvatar"
/>
<div class="username">{{ userInfo.UserNick }}</div> <div class="username">{{ userInfo.UserNick }}</div>
<a-popconfirm <a-popconfirm
title="确认退出?" title="确认退出?"
...@@ -294,7 +298,7 @@ export default { ...@@ -294,7 +298,7 @@ export default {
<style lang="less"> <style lang="less">
@import "../../../assets/style/varable.less"; @import "../../../assets/style/varable.less";
.pg-settings { .pg-settings {
height: calc(~"100vh - 110px"); height: calc(~"100vh - 220px");
overflow: auto; overflow: auto;
.dev-detail { .dev-detail {
height: 100%; height: 100%;
......
...@@ -23,9 +23,138 @@ const state = { ...@@ -23,9 +23,138 @@ const state = {
current: ["market"], current: ["market"],
searchValue: "", searchValue: "",
devPlugins: mergePlugins(sysFile.getUserPlugins() || []), devPlugins: mergePlugins(sysFile.getUserPlugins() || []),
mode: "view",
installs: [
{
icon: "https://gitcode.net/codechina/operation-work/uploads/48886bea190eb24ef4cf0499e589554c/1_cpongo9_1634797583.gif",
name: "CSDN",
showTag: true,
url: "http://csdn.net",
tag: "new"
},
{
icon: "https://infinityicon.infinitynewtab.com/user-share-icon/6e49210c084629259f22609980c48ecf.png?imageMogr2/thumbnail/240x/format/webp/blur/1x0/quality/100|imageslim",
name: "待办事项",
url: "",
showTag: true,
tag: 7
},
{
icon: "https://infinityicon.infinitynewtab.com/assets/weather/code_100.png?imageMogr2/thumbnail/240x/format/webp/blur/1x0/quality/100|imageslim",
name: "天气",
showTag: true,
url: "http://weathernew.pae.baidu.com/weathernew/pc?query=%E5%8C%97%E4%BA%AC%E5%A4%A9%E6%B0%94&srcid=4982&city_name=%E5%8C%97%E4%BA%AC&province_name=%E5%8C%97%E4%BA%AC",
tag: "26℃"
},
{
icon: "https://infinityicon.infinitynewtab.com/user-share-icon/cee009549b352def723ba09d6da4b742.png?imageMogr2/thumbnail/240x/format/webp/blur/1x0/quality/100|imageslim",
name: "京东",
showTag: true,
url: "http://www.jd.com",
tag: "99+"
},
{
icon: "https://codechina.csdn.net/uploads/-/system/project/avatar/39/logo-1-s.png?width=108",
name: "Gitcode",
showTag: true,
tag: "git",
subMenu: [
{
icon: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fbpic.588ku.com%2Felement_origin_min_pic%2F01%2F19%2F39%2F40570b09774307e.jpg&refer=http%3A%2F%2Fbpic.588ku.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1638705958&t=2b31b638b2ca256f12794fa7b5e76ef1",
name: "新建项目",
url: "https://gitcode.net/codechina/operation-work/uploads/497f7a5e18fffed48e7059af16ef5d3b/image.png",
type: 1
},
{
icon: "http://img2.baidu.com/it/u=2689189425,1285948593&fm=253&app=138&f=JPEG?w=500&h=500",
url: "https://gitcode.net/codechina/operation-work/uploads/8ad0dcbc201c3e7780395504986c9ad4/image.png",
name: "Issue列表",
type: 2
},
{
icon: "http://img0.baidu.com/it/u=4290061247,3369746211&fm=253&app=138&f=JPEG?w=450&h=450",
name: "新建笔记",
url: "https://gitcode.net/codechina/operation-work/uploads/3d7d50bfbaf7f329f75342650fa2b0f6/image.png",
type: 3
}
]
},
{
icon: "https://infinityicon.infinitynewtab.com/user-share-icon/f6ec2e6ee20fe198f81cf620413bc35b.png?imageMogr2/thumbnail/240x/format/webp/blur/1x0/quality/100|imageslim",
name: "携程网",
url: "https://www.ctrip.com/",
showTag: true,
tag: "hot"
},
{
icon: "https://infinityicon.infinitynewtab.com/user-share-icon/37d396f9975e494b10ac8696d64ebb2a.png?imageMogr2/thumbnail/240x/format/webp/blur/1x0/quality/100|imageslim",
name: "Youtube",
url: "http://www.youtube.com",
showTag: true,
tag: "hot"
},
{
icon: "https://infinityicon.infinitynewtab.com/user-share-icon/11ad5726053067fa842833ff0529b680.png?imageMogr2/thumbnail/240x/format/webp/blur/1x0/quality/100|imageslim",
name: "Github",
url: "http://www.github.com",
showTag: true,
tag: "git"
},
{
icon: "https://infinityicon.infinitynewtab.com/user-share-icon/24982e111c555d3a4afc44981627925f.png?imageMogr2/thumbnail/240x/format/webp/blur/1x0/quality/100|imageslim",
name: "知乎",
url: "https://www.zhihu.com/",
showTag: true,
tag: "知乎"
},
{
icon: "https://infinityicon.infinitynewtab.com/user-share-icon/2fc65bd66987ba1596324d55c01bddd7.png?imageMogr2/thumbnail/240x/format/webp/blur/1x0/quality/100|imageslim",
name: "微信",
showTag: true,
url: "https://wx.qq.com/",
tag: "23"
},
{
icon: "https://infinityicon.infinitynewtab.com/user-share-icon/8061c93a71355024e801820969e2ecff.png?imageMogr2/thumbnail/240x/format/webp/blur/1x0/quality/100|imageslim",
name: "百度网盘",
showTag: true,
url: "https://pan.baidu.com/",
tag: "100TB"
}
],
uninstalls: [
{
icon: "https://infinityicon.infinitynewtab.com/user-share-icon/65e5f9e7f4f0023ed9c04dd2af62aa1b.png?imageMogr2/thumbnail/240x/format/webp/blur/1x0/quality/100|imageslim",
name: "翻译",
showTag: true,
url: "http://csdn.net",
tag: "new"
}
],
searchOptions: [
{
key: "csdn",
name: "CSDN",
icon: "https://gitcode.net/uploads/-/system/group/avatar/42/0_csdn.png",
path: "https://so.csdn.net/so/search?q="
},
{
key: "baidu",
name: "百度",
icon: "https://img0.baidu.com/it/u=3653818396,394239711&fm=253&fmt=auto&app=120&f=PNG?w=200&h=200",
path: "https://www.baidu.com/s?&wd="
},
{
key: "git",
name: "GitCode",
icon: "https://codechina.csdn.net/uploads/-/system/project/avatar/39/logo-1-s.png?width=108",
path: `file://${__static}/plugins/gitcode/index.html?`
// path: path.resolve(__dirname, `../../../../static/plugins/gitcode/index.html`)
}
],
subPlaceHolder: "", subPlaceHolder: "",
userInfo: { ...opConfig.get() }.userInfo, userInfo: { ...opConfig.get() }.userInfo,
webviewPath: "https://so.csdn.net/so/search?q=csdn", webviewPath: "",
pluginLoading: true, pluginLoading: true,
pluginInfo: (() => { pluginInfo: (() => {
try { try {
...@@ -35,6 +164,21 @@ const state = { ...@@ -35,6 +164,21 @@ const state = {
}; };
const mutations = { const mutations = {
changeMode(state, val) {
state.mode = val;
},
uninstallApp(state, index) {
state.installs.splice(index, 1);
},
installApp(state, app) {
state.installs.push(app);
},
saveUninstalls(state, val) {
state.uninstalls.push(val);
},
removeUninstalls(state, index) {
state.uninstalls.splice(index, 1);
},
setUserInfo(state, info) { setUserInfo(state, info) {
state.userInfo = info; state.userInfo = info;
}, },
...@@ -144,6 +288,7 @@ const actions = { ...@@ -144,6 +288,7 @@ const actions = {
type: "dev", type: "dev",
icon: "image://" + path.join(fileUrl, `../${config.logo}`), icon: "image://" + path.join(fileUrl, `../${config.logo}`),
subType: (() => { subType: (() => {
if (config.subType) return config.subType;
if (config.main) { if (config.main) {
return ""; return "";
} }
......
<svg t="1637724342647" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3131" width="200" height="200"><path d="M616.28 170.03c-135.39 0-250.51 86.56-293.22 207.33h-17.78c-114.5 0-207.33 92.82-207.33 207.34 0 114.51 92.83 207.34 207.34 207.34 0.23 0 0.44-0.02 0.67-0.02h33.88v-69.11h-34.56c-19.08 0-37.26-3.87-53.8-10.86-49.61-20.99-84.42-70.11-84.42-127.36 0-76.34 61.89-138.22 138.22-138.22h71.68c16.78-117.2 117.48-207.33 239.31-207.33 133.59 0 241.89 108.3 241.89 241.89 0 121.85-55.55 222.67-172.78 239.43v69.67c155.49-17.19 241.89-149.03 241.89-309.1 0.01-171.76-139.23-311-310.99-311z" fill="#C0C4CC" p-id="3132"></path><path d="M574.51 685.54H447.5v-3.28c0-12.16 2.16-23.75 6.05-34.28 11.7-31.62 39.09-53.8 71.02-53.8 42.57 0 77.07 16.01 77.07 64.65h38.54c0-72.96-51.76-108.69-115.61-108.69S408.96 609.3 408.96 682.27c0 0.14 0.01 0.28 0.01 0.42v9.87c-22.94 11.24-38.74 34.82-38.74 62.09v32.65c0 38.17 30.94 69.11 69.11 69.11h135.18c38.17 0 69.11-30.94 69.11-69.11v-32.65c-0.01-38.17-30.95-69.11-69.12-69.11z" fill="#C0C4CC" p-id="3133"></path></svg>
\ No newline at end of file
<svg t="1637725059672" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="16079" width="200" height="200"><path d="M709.9904 789.76c44.6464 0 88.9856 0.7168 132.1984-12.6976 57.8048-17.9712 109.4656-54.4768 141.824-106.0864 54.272-86.528 45.4144-222.5152-23.7568-299.0592-46.4896-51.5072-117.504-67.3792-184.32-69.0688L814.592 353.28c24.9856-133.632-60.416-246.8864-183.9104-290.8672-117.0432-41.6256-270.2848-16.64-351.5392 82.9952a257.3824 257.3824 0 0 0-55.6544 195.2256l39.936-39.936C140.288 296.4992 35.84 376.0128 15.36 499.1488c-21.248 126.5152 51.2 236.3392 171.8272 276.1216 46.7968 15.36 94.5664 14.336 143.0528 14.3872 51.2 0 51.456-79.8208 0-79.872-40.3968 0-79.4624 1.792-118.5792-10.24-51.2-16.0256-98.6624-53.8624-114.6368-106.752-14.8992-49.2544-4.1984-106.8032 24.6272-149.0944C154.0608 395.6736 207.7696 378.88 263.424 380.5696c19.712 0.6656 42.4448-18.944 39.936-39.936-6.9632-58.2656 5.7344-114.5344 48.5376-156.7232 41.5232-40.96 100.4544-59.2384 157.7472-60.4672 113.664-2.4064 252.416 77.7728 227.9424 208.6912-4.8128 25.6 10.9056 49.8176 38.5024 50.5344C826.0608 384 881.7152 394.24 911.36 438.528c24.7808 36.5056 31.5392 89.9072 25.344 133.12-7.8848 55.2448-46.8992 99.7376-97.28 121.5488-41.7792 18.0736-85.248 16.64-129.6384 16.64-51.2 0-51.456 79.8208 0 79.872z" p-id="16080" fill="#C0C4CC"></path><path d="M676.7104 577.6896l-160.9728-165.632-163.328 163.328a34.816 34.816 0 0 0 0 49.0496 34.816 34.816 0 0 0 49.0496 0l113.7664-110.5408 112.64 112.64a34.7136 34.7136 0 0 0 49.0496-49.0496z" p-id="16081" fill="#C0C4CC"></path><path d="M475.904 497.4592m38.4512 0l0 0q38.4512 0 38.4512 38.4512l0 380.0576q0 38.4512-38.4512 38.4512l0 0q-38.4512 0-38.4512-38.4512l0-380.0576q0-38.4512 38.4512-38.4512Z" p-id="16082" fill="#C0C4CC"></path></svg>
\ No newline at end of file
const { remote } = require("electron");
const simpleGit = require("simple-git");
new Vue({
el: "#app",
data() {
const opConfig = remote.getGlobal("opConfig");
console.log({ ...opConfig.get().userInfo });
return {
host: "http://test-code.csdn.net",
defaultBranch: "master",
userInfo: { ...opConfig.get().userInfo },
token: "-y8xo_X_DShoUGBMxRH9",
list: []
};
},
created() {
this.getProjectList();
},
methods: {
getProjectList() {
axios
.get(
this.host +
`/api/v4/users/${this.userInfo.UserName}/projects?skip_namespace=true`
)
.then(res => {
this.list = res.data;
});
},
createProject(visibility, e) {
console.log(visibility, e);
const { path, name } = e;
axios
.post(
this.host + "/api/v4/projects",
{
name,
visibility
},
{
headers: {
"PRIVATE-TOKEN": this.token
}
}
)
.then(res => {
console.log(res);
const repo = res.data.http_url_to_repo.replace(
/^((http|https):\/\/)/,
`$1quicker:${this.token}@`
);
const git = simpleGit(path);
// const git = simpleGit("/Users/guoweijia/Desktop/test");
git
.init()
.addConfig("user.name", this.userInfo.UserName)
.addConfig("user.email", this.userInfo.UserEmail)
.add("./*")
.commit("上传项目")
.addRemote("origin", `${repo}`)
.push(["origin", "master"], () => {
console.log("done");
remote
.Notification({
title: "通知",
body: "上传成功"
})
.show();
this.getProjectList();
});
})
.catch(
({
response: {
data: { message: e }
}
}) => {
let errMsg;
if (e.name) {
errMsg = "名字重复了";
} else {
errMsg = "网络错误,请重新上传";
}
remote
.Notification({
title: "通知",
body: errMsg
})
.show();
}
);
},
downloadProject(item) {
location.href = `${item.web_url}/-/archive/${this.defaultBranch}/${item.path}-${this.defaultBranch}.zip`;
}
}
});
此差异已折叠。
[v-cloak] {
display: none;
}
#app .el-carousel .el-carousel__item {
background: #99a9bf;
box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.2);
text-align: center;
}
#app .upload_project {
display: flex;
justify-content: space-between;
}
#app .upload_project .upload-item {
width: calc(50% - 7px);
}
#app .upload_project .upload-item .el-upload,
#app .upload_project .upload-item .el-upload-dragger {
width: 100%;
}
#app .upload_project .upload-item .el-upload .el-icon-upload,
#app .upload_project .upload-item .el-upload-dragger .el-icon-upload {
width: 64px;
margin-bottom: 0;
}
#app .upload_project .upload-item .el-upload .el-icon-upload.public,
#app .upload_project .upload-item .el-upload-dragger .el-icon-upload.public {
width: 52px;
margin-top: 52px;
}
#app .project_list {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
#app .project_list .project_item {
width: calc(50% - 7px);
margin-top: 14px;
height: 140px;
padding: 12px;
box-sizing: border-box;
display: flex;
justify-content: space-between;
}
#app .project_list .project_item:hover {
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}
#app .project_list .project_item .project_avatar {
width: 180px;
height: 100%;
object-fit: cover;
}
#app .project_list .project_item .project_info {
flex: 1;
overflow: hidden;
margin: 0 12px;
display: flex;
flex-direction: column;
justify-content: space-between;
}
#app .project_list .project_item .project_info .name {
font-size: 16px;
font-weight: 500;
color: #333;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
#app .project_list .project_item .project_info .desc {
color: #666;
font-size: 14px;
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: hidden;
-webkit-line-clamp: 3;
}
#app .project_list .project_item .project_info .detail {
display: flex;
justify-content: space-between;
}
#app .project_list .project_item .project_info .detail .time,
#app .project_list .project_item .project_info .detail .data {
font-size: 12px;
color: #666;
}
#app .project_list .project_item .project_info .detail .data .star,
#app .project_list .project_item .project_info .detail .data .fork {
display: inline-block;
}
#app .project_list .project_item .project_controls {
display: flex;
flex-direction: column;
justify-content: center;
box-sizing: border-box;
}
#app .project_list .project_item .project_controls .el-button {
font-size: 22px;
padding: 8px;
color: #666;
}
[v-cloak] {
display: none;
}
#app {
.el-carousel {
.el-carousel__item {
background: #99a9bf;
box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.2);
text-align: center;
}
}
.upload_project {
display: flex;
justify-content: space-between;
.upload-item {
width: calc(50% - 7px);
.el-upload,
.el-upload-dragger {
width: 100%;
.el-icon-upload {
width: 64px;
margin-bottom: 0;
&.public {
width: 52px;
margin-top: 52px;
}
}
}
}
}
.project_list {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
.project_item {
width: calc(50% - 7px);
margin-top: 14px;
height: 140px;
padding: 12px;
box-sizing: border-box;
display: flex;
justify-content: space-between;
&:hover {
box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
}
.project_avatar {
width: 180px;
height: 100%;
object-fit: cover;
}
.project_info {
flex: 1;
overflow: hidden;
margin: 0 12px;
display: flex;
flex-direction: column;
justify-content: space-between;
.name {
font-size: 16px;
font-weight: 500;
color: #333;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.desc {
color: #666;
font-size: 14px;
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: hidden;
-webkit-line-clamp: 3;
}
.detail {
display: flex;
justify-content: space-between;
.time,
.data {
font-size: 12px;
color: #666;
}
.data {
.star,
.fork {
display: inline-block;
}
}
}
}
.project_controls {
display: flex;
flex-direction: column;
justify-content: center;
box-sizing: border-box;
.el-button {
font-size: 22px;
padding: 8px;
color: #666;
}
}
}
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="stylesheet"
href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"
/>
<link rel="stylesheet" href="./assets/style/index.css" />
<title>Document</title>
</head>
<body>
<div id="app" v-cloak>
<!-- <el-carousel :interval="4000" height="200px">
<el-carousel-item v-for="(item, index) in pinList" :key="index">
<h3 class="medium">{{ item.name }}</h3>
</el-carousel-item>
</el-carousel> -->
<div class="upload_project">
<el-upload
class="upload-item"
drag
action=""
multiple
:show-file-list="false"
:before-upload="e => createProject('public',e)"
>
<img
class="el-icon-upload public"
src="./assets/img/public.svg"
alt=""
/>
<div class="el-upload__text">拖动或<em>点击上传</em>公开项目</div>
<!-- <div class="el-upload__tip" slot="tip">
只能上传jpg/png文件,且不超过500kb
</div> -->
</el-upload>
<el-upload
class="upload-item"
drag
action=""
multiple
:show-file-list="false"
:before-upload="e => createProject('private',e)"
>
<img class="el-icon-upload" src="./assets/img/private.svg" alt="" />
<!-- <i class="el-icon-upload"></i> -->
<div class="el-upload__text">拖动或<em>点击上传</em>私有项目</div>
<!-- <div class="el-upload__tip" slot="tip">
只能上传jpg/png文件,且不超过500kb
</div> -->
</el-upload>
</div>
<el-button @click="getProjectList">获取项目列表</el-button>
<el-button @click="createProject('public')">新建公开项目</el-button>
<el-button @click="createProject('private')">新建私有项目</el-button>
<img src="https://profile.csdnimg.cn/C/E/1/1_weixin_43881430" alt="" />
<div class="project_list">
<div class="project_item el-card" v-for="item in list" ::key="item.id">
<img
class="project_avatar"
:src="item.avatar_url || 'https://static.wbolt.com/wp-content/uploads/2020/09/wordpress-repair-database-thumb.jpg'"
alt=""
/>
<div class="project_info">
<div class="name">{{item.name}}</div>
<div class="desc">{{item.description}}</div>
<div class="detail">
<div class="time">2020-02-20</div>
<div class="data">
<div class="star">2</div>
<div class="fork">2</div>
</div>
</div>
</div>
<div class="project_controls">
<el-button
@click="downloadProject(item)"
circle
icon="el-icon-download"
></el-button>
</div>
</div>
</div>
</div>
<script src="./assets/js/vue.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script src="./assets/js/index.js" type="module"></script>
</body>
</html>
{
"dependencies": {
"simple-git": "^2.47.0"
}
}
{
"logo": "logo.png",
"name": "gitcode",
"pluginName": "GitCode",
"description": "上传下载项目",
"author": "璃白",
"subType": "webview",
"features": [
{
"code": "git",
"explain": "GitCode",
"cmds": ["git", "code"]
}
]
}
new Vue({
el: '#app',
data() {
return {
a: 111
}
}
})
\ No newline at end of file
此差异已折叠。
iframe {
border: none;
width: 100%;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="stylesheet"
href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"
/>
<title>Search</title>
</head>
<body>
<div id="app" v-cloak>
<el-tabs type="border-card">
<el-tab-pane>
<span slot="label"><i class="el-icon-search"></i> CSDN</span>
</el-tab-pane>
<el-tab-pane>
<span slot="label"><i class="el-icon-date"></i> 百度</span>
</el-tab-pane>
<el-tab-pane>
<span slot="label"><i class="el-icon-circle-check"></i> 必应</span>
</el-tab-pane>
</el-tabs>
</div>
<script>
</script>
<script src="./assets//js/vue.min.js"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script src="./assets/js/index.js"></script>
</body>
</html>
{
"main": "index.html",
"logo": "icon.png",
"name": "search",
"pluginName": "聚合搜索",
"description": "聚合CSDN、百度、biying等搜索引擎",
"author": "璃白",
"subType": "webview",
"features": [
{
"code": "search",
"explain": "聚合搜索",
"cmds": ["cc", "ss", "csdn"]
}
]
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册