import request from '@/utils/request.js'
import config from '@/config'

const preUrl = '/clientServices.do?iscrypt=1'

// 登录
export function login(username, password) {
	return request({
		url: preUrl,
		method: 'post',
		data: {
			serviceId: 'eu_2013V01login',
			params: {
				userName: username,
				password: password
			}
		}
	})
}

// 保存session
export function reLogin(username, password) {
	return uni.request({
		  method: 'get',
		  timeout: 10000,
		  url: config.baseUrl + '/LoginSA.do?user='+username+'&pass='+password,
		  dataType: 'json'
		})
}

//session续期
export function keepSession() {
	return request({
		url: '/sessionKeep.do',
		method: 'post',
		isSession: true,
	})
}

// 获取用户信息
export function getInfo(useId) {
	return request({
		url: preUrl,
		method: 'post',
		data: {
			serviceId: 'eu_2013V01loadMe',
			params: {
				staffId: useId
			}
		}
	})
}

// 登出
export function logout() {
	// return request({
	// method: 'post',
	// 	data: {
	// 		'serviceId': 'eu_2013V01login',
	// 		'params': {
	//        "userName": username,
	//        "password": password
	// 		}
	// 	}
	// })
}