diff --git a/src/lib/contact.test.ts b/src/lib/contact.test.ts index 3bfdefa..a074a4c 100644 --- a/src/lib/contact.test.ts +++ b/src/lib/contact.test.ts @@ -19,8 +19,8 @@ describe('getWeixinContactAction', () => { expect(getWeixinContactAction('https://u.wechat.com/ELkCkT_hVVAz8wNghBA3hMc?s=2')).toBe('qrcode') }) - it('copies the link for work weixin customer-service urls', () => { - expect(getWeixinContactAction('https://work.weixin.qq.com/ca/cawcde9d9bc540aebe')).toBe('copy') + it('shows a QR code for work weixin customer-service urls', () => { + expect(getWeixinContactAction('https://work.weixin.qq.com/ca/cawcde9d9bc540aebe')).toBe('qrcode') }) }) diff --git a/src/lib/contact.ts b/src/lib/contact.ts index 7b88ec4..d72d36b 100644 --- a/src/lib/contact.ts +++ b/src/lib/contact.ts @@ -35,8 +35,10 @@ export function getWeixinContactAction (url?: string): 'qrcode' | 'copy' { try { const host = new URL(value).hostname.toLowerCase() 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 { if (/u\.wechat\.com/i.test(value)) return 'qrcode' + if (/work\.weixin\.qq\.com/i.test(value)) return 'qrcode' } return 'copy' diff --git a/src/pages/index/index.scss b/src/pages/index/index.scss index 9235950..2a6152e 100644 --- a/src/pages/index/index.scss +++ b/src/pages/index/index.scss @@ -530,7 +530,7 @@ .contact-fab { position: fixed; right: 32px; - bottom: 80px; + bottom: 232px; z-index: 15; box-sizing: border-box; display: flex; diff --git a/src/pages/index/weixin-qr.tsx b/src/pages/index/weixin-qr.tsx index 2ada4ea..d39a078 100644 --- a/src/pages/index/weixin-qr.tsx +++ b/src/pages/index/weixin-qr.tsx @@ -74,7 +74,7 @@ export default function WeixinQrImage ({ url }: { url: string }) { ) : ( )} - 截图并使用微信扫码识别添加客服微信 + 长按/截图扫一扫... ) }