mirror of
https://github.com/rubickCenter/rubick
synced 2025-12-29 22:39:45 +08:00
✨ 支持本地启动,修改mac 下获取 APP icon 的方式
This commit is contained in:
@@ -96,6 +96,9 @@ export default {
|
||||
accessToken: 'access token',
|
||||
placeholder: 'required for private network gitlab warehouse',
|
||||
},
|
||||
localstart: {
|
||||
title: 'Local Start',
|
||||
},
|
||||
},
|
||||
dev: {
|
||||
title: 'Developer',
|
||||
|
||||
@@ -94,6 +94,9 @@ export default {
|
||||
accessToken: 'access token',
|
||||
placeholder: '内网gitlab仓库必填',
|
||||
},
|
||||
localstart: {
|
||||
title: '本地启动',
|
||||
},
|
||||
},
|
||||
dev: {
|
||||
title: '开发者',
|
||||
|
||||
@@ -14,6 +14,12 @@
|
||||
</template>
|
||||
{{ $t('feature.settings.basic.title') }}
|
||||
</a-menu-item>
|
||||
<a-menu-item key="localstart">
|
||||
<template #icon>
|
||||
<FolderOpenOutlined />
|
||||
</template>
|
||||
{{ $t('feature.settings.localstart.title') }}
|
||||
</a-menu-item>
|
||||
<a-menu-item key="global">
|
||||
<template #icon>
|
||||
<LaptopOutlined />
|
||||
@@ -220,6 +226,7 @@
|
||||
</div>
|
||||
<SuperPanel v-if="currentSelect[0] === 'superpanel'" />
|
||||
<Localhost v-if="currentSelect[0] === 'localhost'" />
|
||||
<LocalStart v-if="currentSelect[0] === 'localstart'" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -232,6 +239,7 @@ import {
|
||||
MinusCircleOutlined,
|
||||
PlusCircleOutlined,
|
||||
UserOutlined,
|
||||
FolderOpenOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
import debounce from 'lodash.debounce';
|
||||
import { ref, reactive, watch, toRefs, computed } from 'vue';
|
||||
@@ -239,6 +247,7 @@ import keycodes from './keycode';
|
||||
import Localhost from './localhost.vue';
|
||||
import SuperPanel from './super-panel.vue';
|
||||
import UserInfo from './user-info';
|
||||
import LocalStart from './local-start';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import localConfig from '@/confOp';
|
||||
|
||||
|
||||
71
feature/src/views/settings/local-start.vue
Normal file
71
feature/src/views/settings/local-start.vue
Normal file
@@ -0,0 +1,71 @@
|
||||
<template>
|
||||
<div class="file-container" @drop.prevent="dropFile" @dragenter="checkDrop" @dragover="checkDrop">
|
||||
<a-alert message="可拖放文件夹到这里加入启动" type="info" show-icon />
|
||||
<a-list item-layout="horizontal" :data-source="localStartList">
|
||||
<template #renderItem="{ item }">
|
||||
<a-list-item>
|
||||
<template #actions>
|
||||
<a key="list-loadmore-edit" @click="() => remove(item)">移除</a>
|
||||
</template>
|
||||
<a-list-item-meta :description="item.desc">
|
||||
<template #title>
|
||||
<div>{{item.name}}</div>
|
||||
</template>
|
||||
<template #avatar>
|
||||
<a-avatar shape="square" :src="item.icon" />
|
||||
</template>
|
||||
</a-list-item-meta>
|
||||
</a-list-item>
|
||||
</template>
|
||||
</a-list>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
const dbId = 'rubick-local-start-app';
|
||||
|
||||
const localStartList = ref(window.rubick.dbStorage.getItem(dbId) || []);
|
||||
|
||||
const dropFile = (e) => {
|
||||
const files = Array.from(e.dataTransfer.files).map((file) => {
|
||||
const plugin = {
|
||||
icon: window.rubick.getFileIcon(file.path),
|
||||
value: 'plugin',
|
||||
desc: file.path,
|
||||
pluginType: 'app',
|
||||
name: file.name,
|
||||
action: `open ${file.path.replace(/ /g, '\\ ')}`,
|
||||
keyWords: [file.name],
|
||||
names: [file.name],
|
||||
};
|
||||
window.market.addLocalStartPlugin(plugin);
|
||||
return plugin;
|
||||
});
|
||||
localStartList.value = [
|
||||
...localStartList.value,
|
||||
...files,
|
||||
];
|
||||
window.rubick.dbStorage.setItem(dbId, JSON.parse(JSON.stringify(localStartList.value)));
|
||||
};
|
||||
|
||||
const remove = (item) => {
|
||||
localStartList.value = localStartList.value.filter(app => app.desc !== item.desc);
|
||||
window.rubick.dbStorage.setItem(dbId, JSON.parse(JSON.stringify(localStartList.value)));
|
||||
window.market.removeLocalStartPlugin(JSON.parse(JSON.stringify(item)));
|
||||
};
|
||||
|
||||
const checkDrop = (e) => {
|
||||
e.preventDefault();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.file-container {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
overflow-x: hidden;
|
||||
background: var(--color-body-bg);
|
||||
height: calc(~'100vh - 106px');
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user