function readFilePath(username, password) {
var loginFlag = false;
const newFile_path = path.join(__dirname, 'data/user.json').replace(/\\/g, "\/");
fs.exists(newFile_path, function (exists) {
console.log(exists ? "文件存在" : "文件不存在");
if (!exists) {
$(".errorInformation").show();
$(".errorInformation").text("查找失败,本地文件不存在!");
return;
} else {
let result = JSON.parse(fs.readFileSync(newFile_path));
for (var i in result) {
if ((result[i].lid == username) && (result[i].password == password)) {
let data = JSON.stringify(result[i]);
ipc.send('open-user-editor', data);
loginFlag = true;
break;
}
}
if (!loginFlag) {
$(".errorInformation").show();
$(".errorInformation").text("用户名或密码错误!");
}
}
});
}