| | |
| | | |
| | | export const AppLocalConfig = { |
| | | userType: EnumUserType.Enterprise, |
| | | clientType: EnumClientType.PcWeb, |
| | | clientType: EnumClientType.Wxmp, |
| | | }; |
| | |
| | | ) { |
| | | try { |
| | | let res: API.LoginCommandCallback = wxMiniAppUserLoginRes; |
| | | if (!wxMiniAppUserLoginRes.isBindPhoneNumber) { |
| | | if (!wxMiniAppUserLoginRes?.isBindPhoneNumber) { |
| | | let bindRes = await authServices.bindWxmpUserInfo({ |
| | | encryptedData: detail.encryptedData, |
| | | iv: detail.iv, |
| | | sessionKey: wxMiniAppUserLoginRes.sessionKey, |
| | | }); |
| | | res.accessToken = bindRes.accessToken; |
| | | this.loginSuccess(res); |
| | | } |
| | | this.loginSuccess(res); |
| | | return res; |
| | | } catch (error) { |
| | | console.log('error3: ', error); |
| | |
| | | type: AppLocalConfig.userType, |
| | | }; |
| | | wxMiniAppUserLoginRes.value = await authServices.wxmpLogin(params); |
| | | if (wxMiniAppUserLoginRes.value.isBindPhoneNumber) { |
| | | if (wxMiniAppUserLoginRes.value?.isBindPhoneNumber) { |
| | | isAccount.value = true; |
| | | } |
| | | } |
| | |
| | | <img :src="OssAssets.login.AuthBg" class="authorization-page-auth" /> |
| | | </template> |
| | | |
| | | <div class="authorization-page-title">欢迎使用工益赚</div> |
| | | <div class="authorization-page-title">欢迎使用灵工达</div> |
| | | |
| | | <slot></slot> |
| | | </PageLayout> |
| | |
| | | </nut-form-item> |
| | | </nut-form> |
| | | <LargeButton class="login-btn" @click="handleLogin" :loading="form.loading">登录</LargeButton> |
| | | <div class="go-register-btn" @click="goRegister">立即注册</div> |
| | | <!-- <div class="go-register-btn" @click="goRegister">立即注册</div> --> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | </nut-form-item> |
| | | </nut-form> |
| | | <LargeButton class="login-btn" @click="handleLogin" :loading="form.loading">登录</LargeButton> |
| | | <div class="go-register-btn" @click="goRegister">立即注册</div> |
| | | <!-- <div class="go-register-btn" @click="goRegister">立即注册</div> --> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | if (state.policyChecked) { |
| | | const { valid } = await formRef.value.validate(); |
| | | if (valid) { |
| | | let params: API.PhoneMesssageCodeRegisterInput = { |
| | | code: form.verificationCode, |
| | | phoneNumber: form.phoneNumber, |
| | | }; |
| | | let res = await accountServices.phoneMesssageCodeRegister(params); |
| | | if (res) { |
| | | Message.success('注册成功', { |
| | | onClosed: () => { |
| | | goLogin(); |
| | | }, |
| | | }); |
| | | } |
| | | // let params: API.PhoneMesssageCodeRegisterInput = { |
| | | // code: form.verificationCode, |
| | | // phoneNumber: form.phoneNumber, |
| | | // }; |
| | | // let res = await accountServices.phoneMesssageCodeRegister(params); |
| | | // if (res) { |
| | | // Message.success('注册成功', { |
| | | // onClosed: () => { |
| | | // goLogin(); |
| | | // }, |
| | | // }); |
| | | // } |
| | | } |
| | | } else { |
| | | noAccess(); |
| | |
| | | |
| | | /** 请求白名单,放置一些不需要token的接口(通过设置请求白名单,防止token过期后再请求造成的死循环问题) */ |
| | | const whiteList = [RefreshTokenUrl]; |
| | | const RefreshTokenBlackList = ['wxmpLogin']; |
| | | |
| | | export function startLoading(showNavigationBarLoading: boolean) { |
| | | if (showNavigationBarLoading) { |
| | |
| | | |
| | | const userStore = useUserStoreWithOut(); |
| | | |
| | | if (response.headers['x-access-token']) { |
| | | if ( |
| | | response.headers['x-access-token'] && |
| | | RefreshTokenBlackList.every((url) => !response.config.url?.includes(url)) |
| | | ) { |
| | | const tokenInfo: API.LoginCommandCallback = { |
| | | accessToken: response.headers['access-token'], |
| | | refreshToken: response.headers['x-access-token'], |
| | |
| | | |
| | | export const AppLocalConfig = { |
| | | userType: EnumUserType.Personal, |
| | | clientType: EnumClientType.PcWeb, |
| | | clientType: EnumClientType.Wxmp, |
| | | }; |
| | |
| | | // 手机号授权Code登录 |
| | | async getTokenByPhone( |
| | | detail: ButtonProps.onGetPhoneNumberEventDetail, |
| | | wxMiniAppUserLoginRes: any |
| | | wxMiniAppUserLoginRes: API.LoginCommandCallback |
| | | ) { |
| | | try { |
| | | let res: API.IdentityModelTokenCacheItem; |
| | | if (!wxMiniAppUserLoginRes.accessToken) { |
| | | let params: API.WxMiniAppPhoneLoginInput = { |
| | | openId: wxMiniAppUserLoginRes.openId, |
| | | sessionKey: wxMiniAppUserLoginRes.sessionKey, |
| | | let res: API.LoginCommandCallback = wxMiniAppUserLoginRes; |
| | | if (!wxMiniAppUserLoginRes?.isBindPhoneNumber) { |
| | | let bindRes = await authServices.bindWxmpUserInfo({ |
| | | encryptedData: detail.encryptedData, |
| | | iv: detail.iv, |
| | | wxMiniApp: WxMiniAppEnum.C端小程序, |
| | | }; |
| | | res = await accountServices.wxMiniAppPhoneAuthLogin(params); |
| | | sessionKey: wxMiniAppUserLoginRes.sessionKey, |
| | | }); |
| | | res.accessToken = bindRes.accessToken; |
| | | this.loginSuccess(res); |
| | | } |
| | | return res; |
| | |
| | | return _elevatorData; |
| | | }); |
| | | |
| | | console.log('elevatorData: ', elevatorData); |
| | | |
| | | const clickItem = (key: string, item: any) => { |
| | | console.log('item: ', item, getAreaByAreaCode(item.parentId).areaName); |
| | | userStore.setLocationCity(item.name, getAreaByAreaCode(item.parentId).areaName); |
| | | console.log('item: ', item, 1111); |
| | | // userStore.setLocationCity(item.name, getAreaByAreaCode(item.parentId).areaName); |
| | | }; |
| | | |
| | | async function resetLocation() { |
| | |
| | | import { CommonEventFunction, ButtonProps } from '@tarojs/components'; |
| | | import Taro from '@tarojs/taro'; |
| | | import { useLoginedJump } from '@/hooks'; |
| | | import * as accountServices from '@12333/services/api/Account'; |
| | | import IconCaptcha from '@/assets/login/icon-btn-captcha.png'; |
| | | import IconPassword from '@/assets/login/icon-btn-password.png'; |
| | | import { LoginFormTabs } from '../constants'; |
| | | import { WxMiniAppEnum } from '@12333/constants'; |
| | | import * as authServices from '@12333/services/apiV2/auth'; |
| | | |
| | | defineOptions({ |
| | | name: 'authorization', |
| | |
| | | RouterPath.authorization.includes(launchOptions.path) && launchOptions.scene === 1047 && uuid |
| | | ); |
| | | |
| | | const wxIndentityRes = ref<API.WxMiniAppIndentityInfo>(); |
| | | const wxMiniAppUserLoginRes = ref<API.IdentityModelTokenCacheItem>(); |
| | | const wxIndentityRes = ref<API.LoginCommandCallback>(); |
| | | const wxMiniAppUserLoginRes = ref<API.LoginCommandCallback>(); |
| | | |
| | | const isAccount = ref(false); |
| | | |
| | |
| | | try { |
| | | let loginRes = await Taro.login(); |
| | | if (isLoginByWeb.value) { |
| | | const wxIndentity = await accountServices.getWxIndentity({ |
| | | code: loginRes.code, |
| | | wxMiniApp: WxMiniAppEnum.C端小程序, |
| | | }); |
| | | wxIndentityRes.value = wxIndentity; |
| | | if (wxIndentityRes.value.userName) { |
| | | isAccount.value = true; |
| | | } |
| | | // const wxIndentity = await authServices.wxmpLogin({ |
| | | // code: loginRes.code, |
| | | // type: AppLocalConfig.userType, |
| | | // }); |
| | | // wxIndentityRes.value = wxIndentity; |
| | | // if (wxIndentityRes.value.isBindPhoneNumber) { |
| | | // isAccount.value = true; |
| | | // } |
| | | } else { |
| | | const params: API.APIwxMiniAppUserLoginParams = { |
| | | const params: API.WxmpLoginCommand = { |
| | | code: loginRes.code, |
| | | wxMiniApp: WxMiniAppEnum.C端小程序, |
| | | type: AppLocalConfig.userType, |
| | | }; |
| | | wxMiniAppUserLoginRes.value = await accountServices.wxMiniAppUserLogin(params); |
| | | if (wxMiniAppUserLoginRes.value.accessToken) { |
| | | wxMiniAppUserLoginRes.value = await authServices.wxmpLogin(params); |
| | | if (wxMiniAppUserLoginRes.value?.isBindPhoneNumber) { |
| | | isAccount.value = true; |
| | | } |
| | | } |
| | |
| | | console.log('errMsg: ', errMsg, isLoginByWeb.value); |
| | | if (errMsg === 'getPhoneNumber:ok') { |
| | | if (isLoginByWeb.value) { |
| | | let res = await userStore.wxMiniAppPhoneAuthLoginFromScan( |
| | | ev.detail, |
| | | wxIndentityRes.value, |
| | | uuid |
| | | ); |
| | | if (res) { |
| | | handleLoginSuccess(); |
| | | } |
| | | // let res = await userStore.wxMiniAppPhoneAuthLoginFromScan( |
| | | // ev.detail, |
| | | // wxIndentityRes.value, |
| | | // uuid |
| | | // ); |
| | | // if (res) { |
| | | // handleLoginSuccess(); |
| | | // } |
| | | } else { |
| | | let res = await userStore.getTokenByPhone(ev.detail, wxMiniAppUserLoginRes.value); |
| | | if (res) { |
| | |
| | | if (state.policyChecked) { |
| | | if (isLoginByWeb.value) { |
| | | console.log('uuid: ', uuid); |
| | | let res = await userStore.wxMiniAppUserLoginFromScan(wxIndentityRes.value, uuid); |
| | | if (res) { |
| | | handleLoginSuccess(); |
| | | } |
| | | // let res = await userStore.wxMiniAppUserLoginFromScan(wxIndentityRes.value, uuid); |
| | | // if (res) { |
| | | // handleLoginSuccess(); |
| | | // } |
| | | } else { |
| | | userStore.loginSuccess(wxMiniAppUserLoginRes.value); |
| | | handleLoginSuccess(); |
| | |
| | | <img :src="OssAssets.login.AuthBg" class="authorization-page-auth" /> |
| | | </template> |
| | | |
| | | <div class="authorization-page-title">欢迎使用818平台</div> |
| | | <div class="authorization-page-title">欢迎使用工易赚</div> |
| | | |
| | | <slot></slot> |
| | | </PageLayout> |
| | |
| | | if (state.policyChecked) { |
| | | const { valid } = await formRef.value.validate(); |
| | | if (valid) { |
| | | let params: API.PhoneMesssageCodeRegisterInput = { |
| | | code: form.verificationCode, |
| | | let params: API.RegisterPersonalUserCommand = { |
| | | verifyCode: form.verificationCode, |
| | | phoneNumber: form.phoneNumber, |
| | | }; |
| | | let res = await accountServices.phoneMesssageCodeRegister(params); |
| | | let res = await authServices.registerPersonalUser(params); |
| | | if (res) { |
| | | Message.success('注册成功', { |
| | | onClosed: () => { |
| | |
| | | |
| | | /** 请求白名单,放置一些不需要token的接口(通过设置请求白名单,防止token过期后再请求造成的死循环问题) */ |
| | | const whiteList = [RefreshTokenUrl]; |
| | | const RefreshTokenBlackList = ['wxmpLogin']; |
| | | |
| | | export function startLoading(showNavigationBarLoading: boolean) { |
| | | if (showNavigationBarLoading) { |
| | |
| | | |
| | | const userStore = useUserStoreWithOut(); |
| | | |
| | | if (response.headers['x-access-token']) { |
| | | if ( |
| | | response.headers['x-access-token'] && |
| | | RefreshTokenBlackList.every((url) => !response.config.url?.includes(url)) |
| | | ) { |
| | | const tokenInfo: API.LoginCommandCallback = { |
| | | accessToken: response.headers['access-token'], |
| | | refreshToken: response.headers['x-access-token'], |
| | |
| | | resolve(1); |
| | | }} |
| | | confirmText={confirmText} |
| | | //@ts-ignore |
| | | onClickOverlay={() => { |
| | | onClose(); |
| | | reject(); |
| | | }} |
| | | ></Model> |
| | | ), |
| | | }} |
| | |
| | | version: 6.11.1 |
| | | senin-mini: |
| | | specifier: ^1.0.12 |
| | | version: 1.0.12(@nutui/icons-vue-taro@0.0.9)(@nutui/nutui-taro@4.3.13)(@tanstack/vue-query@4.35.3)(@tarojs/components@3.6.20)(@tarojs/taro@3.6.20)(axios@1.4.0)(dayjs@1.11.6)(lodash@4.17.21)(vue@3.5.12) |
| | | version: link:../../../../demo/modern-module/packages/senin-mini |
| | | senior-request: |
| | | specifier: ^1.0.3 |
| | | version: 1.0.3(axios@1.4.0) |