feat:navigateBackPlus 替换 uni.navigateBack 方法,避免回退失败的情况(刷新后)

This commit is contained in:
YunaiV
2025-12-15 21:15:40 +08:00
parent 8807caa3eb
commit 90b86589ae
10 changed files with 47 additions and 46 deletions

View File

@@ -114,7 +114,7 @@ async function handleSubmit() {
icon: 'success',
})
setTimeout(() => {
uni.navigateBack()
handleBack()
}, 1500)
}
} catch (error) {

View File

@@ -5,7 +5,6 @@
<wd-navbar
title="我的消息"
placeholder safe-area-inset-top fixed
@click-left="handleBack"
>
<template #right>
<view class="flex items-center gap-24rpx">
@@ -106,6 +105,7 @@ import {
updateNotifyMessageRead,
} from '@/api/system/notify'
import { getDictLabel } from '@/hooks/useDict'
import { navigateBackPlus } from '@/utils'
import { DICT_TYPE } from '@/utils/constants'
import { formatDateRange, formatDateTime } from '@/utils/date'
import DetailPopup from './components/detail-popup.vue'
@@ -131,11 +131,6 @@ const queryParams = reactive({
})
const detailPopupRef = ref<InstanceType<typeof DetailPopup>>() // 详情弹窗
/** 返回上一页 */
function handleBack() {
uni.navigateBack()
}
/** 查询消息列表 */
async function getList() {
loadMoreState.value = 'loading'

View File

@@ -22,7 +22,7 @@
mode="aspectFit"
/>
</view>
<text class="mb-40rpx text-32rpx font-bold text-gray-800">
<text class="mb-40rpx text-32rpx text-gray-800 font-bold">
添加客服二维码
</text>
<text class="mb-16rpx text-28rpx text-gray-500">
@@ -53,6 +53,7 @@
<script lang="ts" setup>
import { ref } from 'vue'
import { navigateBackPlus } from '@/utils'
import { saveImageToAlbum } from '@/utils/download'
definePage({
@@ -67,7 +68,7 @@ const servicePhone = ref('18818818818') // 客服电话号码
/** 返回上一页 */
function handleBack() {
uni.navigateBack()
navigateBackPlus('/pages/user/index')
}
/** 拨打电话 */
@@ -87,4 +88,4 @@ function handleCallPhone() {
async function handleSaveQRCode() {
await saveImageToAlbum(qrCodeUrl.value, 'weixin_qrcode.png')
}
</script>
</script>

View File

@@ -54,6 +54,7 @@
<script lang="ts" setup>
import type { FaqItem } from './data'
import { ref } from 'vue'
import { navigateBackPlus } from '@/utils'
import { faqList } from './data'
definePage({
@@ -79,7 +80,7 @@ function filteredList(list: FaqItem[]) {
/** 返回上一页 */
function handleBack() {
uni.navigateBack()
navigateBackPlus('/pages/user/index')
}
</script>

View File

@@ -22,8 +22,7 @@
clearable
:rows="5"
/>
<wd-cell title="反馈图片" title-width="180rpx">
</wd-cell>
<wd-cell title="反馈图片" title-width="180rpx" />
<!-- TODO @芋艿图片上传的接入 -->
<view class="px-24rpx pb-24rpx">
<wd-upload
@@ -56,7 +55,7 @@
import type { UploadFile, UploadMethod } from 'wot-design-uni/components/wd-upload/types'
import { ref } from 'vue'
import { useToast } from 'wot-design-uni'
import { getEnvBaseUrl } from '@/utils/index'
import { getEnvBaseUrl, navigateBackPlus } from '@/utils/index'
definePage({
style: {
@@ -86,7 +85,7 @@ const formRules = {
/** 返回上一页 */
function handleBack() {
uni.navigateBack()
navigateBackPlus('/pages/user/index')
}
/** 自定义上传方法 */
@@ -103,8 +102,7 @@ const customUpload: UploadMethod = (file, formData, options) => {
success(res) {
if (res.statusCode === options.statusCode) {
options.onSuccess(res, file, formData)
}
else {
} else {
options.onError({ ...res, errMsg: res.errMsg || '' }, file, formData)
}
},
@@ -138,8 +136,7 @@ async function handleSubmit() {
try {
const res = typeof file.response === 'string' ? JSON.parse(file.response) : file.response
return res.data || file.url
}
catch {
} catch {
return file.url
}
}

View File

@@ -48,6 +48,7 @@ import { useToast } from 'wot-design-uni'
import { getUserProfile, updateUserProfile } from '@/api/system/user/profile'
import { getDictLabel } from '@/hooks/useDict'
import { useUserStore } from '@/store/user'
import { navigateBackPlus } from '@/utils'
import { DICT_TYPE } from '@/utils/constants'
import { uploadFileFromPath } from '@/utils/uploadFile'
import Form from './components/form.vue'
@@ -75,7 +76,7 @@ const formValue = ref<string | number>('')
/** 返回上一页 */
function handleBack() {
uni.navigateBack()
navigateBackPlus('/pages/user/index')
}
/** 加载用户信息 */

View File

@@ -40,6 +40,7 @@
<script lang="ts" setup>
import { ref } from 'vue'
import { useToast } from 'wot-design-uni'
import { navigateBackPlus } from '@/utils'
import PasswordForm from './components/password-form.vue'
definePage({
@@ -54,7 +55,7 @@ const showPasswordPopup = ref(false) // 密码弹窗相关
/** 返回上一页 */
function handleBack() {
uni.navigateBack()
navigateBackPlus('/pages/user/index')
}
/** 打开修改密码弹窗 */

View File

@@ -13,12 +13,12 @@
<!-- 协议内容 -->
<view class="p-32rpx">
<view class="mb-40rpx text-center">
<text class="text-36rpx font-bold text-gray-800">用户服务协议</text>
<text class="text-36rpx text-gray-800 font-bold">用户服务协议</text>
</view>
<view class="text-28rpx leading-relaxed text-gray-600">
<view class="text-28rpx text-gray-600 leading-relaxed">
<view class="mb-32rpx">
<text class="mb-16rpx block font-bold text-gray-800">总则</text>
<text class="mb-16rpx block text-gray-800 font-bold">总则</text>
<text class="block">
1.1 欢迎使用芋道移动端应用以下简称"本应用"在使用本应用前请您仔细阅读本协议
</text>
@@ -31,7 +31,7 @@
</view>
<view class="mb-32rpx">
<text class="mb-16rpx block font-bold text-gray-800">服务内容</text>
<text class="mb-16rpx block text-gray-800 font-bold">服务内容</text>
<text class="block">
2.1 本应用为用户提供企业管理数据分析业务处理等相关服务
</text>
@@ -44,7 +44,7 @@
</view>
<view class="mb-32rpx">
<text class="mb-16rpx block font-bold text-gray-800">用户账号</text>
<text class="mb-16rpx block text-gray-800 font-bold">用户账号</text>
<text class="block">
3.1 用户在使用本应用服务前需要注册账号用户应当对其账号和密码的安全负责
</text>
@@ -57,7 +57,7 @@
</view>
<view class="mb-32rpx">
<text class="mb-16rpx block font-bold text-gray-800">用户行为规范</text>
<text class="mb-16rpx block text-gray-800 font-bold">用户行为规范</text>
<text class="block">
4.1 用户在使用本应用服务时必须遵守国家法律法规不得利用本应用从事违法违规活动
</text>
@@ -70,7 +70,7 @@
</view>
<view class="mb-32rpx">
<text class="mb-16rpx block font-bold text-gray-800">知识产权</text>
<text class="mb-16rpx block text-gray-800 font-bold">知识产权</text>
<text class="block">
5.1 本应用的所有内容包括但不限于文字图片音频视频软件程序版面设计等均受知识产权法律法规保护
</text>
@@ -80,7 +80,7 @@
</view>
<view class="mb-32rpx">
<text class="mb-16rpx block font-bold text-gray-800">免责声明</text>
<text class="mb-16rpx block text-gray-800 font-bold">免责声明</text>
<text class="block">
6.1 本应用不对因网络状况通讯线路等任何技术原因导致的服务中断或其他缺陷承担责任
</text>
@@ -90,7 +90,7 @@
</view>
<view class="mb-32rpx">
<text class="mb-16rpx block font-bold text-gray-800">其他</text>
<text class="mb-16rpx block text-gray-800 font-bold">其他</text>
<text class="block">
7.1 本协议的订立执行和解释及争议的解决均应适用中华人民共和国法律
</text>
@@ -108,6 +108,8 @@
</template>
<script lang="ts" setup>
import { navigateBackPlus } from '@/utils'
definePage({
style: {
navigationBarTitleText: '',
@@ -117,6 +119,6 @@ definePage({
/** 返回上一页 */
function handleBack() {
uni.navigateBack()
navigateBackPlus()
}
</script>
</script>

View File

@@ -66,6 +66,7 @@
<script lang="ts" setup>
import { onMounted, ref } from 'vue'
import { useToast } from 'wot-design-uni'
import { navigateBackPlus } from '@/utils'
definePage({
style: {
@@ -80,7 +81,7 @@ const storageSize = ref('') // 本地缓存大小
/** 返回上一页 */
function handleBack() {
uni.navigateBack()
navigateBackPlus('/pages/user/index')
}
/** 获取应用版本号 */

View File

@@ -13,19 +13,19 @@
<!-- 协议内容 -->
<view class="p-32rpx">
<view class="mb-40rpx text-center">
<text class="text-36rpx font-bold text-gray-800">隐私保护政策</text>
<text class="text-36rpx text-gray-800 font-bold">隐私保护政策</text>
</view>
<view class="text-28rpx leading-relaxed text-gray-600">
<view class="text-28rpx text-gray-600 leading-relaxed">
<view class="mb-32rpx">
<text class="mb-16rpx block font-bold text-gray-800">引言</text>
<text class="mb-16rpx block text-gray-800 font-bold">引言</text>
<text class="block">
芋道移动端以下简称"我们"非常重视用户的隐私和个人信息保护本隐私政策旨在向您说明我们如何收集使用存储和保护您的个人信息请您在使用我们的服务前仔细阅读并理解本隐私政策
</text>
</view>
<view class="mb-32rpx">
<text class="mb-16rpx block font-bold text-gray-800">我们收集的信息</text>
<text class="mb-16rpx block text-gray-800 font-bold">我们收集的信息</text>
<text class="block">
1.1 账号信息当您注册账号时我们会收集您的手机号码邮箱地址等信息
</text>
@@ -41,7 +41,7 @@
</view>
<view class="mb-32rpx">
<text class="mb-16rpx block font-bold text-gray-800">信息的使用</text>
<text class="mb-16rpx block text-gray-800 font-bold">信息的使用</text>
<text class="block">
2.1 为您提供服务我们使用收集的信息来提供维护和改进我们的服务
</text>
@@ -57,7 +57,7 @@
</view>
<view class="mb-32rpx">
<text class="mb-16rpx block font-bold text-gray-800">信息的存储</text>
<text class="mb-16rpx block text-gray-800 font-bold">信息的存储</text>
<text class="block">
3.1 我们会采取合理的安全措施来保护您的个人信息防止未经授权的访问使用或泄露
</text>
@@ -70,7 +70,7 @@
</view>
<view class="mb-32rpx">
<text class="mb-16rpx block font-bold text-gray-800">信息的共享</text>
<text class="mb-16rpx block text-gray-800 font-bold">信息的共享</text>
<text class="block">
4.1 未经您的同意我们不会向第三方共享您的个人信息但以下情况除外
</text>
@@ -86,7 +86,7 @@
</view>
<view class="mb-32rpx">
<text class="mb-16rpx block font-bold text-gray-800">您的权利</text>
<text class="mb-16rpx block text-gray-800 font-bold">您的权利</text>
<text class="block">
5.1 访问权您有权访问我们持有的关于您的个人信息
</text>
@@ -102,7 +102,7 @@
</view>
<view class="mb-32rpx">
<text class="mb-16rpx block font-bold text-gray-800">未成年人保护</text>
<text class="mb-16rpx block text-gray-800 font-bold">未成年人保护</text>
<text class="block">
6.1 我们非常重视对未成年人个人信息的保护如果您是未满18周岁的未成年人请在监护人的陪同下阅读本政策
</text>
@@ -112,7 +112,7 @@
</view>
<view class="mb-32rpx">
<text class="mb-16rpx block font-bold text-gray-800">政策更新</text>
<text class="mb-16rpx block text-gray-800 font-bold">政策更新</text>
<text class="block">
7.1 我们可能会不时更新本隐私政策更新后的政策将在应用内公布
</text>
@@ -122,7 +122,7 @@
</view>
<view class="mb-32rpx">
<text class="mb-16rpx block font-bold text-gray-800">联系我们</text>
<text class="mb-16rpx block text-gray-800 font-bold">联系我们</text>
<text class="block">
如果您对本隐私政策有任何疑问意见或建议请通过以下方式联系我们
</text>
@@ -143,6 +143,8 @@
</template>
<script lang="ts" setup>
import { navigateBackPlus } from '@/utils'
definePage({
style: {
navigationBarTitleText: '',
@@ -152,6 +154,6 @@ definePage({
/** 返回上一页 */
function handleBack() {
uni.navigateBack()
navigateBackPlus()
}
</script>
</script>