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": {
|
||||
"ant-design-vue": "^1.7.5",
|
||||
"anyproxy": "^4.1.3",
|
||||
"axios": "^0.18.1",
|
||||
"chokidar": "^3.5.1",
|
||||
"download-git-repo": "^3.0.2",
|
||||
"electron-store": "^8.0.0",
|
||||
"marked": "^2.0.7",
|
||||
|
@ -1,4 +1,4 @@
|
||||
export default {
|
||||
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 banner from './list/banner';
|
||||
|
||||
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');
|
||||
|
||||
return new Promise(async (resolve, reject) => {
|
||||
@ -59,7 +60,7 @@ function downloadFunc(downloadRepoUrl, name) {
|
||||
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')
|
||||
if (err) {
|
||||
console.log(err);
|
||||
|
@ -14,8 +14,8 @@
|
||||
<a-icon type="code"/>
|
||||
开发者
|
||||
</a-menu-item>
|
||||
<a-menu-item key="set">
|
||||
<a-icon type="setting"/>
|
||||
<a-menu-item key="settings">
|
||||
<a-icon type="settings"/>
|
||||
设置
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
|
@ -12,10 +12,9 @@
|
||||
<div slot="nextArrow" slot-scope="props" class="custom-slick-arrow" style="right: 10px">
|
||||
<a-icon type="right-circle" />
|
||||
</div>
|
||||
<div><h3>1</h3></div>
|
||||
<div><h3>2</h3></div>
|
||||
<div><h3>3</h3></div>
|
||||
<div><h3>4</h3></div>
|
||||
<div v-for="banner in bannerList">
|
||||
<img width="100%" :src="banner.src" />
|
||||
</div>
|
||||
</a-carousel>
|
||||
<a-divider></a-divider>
|
||||
<h2>插件</h2>
|
||||
@ -29,7 +28,7 @@
|
||||
<a-list-item-meta
|
||||
:description="item.description"
|
||||
>
|
||||
<a slot="title" href="https://www.antdv.com/">{{ item.title }}</a>
|
||||
<div slot="title">{{ item.pluginName }}</div>
|
||||
<a-avatar
|
||||
slot="avatar"
|
||||
src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"
|
||||
@ -49,18 +48,28 @@ export default {
|
||||
return {
|
||||
pluginList: [],
|
||||
loading: {},
|
||||
bannerList: []
|
||||
}
|
||||
},
|
||||
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.bannerList = bannerRes.result;
|
||||
console.log(bannerRes)
|
||||
},
|
||||
|
||||
methods: {
|
||||
async download(index, item) {
|
||||
if (this.loading[index]) return;
|
||||
this.$set(this.loading, index, true);
|
||||
try {
|
||||
await this.downloadPlugin(item);
|
||||
} catch (e) {
|
||||
this.$message.error(e);
|
||||
}
|
||||
this.$set(this.loading, index, false);
|
||||
},
|
||||
showButton(item) {
|
||||
@ -82,7 +91,7 @@ export default {
|
||||
box-sizing: border-box;
|
||||
.ant-carousel .slick-slide {
|
||||
text-align: center;
|
||||
height: 200px;
|
||||
height: 235px;
|
||||
line-height: 160px;
|
||||
background: #364d79;
|
||||
overflow: hidden;
|
||||
|
@ -2,7 +2,7 @@
|
||||
<div class="dev-container">
|
||||
<div class="dev-detail" v-if="prodPlugin.length">
|
||||
<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.description }}</div>
|
||||
</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 Dev from '../pages/search/subpages/dev';
|
||||
import Installed from '../pages/search/subpages/plugin';
|
||||
import Settings from '../pages/search/subpages/settings';
|
||||
|
||||
Vue.use(Router)
|
||||
|
||||
@ -25,6 +26,10 @@ export default new Router({
|
||||
path: 'plugin',
|
||||
component: Installed
|
||||
},
|
||||
{
|
||||
path: 'settings',
|
||||
component: Settings
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ const mutations = {
|
||||
sysFile.savePlugins(state.devPlugins);
|
||||
},
|
||||
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);
|
||||
// todo 删除 static 目录下的对应插件
|
||||
},
|
||||
@ -107,8 +107,9 @@ const actions = {
|
||||
const pluginConfig = {
|
||||
...config,
|
||||
sourceFile: path.join(fileUrl, `../${config.main || 'index.html'}`),
|
||||
name: uuidv4(),
|
||||
id: uuidv4(),
|
||||
type: 'dev',
|
||||
icon: 'image://' + path.join(fileUrl, `../${config.logo}`),
|
||||
subType: (() => {
|
||||
if (config.main) {
|
||||
return ''
|
||||
@ -202,6 +203,7 @@ const actions = {
|
||||
const config = JSON.parse(fs.readFileSync(`${fileUrl}/plugin.json`, 'utf-8'));
|
||||
const pluginConfig = {
|
||||
...config,
|
||||
id: uuidv4(),
|
||||
sourceFile: `${fileUrl}/${config.main}`,
|
||||
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