mirror of
https://github.com/rubickCenter/rubick
synced 2025-12-24 11:31:44 +08:00
♻️ 代码重构
This commit is contained in:
@@ -51,6 +51,10 @@ const changeMenu = (key: any) => {
|
||||
const store = useStore();
|
||||
const init = () => store.dispatch("init");
|
||||
init();
|
||||
|
||||
(window as any).rubick.onPluginEnter((res) => {
|
||||
console.log(res);
|
||||
})
|
||||
</script>
|
||||
<style lang="less">
|
||||
* {
|
||||
|
||||
@@ -27,7 +27,7 @@ export default createStore({
|
||||
actions: {
|
||||
async init({ commit }) {
|
||||
const totalPlugins = await request.getTotalPlugins();
|
||||
const localPlugins = (window as any).rubick.getLocalPlugins();
|
||||
const localPlugins = (window as any).market.getLocalPlugins();
|
||||
|
||||
totalPlugins.forEach(
|
||||
(origin: { isdwonload?: any; name?: any; isloading: boolean }) => {
|
||||
@@ -63,7 +63,7 @@ export default createStore({
|
||||
}
|
||||
}
|
||||
);
|
||||
const localPlugins = (window as any).rubick.getLocalPlugins();
|
||||
const localPlugins = (window as any).market.getLocalPlugins();
|
||||
|
||||
commit("commonUpdate", {
|
||||
totalPlugins,
|
||||
@@ -71,7 +71,7 @@ export default createStore({
|
||||
});
|
||||
},
|
||||
updateLocalPlugin({ commit }) {
|
||||
const localPlugins = (window as any).rubick.getLocalPlugins();
|
||||
const localPlugins = (window as any).market.getLocalPlugins();
|
||||
commit("commonUpdate", {
|
||||
localPlugins,
|
||||
});
|
||||
|
||||
@@ -83,7 +83,7 @@ const readme = computed(() => {
|
||||
});
|
||||
|
||||
const deletePlugin = async (plugin) => {
|
||||
await window.rubick.deletePlugin(plugin);
|
||||
await window.market.deletePlugin(plugin);
|
||||
updateLocalPlugin();
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -15,8 +15,17 @@
|
||||
<img @click="jumpTo(banner.link)" width="100%" :src="banner.src" />
|
||||
</div>
|
||||
</a-carousel>
|
||||
<PluginList @downloadSuccess="downloadSuccess" title="推荐" :list="recommend || []" />
|
||||
<PluginList title="最近更新" :list="newList || []" />
|
||||
<PluginList
|
||||
v-if="recommend && !!recommend.length"
|
||||
@downloadSuccess="downloadSuccess"
|
||||
title="推荐"
|
||||
:list="recommend"
|
||||
/>
|
||||
<PluginList
|
||||
v-if="newList && !!newList.length"
|
||||
title="最近更新"
|
||||
:list="newList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -25,7 +34,7 @@ import {
|
||||
LeftCircleOutlined,
|
||||
RightCircleOutlined,
|
||||
} from "@ant-design/icons-vue";
|
||||
import { ref, computed } from "vue";
|
||||
import { ref, computed, onBeforeMount } from "vue";
|
||||
import request from "../../../assets/request/index";
|
||||
import PluginList from "./plugin-list.vue";
|
||||
|
||||
@@ -35,8 +44,9 @@ const totalPlugins = computed(() => store.state.totalPlugins);
|
||||
|
||||
const data = ref([]);
|
||||
|
||||
request.getFinderDetail().then(res => {
|
||||
data.value = res;
|
||||
onBeforeMount(async () => {
|
||||
console.log(12312);
|
||||
data.value = await request.getFinderDetail();
|
||||
});
|
||||
|
||||
const recommend = computed(() => {
|
||||
|
||||
@@ -73,7 +73,7 @@ import {
|
||||
ArrowLeftOutlined,
|
||||
} from "@ant-design/icons-vue";
|
||||
|
||||
import { computed, defineProps, ref } from "vue";
|
||||
import { defineProps, ref } from "vue";
|
||||
import { useStore } from "vuex";
|
||||
|
||||
const store = useStore();
|
||||
@@ -91,7 +91,7 @@ defineProps({
|
||||
|
||||
const downloadPlugin = async (plugin) => {
|
||||
startDownload(plugin.name);
|
||||
await window.rubick.downloadPlugin(plugin);
|
||||
await window.market.downloadPlugin(plugin);
|
||||
successDownload(plugin.name);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user