[门禁端&后端&小程序] 完成门禁端;完成小程序扫码跳转页面;完成后端获取不限制的小程序场景码接口
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
</view>
|
||||
<button type="primary" size="mini" @tap="toggleDot('code', true)">显示小红点</button>
|
||||
<button type="primary" size="mini" @tap="toggleDot('code', false)">隐藏小红点</button>
|
||||
<button type="warn" size="mini" @tap="magicButton">魔法按钮</button>
|
||||
<DebugComp :params="debugObject" :userGroup="userGroup" />
|
||||
</view>
|
||||
</template>
|
||||
@@ -51,13 +52,13 @@ export default {
|
||||
|
||||
onLoad() {
|
||||
// 开发模式下自动跳转到指定页面,节省开发时间
|
||||
if (this.debugMode) {
|
||||
Taro.switchTab({ url: '/pages/residents/report' })
|
||||
}
|
||||
// if (this.debugMode) {
|
||||
// Taro.switchTab({ url: '/pages/residents/report' })
|
||||
// }
|
||||
},
|
||||
|
||||
onShow() {
|
||||
console.log('onShow')
|
||||
onShow(options) {
|
||||
console.log('onShow', options)
|
||||
console.log("menuItemDict", menuItemDict)
|
||||
this.userInfo = Taro.getStorageSync("userInfo");
|
||||
this.displayUsername = this.userInfo?.username ?? "请登录";
|
||||
@@ -67,8 +68,21 @@ export default {
|
||||
url: '/pages/index/login'
|
||||
})
|
||||
} else {
|
||||
// 用户已登录
|
||||
this.userGroup = getUserGroupByRole(this.userInfo.role);
|
||||
this.debugObject = { userGroup: this.userGroup };
|
||||
|
||||
//判断用户是否是通过扫小程序码进来的
|
||||
let launchParams = Taro.getCurrentInstance().router.params;
|
||||
if (launchParams.scene) {
|
||||
// 扫门禁的小程序码
|
||||
if (launchParams.scene.split('%')[0] == "guard") {
|
||||
Taro.getCurrentInstance().router.params.scene = null;
|
||||
Taro.navigateTo({
|
||||
url: "/pages/scan/entrance"
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -92,6 +106,11 @@ export default {
|
||||
},
|
||||
toggleDot(iconName, status = true) {
|
||||
this.menuItemDict[iconName].addDot = status;
|
||||
},
|
||||
magicButton() {
|
||||
Taro.navigateTo({
|
||||
url: "/pages/scan/entrance"
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -28,3 +28,9 @@
|
||||
color: grey;
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
#scan-btn {
|
||||
margin-top: 50px;
|
||||
padding: 9px 60px;
|
||||
font-size: initial;
|
||||
}
|
||||
|
@@ -5,6 +5,8 @@
|
||||
<canvas type="2d" style="width: 250px; height: 250px;" id="myQrcode"></canvas>
|
||||
<view id="show-text"><text :style="{ color: showTextColor }">{{ showText }}</text></view>
|
||||
<view id="small-text"><text>下拉可刷新</text></view>
|
||||
|
||||
<button id="scan-btn" size="mini" @tap="scan">扫门禁码</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -12,6 +14,7 @@
|
||||
import Taro from '@tarojs/taro'
|
||||
import md5 from 'blueimp-md5'
|
||||
import drawQrcode from '../../utils/qrcode/index'
|
||||
import scanQRCode from '../../utils/scanQRCode'
|
||||
import utils from '../../utils/utils'
|
||||
|
||||
import './code.css'
|
||||
@@ -158,6 +161,9 @@ export default {
|
||||
updateTime() {
|
||||
this.time = utils.formatTime(new Date())
|
||||
console.log("刷新时间")
|
||||
},
|
||||
scan() {
|
||||
scanQRCode(Taro)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
3
miniprogram/src/pages/scan/entrance.config.js
Normal file
3
miniprogram/src/pages/scan/entrance.config.js
Normal file
@@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '进入社区',
|
||||
})
|
38
miniprogram/src/pages/scan/entrance.vue
Normal file
38
miniprogram/src/pages/scan/entrance.vue
Normal file
@@ -0,0 +1,38 @@
|
||||
<template>
|
||||
<view>
|
||||
您将要进入社区
|
||||
<textarea maxlength="-1" disabled="true" auto-height="true" style="width: 100%" :value="debugText"></textarea>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Taro from '@tarojs/taro'
|
||||
import utils from '../../utils/utils'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
...Taro.getApp().globalData,
|
||||
userInfo: null,
|
||||
scene: null,
|
||||
debugText: JSON.stringify(Taro.getCurrentInstance().router, null, 4),
|
||||
}
|
||||
},
|
||||
|
||||
onLaunch(option) {
|
||||
console.log("onLaunch", option);
|
||||
},
|
||||
|
||||
onShow() {
|
||||
console.log('onShow')
|
||||
this.userInfo = Taro.getStorageSync("userInfo")
|
||||
},
|
||||
|
||||
onHide() {
|
||||
console.log('onHide')
|
||||
},
|
||||
|
||||
methods: {
|
||||
}
|
||||
}
|
||||
</script>
|
Reference in New Issue
Block a user