Browse Source

app更新,H5打包缓存

miaofuhao 2 years ago
parent
commit
a17845ff6c

+ 3 - 2
CallCenterWeb.UI/RMYYAPP/manifest.json

@@ -2,7 +2,7 @@
2 2
     "name" : "郑州人民医院综合服务保障调度平台",
3 3
     "appid" : "__UNI__5A5207D",
4 4
     "description" : "",
5
-    "versionName" : "1.2.32",
5
+    "versionName" : "1.2.33",
6 6
     "versionCode" : 122,
7 7
     "transformPx" : false,
8 8
     /* 5+App特有相关 */
@@ -128,6 +128,7 @@
128 128
         "enable" : false
129 129
     },
130 130
     "h5" : {
131
-        "title" : "郑州人民医院综合服务保障调度平台"
131
+        "title" : "郑州人民医院综合服务保障调度平台",
132
+        "template" : "templateh5.html"
132 133
     }
133 134
 }

+ 26 - 23
CallCenterWeb.UI/RMYYAPP/pages/myTask/myTask.vue

@@ -164,30 +164,33 @@
164 164
 						console.log(nowVersionCode + "---" +serveVersionCode)
165 165
 						if (nowVersionCode !== serveVersionCode) {
166 166
 							if(typeUp === 0){
167
-								uni.showModal({
168
-									title: '更新',
169
-									content: '是否更新',
170
-									success: function (res) {
171
-										if (res.confirm) {
172
-											console.log(data.F_FileUrl)
173
-											plus.runtime.openURL(data.FileUrl[0].F_FileUrl);
174
-										} else if (res.cancel) {
175
-											this.$mHelper.toast("取消更新");
176
-										}
177
-									}
178
-								});
167
+								plus.runtime.openURL(data.FileUrl[0].F_FileUrl, err=>{
168
+									plus.runtime.openURL(data.FileUrl[0].F_FileUrl);
169
+								}, 'com.android.browser');
170
+								// uni.showModal({
171
+								// 	title: '更新',
172
+								// 	content: '是否更新',
173
+								// 	success: function (res) {
174
+								// 		if (res.confirm) {
175
+								// 			console.log(data.F_FileUrl)
176
+								// 		} else if (res.cancel) {
177
+								// 			this.$mHelper.toast("取消更新");
178
+								// 		}
179
+								// 	}
180
+								// });
179 181
 							}else if(typeUp === 1){
180
-								uni.showModal({
181
-									title: '更新',
182
-									content: '是否更新',
183
-									success: function (res) {
184
-										if (res.confirm) {
185
-											plus.runtime.openURL(data.F_Url);
186
-										} else if (res.cancel) {
187
-											this.$mHelper.toast("取消更新");
188
-										}
189
-									}
190
-								});
182
+								plus.runtime.openURL(data.F_Url);
183
+								// uni.showModal({
184
+								// 	title: '更新',
185
+								// 	content: '是否更新',
186
+								// 	success: function (res) {
187
+								// 		if (res.confirm) {
188
+								// 			plus.runtime.openURL(data.F_Url);
189
+								// 		} else if (res.cancel) {
190
+								// 			this.$mHelper.toast("取消更新");
191
+								// 		}
192
+								// 	}
193
+								// });
191 194
 								
192 195
 							}
193 196
 							

+ 25 - 0
CallCenterWeb.UI/RMYYAPP/templateh5.html

@@ -0,0 +1,25 @@
1
+<!DOCTYPE html>
2
+<html lang="zh-CN">
3
+	<head>
4
+		<meta charset="utf-8">
5
+		<meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+		<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
7
+		<meta http-equiv="Pragma" content="no-cache" />
8
+		<meta http-equiv="Expires" content="0" />
9
+		<title>
10
+			<%= htmlWebpackPlugin.options.title %>
11
+		</title>
12
+		<script>
13
+			var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
14
+			document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')
15
+		</script>
16
+		<link rel="stylesheet" href="<%= BASE_URL %>static/index.<%= VUE_APP_INDEX_CSS_HASH %>.css" />
17
+	</head>
18
+	<body>
19
+		<noscript>
20
+			<strong>Please enable JavaScript to continue.</strong>
21
+		</noscript>
22
+		<div id="app"></div>
23
+		<!-- built files will be auto injected -->
24
+	</body>
25
+</html>

+ 18 - 0
CallCenterWeb.UI/RMYYAPP/vue.config.js

@@ -0,0 +1,18 @@
1
+let filePath = '';   // 默认文件路径
2
+let TimeStamp = '';  // 时间戳
3
+let Version = '-V1.0.1-'; // 版本号
4
+//编译环境判断,可以根据不同环境来做相应的配置
5
+if (process.env.UNI_PLATFORM === 'h5') {
6
+  filePath = 'static/js/'
7
+  TimeStamp = new Date().getTime();
8
+  process.env.VUE_APP_INDEX_CSS_HASH=`${Version}${TimeStamp}`   //给css文件也使用该时间戳
9
+}
10
+ 
11
+module.exports = {
12
+  configureWebpack: {
13
+    output: { //重构文件名
14
+      filename: `${filePath}[name].${Version}${TimeStamp}.js`, // index文件重命名为带有版本号+时间戳的格式
15
+      chunkFilename: `${filePath}[name].${Version}${TimeStamp}.js` // static/js/pages-home-index.-V1-754654657.js  
16
+    },
17
+  },
18
+}