diff --git a/src/App.vue b/src/App.vue
index 5a520e9..819d38e 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -8,7 +8,9 @@
style="width: 320px"
@change="fetchRepoData"
>
- BetterGI 中央仓库
+
+ {{ repo.label }}
+
@@ -91,6 +93,20 @@
+
+
+
+
+
@@ -98,6 +114,24 @@
import { ref, onMounted, reactive, computed } from 'vue';
import { Message, Popover, Typography } from '@arco-design/web-vue';
+const baseRepo = "https://raw.githubusercontent.com/babalae/bettergi-scripts-list/refs/heads/main/build/tree.json";
+const mirrorUrls = [
+ "{0}",
+ "https://mirror.ghproxy.com/{0}",
+ "https://hub.gitmirror.com/{0}",
+ "https://ghproxy.cc/{0}",
+ "https://www.ghproxy.cc/{0}",
+ "https://ghproxy.cn/{0}",
+ "https://ghproxy.net/{0}"
+];
+
+const repoOptions = computed(() => {
+ return mirrorUrls.map((url, index) => ({
+ label: index === 0 ? "BetterGI 中央仓库" : `BetterGI 中央仓库 镜像 ${index}`,
+ value: url.replace("{0}", baseRepo)
+ }));
+});
+
const selectedRepo = ref('');
const repoData = ref([]);
const drawerVisible = ref(false);
@@ -105,6 +139,9 @@ const drawerData = ref([]);
const searchConditions = reactive({});
const filteredData = reactive({});
+// 添加 loading 状态
+const loading = ref(false);
+
const columns = [
{
title: '名称',
@@ -113,8 +150,8 @@ const columns = [
ellipsis: true,
tooltip: false // 关闭默认的 tooltip
},
- { title: '作者', dataIndex: 'author' },
- { title: '版本', dataIndex: 'version' },
+ { title: '作者', dataIndex: 'author', width: 200 },
+ { title: '版本', dataIndex: 'version', width: 100 },
{ title: '标签', dataIndex: 'tags', slotName: 'tags' },
{ title: '操作', slotName: 'operations' },
];
@@ -122,6 +159,8 @@ const columns = [
const fetchRepoData = async () => {
if (!selectedRepo.value) return;
+ loading.value = true; // 显示加载模态框
+
try {
const response = await fetch(selectedRepo.value);
const data = await response.json();
@@ -147,6 +186,8 @@ const fetchRepoData = async () => {
} catch (error) {
Message.error('获取仓库数据失败');
console.error('Error fetching repo data:', error);
+ } finally {
+ loading.value = false; // 隐藏加载模态框
}
};
@@ -167,6 +208,12 @@ const traverseCategory = (category, callback) => {
if (category.name === 'js') {
category.children.forEach(child => {
if (child.type === 'directory') {
+ // 处理 JS 脚本
+ if (child.description && child.description.includes('~|~')) {
+ const [nameSuffix, newDescription] = child.description.split('~|~');
+ child.name = `${child.name} - ${nameSuffix.trim()}`;
+ child.description = newDescription.trim();
+ }
callback(child);
} else {
traverseCategory(child, callback);
@@ -250,7 +297,7 @@ const getTagColor = (tag) => {
onMounted(() => {
// 默认选中第一个仓库
- selectedRepo.value = 'https://raw.githubusercontent.com/babalae/bettergi-scripts-list/refs/heads/main/build/tree.json';
+ selectedRepo.value = repoOptions.value[0].value;
fetchRepoData();
});