From 51e8abcb44b0a5716dda42ad401354ea596c4d75 Mon Sep 17 00:00:00 2001 From: maochaoying <925670706@qq.com> Date: Sat, 15 Jul 2023 11:58:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.vue | 55 ++++++++++++---------- unpackage/dist/dev/mp-weixin/pages/index/index.js | 42 ++++++++++------- .../dist/dev/mp-weixin/pages/index/index.wxml | 2 +- 3 files changed, 56 insertions(+), 43 deletions(-) diff --git a/pages/index/index.vue b/pages/index/index.vue index ac712cf..3e1c508 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -82,7 +82,7 @@ - 当前结果 + 刷新结果 @@ -101,32 +101,39 @@ export default { username: '', resultList: [] } - }, + }, onLoad() { - const self = this - // 就在加载的时候请求一次某人的数据 筛选最新一条放入第一个tab - // 历史数据渲染到第二个tab - // 数据中有username idcard 以及信息列表 - uni.request({ - url: 'http://localhost:8080/zsjyadmin/detection/current', - method:"GET", - success: (res) => { - if (res?.data?.code == 0){ - const data = res?.data?.data - const {idcard, username, resultList} = data || {} - self.idcard = idcard - self.username = username - // 对resultList 根据id进行排序 - resultList.sort((a, b) => { - return b.id - a.id - }) - self.resultList = resultList - } - } - }); + this.getData() }, - methods: { + methods: { + getData() { + const self = this + // 就在加载的时候请求一次某人的数据 筛选最新一条放入第一个tab + // 历史数据渲染到第二个tab + // 数据中有username idcard 以及信息列表 + uni.request({ + url: 'http://localhost:8080/zsjyadmin/detection/current', + method:"GET", + success: (res) => { + if (res?.data?.code == 0){ + const data = res?.data?.data + const {idcard, username, resultList} = data || {} + self.idcard = idcard + self.username = username + // 对resultList 根据id进行排序 + resultList.sort((a, b) => { + return b.id - a.id + }) + self.resultList = resultList + } + } + }); + }, changeActiveTab(activeTab) { + if(activeTab == 0) { + // 刷新当前结果 + this.getData() + } this.activeTab = activeTab } } diff --git a/unpackage/dist/dev/mp-weixin/pages/index/index.js b/unpackage/dist/dev/mp-weixin/pages/index/index.js index 05260c2..8d12593 100644 --- a/unpackage/dist/dev/mp-weixin/pages/index/index.js +++ b/unpackage/dist/dev/mp-weixin/pages/index/index.js @@ -10,27 +10,33 @@ const _sfc_main = { }; }, onLoad() { - const self = this; - common_vendor.index.request({ - url: "http://localhost:8080/zsjyadmin/detection/current", - method: "GET", - success: (res) => { - var _a, _b; - if (((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.code) == 0) { - const data = (_b = res == null ? void 0 : res.data) == null ? void 0 : _b.data; - const { idcard, username, resultList } = data || {}; - self.idcard = idcard; - self.username = username; - resultList.sort((a, b) => { - return b.id - a.id; - }); - self.resultList = resultList; - } - } - }); + this.getData(); }, methods: { + getData() { + const self = this; + common_vendor.index.request({ + url: "http://localhost:8080/zsjyadmin/detection/current", + method: "GET", + success: (res) => { + var _a, _b; + if (((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.code) == 0) { + const data = (_b = res == null ? void 0 : res.data) == null ? void 0 : _b.data; + const { idcard, username, resultList } = data || {}; + self.idcard = idcard; + self.username = username; + resultList.sort((a, b) => { + return b.id - a.id; + }); + self.resultList = resultList; + } + } + }); + }, changeActiveTab(activeTab) { + if (activeTab == 0) { + this.getData(); + } this.activeTab = activeTab; } } diff --git a/unpackage/dist/dev/mp-weixin/pages/index/index.wxml b/unpackage/dist/dev/mp-weixin/pages/index/index.wxml index 043b9e8..3aedcf0 100644 --- a/unpackage/dist/dev/mp-weixin/pages/index/index.wxml +++ b/unpackage/dist/dev/mp-weixin/pages/index/index.wxml @@ -1 +1 @@ -姓名 : {{a}}身份证号 : {{b}}L-乳酸{{d}}mmol / L肌酸{{e}}mmol / L肌酐{{f}}mmol / L尿素{{g}}mmol / Lβ-羟丁酸{{h}}mmol / LL-谷氨酸{{i}}mmol / L{{item.a}}{{item.b}}L-乳酸 {{item.c}}mmol/L肌酸 {{item.d}}mmol/L肌酐 {{item.e}}mmol/L尿素 {{item.f}}mmol/Lβ-羟丁酸 {{item.g}}mmol/LL-谷氨酸 {{item.h}}mmol/L当前结果历史数据 \ No newline at end of file +姓名 : {{a}}身份证号 : {{b}}L-乳酸{{d}}mmol / L肌酸{{e}}mmol / L肌酐{{f}}mmol / L尿素{{g}}mmol / Lβ-羟丁酸{{h}}mmol / LL-谷氨酸{{i}}mmol / L{{item.a}}{{item.b}}L-乳酸 {{item.c}}mmol/L肌酸 {{item.d}}mmol/L肌酐 {{item.e}}mmol/L尿素 {{item.f}}mmol/Lβ-羟丁酸 {{item.g}}mmol/LL-谷氨酸 {{item.h}}mmol/L刷新结果历史数据 \ No newline at end of file