|
@@ -251,9 +251,37 @@ export default {
|
|
console.log("使用旧客户端");
|
|
console.log("使用旧客户端");
|
|
} catch (error) {
|
|
} catch (error) {
|
|
console.log("尝试使用新客户端");
|
|
console.log("尝试使用新客户端");
|
|
- config = fs.readFileSync("config.js", "utf-8");
|
|
|
|
|
|
+ try {
|
|
|
|
+ config = fs.readFileSync("config.js", "utf-8");
|
|
|
|
+ } catch (error) {
|
|
|
|
+ const appPath = window
|
|
|
|
+ .nodeRequire("electron")
|
|
|
|
+ .remote.app.getAppPath();
|
|
|
|
+ try {
|
|
|
|
+ console.log("尝试使用最新的appPath");
|
|
|
|
+ config = fs.readFileSync(appPath + "/config.js", "utf-8");
|
|
|
|
+ } catch (error) {
|
|
|
|
+ this.$Message.error({
|
|
|
|
+ content: "读取本地配置文件出错,请重新打开程序或联系老师!",
|
|
|
|
+ duration: 15,
|
|
|
|
+ closable: true,
|
|
|
|
+ });
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ var nameJson;
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ nameJson = JSON.parse(config);
|
|
|
|
+ } catch (error) {
|
|
|
|
+ this.$Message.error({
|
|
|
|
+ content: "解析本地配置文件出错,请重新打开程序或联系老师!",
|
|
|
|
+ duration: 15,
|
|
|
|
+ closable: true,
|
|
|
|
+ });
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
- var nameJson = JSON.parse(config);
|
|
|
|
|
|
|
|
let electronConfig = null;
|
|
let electronConfig = null;
|
|
try {
|
|
try {
|
|
@@ -264,7 +292,7 @@ export default {
|
|
)).data;
|
|
)).data;
|
|
} catch (error) {
|
|
} catch (error) {
|
|
this.$Message.error({
|
|
this.$Message.error({
|
|
- content: "获取机构的客户端设置失败,请退出后重试!",
|
|
|
|
|
|
+ content: "获取机构的客户端设置失败,请退出程序后重试!",
|
|
duration: 15,
|
|
duration: 15,
|
|
closable: true,
|
|
closable: true,
|
|
});
|
|
});
|
|
@@ -274,10 +302,19 @@ export default {
|
|
//如果配置中配置了 checkRemoteControl:true
|
|
//如果配置中配置了 checkRemoteControl:true
|
|
if (electronConfig.otherConfig.checkRemoteControl) {
|
|
if (electronConfig.otherConfig.checkRemoteControl) {
|
|
window.nodeRequire("node-cmd").get("Project1.exe", function() {
|
|
window.nodeRequire("node-cmd").get("Project1.exe", function() {
|
|
- var applicationNames = fs.readFileSync(
|
|
|
|
- "remoteApplication.txt",
|
|
|
|
- "utf-8"
|
|
|
|
- );
|
|
|
|
|
|
+ var applicationNames;
|
|
|
|
+ try {
|
|
|
|
+ applicationNames = fs.readFileSync(
|
|
|
|
+ "remoteApplication.txt",
|
|
|
|
+ "utf-8"
|
|
|
|
+ );
|
|
|
|
+ } catch (error) {
|
|
|
|
+ that.$Message.error({
|
|
|
|
+ content: "系统检测出错,请退出程序后重试!",
|
|
|
|
+ duration: 2 * 24 * 60 * 60,
|
|
|
|
+ });
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
if (applicationNames && applicationNames.trim()) {
|
|
if (applicationNames && applicationNames.trim()) {
|
|
that.disableLoginBtn = true;
|
|
that.disableLoginBtn = true;
|
|
that.$Message.info({
|
|
that.$Message.info({
|