
import config, {
	baseUrl,
	loginUrl
} from '@/config'

let timeout = 10000

console.log(loginUrl)
const request = config => {
console.log("登录接口----" + loginUrl + config.url)
	return new Promise((resolve, reject) => {
			
			uni.request({
					method: config.method, 
					header: {
						"Content-Type": "application/x-www-form-urlencoded"
					},
					url: loginUrl + config.url,
					timeout: config.timeout || timeout,
					data: config.data,
					success: (res) => {
						console.log("----then----" + res); 
						// let str = parseXML(res.data)
						resolve(res.data)
					},
					fail(error) {
						console.log("----then----" + error); 
						reject(error)
					}
				})
		}



	)


}
export default request