Browse Source

检测更新

seimin 2 years ago
parent
commit
240ec5752e

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
2 2
     "name" : "医疗服务中心转运系统",
3 3
     "appid" : "__UNI__FEB1B1E",
4 4
     "description" : "医疗服务中心转运系统",
5
-    "versionName" : "1.0.0",
6
-    "versionCode" : "100",
5
+    "versionName" : "1.0.1",
6
+    "versionCode" : 101,
7 7
     "transformPx" : false,
8 8
     "app-plus" : {
9 9
         /* 5+App特有相关 */

+ 11 - 0
pages.json

@@ -140,6 +140,17 @@
140 140
         "enablePullDownRefresh": true
141 141
       }
142 142
 
143
+    }, {
144
+      "path": "pages/search/search",
145
+      "style": {
146
+        "h5": {
147
+          "titleNView": false
148
+        },
149
+        "navigationBarTitleText": "搜索",
150
+        "navigationBarBackgroundColor": "#2C2D31",
151
+        "enablePullDownRefresh": true
152
+      }
153
+
143 154
     }
144 155
   ],
145 156
   "globalStyle": {

+ 11 - 1
pages/index/index.vue

@@ -5,7 +5,8 @@
5 5
       <!-- 头部搜索 -->
6 6
       <view class="search">
7 7
         <view class="search_wrap">
8
-          <input focus placeholder="请输入标本编码/检查单号/请…" :placeholder-style="placeholderStyle" confirm-type="search" />
8
+          <input focus placeholder="请输入标本编码/检查单号/请…" :placeholder-style="placeholderStyle" confirm-type="search"
9
+            v-model="searchText" />
9 10
           <view class="searchBtn"> 搜索 </view>
10 11
         </view>
11 12
         <view class="icon-saoma">
@@ -103,8 +104,17 @@
103 104
     ASSOCIATION_TYPES
104 105
   } from "../../utils/enum.association_types.js";
105 106
   export default {
107
+    watch: {
108
+      // 首页搜索内容
109
+      searchText(newVal) {
110
+        uni.navigateTo({
111
+          url: `/pages/search/search?txt=${newVal}`
112
+        })
113
+      }
114
+    },
106 115
     data() {
107 116
       return {
117
+        searchText: '', //首页搜索内容
108 118
         placeholderStyle: "color:#999;font-size:30rpx;line-height:66rpx;",
109 119
         urgentNum: 0, //急标数量
110 120
         ordinaryNum: 0, //普标数量

+ 7 - 2
pages/patientBuild/patientBuild.vue

@@ -227,7 +227,12 @@
227 227
         }
228 228
         //判断预约建单按钮
229 229
         console.log(this.patientBuildTrip)
230
-        if (this.hasYYtimeChecks.length && this.patientTaskType.appointmentSwitch == 1) {
230
+        if (
231
+          (this.patientTaskType.associationType.value === this.ASSOCIATION_TYPES['患者陪检业务'] &&
232
+            this.hasYYtimeChecks.length && this.patientTaskType.appointmentSwitch == 1) ||
233
+          (this.patientTaskType.associationType.value === this.ASSOCIATION_TYPES['患者其他服务业务'] &&
234
+            this.patientTaskType.appointmentOtherSwitch == 1)
235
+        ) {
231 236
           //选中的检查数组都有预约时间并且允许预约建单
232 237
           this.isYYBuild = true;
233 238
           this.allowUrgentChange(this.isUrgent);
@@ -244,12 +249,12 @@
244 249
           this.timestamp = new Date().getTime();
245 250
           this.yyInspectChange();
246 251
         }
247
-
248 252
         // 底部按钮展示
249 253
         this.showBtns(this.isYYBuild);
250 254
       },
251 255
       // 底部按钮展示
252 256
       showBtns(flag) {
257
+        console.log(flag)
253 258
         if (flag) {
254 259
           //患者陪检业务或患者其他服务业务,并且预约建单开关打开的情况下
255 260
           this.btns = [{

+ 96 - 0
pages/personalCenter/personalCenter.vue

@@ -29,6 +29,7 @@
29 29
     </view>
30 30
     <view class="changeDept">
31 31
       <button type="primary" @click="showDeptModel">切换科室</button>
32
+      <button type="primary" @click="checkUpdate">检测更新</button>
32 33
       <button type="primary" @click="changePwd">修改密码</button>
33 34
       <button type="primary" @click="logout">退出登录</button>
34 35
     </view>
@@ -42,6 +43,7 @@
42 43
 </template>
43 44
 
44 45
 <script>
46
+  import config from "../../request/config.js";
45 47
   import {
46 48
     mapState,
47 49
     mapMutations
@@ -49,6 +51,7 @@
49 51
   import {
50 52
     reqLogout2,
51 53
     reqUppwd,
54
+    reqFetchDataList,
52 55
   } from "../../request/api.js";
53 56
   export default {
54 57
     data() {
@@ -220,6 +223,99 @@
220 223
           }, ],
221 224
         })
222 225
       },
226
+      // 检测更新
227
+      checkUpdate() {
228
+        uni.showLoading({
229
+          mask: true,
230
+          title: '加载中'
231
+        })
232
+        let postData = {
233
+          "idx": 0,
234
+          "sum": 1,
235
+          "systemConfiguration": {
236
+            "keyconfig": "pdaVersion"
237
+          }
238
+        };
239
+        reqFetchDataList('simple/data', 'systemConfiguration', postData)
240
+          .then((data) => {
241
+            uni.hideLoading();
242
+            if (data.status == 200) {
243
+              const version = data.list[0].valueconfig;
244
+              // #ifdef APP-PLUS
245
+              plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
246
+                console.log(wgtinfo.version); //应用版本号
247
+                if (wgtinfo.version === version) {
248
+                  this.$refs.seiminModel.show({
249
+                    skin: "toast",
250
+                    icon: "success",
251
+                    content: "您所使用的已是最新版本",
252
+                  });
253
+                } else {
254
+                  this.$refs.seiminModel.show({
255
+                    icon: 'warn',
256
+                    content: `发现新版本Version ${version}`,
257
+                    btns: [{},
258
+                      {
259
+                        name: '立即下载更新',
260
+                        click: () => {
261
+                          this.downloadUrl(`${config.pdaDownloadUrl}/pda-v${version}.apk`);
262
+                        }
263
+                      }
264
+                    ]
265
+                  });
266
+                }
267
+              })
268
+              // #endif
269
+              // #ifndef APP-PLUS
270
+              this.$refs.seiminModel.show({
271
+                skin: "toast",
272
+                icon: "error",
273
+                content: "当前不是APP端",
274
+              });
275
+              // #endif
276
+            } else {
277
+              this.$refs.seiminModel.show({
278
+                skin: "toast",
279
+                icon: "error",
280
+                content: data.error || "获取版本失败",
281
+              });
282
+            }
283
+          });
284
+      },
285
+      // 下载更新
286
+      downloadUrl(Url = '') {
287
+        uni.showLoading({
288
+          title: '更新中……',
289
+          mask: true,
290
+        })
291
+        const downloadTask = uni.downloadFile({ //执行下载
292
+          url: Url, //下载地址
293
+          timeout: 1000 * 30, //30秒超时时间
294
+          success: downloadResult => { //下载成功
295
+            console.log(downloadResult)
296
+            uni.hideLoading();
297
+            if (downloadResult.statusCode == 200) {
298
+              plus.runtime.install( //安装软件
299
+                downloadResult.tempFilePath, {
300
+                  force: true
301
+                },
302
+                function(res) {
303
+                  plus.runtime.restart();
304
+                }
305
+              );
306
+            }
307
+          },
308
+          fail: err => {
309
+            uni.hideLoading();
310
+            this.$refs.seiminModel.show({
311
+              skin: "toast",
312
+              icon: "error",
313
+              content: "更新失败",
314
+            });
315
+            console.log(err)
316
+          },
317
+        });
318
+      },
223 319
     }
224 320
   }
225 321
 </script>

+ 22 - 0
pages/search/search.vue

@@ -0,0 +1,22 @@
1
+<template>
2
+  <view>
3
+
4
+  </view>
5
+</template>
6
+
7
+<script>
8
+  export default {
9
+    data() {
10
+      return {
11
+
12
+      };
13
+    },
14
+    onLoad() {
15
+
16
+    },
17
+  }
18
+</script>
19
+
20
+<style lang="scss">
21
+
22
+</style>

+ 3 - 2
request/config.js

@@ -5,15 +5,16 @@
5 5
  * @LastEditTime: 2022-04-02 14:29:15
6 6
  * @Description: 后端服务配置文件
7 7
  */
8
+const host = 'http://192.168.3.108';
8 9
 //配置项
9 10
 const config = {
10 11
   baseUrl: "", // 后端服务地址
12
+  pdaDownloadUrl: `${host}/assets/downloads`, // PDA下载地址
11 13
 };
12 14
 // 后端服务地址
13 15
 const baseUrls = {
14 16
   development: "http://192.168.3.108/service", //开发环境
15
-  // development: "http://localhost/service", //开发环境
16
-  production: "http://192.168.3.108/service", //生产环境
17
+  production: `${host}/service`, //生产环境
17 18
 };
18 19
 config.baseUrl = baseUrls[process.env.NODE_ENV];
19 20
 export default config;