From 92ebd6e912478a9cfc1de9d3084980864797fd5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=B4=AB=E6=98=9F?= <1315228475@qq.com> Date: Sat, 30 Nov 2024 22:29:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B0=83=E6=95=B4=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=88=97=E8=A1=A8=20=E4=BB=A5=E5=8F=8A=E7=9B=B8=E5=85=B3TODO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .prettierrc.cjs | 8 +-- .stylelintrc.cjs | 24 ++++----- src/pages.json | 20 +++++-- src/pages/login/forget.vue | 3 +- src/pages/login/index.vue | 3 +- src/pages/login/phoneIndex.vue | 3 +- src/pages/login/registerCode.vue | 3 +- src/pages/user/index.vue | 77 +++++++++++++++++---------- src/pages/user/show.vue | 20 +++++++ src/style/index.scss | 3 ++ src/types/auto-import.d.ts | 89 ++------------------------------ src/types/enums.ts | 5 ++ src/types/uni-pages.d.ts | 1 + src/utils/index.ts | 14 ++--- 14 files changed, 128 insertions(+), 145 deletions(-) create mode 100644 src/pages/user/show.vue create mode 100644 src/types/enums.ts diff --git a/.prettierrc.cjs b/.prettierrc.cjs index 3986355..0d4f123 100644 --- a/.prettierrc.cjs +++ b/.prettierrc.cjs @@ -12,8 +12,8 @@ module.exports = { { files: '*.json', options: { - trailingComma: 'none', - }, - }, - ], + trailingComma: 'none' + } + } + ] } diff --git a/.stylelintrc.cjs b/.stylelintrc.cjs index 574beef..03013fa 100644 --- a/.stylelintrc.cjs +++ b/.stylelintrc.cjs @@ -9,19 +9,19 @@ module.exports = { 'stylelint-config-recommended-scss', 'stylelint-config-recommended-vue/scss', 'stylelint-config-html/vue', - 'stylelint-config-recess-order', + 'stylelint-config-recess-order' ], plugins: ['stylelint-prettier'], overrides: [ // 扫描 .vue/html 文件中的 diff --git a/src/pages/user/show.vue b/src/pages/user/show.vue new file mode 100644 index 0000000..f7b5f4b --- /dev/null +++ b/src/pages/user/show.vue @@ -0,0 +1,20 @@ + +{ + layout: 'default', + style: { + navigationBarTitleText: '用户详情' + } +} + + + + + + + diff --git a/src/style/index.scss b/src/style/index.scss index bdb7553..70edc22 100644 --- a/src/style/index.scss +++ b/src/style/index.scss @@ -21,4 +21,7 @@ page { // --wot-search-light-bg: #f2f3f7; --wot-search-input-radius: 5px; + + // card + --wot-card-padding: 12px; } diff --git a/src/types/auto-import.d.ts b/src/types/auto-import.d.ts index 255cb5b..b5c1bff 100644 --- a/src/types/auto-import.d.ts +++ b/src/types/auto-import.d.ts @@ -94,7 +94,7 @@ declare global { // for type re-export declare global { // @ts-ignore - export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue' + export type { Component, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue' import('vue') } // for vue template auto import @@ -156,6 +156,7 @@ declare module 'vue' { readonly onUnload: UnwrapRef readonly onUnmounted: UnwrapRef readonly onUpdated: UnwrapRef + readonly onWatcherCleanup: UnwrapRef readonly provide: UnwrapRef readonly reactive: UnwrapRef readonly readonly: UnwrapRef @@ -173,91 +174,11 @@ declare module 'vue' { readonly useAttrs: UnwrapRef readonly useCssModule: UnwrapRef readonly useCssVars: UnwrapRef + readonly useId: UnwrapRef + readonly useModel: UnwrapRef readonly useRequest: UnwrapRef readonly useSlots: UnwrapRef - readonly useUpload: UnwrapRef - readonly watch: UnwrapRef - readonly watchEffect: UnwrapRef - readonly watchPostEffect: UnwrapRef - readonly watchSyncEffect: UnwrapRef - } -} -declare module '@vue/runtime-core' { - interface GlobalComponents {} - interface ComponentCustomProperties { - readonly EffectScope: UnwrapRef - readonly computed: UnwrapRef - readonly createApp: UnwrapRef - readonly customRef: UnwrapRef - readonly defineAsyncComponent: UnwrapRef - readonly defineComponent: UnwrapRef - readonly effectScope: UnwrapRef - readonly getCurrentInstance: UnwrapRef - readonly getCurrentScope: UnwrapRef - readonly h: UnwrapRef - readonly inject: UnwrapRef - readonly isProxy: UnwrapRef - readonly isReactive: UnwrapRef - readonly isReadonly: UnwrapRef - readonly isRef: UnwrapRef - readonly markRaw: UnwrapRef - readonly nextTick: UnwrapRef - readonly onActivated: UnwrapRef - readonly onAddToFavorites: UnwrapRef - readonly onBackPress: UnwrapRef - readonly onBeforeMount: UnwrapRef - readonly onBeforeUnmount: UnwrapRef - readonly onBeforeUpdate: UnwrapRef - readonly onDeactivated: UnwrapRef - readonly onError: UnwrapRef - readonly onErrorCaptured: UnwrapRef - readonly onHide: UnwrapRef - readonly onLaunch: UnwrapRef - readonly onLoad: UnwrapRef - readonly onMounted: UnwrapRef - readonly onNavigationBarButtonTap: UnwrapRef - readonly onNavigationBarSearchInputChanged: UnwrapRef - readonly onNavigationBarSearchInputClicked: UnwrapRef - readonly onNavigationBarSearchInputConfirmed: UnwrapRef - readonly onNavigationBarSearchInputFocusChanged: UnwrapRef - readonly onPageNotFound: UnwrapRef - readonly onPageScroll: UnwrapRef - readonly onPullDownRefresh: UnwrapRef - readonly onReachBottom: UnwrapRef - readonly onReady: UnwrapRef - readonly onRenderTracked: UnwrapRef - readonly onRenderTriggered: UnwrapRef - readonly onResize: UnwrapRef - readonly onScopeDispose: UnwrapRef - readonly onServerPrefetch: UnwrapRef - readonly onShareAppMessage: UnwrapRef - readonly onShareTimeline: UnwrapRef - readonly onShow: UnwrapRef - readonly onTabItemTap: UnwrapRef - readonly onThemeChange: UnwrapRef - readonly onUnhandledRejection: UnwrapRef - readonly onUnload: UnwrapRef - readonly onUnmounted: UnwrapRef - readonly onUpdated: UnwrapRef - readonly provide: UnwrapRef - readonly reactive: UnwrapRef - readonly readonly: UnwrapRef - readonly ref: UnwrapRef - readonly resolveComponent: UnwrapRef - readonly shallowReactive: UnwrapRef - readonly shallowReadonly: UnwrapRef - readonly shallowRef: UnwrapRef - readonly toRaw: UnwrapRef - readonly toRef: UnwrapRef - readonly toRefs: UnwrapRef - readonly toValue: UnwrapRef - readonly triggerRef: UnwrapRef - readonly unref: UnwrapRef - readonly useAttrs: UnwrapRef - readonly useCssModule: UnwrapRef - readonly useCssVars: UnwrapRef - readonly useRequest: UnwrapRef - readonly useSlots: UnwrapRef + readonly useTemplateRef: UnwrapRef readonly useUpload: UnwrapRef readonly watch: UnwrapRef readonly watchEffect: UnwrapRef diff --git a/src/types/enums.ts b/src/types/enums.ts new file mode 100644 index 0000000..d3ac8f2 --- /dev/null +++ b/src/types/enums.ts @@ -0,0 +1,5 @@ +export enum LoadMoreState { + loading = 'loading', + finished = 'finished', + error = 'error' +} diff --git a/src/types/uni-pages.d.ts b/src/types/uni-pages.d.ts index 08b9b57..e8bce39 100644 --- a/src/types/uni-pages.d.ts +++ b/src/types/uni-pages.d.ts @@ -20,6 +20,7 @@ interface NavigateToOptions { "/pages/role/index" | "/pages/role/show" | "/pages/user/index" | + "/pages/user/show" | "/pages/colab/detail/index" | "/pages/my/contact-service/index" | "/pages/my/helper/index" | diff --git a/src/utils/index.ts b/src/utils/index.ts index dca1556..7f6f807 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,6 +1,6 @@ import { pages, subPackages, tabBar } from '@/pages.json' import { isMp } from './platform' -import { debug } from '@uni-helper/vite-plugin-uni-pages' +import { isEmpty } from '@/utils/is' const getLastPage = () => { // getCurrentPages() 至少有1个元素,所以不再额外判断 @@ -82,11 +82,7 @@ export const getAllPages = (key = 'needLogin') => { // 这里处理主包 const mainPages = [ ...pages - .filter((page) => { - // TODO @xiaohong:为啥这里要特殊判断呀。 - if (page.path.includes('login')) return false - return !!key || page[key] - }) + .filter((page) => (isEmpty(page[key]) ? !!key : page[key])) .map((page) => ({ ...page, path: `/${page.path}` @@ -99,11 +95,7 @@ export const getAllPages = (key = 'needLogin') => { const { root } = subPageObj subPageObj.pages - .filter((page) => { - // TODO @xiaohong:为啥这里要特殊判断呀。 - if (page.path.includes('login')) return false - return !!key || page[key] - }) + .filter((page) => (isEmpty(page[key]) ? !!key : page[key])) .forEach((page: { path: string } & Record) => { subPages.push({ ...page, -- Gitee