diff --git a/src/App.vue b/src/App.vue index a8e315e..969d42a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -2,6 +2,7 @@ import { onLaunch, onShow, onHide } from '@dcloudio/uni-app' onLaunch(() => { + uni.showModal({ title: '提示', content: 'App Launch' }) console.log('App Launch') }) onShow(() => { @@ -72,4 +73,42 @@ image { view { box-sizing: border-box; } + +uni-modal { + .uni-modal { + @apply max-w-345 rounded-16; + } + + .uni-modal__hd { + @apply p-0; + } + + .uni-modal__title { + @apply p-16 text-left text-16 font-600; + } + + .uni-modal__bd { + @apply mb-16 px-16 pt-0 text-left text-14 font-medium text-#666; + } + + .uni-modal__btn { + @apply px-16 py-8 flex-none rounded-full shadow-none text-14; + + &::after { + content: none; + } + + &.uni-modal__btn_primary { + @apply ml-8 bg-gray-200 !text-black; + } + } + + .uni-modal__ft { + @apply justify-end p-16 leading-normal; + + &::after { + content: none; + } + } +} diff --git a/src/utils/index.ts b/src/utils/index.ts index be21dd6..57f0042 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,7 +1,7 @@ import { pages, subPackages, tabBar } from '@/pages.json' import { isMp } from './platform' -const getLastPage = () => { +export const getLastPage = () => { // getCurrentPages() 至少有1个元素,所以不再额外判断 // const lastPage = getCurrentPages().at(-1) // 上面那个在低版本安卓中打包回报错,所以改用下面这个【虽然我加了src/interceptions/prototype.ts,但依然报错】 @@ -176,3 +176,30 @@ export const getEnvBaseUploadUrl = () => { return baseUploadUrl } + +export function mergeStep(wrapped: (...rest: any[]) => Promise) { + let _mergeStepRequestInstance: any = null + return async function (...args) { + if (this?._mergeStepRequestInstance ?? _mergeStepRequestInstance) + return this?._mergeStepRequestInstance ?? _mergeStepRequestInstance + if (this) { + this._mergeStepRequestInstance = wrapped.apply(this, args) + } else { + _mergeStepRequestInstance = wrapped(...args) + } + if ( + Object.prototype.toString.call( + this?._mergeStepRequestInstance ?? _mergeStepRequestInstance, + ) === '[object Promise]' + ) { + ;(this?._mergeStepRequestInstance ?? _mergeStepRequestInstance).finally(() => { + if (this?._mergeStepRequestInstance) { + this._mergeStepRequestInstance = null + } else { + _mergeStepRequestInstance = null + } + }) + } + return _mergeStepRequestInstance + } +} diff --git a/tsconfig.json b/tsconfig.json index c0755ed..2b7263f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,7 +5,7 @@ "module": "ESNext", "moduleResolution": "Node", "resolveJsonModule": true, - "noImplicitThis": true, + "noImplicitThis": false, "allowSyntheticDefaultImports": true, "allowJs": true, "sourceMap": true,