feat: uniapp 适配aj-captcha
parent
af2b1eb25f
commit
baf5d87d32
@ -1,47 +1,60 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
// 登录方法
|
// 登录方法
|
||||||
export function login(username, password, code, uuid) {
|
export function login(username, password, captchaVerification) {
|
||||||
const data = {
|
const data = {
|
||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
code,
|
captchaVerification
|
||||||
uuid
|
}
|
||||||
}
|
return request({
|
||||||
return request({
|
url: '/system/auth/login',
|
||||||
url: '/system/auth/login',
|
headers: {
|
||||||
headers: {
|
isToken: false
|
||||||
isToken: false
|
},
|
||||||
},
|
'method': 'POST',
|
||||||
'method': 'post',
|
'data': data
|
||||||
'data': data
|
})
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户详细信息
|
// 获取用户详细信息
|
||||||
export function getInfo() {
|
export function getInfo() {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/auth/get-permission-info',
|
url: '/system/auth/get-permission-info',
|
||||||
'method': 'get'
|
'method': 'GET'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 退出方法
|
// 退出方法
|
||||||
export function logout() {
|
export function logout() {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/auth/logout',
|
url: '/system/auth/logout',
|
||||||
'method': 'post'
|
'method': 'POST'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取验证码
|
// 获取验证码
|
||||||
export function getCodeImg() {
|
export function getCaptcha(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/captcha/get-image',
|
url: '/captcha/get',
|
||||||
headers: {
|
headers: {
|
||||||
isToken: false
|
isToken: false,
|
||||||
},
|
isTenant: false
|
||||||
method: 'get',
|
},
|
||||||
timeout: 20000
|
method: 'POST',
|
||||||
})
|
'data': data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 验证验证码
|
||||||
|
export function checkCaptcha(data) {
|
||||||
|
return request({
|
||||||
|
url: '/captcha/check',
|
||||||
|
headers: {
|
||||||
|
isToken: false,
|
||||||
|
isTenant: false
|
||||||
|
},
|
||||||
|
method: 'POST',
|
||||||
|
'data': data
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,11 @@
|
|||||||
|
import CryptoJS from 'crypto-js'
|
||||||
|
/**
|
||||||
|
* @word 要加密的内容
|
||||||
|
* @keyWord String 服务器随机返回的关键字
|
||||||
|
* */
|
||||||
|
export function aesEncrypt(word,keyWord="XwKsGlMcdPMEhR1B"){
|
||||||
|
var key = CryptoJS.enc.Utf8.parse(keyWord);
|
||||||
|
var srcs = CryptoJS.enc.Utf8.parse(word);
|
||||||
|
var encrypted = CryptoJS.AES.encrypt(srcs, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
|
||||||
|
return encrypted.toString();
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
import config from '@/config'
|
||||||
|
const baseUrl = config.baseUrl
|
||||||
|
export const myRequest = (option={})=>{
|
||||||
|
return new Promise((reslove,reject)=>{
|
||||||
|
uni.request({
|
||||||
|
url: baseUrl + option.url,
|
||||||
|
data :option.data,
|
||||||
|
method:option.method || "GET",
|
||||||
|
success: (result) => {
|
||||||
|
reslove(result)
|
||||||
|
},
|
||||||
|
fail:(error)=>{
|
||||||
|
reject(error)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"dependencies": {
|
||||||
|
"crypto-js": "^4.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
Loading…
Reference in New Issue