♻️ 代码重构

This commit is contained in:
muwoo
2021-12-06 18:23:34 +08:00
parent cd41f0561c
commit 1353c440aa
29 changed files with 295 additions and 13562 deletions

View File

@@ -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">
* {

View File

@@ -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,
});

View File

@@ -83,7 +83,7 @@ const readme = computed(() => {
});
const deletePlugin = async (plugin) => {
await window.rubick.deletePlugin(plugin);
await window.market.deletePlugin(plugin);
updateLocalPlugin();
};
</script>

View File

@@ -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(() => {

View File

@@ -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);
};