mirror of
https://github.com/rubickCenter/rubick
synced 2025-06-24 05:12:42 +08:00
ref: 功能优化
This commit is contained in:
parent
d0e489c36a
commit
3446b294ac
@ -58,9 +58,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ant-design-vue": "^1.7.5",
|
"ant-design-vue": "^1.7.5",
|
||||||
"anyproxy": "^4.1.3",
|
|
||||||
"axios": "^0.18.1",
|
"axios": "^0.18.1",
|
||||||
"chokidar": "^3.5.1",
|
|
||||||
"download-git-repo": "^3.0.2",
|
"download-git-repo": "^3.0.2",
|
||||||
"electron-store": "^8.0.0",
|
"electron-store": "^8.0.0",
|
||||||
"marked": "^2.0.7",
|
"marked": "^2.0.7",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export default {
|
export default {
|
||||||
development: 'http://localhost:7001',
|
development: 'http://localhost:7001',
|
||||||
production: 'http://localhost:7001',
|
production: 'http://rubick-server.qa.91jkys.com',
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import plugin from './list/plugin';
|
import plugin from './list/plugin';
|
||||||
|
import banner from './list/banner';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
plugin
|
plugin,
|
||||||
|
banner
|
||||||
}
|
}
|
||||||
|
8
src/renderer/assets/api/list/banner.js
Normal file
8
src/renderer/assets/api/list/banner.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import instance from '../request';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
async query(params) {
|
||||||
|
const result = await instance.get('/banner/query', {params});
|
||||||
|
return result.data;
|
||||||
|
}
|
||||||
|
}
|
@ -44,7 +44,8 @@ function mkdirFolder(name) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function downloadFunc(downloadRepoUrl, name) {
|
function downloadFunc(downloadRepoUrl, name, gitUrl) {
|
||||||
|
const targetGit = gitUrl ? gitUrl : `github:clouDr-f2e/${name}`;
|
||||||
const plugin_path = path.join(__static, './plugins');
|
const plugin_path = path.join(__static, './plugins');
|
||||||
|
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
@ -59,7 +60,7 @@ function downloadFunc(downloadRepoUrl, name) {
|
|||||||
await process.execSync(`rm -rf ${temp_dest}`);
|
await process.execSync(`rm -rf ${temp_dest}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
download(`github:clouDr-f2e/${name}`, temp_dest, function (err) {
|
download(targetGit, temp_dest, function (err) {
|
||||||
console.log(err ? 'Error' : 'Success')
|
console.log(err ? 'Error' : 'Success')
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
<a-icon type="code"/>
|
<a-icon type="code"/>
|
||||||
开发者
|
开发者
|
||||||
</a-menu-item>
|
</a-menu-item>
|
||||||
<a-menu-item key="set">
|
<a-menu-item key="settings">
|
||||||
<a-icon type="setting"/>
|
<a-icon type="settings"/>
|
||||||
设置
|
设置
|
||||||
</a-menu-item>
|
</a-menu-item>
|
||||||
</a-menu>
|
</a-menu>
|
||||||
|
@ -12,10 +12,9 @@
|
|||||||
<div slot="nextArrow" slot-scope="props" class="custom-slick-arrow" style="right: 10px">
|
<div slot="nextArrow" slot-scope="props" class="custom-slick-arrow" style="right: 10px">
|
||||||
<a-icon type="right-circle" />
|
<a-icon type="right-circle" />
|
||||||
</div>
|
</div>
|
||||||
<div><h3>1</h3></div>
|
<div v-for="banner in bannerList">
|
||||||
<div><h3>2</h3></div>
|
<img width="100%" :src="banner.src" />
|
||||||
<div><h3>3</h3></div>
|
</div>
|
||||||
<div><h3>4</h3></div>
|
|
||||||
</a-carousel>
|
</a-carousel>
|
||||||
<a-divider></a-divider>
|
<a-divider></a-divider>
|
||||||
<h2>插件</h2>
|
<h2>插件</h2>
|
||||||
@ -29,7 +28,7 @@
|
|||||||
<a-list-item-meta
|
<a-list-item-meta
|
||||||
:description="item.description"
|
:description="item.description"
|
||||||
>
|
>
|
||||||
<a slot="title" href="https://www.antdv.com/">{{ item.title }}</a>
|
<div slot="title">{{ item.pluginName }}</div>
|
||||||
<a-avatar
|
<a-avatar
|
||||||
slot="avatar"
|
slot="avatar"
|
||||||
src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"
|
src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"
|
||||||
@ -49,18 +48,28 @@ export default {
|
|||||||
return {
|
return {
|
||||||
pluginList: [],
|
pluginList: [],
|
||||||
loading: {},
|
loading: {},
|
||||||
|
bannerList: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
const result = await api.plugin.query();
|
const [result, bannerRes] = await Promise.all([
|
||||||
|
api.plugin.query(),
|
||||||
|
api.banner.query(),
|
||||||
|
]);
|
||||||
this.pluginList = result.result;
|
this.pluginList = result.result;
|
||||||
|
this.bannerList = bannerRes.result;
|
||||||
|
console.log(bannerRes)
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
async download(index, item) {
|
async download(index, item) {
|
||||||
if (this.loading[index]) return;
|
if (this.loading[index]) return;
|
||||||
this.$set(this.loading, index, true);
|
this.$set(this.loading, index, true);
|
||||||
await this.downloadPlugin(item);
|
try {
|
||||||
|
await this.downloadPlugin(item);
|
||||||
|
} catch (e) {
|
||||||
|
this.$message.error(e);
|
||||||
|
}
|
||||||
this.$set(this.loading, index, false);
|
this.$set(this.loading, index, false);
|
||||||
},
|
},
|
||||||
showButton(item) {
|
showButton(item) {
|
||||||
@ -82,7 +91,7 @@ export default {
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
.ant-carousel .slick-slide {
|
.ant-carousel .slick-slide {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
height: 200px;
|
height: 235px;
|
||||||
line-height: 160px;
|
line-height: 160px;
|
||||||
background: #364d79;
|
background: #364d79;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<div class="dev-container">
|
<div class="dev-container">
|
||||||
<div class="dev-detail" v-if="prodPlugin.length">
|
<div class="dev-detail" v-if="prodPlugin.length">
|
||||||
<a-menu v-model="currentSelect" style="width: 256px; height: 100%" mode="vertical">
|
<a-menu v-model="currentSelect" style="width: 256px; height: 100%" mode="vertical">
|
||||||
<a-menu-item @click="currentSelect = [index]" v-for="(plugin, index) in devPlugins" :key="index">
|
<a-menu-item @click="currentSelect = [index]" v-for="(plugin, index) in prodPlugin" :key="index">
|
||||||
<div>{{ plugin.pluginName }}</div>
|
<div>{{ plugin.pluginName }}</div>
|
||||||
<div>{{ plugin.description }}</div>
|
<div>{{ plugin.description }}</div>
|
||||||
</a-menu-item>
|
</a-menu-item>
|
||||||
|
14
src/renderer/pages/search/subpages/settings.vue
Normal file
14
src/renderer/pages/search/subpages/settings.vue
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<template>
|
||||||
|
<a-result status="403" title="功能开发中" sub-title="敬请期待...">
|
||||||
|
</a-result>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "settings.vue"
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
@ -3,6 +3,7 @@ import Router from 'vue-router'
|
|||||||
import Market from '../pages/search/subpages/market';
|
import Market from '../pages/search/subpages/market';
|
||||||
import Dev from '../pages/search/subpages/dev';
|
import Dev from '../pages/search/subpages/dev';
|
||||||
import Installed from '../pages/search/subpages/plugin';
|
import Installed from '../pages/search/subpages/plugin';
|
||||||
|
import Settings from '../pages/search/subpages/settings';
|
||||||
|
|
||||||
Vue.use(Router)
|
Vue.use(Router)
|
||||||
|
|
||||||
@ -25,6 +26,10 @@ export default new Router({
|
|||||||
path: 'plugin',
|
path: 'plugin',
|
||||||
component: Installed
|
component: Installed
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'settings',
|
||||||
|
component: Settings
|
||||||
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -38,7 +38,7 @@ const mutations = {
|
|||||||
sysFile.savePlugins(state.devPlugins);
|
sysFile.savePlugins(state.devPlugins);
|
||||||
},
|
},
|
||||||
deleteProdPlugin(state, payload) {
|
deleteProdPlugin(state, payload) {
|
||||||
state.devPlugins = state.devPlugins.filter(plugin => plugin.name !== payload.name);
|
state.devPlugins = state.devPlugins.filter(plugin => plugin.id !== payload.id);
|
||||||
sysFile.savePlugins(state.devPlugins);
|
sysFile.savePlugins(state.devPlugins);
|
||||||
// todo 删除 static 目录下的对应插件
|
// todo 删除 static 目录下的对应插件
|
||||||
},
|
},
|
||||||
@ -107,8 +107,9 @@ const actions = {
|
|||||||
const pluginConfig = {
|
const pluginConfig = {
|
||||||
...config,
|
...config,
|
||||||
sourceFile: path.join(fileUrl, `../${config.main || 'index.html'}`),
|
sourceFile: path.join(fileUrl, `../${config.main || 'index.html'}`),
|
||||||
name: uuidv4(),
|
id: uuidv4(),
|
||||||
type: 'dev',
|
type: 'dev',
|
||||||
|
icon: 'image://' + path.join(fileUrl, `../${config.logo}`),
|
||||||
subType: (() => {
|
subType: (() => {
|
||||||
if (config.main) {
|
if (config.main) {
|
||||||
return ''
|
return ''
|
||||||
@ -202,6 +203,7 @@ const actions = {
|
|||||||
const config = JSON.parse(fs.readFileSync(`${fileUrl}/plugin.json`, 'utf-8'));
|
const config = JSON.parse(fs.readFileSync(`${fileUrl}/plugin.json`, 'utf-8'));
|
||||||
const pluginConfig = {
|
const pluginConfig = {
|
||||||
...config,
|
...config,
|
||||||
|
id: uuidv4(),
|
||||||
sourceFile: `${fileUrl}/${config.main}`,
|
sourceFile: `${fileUrl}/${config.main}`,
|
||||||
type: 'prod'
|
type: 'prod'
|
||||||
};
|
};
|
||||||
|
2
static/plugins/rubick-plugin-demo/.gitignore
vendored
2
static/plugins/rubick-plugin-demo/.gitignore
vendored
@ -1,2 +0,0 @@
|
|||||||
node_modules
|
|
||||||
.idea
|
|
@ -1,6 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<body>
|
|
||||||
hello world123123
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Binary file not shown.
Before Width: | Height: | Size: 90 KiB |
@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"pluginName": "测试插件",
|
|
||||||
"description": "我的第一个 rubick 插件",
|
|
||||||
"main": "index.html",
|
|
||||||
"version": "0.0.1",
|
|
||||||
"logo": "logo.png",
|
|
||||||
"features": [
|
|
||||||
{
|
|
||||||
"code": "hello",
|
|
||||||
"explain": "这是一个测试的插件",
|
|
||||||
"cmds":["hello", "你好"]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"preload": "preload.js"
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
const { readFileSync } = require('fs')
|
|
||||||
|
|
||||||
window.readConfig = function () {
|
|
||||||
const data = '123123'
|
|
||||||
return data
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user