Browse Source

开启检测版本

lifanagju_citu 6 months ago
parent
commit
de70f6f97e
3 changed files with 8 additions and 9 deletions
  1. 1 1
      .env.development
  2. 7 6
      src/App.vue
  3. 0 2
      src/plugins/confirm/confirm.vue

+ 1 - 1
.env.development

@@ -1,7 +1,7 @@
 NODE_ENV = 'development'
 
 # 版本号 1937
-VITE_VERSION = 'v24.11.07.1938'
+VITE_VERSION = 'v24.11.07.1937'
 
 VITE_APP_TITLE = 门墩儿
 

+ 7 - 6
src/App.vue

@@ -4,15 +4,15 @@ import { ref, onMounted, onUnmounted, nextTick } from 'vue'
 import Confirm from '@/plugins/confirm'
 import axios from 'axios'
 
-const testVersion = '' // 开启测试环境测试 (默认为空关闭测试,v24.11.07.1936测试使用) 
+const openCheckVersion = true // 开启检测版本
 const timer = ref(null)
-const setIntervalTime = 10000 // 300000 五分钟
+const setIntervalTime = 300000 // 300000 五分钟
 onMounted(() => {
   nextTick(() => {
-    console.log('baseurl:', import.meta.env?.VITE_BASE_URL, 'version:', import.meta.env?.VITE_VERSION || testVersion)
+    console.log('baseurl:', import.meta.env?.VITE_BASE_URL, 'version:', import.meta.env?.VITE_VERSION)
     //
     const process_ENV = process?.env?.NODE_ENV || ''
-    if (process_ENV === 'development' || testVersion) { // development production
+    if ((process_ENV === 'production' || process_ENV === 'development') && openCheckVersion) {
       if (timer.value) clearInterval(timer.value)
       timer.value = setInterval(() => { checkVersion() }, setIntervalTime)
     }
@@ -25,9 +25,10 @@ onUnmounted(() => {
 // 检查版本号
 const checkVersion = () => {
   const baseUrl = import.meta.env.VITE_BASE_URL || ''
-  const version = import.meta.env?.VITE_VERSION || testVersion
+  const version = import.meta.env?.VITE_VERSION || ''
   const tenantId = import.meta.env?.VITE_TENANTCODE || ''
-  if (!baseUrl || !version) return
+  // 
+  if (!baseUrl || !version || !tenantId) return
   axios.get(`${baseUrl}/app-api/menduner/system/get/version`, {
     headers: { ['tenant-id']: tenantId }
   }).then((res) => {

+ 0 - 2
src/plugins/confirm/confirm.vue

@@ -22,11 +22,9 @@ const sureText = props.option.sureText || '确认'
 const otherBtnText = props.option.otherBtnText || ''
 const autoCloseTime = props.option.autoCloseTime || 0
 
-console.log('弹窗打开')
 // 自动关闭弹窗
 if (autoCloseTime && Number.isInteger(autoCloseTime) && autoCloseTime >= 1000) {
   setTimeout(() => {
-    console.log('自动关闭弹窗')
     props.cancel()
   }, autoCloseTime)
 }