// 存放接口处
import http from './request.js';

/**
 * 账号密码登录
 * @param{account:string ,password: string} params
 */
export const userLogin = (data) => http.request({
	method: "POST",
	url: '/user/login',
	data
});

/**
 * 微信code登录
 * @param{platform:string ,code: 微信code} data
 */
export const thirdLogin = (data) => http.request({
	method: "POST",
	url: '/user/third',
	data
})

/**
 * 手机验证码登录
 * @param{mobile:string ,captcha: 验证码} data
 */
export const phonenumberLogin = (data) => http.request({
	method: "POST",
	url: '/user/mobilelogin',
	data
})


/**
 * 重置密码
 * @param{mobile:string ,captcha: 验证码,newpassword:string} data
 */
export const retrievePassword = (data) => http.request({
	method: "POST",
	url: '/user/resetpwd',
	data
})


/**
 * 发送验证码
 * @param{mobile:手机号码 ,event: [register:'注册',login:'登录',bind:'绑定手机号',修改:'savepwd']} data
 */
export const sendVerifyCode = (data) => http.request({
	method: "POST",
	url: '/sms/send',
	data
})


// /**
//  * 上传文件
//  * @param{file} file
//  */
// export const uploadFile = (files) => {
// 	uni.uploadFile({
// 		url: 'https://jx.xiaolinghou.com/api/common/upload', //仅为示例，非真实的接口地址
// 		header: {
// 			token: uni.getStorageSync('token'),
// 		},
// 		files,
// 		name: 'file',
// 		success: (res) => {
// 			console.log(res);
// 		},
// 		fail: (err) => {
// 			console.log(err);
// 		}
// 	});
// }


/**
 * 上传
 */
export const uploadFile = (filePath) => http.upload('/common/upload', {
	filePath,
	name: 'file'
})
