This commit is contained in:
aihe 2024-08-10 09:39:55 +08:00
parent bdbf6e65cc
commit 2b8dc2840f
2 changed files with 15 additions and 7 deletions

View File

@ -38,7 +38,12 @@ const goto = (url, type = 1)=> {
} }
const goBack = (opt = {})=> { const goBack = (opt = {})=> {
uni.navigateBack(opt) uni.navigateBack({
fail: ()=>{
goto(opt._finalUrl || `tabBar/home/home`, 2)
},
...opt,
})
} }
const reLaunch = (opt = {})=> { const reLaunch = (opt = {})=> {
@ -294,10 +299,11 @@ const setNavigationBarTitle = (title)=> {
} }
const reloadCurrentPage = (_thisPage)=> { const reloadCurrentPage = (_thisPage)=> {
let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
let curPage = routes[routes.length - 1] // 获取当前页面路由,也就是最后一个打开的页面路由
_thisPage = curPage || _thisPage
let { fullPath } = _thisPage.$page let { fullPath } = _thisPage.$page
uni.redirectTo({ goto(fullPath, 2)
url: fullPath
});
} }
const playAudio = (src)=> { const playAudio = (src)=> {

View File

@ -30,7 +30,7 @@ const chooseFile = function (action = 'chooseImage', opt = {}) {
}) })
} }
const doRequest = function (file) { const doRequest = function (file, opt = {}) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let comReqData = getCommonReqData() let comReqData = getCommonReqData()
uni.uploadFile({ uni.uploadFile({
@ -55,7 +55,8 @@ const doRequest = function (file) {
fail() { fail() {
showToast("文件上传失败") showToast("文件上传失败")
reject() reject()
} },
...opt
}) })
}) })
} }
@ -104,5 +105,6 @@ const coreMultiUploadFile = async (action = 'chooseImage', opt = {})=> {
export { export {
coreUploadFile, coreUploadFile,
coreMultiUploadFile coreMultiUploadFile,
doRequest
} }