支持图像分类插件查看

This commit is contained in:
muwoo
2023-04-01 10:26:17 +08:00
parent a8006ec199
commit 35c9a32604
5 changed files with 109 additions and 48 deletions

View File

@@ -1,10 +1,10 @@
import axios from "axios";
import axios from 'axios';
let baseURL = "https://gitcode.net/rubickcenter/rubick-database/-/raw/master";
let access_token = "";
let baseURL = 'https://gitcode.net/rubickcenter/rubick-database/-/raw/master';
let access_token = '';
try {
const dbdata = window.rubick.db.get("rubick-localhost-config");
const dbdata = window.rubick.db.get('rubick-localhost-config');
baseURL = dbdata.data.database;
access_token = dbdata.data.access_token;
} catch (e) {
@@ -12,40 +12,49 @@ try {
}
const instance = axios.create({
baseURL: baseURL || "https://gitcode.net/rubickcenter/rubick-database/-/raw/master",
baseURL:
baseURL || 'https://gitcode.net/rubickcenter/rubick-database/-/raw/master',
});
export default {
async getTotalPlugins() {
let targetPath = "plugins/total-plugins.json";
let targetPath = 'plugins/total-plugins.json';
if (access_token) {
targetPath = `${encodeURIComponent(targetPath)}/raw?access_token=${access_token}&ref=master`
targetPath = `${encodeURIComponent(
targetPath
)}/raw?access_token=${access_token}&ref=master`;
}
const res = await instance.get(targetPath);
return res.data;
},
async getFinderDetail() {
let targetPath = "plugins/finder.json";
let targetPath = 'plugins/finder.json';
if (access_token) {
targetPath = `${encodeURIComponent(targetPath)}/raw?access_token=${access_token}&ref=master`
targetPath = `${encodeURIComponent(
targetPath
)}/raw?access_token=${access_token}&ref=master`;
}
const res = await instance.get(targetPath);
return res.data;
},
async getSystemDetail() {
let targetPath = "plugins/system.json";
let targetPath = 'plugins/system.json';
if (access_token) {
targetPath = `${encodeURIComponent(targetPath)}/raw?access_token=${access_token}&ref=master`
targetPath = `${encodeURIComponent(
targetPath
)}/raw?access_token=${access_token}&ref=master`;
}
const res = await instance.get(targetPath);
return res.data;
},
async getWorkerDetail() {
let targetPath = "plugins/worker.json";
let targetPath = 'plugins/worker.json';
if (access_token) {
targetPath = `${encodeURIComponent(targetPath)}/raw?access_token=${access_token}&ref=master`
targetPath = `${encodeURIComponent(
targetPath
)}/raw?access_token=${access_token}&ref=master`;
}
const res = await instance.get(targetPath);
return res.data;
@@ -57,17 +66,31 @@ export default {
},
async getSearchDetail() {
let targetPath = "plugins/search.json";
let targetPath = 'plugins/search.json';
if (access_token) {
targetPath = `${encodeURIComponent(targetPath)}/raw?access_token=${access_token}&ref=master`
targetPath = `${encodeURIComponent(
targetPath
)}/raw?access_token=${access_token}&ref=master`;
}
const res = await instance.get(targetPath);
return res.data;
},
async getDevDetail() {
let targetPath = "plugins/dev.json";
let targetPath = 'plugins/dev.json';
if (access_token) {
targetPath = `${encodeURIComponent(targetPath)}/raw?access_token=${access_token}&ref=master`
targetPath = `${encodeURIComponent(
targetPath
)}/raw?access_token=${access_token}&ref=master`;
}
const res = await instance.get(targetPath);
return res.data;
},
async getImageDetail() {
let targetPath = 'plugins/image.json';
if (access_token) {
targetPath = `${encodeURIComponent(
targetPath
)}/raw?access_token=${access_token}&ref=master`;
}
const res = await instance.get(targetPath);
return res.data;

View File

@@ -1,13 +1,49 @@
<template>
<div class="system">
<PluginList
v-if="system && !!system.length"
@downloadSuccess="downloadSuccess"
title="系统插件"
:list="system"
/>
</div>
</template>
<script>
export default {
name: "image"
};
<script setup>
import { ref, computed, onBeforeMount } from "vue";
import request from "../../../assets/request/index";
import PluginList from "./plugin-list.vue";
import { useStore } from "vuex";
const store = useStore();
const totalPlugins = computed(() => store.state.totalPlugins);
const data = ref([]);
onBeforeMount(async () => {
data.value = await request.getImageDetail();
});
const system = computed(() => {
const defaultData = data.value || [];
if (!defaultData.length) return [];
return defaultData.map((plugin) => {
let searchInfo = null;
totalPlugins.value.forEach((t) => {
if (t.name === plugin) {
searchInfo = t;
}
});
return searchInfo;
});
});
</script>
<style scoped>
<style lang="less">
.system {
width: 100%;
height: 100vh;
overflow-x: hidden;
box-sizing: border-box;
}
</style>

View File

@@ -71,11 +71,13 @@ import System from "./components/system.vue";
import Worker from "./components/worker.vue";
import Tools from "./components/tools.vue";
import Dev from "./components/devlopment.vue";
import Image from "./components/image.vue";
const Components = {
finder: Finder,
system: System,
worker: Worker,
image: Image,
tools: Tools,
dev: Dev,
};