| | |
| | | import * as authServices from '@12333/services/apiV2/auth'; |
| | | import { NODE_ENV } from '@/constants'; |
| | | import { subscribeMessageTemplateIdsForC } from '@12333/constants'; |
| | | import { ResponseStructure } from '@/utils/request'; |
| | | console.log('NODE_ENV: ', NODE_ENV); |
| | | |
| | | defineOptions({ |
| | |
| | | |
| | | const wxIndentityRes = ref<API.LoginCommandCallback>(); |
| | | const wxMiniAppUserLoginRes = ref<API.LoginCommandCallback>(); |
| | | const wxmpLoginRes = ref<ResponseStructure<API.LoginCommandCallback>>(); |
| | | |
| | | const isAccount = ref(false); |
| | | |
| | |
| | | type: AppLocalConfig.userType, |
| | | enterpriseType: AppLocalConfig.enterpriseType, |
| | | }; |
| | | wxmpLoginRes.value = (await authServices.wxmpLogin(params, { |
| | | getResponse: true, |
| | | })) as ResponseStructure<API.LoginCommandCallback>; |
| | | console.log('wxmpLoginRes.value: ', wxmpLoginRes.value); |
| | | wxMiniAppUserLoginRes.value = wxmpLoginRes.value.data; |
| | | wxMiniAppUserLoginRes.value = await authServices.wxmpLogin(params); |
| | | if (wxMiniAppUserLoginRes.value?.isBindPhoneNumber) { |
| | | isAccount.value = true; |
| | | } |
| | |
| | | try { |
| | | const { errMsg, code } = ev.detail; |
| | | console.log('errMsg: ', errMsg, isLoginByWeb.value); |
| | | if (!wxmpLoginRes.value.success) { |
| | | Message.error(wxmpLoginRes.value.msg); |
| | | return; |
| | | } |
| | | if (errMsg === 'getPhoneNumber:ok') { |
| | | if (isLoginByWeb.value) { |
| | | // let res = await userStore.wxMiniAppPhoneAuthLoginFromScan( |
| | |
| | | // handleLoginSuccess(); |
| | | // } |
| | | } else { |
| | | let loginRes = await Taro.login(); |
| | | const params: API.WxmpLoginCommand = { |
| | | code: loginRes.code, |
| | | type: AppLocalConfig.userType, |
| | | enterpriseType: AppLocalConfig.enterpriseType, |
| | | }; |
| | | wxMiniAppUserLoginRes.value = await authServices.wxmpLogin(params); |
| | | let res = await userStore.getTokenByPhone(ev.detail, wxMiniAppUserLoginRes.value); |
| | | if (res) { |
| | | handleLoginSuccess(); |