From 80caf91d084abfaaf90d6e8c4b8d5234c91035fd Mon Sep 17 00:00:00 2001 From: chengkun Date: Fri, 25 Aug 2023 10:54:07 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 32 +++---- pages/history/History.vue | 177 ++++++++++++++++++++++++-------------- pages/scan/Barcode.vue | 37 ++++---- pages/scan/Book.vue | 37 ++++---- pages/scan/Calendar.vue | 37 ++++---- pages/scan/Contacts.vue | 37 ++++---- pages/scan/Email.vue | 37 ++++---- pages/scan/Location.vue | 37 ++++---- pages/scan/Paypal.vue | 153 -------------------------------- pages/scan/Product.vue | 37 ++++---- pages/scan/Scan.nvue | 153 ++++++++++++++++---------------- pages/scan/Sms.vue | 37 ++++---- pages/scan/Tel.vue | 37 ++++---- pages/scan/Text.vue | 37 ++++---- pages/scan/Url.vue | 152 +++++++++++++++++++++++++++----- pages/scan/Wifi.vue | 129 +++++++++++++++++++++++---- pages/setting/Setting.vue | 34 ++++---- utils/database.js | 26 +++--- 18 files changed, 661 insertions(+), 565 deletions(-) delete mode 100644 pages/scan/Paypal.vue diff --git a/pages.json b/pages.json index 72e7cb9..f3d952e 100644 --- a/pages.json +++ b/pages.json @@ -10,13 +10,14 @@ "enablePullDownRefresh": false } }, + // { + // "path": "pages/create/Create", + // "style": { + // "navigationBarTitleText": "Create", + // "enablePullDownRefresh": false + // } + // }, { - "path": "pages/create/Create", - "style": { - "navigationBarTitleText": "Create", - "enablePullDownRefresh": false - } - },{ "path": "pages/history/History", "style": { "navigationBarTitleText": "History", @@ -72,13 +73,6 @@ "enablePullDownRefresh": false } }, - { - "path": "pages/scan/Paypal", - "style": { - "navigationBarTitleText": "Paypal", - "enablePullDownRefresh": false - } - }, { "path": "pages/scan/Product", "style": { @@ -147,12 +141,12 @@ "selectedIconPath": "static/art-select.png", "text": "History" }, - { - "pagePath": "pages/create/Create", - "iconPath": "static/art-default.png", - "selectedIconPath": "static/art-select.png", - "text": "Create" - }, + // { + // "pagePath": "pages/create/Create", + // "iconPath": "static/art-default.png", + // "selectedIconPath": "static/art-select.png", + // "text": "Create" + // }, { "pagePath": "pages/setting/Setting", "iconPath": "static/art-default.png", diff --git a/pages/history/History.vue b/pages/history/History.vue index 2d04bb2..9bfd646 100644 --- a/pages/history/History.vue +++ b/pages/history/History.vue @@ -30,9 +30,9 @@ - - {{ item.label }} - {{ item.text }} + + {{ item.category }} + {{ item.content }} @@ -53,7 +53,7 @@ data() { return { title: 'History', - tableName:"scancode", + tableName:"scan_code", options:{ current:1, // 分页默认为第1页 size:10, @@ -101,56 +101,100 @@ }, ], - historyList:[ - { - "icon":"grid-item-icon tn-icon-empty-network", - "text":"15936215478", - "sort":"0", - "label":"WIFI" - }, - { - "icon":"grid-item-icon tn-icon-empty-network", - "text":"15936215478", - "sort":"1", - "label":"WIFI" - }, - { - "icon":"grid-item-icon tn-icon-empty-network", - "text":"15936215478", - "sort":"2", - "label":"WIFI" - }, - { - "icon":"grid-item-icon tn-icon-empty-network", - "text":"15936215478", - "sort":"3", - "label":"WIFI" - }, - { - "icon":"grid-item-icon tn-icon-empty-network", - "text":"15936215478", - "sort":"4", - "label":"WIFI" - } - ] + historyList: [] + // historyList:[ + // { + // "icon":"grid-item-icon tn-icon-empty-network", + // "text":"15936215478", + // "sort":"0", + // "label":"WIFI" + // }, + // { + // "icon":"grid-item-icon tn-icon-empty-network", + // "text":"15936215478", + // "sort":"1", + // "label":"WIFI" + // }, + // { + // "icon":"grid-item-icon tn-icon-empty-network", + // "text":"15936215478", + // "sort":"2", + // "label":"WIFI" + // }, + // { + // "icon":"grid-item-icon tn-icon-empty-network", + // "text":"15936215478", + // "sort":"3", + // "label":"WIFI" + // }, + // { + // "icon":"grid-item-icon tn-icon-empty-network", + // "text":"15936215478", + // "sort":"4", + // "label":"WIFI" + // } + // ] } }, - onLoad() { - + async onShow() { + let that = this; + //打开db + await that.openSqlite(); + //获取历史数据 + await that.getData(); }, - async onShow(){ - await this.openSqlite() + onHide() { + let that = this; + that.closedb(); }, methods: { + //查看指定记录历史信息 + getHistory(category,data){ + console.log("123") + let that = this; + + if(category === 'Contacts'){ + that.jumpToPage('/pages/scan/Contacts','history',data); + }else if(category === 'Email'){ + that.jumpToPage('/pages/scan/Email','history',data); + }else if(category === 'Tel'){ + that.jumpToPage('/pages/scan/Tel','history',data); + }else if(category === 'Product'){ + that.jumpToPage('/pages/scan/Product','history',data); + }else if(category === 'Sms'){ + that.jumpToPage('/pages/scan/Sms','history',data); + }else if(category === 'Text'){ + that.jumpToPage('/pages/scan/Text','history',data); + }else if(category === 'Url'){ + that.jumpToPage('/pages/scan/Url','history',data); + }else if(category === 'Wifi'){ + that.jumpToPage('/pages/scan/Wifi','history',data); + }else if(category === 'Location'){ + that.jumpToPage('/pages/scan/Location','history',data); + }else if(category === 'Calendar'){ + that.jumpToPage('/pages/scan/Calendar','history',data); + }else if(category === 'Book'){ + that.jumpToPage('/pages/scan/Book','history',data); + } + }, + + //根据数据库页面类型结果判断跳转到哪个指定页面 + jumpToPage(url,category,data){ + uni.navigateTo({ + url: url + '?data='+ data + '&category=' + category + }); + }, + // 打开数据库 async openSqlite(){ try{ let b = await openSqlite() - uni.showToast({ - title:"open db success", - icon:"none" - }) + // uni.showToast({ + // title:"open db success", + // icon:"none" + // }) + console.log('db打开了'); }catch(e){ console.error("open db error",e) } @@ -160,6 +204,7 @@ closedb(){ try{ closedb() + console.log('db关闭了'); }catch(e){ console.error("close db error",e) } @@ -170,17 +215,17 @@ async getData(){ try{ let where = {} - let res = await getPageList(this.tableName,this.options,where,"fid desc") + let res = await getPageList(this.tableName,this.options,where,"id desc") console.log("加载数据",res) - this.list = res.data.data.records + this.historyList = res.data.data.records this.pages = res.data.data.pages this.total = res.data.data.total }catch(e){ - uni.showToast({ - title:"报错,请查看控制台", - icon:"none" - }); - console.error("报错",e) + // uni.showToast({ + // title:"报错,请查看控制台", + // icon:"none" + // }); + console.error("error",e) } }, @@ -227,7 +272,7 @@ .settingList{ //border: 2px solid red; - width: 330px; + width: 660rpx; //height:300px; height: auto; //margin-top: 10px; @@ -235,7 +280,7 @@ .listItem{ //border: 2px solid yellow; - height: 50px; + height: 100rpx; //margin-top: 30px; background-color: #141b29; color: #fff; @@ -254,29 +299,29 @@ justify-content: flex-start; .list-left-text{ - width: 210px; + width: 420rpx; .list-left-text-one{ - font-size: 15px; + font-size: 30rpx; //border: 2px solid blue; } .list-left-text-two{ color: grey; - font-size:13px; + font-size:26rpx; //border: 2px solid lightsalmon; } } .list-left-feedback-text{ - width: 240px; + width: 480rpx; .list-left-feedback-text-one{ - font-size: 15px; + font-size: 30rpx; //border: 2px solid blue; } .list-left-feedback-text-two{ color: grey; - font-size:13px; + font-size: 26rpx; //border: 2px solid lightsalmon; } } @@ -284,14 +329,14 @@ .list-left-icon{ //border: 2px solid blueviolet; - margin-right: 10px; - font-size: 25px; + margin-right: 20rpx; + font-size: 50rpx; } .list-left-select-text{ - width: 160px; + width: 320rpx; .list-left-select-text-one{ - font-size: 15px; + font-size: 30rpx; //border: 2px solid blue; } } @@ -300,12 +345,12 @@ .list-right{ //border: 2px solid pink; color: royalblue; - font-size: 20px; + font-size: 40rpx; .list-right-icon{ //border: 2px solid gainsboro; - font-size: 25px; - margin-left: 15px; + font-size: 50rpx; + margin-left: 30rpx; } .list-right-text{ diff --git a/pages/scan/Barcode.vue b/pages/scan/Barcode.vue index 8e05d8f..aa8a2e8 100644 --- a/pages/scan/Barcode.vue +++ b/pages/scan/Barcode.vue @@ -27,6 +27,7 @@ - - diff --git a/pages/scan/Product.vue b/pages/scan/Product.vue index 914bddf..c90df10 100644 --- a/pages/scan/Product.vue +++ b/pages/scan/Product.vue @@ -27,6 +27,7 @@