From ec5165021e2f7ef957a23cf8a408746664bcd305 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=BD=AA?= Date: Tue, 29 Apr 2025 16:02:02 +0800 Subject: [PATCH] =?UTF-8?q?nfc=E5=8D=A1=E5=86=99=E5=85=A5=E6=9D=83?= =?UTF-8?q?=E9=99=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 165 ++++++++++++----------- pages/adminNfc/components/bindDialog.vue | 4 + pages/adminNfc/index.vue | 39 +++--- pages/login/login.vue | 3 + 4 files changed, 109 insertions(+), 102 deletions(-) diff --git a/App.vue b/App.vue index 5241527..c02d13d 100644 --- a/App.vue +++ b/App.vue @@ -1,31 +1,31 @@ diff --git a/pages/adminNfc/components/bindDialog.vue b/pages/adminNfc/components/bindDialog.vue index c51e136..8433cbc 100644 --- a/pages/adminNfc/components/bindDialog.vue +++ b/pages/adminNfc/components/bindDialog.vue @@ -82,6 +82,10 @@ export default { onLoad() {}, methods: { async nfcInitFn(data) { + if(this.vuex_userData.nfcwrite !== 'True'){ + uni.showToast({ title: '暂无NFC卡写入权限', icon: 'none' }) + return + } if (!data) { uni.showToast({ title: '未传入参数nfcInitFn', icon: 'none' }) return diff --git a/pages/adminNfc/index.vue b/pages/adminNfc/index.vue index b5de389..8675544 100644 --- a/pages/adminNfc/index.vue +++ b/pages/adminNfc/index.vue @@ -12,12 +12,10 @@ - + - + @@ -45,8 +43,7 @@ - + @@ -114,35 +111,37 @@ export default { }, methods: { dialogShowFn(row) { + // console.log(this.vuex_userData.nfcwrite) + // return // 给安卓传参 - let u = navigator.userAgent; - let isAndroid = u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android + let u = navigator.userAgent + let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1 //android console.log(row.state, 'row.state--') // 添加的时候给安卓传参 if (row.state === false) { try { if (isAndroid && AndroidJs) { - console.log("%c%s", "color:red", "安卓--调用方法"); + console.log('%c%s', 'color:red', '安卓--调用方法') const reqRow = { - name: "area", + name: 'area', data: { // state: row.state, state: true, - areaId: row.id, - }, - }; + areaId: row.id + } + } console.log(reqRow, 'reqRow--') - AndroidJs.func(JSON.stringify(reqRow)); // 给安卓传参 + AndroidJs.func(JSON.stringify(reqRow)) // 给安卓传参 } else { - console.log("%c%s", "color:red", "苹果--调用方法"); + console.log('%c%s', 'color:red', '苹果--调用方法') const reqRow = { - name: "back-iphone", - data: "", - }; - window.webkit.messageHandlers.func.postMessage(JSON.stringify(reqRow)); // 给ios 传参 + name: 'back-iphone', + data: '' + } + window.webkit.messageHandlers.func.postMessage(JSON.stringify(reqRow)) // 给ios 传参 } } catch (e) { - console.log(e, "e-----判断安卓苹果类型出错"); + console.log(e, 'e-----判断安卓苹果类型出错') } } diff --git a/pages/login/login.vue b/pages/login/login.vue index 6f4a330..4f6a745 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -77,6 +77,9 @@ export default { let token = res.data uni.setStorageSync('token', 'Bearer ' + token) console.log(jwtDecode(token), '解析的token信息') + let resData = jwtDecode(token) + this.$u.vuex('vuex_userData', resData) + console.log(this.vuex_userData, 'vuex_userData') // return console.log(type, 'type--') if (type === 'user') {