| | |
| | | import IconCaptcha from '@/assets/login/icon-btn-captcha.png'; |
| | | import IconPassword from '@/assets/login/icon-btn-password.png'; |
| | | import { LoginFormTabs } from '../constants'; |
| | | import { subscribeMessageTemplateIdsForB } from '@12333/constants'; |
| | | import * as authServices from '@12333/services/apiV2/auth'; |
| | | |
| | | defineOptions({ |
| | |
| | | } catch (error) {} |
| | | } |
| | | |
| | | function handleLoginSuccess() { |
| | | Message.success('授权登录成功', { |
| | | onClosed: () => { |
| | | jump(); |
| | | }, |
| | | }); |
| | | async function handleLoginSuccess() { |
| | | try { |
| | | if (!Taro.requestSubscribeMessage) { |
| | | await Message.confirm({ message: '你的微信版本过低,不支持订阅消息,是否继续报名' }); |
| | | } |
| | | const res = await Taro.getSetting({ |
| | | withSubscriptions: true, |
| | | }); |
| | | let setting: boolean[] = []; |
| | | if (res.subscriptionsSetting && res.subscriptionsSetting.itemSettings) { |
| | | setting = subscribeMessageTemplateIdsForB |
| | | .map((id) => res.subscriptionsSetting.itemSettings[id] !== 'accept') |
| | | .filter(Boolean); |
| | | } |
| | | if (setting.length > 0) { |
| | | Taro.requestSubscribeMessage({ |
| | | tmplIds: subscribeMessageTemplateIdsForB, |
| | | success: function (res) { |
| | | console.log('res: ', res); |
| | | }, |
| | | }); |
| | | } |
| | | Message.success('授权登录成功', { |
| | | onClosed: () => { |
| | | jump(); |
| | | }, |
| | | }); |
| | | } catch (error) {} |
| | | } |
| | | |
| | | function goLoginByForm(tab = LoginFormTabs.VerificationCodeLogin) { |