| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- import { request, goCommonSearchUrl, commonSearchUrl } from '@/services/request/index';
- import { sha256 } from 'js-sha256';
- import { getUserId } from '@/services/bus/account';
- import { UserInfoReq } from './interface';
- /**
- * 统一查询用户登录账号
- */
- export const queryLoginAccount = (logidCode: String): Promise<string> => {
- return new Promise((resolve, reject) => {
- request({
- method: 'get',
- url: goCommonSearchUrl('/User/GetLoginID'),
- params: { username: logidCode },
- })
- .then((value) => {
- console.log(value);
- resolve(value.data.data);
- })
- .catch((err) => {
- console.log(err);
- reject(err.message);
- });
- });
- };
- /**
- * 请求验证码
- */
- export const querySmsvcode = (mobile: String): Promise<string> => {
- return new Promise((resolve, reject) => {
- request({
- method: 'post',
- url: commonSearchUrl('/user/smsvcode'),
- data: { mobile },
- })
- .then((value) => {
- if (value.data.success === 'true') {
- resolve(value.data);
- } else {
- reject(value.data);
- }
- })
- .catch((err) => reject(err));
- });
- };
- /**
- * 拿登录id
- */
- export const queryLoginInfo = (mobile: String, vcode: String): Promise<string> => {
- return new Promise((resolve, reject) => {
- request({
- method: 'post',
- url: commonSearchUrl('/tradeoperation/querylogininfo'),
- data: { mobile, vcode },
- })
- .then((value) => {
- if (value.data.code === '0') {
- resolve(value.data.resultset);
- } else {
- reject(value.data.message);
- }
- })
- .catch((err) => reject(err));
- });
- };
- /**
- * 改密码
- */
- export const queryResetpwdbycardnum = (mobile: String, vcode: String, pwd: String, loginid: String): Promise<string> => {
- const password = sha256.hex(`${loginid}${pwd}`);
- console.log('password', password);
- return new Promise((resolve, reject) => {
- request({
- method: 'post',
- url: commonSearchUrl('/tradeoperation/resetpwdbycardnum'),
- data: { mobile, vcode, password },
- })
- .then((value: any) => {
- console.log(value);
- if (value.data.code === '500') {
- reject(value.data.message);
- } else {
- resolve(value.data.message);
- }
- })
- .catch((err) => reject(err));
- });
- };
- /**
- * 获取用户实名认证状态
- * @returns
- */
- export function GetUserAuthStatus(): Promise<boolean> {
- const params = { userID: getUserId() };
- return request({
- method: 'get',
- url: goCommonSearchUrl('/User/GetUserAuthStatus'),
- params,
- })
- .then((value: any) => {
- return value.data.data;
- })
- .catch((err) => Promise.reject('获取用户实名认证状态失败:' + err.message));
- }
- /**
- * 获取用户信息
- * @returns
- */
- export function QueryUserInfo(): Promise<UserInfoReq> {
- const params = {
- userID: getUserId(),
- isDecrypt: true,
- };
- return request({
- method: 'get',
- url: goCommonSearchUrl('/User/QueryUserInfo'),
- params,
- })
- .then((value: any) => {
- console.log(value);
- return value.data.data;
- })
- .catch((err) => Promise.reject('获取用户信息' + err.message));
- }
|