This commit is contained in:
parent
58396cf2df
commit
4e52908cfc
|
|
@ -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')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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'
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue