Skip to content

Commit

Permalink
切换插件商店源
Browse files Browse the repository at this point in the history
  • Loading branch information
HalcyonAlcedo committed Aug 18, 2024
1 parent cbc7dc8 commit 0bc1091
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/stores/server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineStore } from 'pinia';
import type { PersistedStateOptions } from 'pinia-plugin-persistedstate';

const serverUrl = localStorage.getItem('api') || 'http://localhost:3000';
const serverUrl = localStorage.getItem('api') || 'http://localhost:5333';

export const useServerStore = defineStore({
id: 'server',
Expand Down
25 changes: 15 additions & 10 deletions src/views/store/Store.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,20 @@ const checkUpdate = (app: string, version: string) => {
* 获取商店插件信息
*/
const getPluginsData = async ({ done }: any) => {
axios.get('http://dev.alcedo.top/getdata.php', { params: { start: pluginsCount.value } }).then((data) => {
if (data.data.length === 0) {
done('empty')
} else {
plugins.value.push(...data.data)
pluginsCount.value += data.data.length
done('ok')
}
/* 暂时不使用分页策略
axios.get('http://dev.alcedo.top/getdata.php', { params: { start: pluginsCount.value } }).then((data) => {
if (data.data.length === 0) {
done('empty')
} else {
plugins.value.push(...data.data)
pluginsCount.value += data.data.length
done('ok')
}
})
*/
axios.get('https://halcyonalcedo.github.io/karin-store/plugins.json').then((data) => {
plugins.value.push(...data.data)
done('empty')
})
}
/**
Expand Down Expand Up @@ -218,7 +223,7 @@ getLocalPluginsData()
</script>

<template>
<BaseBreadcrumb title="插件商店(测试)" :breadcrumbs="breadcrumbs"></BaseBreadcrumb>
<BaseBreadcrumb title="插件商店" :breadcrumbs="breadcrumbs"></BaseBreadcrumb>
<v-infinite-scroll :items="plugins" :onLoad="getPluginsData" style="overflow: hidden;">
<v-row dense>
<template v-for="plugin in plugins" :key="plugin.app">
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default defineConfig({
server: {
proxy: {
'/api': {
target: 'http://localhost:3000', // 目标后端服务地址
target: 'http://localhost:5333', // 目标后端服务地址
changeOrigin: true, // 允许跨域
secure: false, // 允许 HTTPS 下访问 HTTP
rewrite: (path:string) => path.replace(/^\/api/, '')
Expand Down

0 comments on commit 0bc1091

Please sign in to comment.