From 6615b440d5b17a86aba9f557627e3bdbc4b8c85e Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 09 七月 2023 16:54:03 +0800 Subject: [PATCH] 2023-07-09 --- src/index.js | 4 -- src/tabviews/zshare/actionList/exceloutbutton/index.jsx | 23 +++++++++++ public/index.html | 52 +++++++++++++++++++++++++ config/webpack.config.js | 20 +++++++--- public/manifest.json | 3 + 5 files changed, 90 insertions(+), 12 deletions(-) diff --git a/config/webpack.config.js b/config/webpack.config.js index a793358..5826327 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -49,6 +49,14 @@ const cssModuleRegex = /\.module\.css$/; const sassRegex = /\.(scss|sass)$/; const sassModuleRegex = /\.module\.(scss|sass)$/; +const sign = (() => { + let uuid = [] + let options = '0123456789abcdefghigklmnopqrstuv' + for (let i = 0; i < 8; i++) { + uuid.push(options.substr(Math.floor(Math.random() * 0x20), 1)) + } + return uuid.join('') +})() // src => @ function resolves(dir) { @@ -175,14 +183,14 @@ // In development, it does not produce real files. // contenthash => hash filename: isEnvProduction - ? 'static/js/[name].[hash:8].js' + ? `static/js/[name].${sign}.js` : isEnvDevelopment && 'static/js/bundle.js', // TODO: remove this when upgrading to webpack 5 futureEmitAssets: true, // There are also additional JS chunk files if you use code splitting. // contenthash => hash chunkFilename: isEnvProduction - ? 'static/js/[name].[hash:8].chunk.js' + ? `static/js/[name].${sign}.chunk.js` : isEnvDevelopment && 'static/js/[name].chunk.js', // We inferred the "public path" (such as / or /my-project) from homepage. // We use "/" in development. @@ -354,7 +362,7 @@ loader: require.resolve('url-loader'), options: { limit: imageInlineSizeLimit, - name: 'static/media/[name].[hash:8].[ext]', + name: `static/media/[name].${sign}.[ext]`, }, }, // Process application JS with Babel. @@ -494,7 +502,7 @@ // by webpacks internal loaders. exclude: [/\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/], options: { - name: 'static/media/[name].[hash:8].[ext]', + name: `static/media/[name].${sign}.[ext]`, }, }, // ** STOP ** Are you adding a new loader? @@ -568,8 +576,8 @@ // Options similar to the same options in webpackOptions.output // both options are optional // contenthash => hash - filename: 'static/css/[name].[hash:8].css', - chunkFilename: 'static/css/[name].[hash:8].chunk.css', + filename: `static/css/[name].${sign}.css`, + chunkFilename: `static/css/[name].${sign}.chunk.css`, }), // Generate a manifest file which contains a mapping of all asset filenames // to their corresponding output file so that tools can pick it up without diff --git a/public/index.html b/public/index.html index 2e1c8b4..3da241a 100644 --- a/public/index.html +++ b/public/index.html @@ -3,12 +3,62 @@ <head> <meta charset="utf-8" /> <meta name="renderer" content="webkit"> - <!-- <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" /> --> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="theme-color" content="#000000" /> <link rel="shortcut icon" href="#"> <link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> <title></title> + <script> + let _href = window.location.href.split('#')[0] + let l_version = localStorage.getItem(_href + 'version') + let _ctime = parseInt(new Date().getTime() / 1000) + let _time = '' + + if (l_version) { + let vers = l_version.split('-') + l_version = vers[0] + _time = +vers[1] + } + + if (_time && _ctime - _time < 180) { + let meta1 = document.createElement('meta') + let meta2 = document.createElement('meta') + let meta3 = document.createElement('meta') + let meta4 = document.createElement('meta') + meta1.content = '0' + meta1.httpEquiv = 'Expires' + meta2.content = 'no-cache' + meta2.httpEquiv = 'Pragma' + meta3.content = 'no-cache' + meta3.httpEquiv = 'Cache-Control' + meta4.content = 'no-cache' + meta4.httpEquiv = 'Cache' + document.getElementsByTagName('head')[0].appendChild(meta1) + document.getElementsByTagName('head')[0].appendChild(meta2) + document.getElementsByTagName('head')[0].appendChild(meta3) + document.getElementsByTagName('head')[0].appendChild(meta4) + } else { + fetch('./manifest.json', { cache: 'no-cache'}) + .then(response => response.json()) + .then(res => { + if (res && res.mk_version) { + let version = res.mk_version + let nocache = false + + if (l_version && version !== l_version) { + nocache = true + localStorage.setItem(_href + 'version', version + '-' + _ctime) + } else if (!l_version) { + localStorage.setItem(_href + 'version', version + '-' + (_ctime - 360)) + } + + if (nocache) { + window.location.reload() + } + } + }) + } + </script> </head> <body> <noscript>You need to enable JavaScript to run this app.</noscript> diff --git a/public/manifest.json b/public/manifest.json index 2895bc5..d78853d 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -5,5 +5,6 @@ "start_url": ".", "display": "standalone", "theme_color": "#000000", - "background_color": "#ffffff" + "background_color": "#ffffff", + "mk_version": "20230709" } diff --git a/src/index.js b/src/index.js index 04c69e3..5a0bce2 100644 --- a/src/index.js +++ b/src/index.js @@ -8,7 +8,6 @@ import options, { styles } from '@/store/options.js' import '@/assets/css/main.scss' import '@/assets/css/action.scss' -// import '@/assets/css/minkeicon.css' import '@/assets/css/viewstyle.scss' if (window.location.href.indexOf('#/design') > -1) { // 缂栬緫椤甸潰鍒锋柊鏃讹紝璺宠浆鑷充富椤� @@ -45,8 +44,6 @@ } sessionStorage.removeItem('isEditState') - -// 鏂扮郴缁熸枃浠剁疆浜巃dmin涓� ../options.json , { cache: 'no-cache'} fetch('../options.json') .then(response => response.json()) @@ -159,7 +156,6 @@ } let _href = window.location.href.split('#')[0] - let _systemMsg = localStorage.getItem(_href + 'system') GLOB.navBar = 'shutter' // 榛樿涓虹櫨鍙剁獥 diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx index a31ae6b..e779409 100644 --- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx +++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx @@ -557,6 +557,29 @@ return col }) + + if (data && data[0]) { + let errors = [] + columns.forEach(col => { + if (col.Column && data[0][col.Column] === undefined) { + errors.push(col.Text) + } + }) + + if (errors.length) { + notification.error({ + top: 92, + message: '鏁版嵁涓己灏戝瓧娈碉細' + errors.join('銆�'), + duration: 5 + }) + + this.setState({ + loading: false + }) + + return + } + } try { if (imgCol) { -- Gitblit v1.8.0