This commit is contained in:
zhangjianjun 2026-08-21 09:29:21 +08:00
parent 58396cf2df
commit 4e52908cfc
4 changed files with 6 additions and 4 deletions

View File

@ -19,8 +19,8 @@ describe('getWeixinContactAction', () => {
expect(getWeixinContactAction('https://u.wechat.com/ELkCkT_hVVAz8wNghBA3hMc?s=2')).toBe('qrcode') expect(getWeixinContactAction('https://u.wechat.com/ELkCkT_hVVAz8wNghBA3hMc?s=2')).toBe('qrcode')
}) })
it('copies the link for work weixin customer-service urls', () => { it('shows a QR code for work weixin customer-service urls', () => {
expect(getWeixinContactAction('https://work.weixin.qq.com/ca/cawcde9d9bc540aebe')).toBe('copy') expect(getWeixinContactAction('https://work.weixin.qq.com/ca/cawcde9d9bc540aebe')).toBe('qrcode')
}) })
}) })

View File

@ -35,8 +35,10 @@ export function getWeixinContactAction (url?: string): 'qrcode' | 'copy' {
try { try {
const host = new URL(value).hostname.toLowerCase() const host = new URL(value).hostname.toLowerCase()
if (host === 'u.wechat.com' || host.endsWith('.u.wechat.com')) return 'qrcode' if (host === 'u.wechat.com' || host.endsWith('.u.wechat.com')) return 'qrcode'
if (host === 'work.weixin.qq.com' || host.endsWith('.work.weixin.qq.com')) return 'qrcode'
} catch { } catch {
if (/u\.wechat\.com/i.test(value)) return 'qrcode' if (/u\.wechat\.com/i.test(value)) return 'qrcode'
if (/work\.weixin\.qq\.com/i.test(value)) return 'qrcode'
} }
return 'copy' return 'copy'

View File

@ -530,7 +530,7 @@
.contact-fab { .contact-fab {
position: fixed; position: fixed;
right: 32px; right: 32px;
bottom: 80px; bottom: 232px;
z-index: 15; z-index: 15;
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;

View File

@ -74,7 +74,7 @@ export default function WeixinQrImage ({ url }: { url: string }) {
) : ( ) : (
<View className='contact-qrcode__image' /> <View className='contact-qrcode__image' />
)} )}
<Text className='contact-qrcode__hint'>使</Text> <Text className='contact-qrcode__hint'>/...</Text>
</View> </View>
) )
} }