| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- /*
- * @Page: 文件描述
- * @Author: Fengyu
- * @Date: 2025-12-11 16:03:49
- * @LastEditors: Fengyu
- * @LastEditTime: 2025-12-12 14:00:41
- */
- /*
- * @Author: wyd
- * @Date: 2024-02
- * @LastEditors: wyd
- * @LastEditTime: 2024-07
- * @Description: 登录api
- */
- import { http } from '@/utils/http'
- import type { loginItem, captchaItem, captchaResult, smsItem, registerItem, forgetItem, loginResult, useInfoResult } from '@/types/login'
- /**
- * @description: 登录
- * @param {*} data isBind 1微信未绑定系统用户 0已绑定
- * @return {*}
- */
- export const loginApi = (data: loginItem, isBind: number) => {
- if (isBind === 1) {
- // 微信登录且需要绑定
- return http<loginResult>({
- method: 'POST',
- url: '/xcxBind',
- data
- })
- }
- if (data.type === 1) {
- // 短信登录
- return http<loginResult>({
- method: 'POST',
- url: '/smsLogin',
- data
- })
- }
- // 账号密码登录
- return http<loginResult>({
- method: 'POST',
- url: '/mpLogin',
- data
- })
- }
- /**
- * @description: 获取用户信息
- * @param {*} data
- * @return {*}
- */
- export const getUserInfoApi = () => {
- return http<useInfoResult>({
- method: 'GET',
- url: '/getInfo'
- })
- }
- /**
- * @description: 获取验证码图片
- * @param {*} data
- * @return {*}
- */
- export const getCaptchaImageApi = (data?: captchaItem) => {
- return http<captchaResult>({
- method: 'GET',
- url: '/captchaImage',
- data
- })
- }
- /**
- * @description: 获取短信验证码
- * @param {*} data
- * @return {*}
- */
- export const getSmsApi = (data?: smsItem) => {
- return http({
- method: 'GET',
- url: '/captchaSms',
- data
- })
- }
- /**
- * @description: 注册
- * @param {*} data
- * @return {*}
- */
- export const registerApi = (data?: registerItem) => {
- return http({
- method: 'POST',
- url: '/register',
- data
- })
- }
- /**
- * @description: 忘记密码
- * @param {*} data
- * @return {*}
- */
- export const forgetApi = (data?: forgetItem) => {
- return http({
- method: 'POST',
- url: '/password/reset',
- data
- })
- }
- /**
- * @description: 微信登录
- * @param {*} data
- * @return {*}
- */
- export const weixinApi = (data: { code: string }) => {
- return http<loginResult>({
- method: 'POST',
- url: '/xcxLogin',
- header: {
- 'content-type': 'application/x-www-form-urlencoded'
- },
- data
- })
- }
- /**
- * @description: 退出登录
- * @param {*}
- * @return {*}
- */
- export const quiteApi = () => {
- return http({
- method: 'POST',
- url: '/logout'
- })
- }
- /**
- * @description: 手机号登录
- * @param {*} data
- * @return {*}
- */
- export const phoneLoginApi = (data: { code: string }) => {
- return http<loginResult>({
- method: 'POST',
- url: '/xcxPhoneLogin',
- header: {
- 'content-type': 'application/x-www-form-urlencoded'
- },
- data
- })
- }
|