/**
 * 修改密码
 * @param {Object} passwordInfo
 * @param {Object} callback
 */
function modifyPwd(passwordInfo, callback) {

	var oldPassword = passwordInfo.oldPassword;
	var newPassword = passwordInfo.newPassword;
	var newPassword2 = passwordInfo.newPassword2

	if(oldPassword.length == 0) {
		return callback({
			msg: '原密码不能为空'
		});
	}
	if(newPassword.length == 0) {
		return callback({
			msg: '新密码不能为空'
		});
	}
	if(newPassword != newPassword2) {
		return callback({
			msg: '两次输入的密码不一致'
		});
	}

	var url = API.API_URL();
	var state = app.getState(); //获取登陆信息
	var staffId = state.user.useId;
	var obj = {
			'serviceId': 'eu_2013V01modifyPwd',
			'params': '{staffId:' + staffId + ',oldpwd:'+oldPassword+',newpwd:'+newPassword+'}'
		};
	mui.ajax(url, {
		dataType: 'json', //服务器返回json格式数据
		type: 'post', //HTTP请求类型
		data:obj,
		/*data: {
			method: 'modifyPwd',
			apiUser: state.user.id,
			p: '{oldPassword:' + oldPassword + ',newPassword:' + newPassword + ',newPassword2:' + newPassword2 + '}'
		},*/
		timeout: 10000, //超时时间设置为10秒；
		headers: {
			'Accept': 'application/json'
		},
		success: function(data) {
			return callback(data);
		},
		error: function(xhr, type, errorThrown) {
			//异常处理；
			console.log(type);
		}
	});
}

/**
 * 获取员工信息
 * @param {Object} staffId
 */
function getMemberInfo(callback,staffId) {
	var url = API.API_URL();
	var state = app.getState(); //获取登陆信息
	if(!state.token) {
		return;
	}
	if(!staffId) {
		staffId = state.user.useId;
	};
	var obj = {
			'serviceId': 'eu_2013V01loadMe',
			'params': '{staffId:' + staffId + '}'
		};
	mui.ajax(url, {
		dataType: 'json', //服务器返回json格式数据
		type: 'post', //HTTP请求类型
		data: obj,
		timeout: 10000, //超时时间设置为10秒；
		headers: {
			'Accept': 'application/json'
		},
		success: function(data) {
			return callback(data);
		},
		error: function(xhr, type, errorThrown) {
			//异常处理；
			console.log(type);
		}
	});
}