| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- /**
- * Created by Andste on 2018/5/2.
- * 用户认证相关API
- */
- import storage from '@/utils/storage.js';
- import {http, Method} from '@/utils/request.js';
- import { md5 } from '@/utils/md5.js';
- /**
- * 普通登录
- * @param username
- * @param password
- * @param captcha
- */
- export function login(username, password, captcha) {
- return http.request({
- url: 'passport/login',
- method: Method.POST,
- params: {
- username,
- password: md5(password),
- captcha,
- uuid: storage.getUuid(),
- },
- });
- }
- /**
- * 验证账户信息
- * @param captcha
- * @param account
- */
- export function validAccount(captcha, account) {
- return http.request({
- url: 'passport/find-pwd',
- method: Method.GET,
- params: {
- uuid: storage.getUuid(),
- captcha,
- account,
- },
- });
- }
- /**
- * 发送找回密码短信
- * @param uuid
- * @param captcha
- */
- export function sendFindPasswordSms(uuid,captcha) {
- return http.request({
- url: 'passport/find-pwd/send',
- method: Method.POST,
- header:{'content-type':"application/x-www-form-urlencoded"},
- data: {
- uuid:uuid,
- captcha,
- },
- });
- }
- /**
- * 校验找回密码验证码
- * @param uuid
- * @param sms_code
- */
- export function validFindPasswordSms(uuid, sms_code) {
- return http.request({
- url: 'passport/find-pwd/valid',
- method: Method.GET,
- params: {
- uuid,
- sms_code,
- },
- });
- }
- /**
- * 修改密码【找回密码用】
- * @param password
- * @param uuid
- */
- export function changePassword(password, uuid) {
- if (!uuid) {
- uuid = storage.getUuid();
- }
- return http.request({
- url: 'passport/find-pwd/update-password',
- method: Method.PUT,
- header:{'content-type':"application/x-www-form-urlencoded"},
- data: {
- uuid,
- password: md5(password),
- },
- });
- }
- // 保存生物认证登录
- export function setBiolofy(params) {
- return http.request({
- url: `passport/login/save/biology`,
- method: 'POST',
- params
- })
- }
|