fix: 优化提交订单页面js警告,充值订单跳转bug以及其他bug。refactor: 重构地址选择

This commit is contained in:
黄少君
2024-03-05 12:16:58 +08:00
parent 3fc1284094
commit a9533e2d7f
18 changed files with 553 additions and 671 deletions

View File

@ -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)
})
})
}

View File

@ -17,7 +17,7 @@ export const useRouter = () => {
* 注意2.8.9+以后版本可以使用events参数传递一个方法对象和新打开的页面建立一个channel通讯getOpenerEventChannel获取到这个channel
* @docs: https://uniapp.dcloud.net.cn/api/router.html#navigateto
* @param {object} options 原始参数
* @param {object} config 配置参数
* @param {any} config 配置参数
* @param {'navigateTo'|'redirectTo'|'reLaunch'} config.type 跳转类型
* @param {object} config.data 跳转参数
* @param {number} config.timeout 延时时间