forked from gxwebsoft/mp-10550
feat(dealer): 添加经销商申请功能并优化用户相关页面
- 新增经销商申请页面和相关组件- 更新用户中心页面,增加经销商状态显示和申请入口 - 修改登录逻辑,支持获取用户手机号- 优化用户钩子,增加获取用户ID和判断超级管理员权限的功能
This commit is contained in:
@@ -5,12 +5,39 @@ import {TenantId} from "@/config/app";
|
||||
import './login.scss';
|
||||
import {saveStorageByLoginUser} from "@/utils/server";
|
||||
|
||||
const Login = (props:any) => {
|
||||
// 微信获取手机号回调参数类型
|
||||
interface GetPhoneNumberDetail {
|
||||
code?: string;
|
||||
encryptedData?: string;
|
||||
iv?: string;
|
||||
errMsg: string;
|
||||
}
|
||||
|
||||
interface GetPhoneNumberEvent {
|
||||
detail: GetPhoneNumberDetail;
|
||||
}
|
||||
|
||||
interface LoginProps {
|
||||
done?: (user: any) => void;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
// 登录接口返回数据类型
|
||||
interface LoginResponse {
|
||||
data: {
|
||||
data: {
|
||||
access_token: string;
|
||||
user: any;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
const Login = (props: LoginProps) => {
|
||||
const [isAgree, setIsAgree] = useState(false)
|
||||
const [env, setEnv] = useState<string>()
|
||||
|
||||
/* 获取用户手机号 */
|
||||
const handleGetPhoneNumber = ({detail}) => {
|
||||
const handleGetPhoneNumber = ({detail}: GetPhoneNumberEvent) => {
|
||||
const {code, encryptedData, iv} = detail
|
||||
Taro.login({
|
||||
success: function () {
|
||||
@@ -31,9 +58,9 @@ const Login = (props:any) => {
|
||||
'content-type': 'application/json',
|
||||
TenantId
|
||||
},
|
||||
success: function (res) {
|
||||
saveStorageByLoginUser(res.data.data.access_token,res.data.data.user)
|
||||
props.done(res.data.data.user);
|
||||
success: function (res: LoginResponse) {
|
||||
saveStorageByLoginUser(res.data.data.access_token, res.data.data.user)
|
||||
props.done?.(res.data.data.user);
|
||||
}
|
||||
})
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user