From deb2536eaaa559d6c8ec94f81afb94b6c7806b4d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 29 三月 2024 16:15:14 +0800
Subject: [PATCH] 2024-03-29

---
 src/views/billprint/index.jsx |   32 ++++++++++++++++++++++++++------
 1 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx
index 58d9659..416c51d 100644
--- a/src/views/billprint/index.jsx
+++ b/src/views/billprint/index.jsx
@@ -1,6 +1,6 @@
 import React, { Component } from 'react'
 import { is, fromJS } from 'immutable'
-import { Col, Row, Spin, notification, Button } from 'antd'
+import { Col, Row, Spin, notification, Button, Modal } from 'antd'
 import moment from 'moment'
 
 import Api from '@/api'
@@ -47,6 +47,8 @@
     auto: true,
     ismob: /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(navigator.userAgent)
   }
+
+  reloading = false
 
   UNSAFE_componentWillMount() {
     const { params } = this.props.match
@@ -917,11 +919,15 @@
             if (item.func === 'sPC_Get_structured_data' && /灏嗘埅鏂瓧绗︿覆鎴栦簩杩涘埗鏁版嵁/ig.test(res.message)) {
               res.message = res.message + '璇锋鏌ュ瓧娈甸泦'
             }
-            notification.warning({
-              top: 92,
-              message: res.message,
-              duration: 5
-            })
+            if (res.ErrCode === 'version_up') {
+              this.reloadTabs()
+            } else {
+              notification.warning({
+                top: 92,
+                message: res.message,
+                duration: 5
+              })
+            }
             resolve(false)
           } else {
             res.componentId = componentId
@@ -1081,6 +1087,20 @@
     })
   }
 
+  reloadTabs = () => {
+    if (this.reloading) return
+
+    this.reloading = true
+
+    Api.getAppVersion(true).then(() => {
+      window.location.reload()
+    }, (message) => {
+      Modal.error({
+        title: message || '绯荤粺閰嶇疆鏇存柊澶辫触锛�',
+      })
+    })
+  }
+
   canvasToImage(canvas) {
     let image = new Image()
     image.src = canvas.toDataURL('image/jpg')

--
Gitblit v1.8.0