diff --git a/App.vue b/App.vue index ce387d2..5241527 100644 --- a/App.vue +++ b/App.vue @@ -60,7 +60,7 @@ export default { }); // #endif }, - onHide: function () {}, + onHide: function () { }, methods: { initFn(data) { uni.hideLoading(); // 关闭 Loading @@ -115,8 +115,7 @@ export default { console.error("跳转失败", err); }, }); - } - if (role === "Admin") { + } else { const adminTabBar = [ { pagePath: "/pages/adminHome/index", diff --git a/pages/adminNfc/components/bindDialog.vue b/pages/adminNfc/components/bindDialog.vue index 3b84a7d..1aafc1b 100644 --- a/pages/adminNfc/components/bindDialog.vue +++ b/pages/adminNfc/components/bindDialog.vue @@ -18,7 +18,6 @@ 传入参数:{{ showMsg }} 接口返回结果:{{ resData }} - @@ -80,7 +79,7 @@ export default { mounted() { // window.nfcInitFn = this.nfcInitFn }, - onLoad() { }, + onLoad() {}, methods: { async nfcInitFn(data) { if (!data) { @@ -112,48 +111,50 @@ export default { this.step = 3 this.lookData = data const req = { - "AreaId": data.areaId, - "pwd": data.pwd, - "isAdd": this.isAdd, + AreaId: data.areaId, + pwd: data.pwd, + isAdd: this.isAdd // "isAdd": true, } - console.log(req, '重置nfc--req') - console.log(666); + // console.log(req, '重置nfc--req') + // console.log(666) // uni.showLoading({ title: '加载中...' }) const res = await ResetNFCApi(req).catch(e => e) if (!res.succeed) { uni.showToast({ title: res.error || '绑定失败', icon: 'none' }) } - this.resData = res; + this.resData = res + // 给安卓传参 + let u = navigator.userAgent + let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1 //android try { if (isAndroid && AndroidJs) { - console.log("%c%s", "color:red", "安卓--调用方法"); + console.log('%c%s', 'color:red', '安卓--调用方法') const reqRow = { - name: "resetNFCRes", - data: res, - }; + name: 'resetNFCRes', + data: res + } 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-----判断安卓苹果类型出错') } return // uni.hideLoading() console.log(res, '重置nfc') - this.resData = res; + this.resData = res if (res.succeed) { uni.showToast({ title: '绑定成功', icon: 'none' }) } else { - uni.showToast({ title: res.error || '绑定失败', icon: 'none' }) } return @@ -186,30 +187,30 @@ export default { this.step = 1 console.log(this.currentRow, 'this.currentRow--') // 给安卓传参 - 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 try { if (isAndroid && AndroidJs) { - console.log("%c%s", "color:red", "安卓--调用方法"); + console.log('%c%s', 'color:red', '安卓--调用方法') const reqRow = { - name: "area", + name: 'area', data: { // state: this.currentRow.state, state: true, - areaId: this.currentRow.id, - }, - }; - AndroidJs.func(JSON.stringify(reqRow)); // 给安卓传参 + areaId: this.currentRow.id + } + } + 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-----判断安卓苹果类型出错') } // this.$emit('changeBinding') // this.closeDialogInternal(); // 可以选择点击后是否关闭弹窗 @@ -230,10 +231,10 @@ export default { watch: { visible(newVal) { if (newVal) { - console.log('打开'); + console.log('打开') window.nfcInitFn = this.nfcInitFn } else { - console.log('关闭'); + console.log('关闭') // 清除 nfcInitFn 函数引用,避免内存泄漏 window.nfcInitFn = null } @@ -361,4 +362,5 @@ export default { /* 可以添加按钮按下的效果 */ // .confirm-button:active { // background-color: #4879e6; -// } +// } + diff --git a/pages/adminNfc/index.vue b/pages/adminNfc/index.vue index 78ed997..b5de389 100644 --- a/pages/adminNfc/index.vue +++ b/pages/adminNfc/index.vue @@ -232,6 +232,7 @@ export default { } } +