微信小程序审核不通过修改
CI / verify (pull_request) Has been cancelled

This commit is contained in:
2026-07-21 09:32:06 +08:00
parent 350a086a73
commit 935ab0d1d4
14 changed files with 466 additions and 242 deletions
@@ -0,0 +1,63 @@
import { Button, Text, View } from '@tarojs/components';
type PhoneQuickLoginButtonProps = {
loading?: boolean;
disabled?: boolean;
/** 须已主动勾选协议后才挂载 getPhoneNumber,避免未同意即拉起授权 */
agreed: boolean;
onRequireAgree: () => void;
onGetPhoneNumber: (phoneCode: string) => void;
onFail?: (message: string) => void;
};
/**
* 小程序手机号快捷登录(open-type=getPhoneNumber)。
* 文案不得使用「微信」字样或仿官方图标,以符合审核要求。
*/
export default function PhoneQuickLoginButton({
loading = false,
disabled = false,
agreed,
onRequireAgree,
onGetPhoneNumber,
onFail,
}: PhoneQuickLoginButtonProps) {
const inactive = loading || disabled;
const className = `login-phone-quick-btn${inactive ? ' login-phone-quick-btn--disabled' : ''}`;
const label = loading ? '登录中...' : '手机号快捷登录';
if (!agreed) {
return (
<View className={className} onClick={inactive ? undefined : onRequireAgree}>
<Text className="login-phone-quick-btn__text">{label}</Text>
</View>
);
}
return (
<Button
className={className}
openType={inactive ? undefined : 'getPhoneNumber'}
hoverClass="none"
onGetPhoneNumber={(e) => {
if (inactive) return;
const detail = e.detail as {
errMsg?: string;
code?: string;
errno?: number;
};
if (!detail?.code) {
const denied =
detail?.errMsg?.includes('deny') ||
detail?.errMsg?.includes('cancel') ||
detail?.errno === 103;
onFail?.(denied ? '已取消手机号授权' : detail?.errMsg || '获取手机号失败');
return;
}
onGetPhoneNumber(detail.code);
}}
>
<Text className="login-phone-quick-btn__text">{label}</Text>
</Button>
);
}
@@ -3,22 +3,16 @@ import { View, Text } from '@tarojs/components';
type WechatLoginButtonProps = {
loading?: boolean;
disabled?: boolean;
/** 默认「授权登录」,避免使用「微信」字样与官方风格图标 */
label?: string;
onClick: () => void;
};
function WechatIcon() {
return (
<View className="wechat-login-icon" aria-hidden>
<View className="wechat-login-icon__big" />
<View className="wechat-login-icon__small" />
</View>
);
}
/** 微信授权一键登录按钮(对齐 h5-user login-wechat-btn */
/** 授权登录按钮(无微信品牌元素,满足小程序审核) */
export default function WechatLoginButton({
loading = false,
disabled = false,
label = '授权登录',
onClick,
}: WechatLoginButtonProps) {
const inactive = loading || disabled;
@@ -28,10 +22,7 @@ export default function WechatLoginButton({
className={`login-wechat-btn${inactive ? ' login-wechat-btn--disabled' : ''}`}
onClick={inactive ? undefined : onClick}
>
<WechatIcon />
<Text className="login-wechat-btn__text">
{loading ? '授权中...' : '微信一键授权'}
</Text>
<Text className="login-wechat-btn__text">{loading ? '授权中...' : label}</Text>
</View>
);
}