diff --git a/openapi-ts-request.config.ts b/openapi-ts-request.config.ts index 37216cf..5c295df 100644 --- a/openapi-ts-request.config.ts +++ b/openapi-ts-request.config.ts @@ -2,7 +2,7 @@ import { defineConfig } from 'openapi-ts-request' export default defineConfig([ { - describe: 'unibest-openapi-test', + describe: 'uni-openapi-test', schemaPath: 'https://ukw0y1.laf.run/unibest-opapi-test.json', serversPath: './src/service', requestLibPath: `import request from '@/http/vue-query';\n import { CustomRequestOptions_ } from '@/http/types';`, diff --git a/src/App.vue b/src/App.vue index c17eb06..3d89c0c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -4,14 +4,26 @@ import { getCurrentInstance, onMounted, onUnmounted } from 'vue' import { navigateToInterceptor } from '@/router/interceptor' import { tabbarStore } from '@/tabbar/store' import { permission } from '@/router/permission' +import { useUniHaloConfigStore } from './store/config' const { proxy } = (getCurrentInstance() || {}) as any const router = proxy?.$router router && permission.install(router) -onLaunch((options) => { +async function init() { + try { + const uniHaloConfigStore = useUniHaloConfigStore() + await uniHaloConfigStore.init() + } + catch (err) { + console.error(err) + } +} + +onLaunch(async (options) => { console.log('App.vue onLaunch', options) + await init() }) onShow((options) => { console.log('App.vue onShow', options) @@ -46,7 +58,3 @@ onUnmounted(() => { }) // #endif - - diff --git a/src/api/halo-plugin/uni-halo.ts b/src/api/halo-plugin/uni-halo.ts index f2ea7fb..19a3692 100644 --- a/src/api/halo-plugin/uni-halo.ts +++ b/src/api/halo-plugin/uni-halo.ts @@ -1,11 +1,15 @@ import { http } from '@/http/alova' +export interface IUniHaloConfig { + baseURL: string +} + /** * 获取 uni-halo 插件配置 * @returns uni-halo 插件配置响应参数 */ export function queryUniHaloPluginConfigs() { - return http.Get(`/apis/api.uni.uhalo.pro/v1alpha1/plugins/plugin-uni-halo/getConfigs`, { + return http.Get(`/apis/api.uni.uhalo.pro/v1alpha1/plugins/plugin-uni-halo/getConfigs`, { meta: { isHalo: true, }, diff --git a/src/components/post-card/post-card.vue b/src/components/post-card/post-card.vue new file mode 100644 index 0000000..d347791 --- /dev/null +++ b/src/components/post-card/post-card.vue @@ -0,0 +1,115 @@ + + + + + diff --git a/src/config/useAppConfig.ts b/src/config/useAppConfig.ts new file mode 100644 index 0000000..7ca85ac --- /dev/null +++ b/src/config/useAppConfig.ts @@ -0,0 +1,5 @@ +export function useAppConfig() { + return { + apiBaseUrl: import.meta.env.VITE_API_BASE_URL, + } +} diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 0e8ff6f..4a600aa 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -4,10 +4,11 @@ import { queryPostByName, queryPosts } from '@/api/halo-base/post' import { completeUrl } from '@/utils/url' import { timeFrom } from '@/utils/base/timeFrom' import { useListData } from '@/hooks/useListData' -import { randomImageUrl } from '@/utils/randomResources' - +import { getRandomUrl, randomImageUrl } from '@/utils/randomResources' import type { ListedPostVo, ListedPostVoList, PostV1alpha1PublicApiQueryPostByNameRequest, PostV1alpha1PublicApiQueryPostsRequest, PostVo } from '@halo-dev/api-client' +import PostCard from '@/components/post-card/post-card.vue' + defineOptions({ name: 'Home', }) @@ -50,6 +51,24 @@ const banner = reactive({ ], }) +const categories = reactive([ + { + name: '全栈开发', + count: 120, + cover: getRandomUrl(), + }, + { + name: 'Docker', + count: 0, + cover: getRandomUrl(), + }, + { + name: 'Vue技术', + count: 99, + cover: getRandomUrl(), + }, +]) + const quickList = reactive([ { pagePath: 'pages/moments/moments', @@ -115,6 +134,10 @@ onLoad(() => { refresh() runSingle({ name: '019eb1ca-e37c-7729-97af-e0b658aeef0f' }) }) + +onPageScroll(({ scrollTop }) => { + +})