import baseurl from '../baseurl.js'

var request = function(config) {
	return new Promise((resolve, rejected) => {
		uni.showLoading({
			title: ''
		});
		uni.request({
			url: baseurl + config.url,
			data: config.data,
			method: config.method,
			timeout: 20000,
			header: {
				// 'Access-Control-Allow-Origin':'*',
				// "Content-Type": "application/x-www-form-urlencoded"
				// "Content-Type": "multipart/form-data"
			},
			success(res) {
				uni.hideLoading();
				resolve(res.data)
			},
			fail(err) {
				uni.hideLoading();
				rejected(err)
			}
		})
	})
}


export function login(username, password, mobileLogin) {
	return request({
		url: `/dzzyb/a/login?username=${username}&password=${password}&mobileLogin=${mobileLogin}`,
		method: 'POST'
	})
}
