feat(approval): 文件选择失败区分取消与微信隐私协议未声明

- 用户自己取消选择(errMsg 含 cancel)不再弹错误提示
- chooseMessageFile 因隐私协议未声明被拦截时,提示需在微信公众平台
  补充「收集你选中的文件」,并附平台原始 errMsg
- 其余失败仍原样提示完整 errMsg
This commit is contained in:
2026-11-01 17:31:04 +08:00
parent 3522957b10
commit 403422dce7
8 changed files with 144 additions and 8 deletions
+18 -1
View File
@@ -270,7 +270,24 @@ function chooseFail(res: any) {
} catch (error) {
detail = String(res);
}
showError('选择文件失败:' + (detail || '未知错误'), null);
if (!detail) {
showError('选择文件失败:未知错误', null);
return;
}
// 用户自己取消选择不算失败,不弹提示
if (/cancel/i.test(detail)) {
return;
}
// 微信隐私协议未声明「收集你选中的文件」时 chooseMessageFile 会被拦截
if (/privacy agreement/i.test(detail)) {
showError(
'微信小程序隐私协议未声明「收集你选中的文件」,需在微信公众平台「账号设置-服务内容声明-用户隐私保护指引」补充并审核通过后重试。原始信息:' +
detail,
null
);
return;
}
showError('选择文件失败:' + detail, null);
}
function chooseAttachment() {
@@ -342,7 +342,24 @@ function chooseFail(res: any) {
} catch (error) {
detail = String(res);
}
showError('选择文件失败:' + (detail || '未知错误'), null);
if (!detail) {
showError('选择文件失败:未知错误', null);
return;
}
// 用户自己取消选择不算失败,不弹提示
if (/cancel/i.test(detail)) {
return;
}
// 微信隐私协议未声明「收集你选中的文件」时 chooseMessageFile 会被拦截
if (/privacy agreement/i.test(detail)) {
showError(
'微信小程序隐私协议未声明「收集你选中的文件」,需在微信公众平台「账号设置-服务内容声明-用户隐私保护指引」补充并审核通过后重试。原始信息:' +
detail,
null
);
return;
}
showError('选择文件失败:' + detail, null);
}
function chooseAttachment() {
+18 -1
View File
@@ -354,7 +354,24 @@ function chooseFail(res: any) {
} catch (error) {
detail = String(res);
}
showError('选择文件失败:' + (detail || '未知错误'), null);
if (!detail) {
showError('选择文件失败:未知错误', null);
return;
}
// 用户自己取消选择不算失败,不弹提示
if (/cancel/i.test(detail)) {
return;
}
// 微信隐私协议未声明「收集你选中的文件」时 chooseMessageFile 会被拦截
if (/privacy agreement/i.test(detail)) {
showError(
'微信小程序隐私协议未声明「收集你选中的文件」,需在微信公众平台「账号设置-服务内容声明-用户隐私保护指引」补充并审核通过后重试。原始信息:' +
detail,
null
);
return;
}
showError('选择文件失败:' + detail, null);
}
function chooseAttachment() {
+18 -1
View File
@@ -429,7 +429,24 @@ function chooseFail(res: any) {
} catch (error) {
detail = String(res);
}
showError('选择文件失败:' + (detail || '未知错误'), null);
if (!detail) {
showError('选择文件失败:未知错误', null);
return;
}
// 用户自己取消选择不算失败,不弹提示
if (/cancel/i.test(detail)) {
return;
}
// 微信隐私协议未声明「收集你选中的文件」时 chooseMessageFile 会被拦截
if (/privacy agreement/i.test(detail)) {
showError(
'微信小程序隐私协议未声明「收集你选中的文件」,需在微信公众平台「账号设置-服务内容声明-用户隐私保护指引」补充并审核通过后重试。原始信息:' +
detail,
null
);
return;
}
showError('选择文件失败:' + detail, null);
}
function chooseAttachment() {
+18 -1
View File
@@ -280,7 +280,24 @@ function chooseFail(res: any) {
} catch (error) {
detail = String(res);
}
showError('选择文件失败:' + (detail || '未知错误'), null);
if (!detail) {
showError('选择文件失败:未知错误', null);
return;
}
// 用户自己取消选择不算失败,不弹提示
if (/cancel/i.test(detail)) {
return;
}
// 微信隐私协议未声明「收集你选中的文件」时 chooseMessageFile 会被拦截
if (/privacy agreement/i.test(detail)) {
showError(
'微信小程序隐私协议未声明「收集你选中的文件」,需在微信公众平台「账号设置-服务内容声明-用户隐私保护指引」补充并审核通过后重试。原始信息:' +
detail,
null
);
return;
}
showError('选择文件失败:' + detail, null);
}
function chooseAttachment() {
+18 -1
View File
@@ -475,7 +475,24 @@ function chooseFail(res: any) {
} catch (error) {
detail = String(res);
}
showError('选择文件失败:' + (detail || '未知错误'), null);
if (!detail) {
showError('选择文件失败:未知错误', null);
return;
}
// 用户自己取消选择不算失败,不弹提示
if (/cancel/i.test(detail)) {
return;
}
// 微信隐私协议未声明「收集你选中的文件」时 chooseMessageFile 会被拦截
if (/privacy agreement/i.test(detail)) {
showError(
'微信小程序隐私协议未声明「收集你选中的文件」,需在微信公众平台「账号设置-服务内容声明-用户隐私保护指引」补充并审核通过后重试。原始信息:' +
detail,
null
);
return;
}
showError('选择文件失败:' + detail, null);
}
function chooseAttachment() {
+18 -1
View File
@@ -457,7 +457,24 @@ function chooseFail(res: any) {
} catch (error) {
detail = String(res);
}
showError('选择文件失败:' + (detail || '未知错误'), null);
if (!detail) {
showError('选择文件失败:未知错误', null);
return;
}
// 用户自己取消选择不算失败,不弹提示
if (/cancel/i.test(detail)) {
return;
}
// 微信隐私协议未声明「收集你选中的文件」时 chooseMessageFile 会被拦截
if (/privacy agreement/i.test(detail)) {
showError(
'微信小程序隐私协议未声明「收集你选中的文件」,需在微信公众平台「账号设置-服务内容声明-用户隐私保护指引」补充并审核通过后重试。原始信息:' +
detail,
null
);
return;
}
showError('选择文件失败:' + detail, null);
}
function chooseAttachment() {
+18 -1
View File
@@ -425,7 +425,24 @@ function chooseFail(res: any) {
} catch (error) {
detail = String(res);
}
showError('选择文件失败:' + (detail || '未知错误'), null);
if (!detail) {
showError('选择文件失败:未知错误', null);
return;
}
// 用户自己取消选择不算失败,不弹提示
if (/cancel/i.test(detail)) {
return;
}
// 微信隐私协议未声明「收集你选中的文件」时 chooseMessageFile 会被拦截
if (/privacy agreement/i.test(detail)) {
showError(
'微信小程序隐私协议未声明「收集你选中的文件」,需在微信公众平台「账号设置-服务内容声明-用户隐私保护指引」补充并审核通过后重试。原始信息:' +
detail,
null
);
return;
}
showError('选择文件失败:' + detail, null);
}
function chooseAttachment() {