进出日志后台查询;小程序端进门;导出表格时日期转换
This commit is contained in:
@@ -49,7 +49,7 @@ Page({
|
||||
if (options && options.scene) {
|
||||
// 扫门禁的小程序码
|
||||
let scene = options.scene
|
||||
if (scene.startsWith("guard%")) { // scene.split('%')[0] == "guard"
|
||||
if (scene.startsWith("guard")) {
|
||||
options.scene = null // 清掉参数 避免重复触发
|
||||
wx.navigateTo({
|
||||
url: "/pages/scan/entrance?scene=" + scene
|
||||
|
||||
@@ -25,19 +25,22 @@ Page({
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
console.log(options)
|
||||
let scene = options.scene
|
||||
if (!scene) {
|
||||
wx.navigateBack()
|
||||
return
|
||||
}
|
||||
scene = decodeURIComponent(scene) // %26 == &
|
||||
if (scene.indexOf('&') == -1) {
|
||||
wx.navigateBack()
|
||||
console.log("entrance -> options", typeof (options), options)
|
||||
let scene = options.scene ? decodeURIComponent(options.scene) : undefined // %3B == ; %26 == &
|
||||
console.log("scene", options.scene, scene)
|
||||
if (!scene || scene.indexOf(';') == -1) {
|
||||
wx.showModal({
|
||||
title: '出错啦',
|
||||
content: '参数不正确' + JSON.stringify(options),
|
||||
showCancel: false,
|
||||
complete: (res) => {
|
||||
wx.navigateBack()
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
let gateId = scene.split('&')[1]
|
||||
let gateId = scene.split(';')[1]
|
||||
this.setData({
|
||||
gateId: gateId,
|
||||
});
|
||||
@@ -109,6 +112,13 @@ Page({
|
||||
})();
|
||||
},
|
||||
|
||||
enterGate: function () {
|
||||
(async () => {
|
||||
let enterGate = await gateService.enterGate(this.data.gateId, "IN")
|
||||
console.log("enterGate", enterGate)
|
||||
})();
|
||||
},
|
||||
|
||||
navigateBack: function () {
|
||||
wx.navigateBack()
|
||||
}
|
||||
|
||||
@@ -13,3 +13,18 @@ export function getGateDetail(id) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 进入大门 */
|
||||
export function enterGate(gateId, type) {
|
||||
let userInfo = wx.getStorageSync("userInfo")
|
||||
console.log("userId, gateId, type", userInfo.id, gateId, type)
|
||||
return send_request({
|
||||
url: '/access/access-log/miniprogram/enterGate',
|
||||
method: "GET",
|
||||
data: {
|
||||
userId: userInfo.id,
|
||||
gateId,
|
||||
type
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -5,12 +5,14 @@ function scanQRCode(wx) {
|
||||
success(res) {
|
||||
console.log(res)
|
||||
if (res.scanType == "WX_CODE" && res.path) {
|
||||
// console.log("res.path", res.path)
|
||||
// res.path pages/index/index?scene=guard;1758617522619420679
|
||||
let searchParams = res.path.split('?');
|
||||
if (searchParams.length > 1 && searchParams[1].startsWith('scene=guard')) {
|
||||
// let scene = searchParams[1].substring(searchParams[1].indexOf('='))
|
||||
console.log("searchParams", searchParams)
|
||||
let params = searchParams[1]
|
||||
console.log("searchParams", searchParams, "params", params)
|
||||
if (params && params.startsWith('scene=guard')) {
|
||||
wx.navigateTo({
|
||||
url: "/pages/scan/entrance?" + searchParams[1]
|
||||
url: "/pages/scan/entrance?" + params
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user