fix: 优化提交订单页面js警告,充值订单跳转bug以及其他bug。refactor: 重构地址选择
This commit is contained in:
@ -8,22 +8,36 @@
|
||||
|
||||
/**
|
||||
* 封装uni app界面相关接口,利于维护
|
||||
* @returns { * }
|
||||
* @returns {
|
||||
* {
|
||||
* toast:Function,
|
||||
* loading:Function,
|
||||
* hideLoading:Function,
|
||||
* setNavTitle:Function,
|
||||
* setNavBgColor:Function,
|
||||
* scrollTo:Function,
|
||||
* pageResize:Function,
|
||||
* unPageResize:Function,
|
||||
* startPullDownRefresh:Function,
|
||||
* stopPullDownRefresh:Function,
|
||||
* createSelectorQuery:Function,
|
||||
* createObserver:Function,
|
||||
* createMediaObserver:Function,
|
||||
* createAnimation:Function,
|
||||
* getMenuButtonInfo:Function
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
export const useInterface = () => {
|
||||
/**
|
||||
* 使用uni的toast
|
||||
* @param options
|
||||
* @returns {Promise<unknown>}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
function toast(options) {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
mask: false,
|
||||
...options,
|
||||
success: () => resolve(true),
|
||||
fail: (error) => reject(error)
|
||||
icon: 'none', mask: false, ...options, success: () => resolve(true), fail: (error) => reject(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
@ -36,11 +50,7 @@ export const useInterface = () => {
|
||||
function loading(options = {}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.showLoading({
|
||||
icon: 'none',
|
||||
mask: true,
|
||||
...options,
|
||||
success: () => resolve(true),
|
||||
fail: (error) => reject(error)
|
||||
icon: 'none', mask: true, ...options, success: () => resolve(true), fail: (error) => reject(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
@ -57,9 +67,7 @@ export const useInterface = () => {
|
||||
function setNavTitle(title) {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.setNavigationBarTitle({
|
||||
title,
|
||||
success: () => resolve(true),
|
||||
fail: (error) => reject(error)
|
||||
title, success: () => resolve(true), fail: (error) => reject(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
@ -73,18 +81,14 @@ export const useInterface = () => {
|
||||
function setNavBgColor(options, timeout = 500) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const setNavigationBarColor = () => uni.setNavigationBarColor({
|
||||
...options,
|
||||
success: () => resolve(true),
|
||||
fail: (error) => reject(error)
|
||||
...options, success: () => resolve(true), fail: (error) => reject(error)
|
||||
})
|
||||
if (timeout === 0) {
|
||||
setNavigationBarColor()
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
uni.setNavigationBarColor({
|
||||
...options,
|
||||
success: () => resolve(true),
|
||||
fail: (error) => reject(error)
|
||||
...options, success: () => resolve(true), fail: (error) => reject(error)
|
||||
})
|
||||
}, timeout)
|
||||
}
|
||||
@ -100,9 +104,7 @@ export const useInterface = () => {
|
||||
function scrollTo(options) {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.pageScrollTo({
|
||||
...options,
|
||||
success: () => resolve(true),
|
||||
fail: (error) => reject(error)
|
||||
...options, success: () => resolve(true), fail: (error) => reject(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
@ -134,8 +136,7 @@ export const useInterface = () => {
|
||||
function startPullDownRefresh() {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.startPullDownRefresh({
|
||||
success: () => resolve(true),
|
||||
fail: (error) => reject(error)
|
||||
success: () => resolve(true), fail: (error) => reject(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user