mirror of
https://github.com/rubickCenter/rubick
synced 2025-06-07 19:14:11 +08:00
feat: 样式调整
This commit is contained in:
parent
3d0e57bc48
commit
d6e32cf0e0
@ -90,6 +90,7 @@ export default {
|
||||
...mapActions('main', ['onSearch', 'showMainUI']),
|
||||
...mapMutations('main', ['commonUpdate']),
|
||||
checkNeedInit(e) {
|
||||
// 如果搜索栏无内容,且按了删除键,则清空 tag
|
||||
if (this.searchValue === '' && e.keyCode === 8) {
|
||||
this.closeTag();
|
||||
}
|
||||
|
@ -46,18 +46,22 @@ function mkdirFolder(name) {
|
||||
}
|
||||
|
||||
async function downloadZip(downloadRepoUrl, name) {
|
||||
const plugin_path = path.join(__static, './plugins');
|
||||
const targetUrl = downloadRepoUrl ? downloadRepoUrl : `https://github.com/clouDr-f2e/${name}/archive/refs/heads/master.zip`;
|
||||
if (!(await existOrNot(plugin_path))) {
|
||||
await mkdirFolder(plugin_path);
|
||||
try {
|
||||
const plugin_path = path.join(__static, './plugins');
|
||||
const targetUrl = downloadRepoUrl ? downloadRepoUrl : `https://github.com/clouDr-f2e/${name}/archive/refs/heads/master.zip`;
|
||||
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) {
|
||||
@ -123,7 +127,7 @@ function mergePlugins(plugins) {
|
||||
]
|
||||
}
|
||||
|
||||
function find(p) {
|
||||
function find(p, target = 'plugin.json') {
|
||||
try {
|
||||
let result;
|
||||
const fileList = fs.readdirSync(p);
|
||||
@ -131,7 +135,7 @@ function find(p) {
|
||||
let thisPath = p + "/" + fileList[i];
|
||||
const data = fs.statSync(thisPath);
|
||||
|
||||
if (data.isFile() && fileList[i] === 'plugin.json') {
|
||||
if (data.isFile() && fileList[i] === target) {
|
||||
result = path.join(thisPath, '../');
|
||||
return result;
|
||||
}
|
||||
@ -143,7 +147,6 @@ function find(p) {
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export {
|
||||
|
@ -1,10 +1,15 @@
|
||||
<template>
|
||||
<div class="dev-container">
|
||||
<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">
|
||||
<div>{{ plugin.pluginName }}</div>
|
||||
<div>{{ plugin.description }}</div>
|
||||
<div class="menu-item">
|
||||
<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>
|
||||
<div class="plugin-detail">
|
||||
@ -56,7 +61,7 @@
|
||||
</div>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="2" tab="详情介绍">
|
||||
Content of Tab Pane 2
|
||||
<div class="detail-container" v-html="readme"></div>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</div>
|
||||
@ -70,6 +75,12 @@
|
||||
<script>
|
||||
import {mapState, mapMutations, mapActions} from 'vuex';
|
||||
import api from "../../../assets/api";
|
||||
import marked from "marked";
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
|
||||
const rendererMD = new marked.Renderer();
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -105,6 +116,25 @@ export default {
|
||||
},
|
||||
devPlugin() {
|
||||
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">
|
||||
.dev-container {
|
||||
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 {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
.plugin-detail {
|
||||
padding: 20px;
|
||||
box-sizing: border-box;
|
||||
flex: 1;
|
||||
.detail-container {
|
||||
height: 340px;
|
||||
overflow: auto;
|
||||
max-height: 320px;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
* {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.plugin-top {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
|
@ -130,7 +130,7 @@ const actions = {
|
||||
{
|
||||
name: '新建rubick开发插件',
|
||||
value: 'new-plugin',
|
||||
icon: 'plus-circle',
|
||||
icon: 'https://static.91jkys.com/activity/img/b37ff555c748489f88f3adac15b76f18.png',
|
||||
desc: '新建rubick开发插件',
|
||||
click: (router) => {
|
||||
commit('commonUpdate', {
|
||||
@ -151,9 +151,18 @@ const actions = {
|
||||
name: '复制路径',
|
||||
desc: '复制路径',
|
||||
value: 'copy-path',
|
||||
icon: 'plus-circle',
|
||||
icon: 'https://static.91jkys.com/activity/img/ac0d4df0247345b9a84c8cd7ea3dd696.png',
|
||||
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