149 lines
3.8 KiB
JavaScript
149 lines
3.8 KiB
JavaScript
import {
|
|
httpUrlFormat,
|
|
ajaxCarryAuthorization,ajaxSync
|
|
} from '@/utils/httpUtils.js'
|
|
|
|
|
|
import { ApiVersion,AppVersion } from '@/config/baseConfig.js'
|
|
|
|
const headerVersion = {
|
|
'API-Version': ApiVersion(),
|
|
'APP-Version':AppVersion()
|
|
}
|
|
|
|
const _flag = 'apiBaseUrl' // 请求的api空间
|
|
|
|
const apiUrl = {
|
|
'generateCode': httpUrlFormat('/generate/code', _flag),//发送短信验证码
|
|
'sms_check': httpUrlFormat('/sms_check', _flag),//验证短信验证码
|
|
'register': httpUrlFormat('/register', _flag),//注册
|
|
'login': httpUrlFormat('/login', _flag),//登录
|
|
'loginCode': httpUrlFormat('/login/code', _flag),//验证码登录
|
|
'wechatAppid': httpUrlFormat('/wechat/appid', _flag),//微信获取appid
|
|
'loginWechat': httpUrlFormat('/login/wechat', _flag),//微信登录
|
|
'phoneWechat': httpUrlFormat('/wechat/user/phone', _flag),//微信登录
|
|
'reset_password': httpUrlFormat('/reset_password', _flag),//重置密码
|
|
'bindPhoneApi': httpUrlFormat('/user/bind/phone', _flag),//绑定手机号
|
|
|
|
|
|
|
|
|
|
'loginXc': httpUrlFormat('/login/xiaochuan', _flag),//用户登录第三方小川
|
|
'agreementDetailApi': httpUrlFormat('/misc/user/agreement/detail', _flag),//用户协议
|
|
|
|
|
|
|
|
}
|
|
export function loginXc(data) {
|
|
return ajaxSync({
|
|
header: headerVersion,
|
|
// header: {'Content-Type': 'application/x-www-form-urlencoded'},
|
|
url: apiUrl.loginXc,
|
|
method: 'POST',
|
|
data: data
|
|
})
|
|
}
|
|
|
|
|
|
export function smsSend(data) {
|
|
const headerObj = {...headerVersion,'Content-Type': 'application/x-www-form-urlencoded'}
|
|
return ajaxSync({
|
|
header: headerObj,
|
|
url: apiUrl.generateCode,
|
|
method: 'POST',
|
|
data: data
|
|
})
|
|
}
|
|
export function smsCheck(data) {
|
|
const headerObj = {...headerVersion,'Content-Type': 'application/x-www-form-urlencoded'}
|
|
return ajaxSync({
|
|
header: headerObj,
|
|
url: apiUrl.sms_check,
|
|
method: 'POST',
|
|
data: data
|
|
})
|
|
}
|
|
|
|
export function register(data) {
|
|
const headerObj = {...headerVersion,'Content-Type': 'application/x-www-form-urlencoded'}
|
|
return ajaxSync({
|
|
header: headerObj,
|
|
url: apiUrl.register,
|
|
method: 'POST',
|
|
data: data
|
|
})
|
|
}
|
|
export function loginCode(data) {
|
|
return ajaxSync({
|
|
header: headerVersion,
|
|
// header: {'Content-Type': 'application/x-www-form-urlencoded'},
|
|
url: apiUrl.loginCode,
|
|
method: 'POST',
|
|
data: data
|
|
})
|
|
}
|
|
export function loginWechat(data) {
|
|
const headerObj = {...headerVersion,'Content-Type': 'application/x-www-form-urlencoded'}
|
|
return ajaxSync({
|
|
header: headerObj,
|
|
url: apiUrl.loginWechat,
|
|
method: 'POST',
|
|
data: data
|
|
})
|
|
}
|
|
export function loginApi(data) {
|
|
const headerObj = {...headerVersion,'Content-Type': 'application/x-www-form-urlencoded'}
|
|
return ajaxSync({
|
|
header: headerObj,
|
|
url: apiUrl.login,
|
|
method: 'POST',
|
|
data: data
|
|
})
|
|
}
|
|
export function resetPassword(data) {
|
|
const headerObj = {...headerVersion,'Content-Type': 'application/x-www-form-urlencoded'}
|
|
return ajaxSync({
|
|
header: headerObj,
|
|
url: apiUrl.reset_password,
|
|
method: 'POST',
|
|
data: data
|
|
})
|
|
}
|
|
export function wechatAppid(data) {
|
|
return ajaxSync({
|
|
header: headerVersion,
|
|
// header: {'Content-Type': 'application/x-www-form-urlencoded'},
|
|
url: apiUrl.wechatAppid,
|
|
method: 'GET',
|
|
data: data
|
|
})
|
|
}
|
|
export function phoneWechat(data) {
|
|
const headerObj = {...headerVersion,'Content-Type': 'application/x-www-form-urlencoded'}
|
|
return ajaxSync({
|
|
header: headerObj,
|
|
url: apiUrl.phoneWechat,
|
|
method: 'POST',
|
|
data: data
|
|
})
|
|
}
|
|
export function bindPhoneApi(data) {
|
|
const headerObj = {...headerVersion,'Content-Type': 'application/x-www-form-urlencoded'}
|
|
return ajaxCarryAuthorization({
|
|
header: headerObj,
|
|
url: apiUrl.bindPhoneApi,
|
|
method: 'POST',
|
|
data: data
|
|
})
|
|
}
|
|
|
|
export function agreementDetailApi(data) {
|
|
return ajaxSync({
|
|
header: headerVersion,
|
|
// header: {'Content-Type': 'application/x-www-form-urlencoded'},
|
|
url: apiUrl.agreementDetailApi,
|
|
method: 'GET',
|
|
data: data
|
|
})
|
|
}
|