refactor(privacy): 调整隐私授权触发逻辑,登录页取消主动预检
- 移除登录页和注册页 `useDidShow` 中主动调用 `ensurePrivacyAuthorized()` 预检的逻辑 - 登录页不再主动弹出隐私协议弹窗,由微信在用户点击手机号登录按钮时强制触发授权 - 门店订单管理页面调用 `chooseProofImage` 前新增 `ensurePrivacyAuthorized()` 预检,确保上传凭证时授权 - 修改隐私弹窗文案为更通用描述,避免误导用户以为是相册授权 - 保留全局 `onNeedPrivacyAuthorization` 通过 `PrivacyModal` 处理,适配微信基础库强制机制 - 统一门店商品管理上传使用已内置预检的 `uploadFile()` 接口调用流程
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import Taro, { useDidShow } from '@tarojs/taro'
|
||||
import Taro from '@tarojs/taro'
|
||||
import { View, Image, Text, Button } from '@tarojs/components'
|
||||
import { TenantId } from '@/config/app'
|
||||
import { getWxOpenId } from '@/api/layout'
|
||||
@@ -7,7 +7,6 @@ import { getUserInfo } from '@/api/layout'
|
||||
import { saveStorageByLoginUser, SERVER_API_URL } from '@/utils/server'
|
||||
import { isUserDisabled } from '@/utils/auth'
|
||||
import request from '@/utils/request'
|
||||
import { ensurePrivacyAuthorized } from '@/api/system/file'
|
||||
import {
|
||||
checkAndHandleInviteRelation,
|
||||
hasPendingInvite,
|
||||
@@ -110,14 +109,6 @@ const Login = () => {
|
||||
setTimeout(() => setShowContent(true), 100)
|
||||
}, [])
|
||||
|
||||
/** 页面显示时预检隐私协议,避免 getPhoneNumber 因未授权隐私协议而失败 */
|
||||
useDidShow(() => {
|
||||
if (!isWeapp) return
|
||||
ensurePrivacyAuthorized().catch((e) => {
|
||||
console.warn('登录页隐私协议预检失败:', e)
|
||||
})
|
||||
})
|
||||
|
||||
/** 解析 redirect 参数 */
|
||||
const redirectUrl = (() => {
|
||||
const raw = (router?.params as Record<string, string> | undefined)?.redirect
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
import Taro, { useDidShow } from '@tarojs/taro'
|
||||
import Taro from '@tarojs/taro'
|
||||
import { View, Text } from '@tarojs/components'
|
||||
import { Button, Checkbox } from '@nutui/nutui-react-taro'
|
||||
import { TenantId } from '@/config/app'
|
||||
@@ -7,7 +7,6 @@ import { getUserInfo, getWxOpenId } from '@/api/layout'
|
||||
import { saveStorageByLoginUser, SERVER_API_URL } from '@/utils/server'
|
||||
import { isUserDisabled } from '@/utils/auth'
|
||||
import request from '@/utils/request'
|
||||
import { ensurePrivacyAuthorized } from '@/api/system/file'
|
||||
import {
|
||||
getStoredInviteParams,
|
||||
parseInviteParams,
|
||||
@@ -101,14 +100,6 @@ const Register = () => {
|
||||
|
||||
const router = Taro.getCurrentInstance().router
|
||||
|
||||
/** 页面显示时预检隐私协议,避免 getPhoneNumber 因未授权隐私协议而失败 */
|
||||
useDidShow(() => {
|
||||
if (!isWeapp) return
|
||||
ensurePrivacyAuthorized().catch((e) => {
|
||||
console.warn('注册页隐私协议预检失败:', e)
|
||||
})
|
||||
})
|
||||
|
||||
const redirectUrl = useMemo(() => {
|
||||
const raw = (router?.params as any)?.redirect as string | undefined
|
||||
const decoded = safeDecodeMaybeEncoded(raw)
|
||||
|
||||
Reference in New Issue
Block a user