Эх сурвалжийг харах

fix照片上传工具客户端的版本不一致

Michael Wang 6 жил өмнө
parent
commit
c28e305c8f
3 өөрчлөгдсөн 11 нэмэгдсэн , 5 устгасан
  1. 1 0
      .env.39
  2. 1 0
      .env.production
  3. 9 5
      public/index.html

+ 1 - 0
.env.39

@@ -1,4 +1,5 @@
 NODE_ENV=production
+VUE_APP_ELECTRON_CLIENT_VERSION=3.0.0
 VUE_APP_ECS_CORE=https://ecs-dev.qmth.com.cn:8878
 VUE_APP_ENV=192.168.10.39(测试服务器)
 VUE_APP_FACEPP_API_URL=https://api-cn.faceplusplus.com

+ 1 - 0
.env.production

@@ -1,4 +1,5 @@
 NODE_ENV=production
+VUE_APP_ELECTRON_CLIENT_VERSION=3.0.0
 VUE_APP_ECS_CORE=https://ecs.qmth.com.cn:8878
 VUE_APP_ENV=ecs.qmth.com.cn(线上服务器)
 VUE_APP_FACEPP_API_URL=https://api-cn.faceplusplus.com

+ 9 - 5
public/index.html

@@ -7,15 +7,19 @@
     <link rel="icon" href="<%= BASE_URL %>favicon.ico" />
     <title>photo-upload</title>
     <script type="text/javascript">
-      const app_version = "3.0.0";
       if (typeof require === "undefined") {
         document.writeln(
-          `不能通过浏览器访问本页面。请下载最新 <a href='https://ecs.qmth.com.cn:8878/electron-config/照片上传工具-3.0.0-正式版.exe'>照片上传工具</a>`
+          `不能通过浏览器访问本页面。请下载最新 <a href='https://ecs.qmth.com.cn:8878/electron-config/照片上传工具-<%= VUE_APP_ELECTRON_CLIENT_VERSION %>-正式版.exe'>照片上传工具</a>`
         );
       }
-      if (navigator.appVersion.match(/ECS-PHOTO-UPLOAD\/(\S+)/)[1] != "3.0.0") {
-        document.writeln(
-          `照片上传工具版本过时。请下载最新 <a href='https://ecs.qmth.com.cn:8878/electron-config/照片上传工具-3.0.0-正式版.exe'>照片上传工具</a>`
+      if (
+        navigator.appVersion.match(/ECS-PHOTO-UPLOAD\/(\S+)/)[1] !=
+        "<%= VUE_APP_ELECTRON_CLIENT_VERSION %>"
+      ) {
+        setTimeout(
+          () =>
+            (document.body.innerHTML = `照片上传工具版本过时。请下载最新 <a href='https://ecs.qmth.com.cn:8878/electron-config/照片上传工具-<%= VUE_APP_ELECTRON_CLIENT_VERSION %>-正式版.exe'>照片上传工具</a>`),
+          300
         );
       }
     </script>