瀏覽代碼

Merge branch 'develop' of http://git.chelingzhu.com/jianguan-web/qpls-md-html into develop

chenrui 3 年之前
父節點
當前提交
f012ffd094
共有 4 個文件被更改,包括 30 次插入3 次删除
  1. 3 0
      public/version.json
  2. 22 0
      src/libs/versionUpdate.js
  3. 3 1
      src/permission.js
  4. 2 2
      src/views/exception/updateBrowser.vue

+ 3 - 0
public/version.json

@@ -0,0 +1,3 @@
+{
+    "version": "1.0.2"
+}

+ 22 - 0
src/libs/versionUpdate.js

@@ -0,0 +1,22 @@
+import axios from 'axios'
+ 
+const isNewVersion = () => {
+  let url = `//${window.location.host}/version.json?t=${new Date().getTime()}`;
+  axios.get(url).then(res => {
+    if (res.status === 200) {
+      let vueVersion = res.data.version;
+      let localVueVersion = localStorage.getItem('vueVersion');
+      if (localVueVersion && localVueVersion != vueVersion) {
+        localStorage.setItem('vueVersion', vueVersion);
+        window.location.reload();
+        return;
+      } else {
+        localStorage.setItem('vueVersion', vueVersion);
+      }
+    }
+  });
+}
+ 
+export default {
+  isNewVersion
+}

+ 3 - 1
src/permission.js

@@ -7,13 +7,15 @@ import '@/components/NProgress/nprogress.less' // progress bar custom style
 import notification from 'ant-design-vue/es/notification'
 import { setDocumentTitle, domTitle } from '@/utils/domUtil'
 import { ACCESS_TOKEN } from '@/store/mutation-types'
-
+import versionTood from '@/libs/versionUpdate'
 NProgress.configure({ showSpinner: false }) // NProgress Configuration
 
 const whiteList = ['login', 'register', 'registerResult','updateBrowser'] // no redirect whitelist
 const defaultRoutePath = '/home'
 
 router.beforeEach((to, from, next) => {
+  //判断当前代码版本是否与服务器中代码版本一致,如不一致则刷新页面获取最新
+  versionTood.isNewVersion()
 	store.commit('TOGGLE_NOW_ROUTER',to.fullPath)
   NProgress.start() // start progress bar
   to.meta && (typeof to.meta.title !== 'undefined' && setDocumentTitle(`${to.meta.title} - ${domTitle}`))

+ 2 - 2
src/views/exception/updateBrowser.vue

@@ -15,7 +15,7 @@
         <p>请检查当前浏览器模式是否是极速模式,如下图所示。</p>
         <p><img src="@/assets/upBrowser/temp1.png"></p>
       </div>
-      <h2>三、建议安装使用"iSCM系统"桌面端软件,以便体验更好,更流畅的使用体验;</h2>
+      <!-- <h2>三、建议安装使用"iSCM系统"桌面端软件,以便体验更好,更流畅的使用体验;</h2>
       <div>
         <h3>桌面端软件安装指南:</h3>
         <p>1、下载软件</p>
@@ -27,7 +27,7 @@
         <p><img src="@/assets/upBrowser/t3.png"></p>
         <p>3、点击完成打开软件 </p>
         <p><img width="499px" src="@/assets/upBrowser/t4.png"></p>
-      </div>
+      </div> -->
     </div>
   </div>
 </template>