mirror of
https://github.com/rubickCenter/rubick
synced 2025-06-08 19:54:05 +08:00
feat: 样式调整
This commit is contained in:
parent
3d0e57bc48
commit
d6e32cf0e0
@ -90,6 +90,7 @@ export default {
|
|||||||
...mapActions('main', ['onSearch', 'showMainUI']),
|
...mapActions('main', ['onSearch', 'showMainUI']),
|
||||||
...mapMutations('main', ['commonUpdate']),
|
...mapMutations('main', ['commonUpdate']),
|
||||||
checkNeedInit(e) {
|
checkNeedInit(e) {
|
||||||
|
// 如果搜索栏无内容,且按了删除键,则清空 tag
|
||||||
if (this.searchValue === '' && e.keyCode === 8) {
|
if (this.searchValue === '' && e.keyCode === 8) {
|
||||||
this.closeTag();
|
this.closeTag();
|
||||||
}
|
}
|
||||||
|
@ -46,18 +46,22 @@ function mkdirFolder(name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function downloadZip(downloadRepoUrl, name) {
|
async function downloadZip(downloadRepoUrl, name) {
|
||||||
const plugin_path = path.join(__static, './plugins');
|
try {
|
||||||
const targetUrl = downloadRepoUrl ? downloadRepoUrl : `https://github.com/clouDr-f2e/${name}/archive/refs/heads/master.zip`;
|
const plugin_path = path.join(__static, './plugins');
|
||||||
if (!(await existOrNot(plugin_path))) {
|
const targetUrl = downloadRepoUrl ? downloadRepoUrl : `https://github.com/clouDr-f2e/${name}/archive/refs/heads/master.zip`;
|
||||||
await mkdirFolder(plugin_path);
|
if (!(await existOrNot(plugin_path))) {
|
||||||
|
await mkdirFolder(plugin_path);
|
||||||
|
}
|
||||||
|
// 基础模版所在目录,如果是初始化,则是模板名称,否则是项目名称
|
||||||
|
const temp_dest = `${plugin_path}/${name}-master`;
|
||||||
|
// 下载模板
|
||||||
|
if (await existOrNot(temp_dest)) {
|
||||||
|
await process.execSync(`rm -rf ${temp_dest}`);
|
||||||
|
}
|
||||||
|
await downloadFile(targetUrl, `${__static}/plugins`,{extract: true})
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
}
|
}
|
||||||
// 基础模版所在目录,如果是初始化,则是模板名称,否则是项目名称
|
|
||||||
const temp_dest = `${plugin_path}/${name}-master`;
|
|
||||||
// 下载模板
|
|
||||||
if (await existOrNot(temp_dest)) {
|
|
||||||
await process.execSync(`rm -rf ${temp_dest}`);
|
|
||||||
}
|
|
||||||
await downloadFile(targetUrl, `${__static}/plugins`,{extract: true})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function downloadFunc(downloadRepoUrl, name) {
|
function downloadFunc(downloadRepoUrl, name) {
|
||||||
@ -123,7 +127,7 @@ function mergePlugins(plugins) {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
function find(p) {
|
function find(p, target = 'plugin.json') {
|
||||||
try {
|
try {
|
||||||
let result;
|
let result;
|
||||||
const fileList = fs.readdirSync(p);
|
const fileList = fs.readdirSync(p);
|
||||||
@ -131,7 +135,7 @@ function find(p) {
|
|||||||
let thisPath = p + "/" + fileList[i];
|
let thisPath = p + "/" + fileList[i];
|
||||||
const data = fs.statSync(thisPath);
|
const data = fs.statSync(thisPath);
|
||||||
|
|
||||||
if (data.isFile() && fileList[i] === 'plugin.json') {
|
if (data.isFile() && fileList[i] === target) {
|
||||||
result = path.join(thisPath, '../');
|
result = path.join(thisPath, '../');
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -143,7 +147,6 @@ function find(p) {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="dev-container">
|
<div class="dev-container">
|
||||||
<div class="dev-detail" v-if="devPlugin.length">
|
<div class="dev-detail" v-if="devPlugin.length">
|
||||||
<a-menu v-model="currentSelect" style="width: 256px; height: 100%" mode="vertical">
|
<a-menu v-model="currentSelect" style="width: 200px; height: 100%" mode="vertical">
|
||||||
<a-menu-item @click="currentSelect = [index]" v-for="(plugin, index) in devPlugin" :key="index">
|
<a-menu-item @click="currentSelect = [index]" v-for="(plugin, index) in devPlugin" :key="index">
|
||||||
<div>{{ plugin.pluginName }}</div>
|
<div class="menu-item">
|
||||||
<div>{{ plugin.description }}</div>
|
<img width="40" height="40" :src="pluginDetail.icon" />
|
||||||
|
<div>
|
||||||
|
<div class="title">{{ plugin.pluginName }}</div>
|
||||||
|
<div class="desc">{{ plugin.description }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</a-menu-item>
|
</a-menu-item>
|
||||||
</a-menu>
|
</a-menu>
|
||||||
<div class="plugin-detail">
|
<div class="plugin-detail">
|
||||||
@ -56,7 +61,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
<a-tab-pane key="2" tab="详情介绍">
|
<a-tab-pane key="2" tab="详情介绍">
|
||||||
Content of Tab Pane 2
|
<div class="detail-container" v-html="readme"></div>
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
</a-tabs>
|
</a-tabs>
|
||||||
</div>
|
</div>
|
||||||
@ -70,6 +75,12 @@
|
|||||||
<script>
|
<script>
|
||||||
import {mapState, mapMutations, mapActions} from 'vuex';
|
import {mapState, mapMutations, mapActions} from 'vuex';
|
||||||
import api from "../../../assets/api";
|
import api from "../../../assets/api";
|
||||||
|
import marked from "marked";
|
||||||
|
import path from "path";
|
||||||
|
import fs from "fs";
|
||||||
|
|
||||||
|
const rendererMD = new marked.Renderer();
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -105,6 +116,25 @@ export default {
|
|||||||
},
|
},
|
||||||
devPlugin() {
|
devPlugin() {
|
||||||
return this.devPlugins.filter(plugin => plugin.type === 'dev')
|
return this.devPlugins.filter(plugin => plugin.type === 'dev')
|
||||||
|
},
|
||||||
|
readme() {
|
||||||
|
marked.setOptions({
|
||||||
|
renderer: rendererMD,
|
||||||
|
gfm: true,
|
||||||
|
tables: true,
|
||||||
|
breaks: false,
|
||||||
|
pedantic: false,
|
||||||
|
sanitize: false,
|
||||||
|
smartLists: true,
|
||||||
|
smartypants: false
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
const mdFile = path.join(this.pluginDetail.sourceFile, '../README.md');
|
||||||
|
return marked(fs.readFileSync(mdFile, 'utf8'));
|
||||||
|
} catch (e) {
|
||||||
|
return '暂无描述信息'
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -113,15 +143,48 @@ export default {
|
|||||||
<style lang="less">
|
<style lang="less">
|
||||||
.dev-container {
|
.dev-container {
|
||||||
height: calc(~'100vh - 110px');
|
height: calc(~'100vh - 110px');
|
||||||
|
width: 100%;
|
||||||
|
.ant-menu-item {
|
||||||
|
height: 60px !important;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
.menu-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
line-height: 22px !important;
|
||||||
|
img {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
.title {
|
||||||
|
color: rgba(0,0,0,0.8);
|
||||||
|
}
|
||||||
|
.desc {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
.dev-detail {
|
.dev-detail {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
.plugin-detail {
|
.plugin-detail {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
.detail-container {
|
||||||
|
height: 340px;
|
||||||
|
overflow: auto;
|
||||||
|
max-height: 320px;
|
||||||
|
width: 100%;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
* {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
.plugin-top {
|
.plugin-top {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
|
@ -130,7 +130,7 @@ const actions = {
|
|||||||
{
|
{
|
||||||
name: '新建rubick开发插件',
|
name: '新建rubick开发插件',
|
||||||
value: 'new-plugin',
|
value: 'new-plugin',
|
||||||
icon: 'plus-circle',
|
icon: 'https://static.91jkys.com/activity/img/b37ff555c748489f88f3adac15b76f18.png',
|
||||||
desc: '新建rubick开发插件',
|
desc: '新建rubick开发插件',
|
||||||
click: (router) => {
|
click: (router) => {
|
||||||
commit('commonUpdate', {
|
commit('commonUpdate', {
|
||||||
@ -151,9 +151,18 @@ const actions = {
|
|||||||
name: '复制路径',
|
name: '复制路径',
|
||||||
desc: '复制路径',
|
desc: '复制路径',
|
||||||
value: 'copy-path',
|
value: 'copy-path',
|
||||||
icon: 'plus-circle',
|
icon: 'https://static.91jkys.com/activity/img/ac0d4df0247345b9a84c8cd7ea3dd696.png',
|
||||||
click: () => {
|
click: () => {
|
||||||
clipboard.writeText(fileUrl)
|
clipboard.writeText(fileUrl);
|
||||||
|
commit('commonUpdate', {
|
||||||
|
showMain: false,
|
||||||
|
selected: null,
|
||||||
|
options: [],
|
||||||
|
});
|
||||||
|
ipcRenderer.send('changeWindowSize-rubick', {
|
||||||
|
height: getWindowHeight([]),
|
||||||
|
});
|
||||||
|
remote.Notification('Rubick 通知', { body: '复制成功' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user