扫描二维码
This commit is contained in:
3
app.json
3
app.json
@@ -22,7 +22,8 @@
|
|||||||
"pages/sportsGroundList/index",
|
"pages/sportsGroundList/index",
|
||||||
"pages/userInfo/index",
|
"pages/userInfo/index",
|
||||||
"pages/loginIndex/index",
|
"pages/loginIndex/index",
|
||||||
"pages/withdrawal/index"
|
"pages/withdrawal/index",
|
||||||
|
"pages/scanCode/index"
|
||||||
],
|
],
|
||||||
"window": {
|
"window": {
|
||||||
"backgroundTextStyle": "dark",
|
"backgroundTextStyle": "dark",
|
||||||
|
|||||||
@@ -110,7 +110,9 @@ Page({
|
|||||||
}, err => {})
|
}, err => {})
|
||||||
},
|
},
|
||||||
fail: function(res) {
|
fail: function(res) {
|
||||||
wx.hideLoading()
|
wx.hideLoading({
|
||||||
|
complete: (complete) => {}
|
||||||
|
},1000);
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ let endM = 0;
|
|||||||
let address = [];
|
let address = [];
|
||||||
let zoom = 6;
|
let zoom = 6;
|
||||||
let mapCtx;
|
let mapCtx;
|
||||||
|
let scanVenue;
|
||||||
Page({
|
Page({
|
||||||
/**
|
/**
|
||||||
* 页面的初始数据
|
* 页面的初始数据
|
||||||
@@ -207,13 +208,17 @@ Page({
|
|||||||
sacnQRCode() {
|
sacnQRCode() {
|
||||||
wx.scanCode({
|
wx.scanCode({
|
||||||
success (res) {
|
success (res) {
|
||||||
wx.showToast({
|
// wx.showToast({
|
||||||
title: res.result,
|
// title: res.result,
|
||||||
icon: 'none',
|
// icon: 'none',
|
||||||
duration: 5000
|
// duration: 5000
|
||||||
})
|
// })qr
|
||||||
|
scanVenue = res.result;
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '/pages/scanCode/index?venueId=' + scanVenue,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
// 跳转个人中心
|
// 跳转个人中心
|
||||||
|
|||||||
130
pages/scanCode/index.js
Normal file
130
pages/scanCode/index.js
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
// pages/scanCode/index.js
|
||||||
|
const app = getApp();
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
venueId: undefined,
|
||||||
|
venue: {
|
||||||
|
|
||||||
|
},
|
||||||
|
isGoHome: false,
|
||||||
|
showDeleteDialog: false,
|
||||||
|
canOpen: true
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad: function (options) {
|
||||||
|
this.data.venueId = options.venueId;
|
||||||
|
app.$api.scanCodeInitVenue({
|
||||||
|
deviceId : this.data.venueId
|
||||||
|
}).then(res => {
|
||||||
|
if (res.venueInit){
|
||||||
|
this.setData({
|
||||||
|
venue: res.venueInit
|
||||||
|
})
|
||||||
|
setTimeout(canOpenDoor,60000);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady: function () {
|
||||||
|
let pages = getCurrentPages();
|
||||||
|
this.setData({
|
||||||
|
isGoHome: pages.length == 1
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow: function () {
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage: function () {
|
||||||
|
return {
|
||||||
|
title: '智慧云馆'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
enterClick : function(){
|
||||||
|
this.setData({
|
||||||
|
showDeleteDialog: true
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 取消弹框
|
||||||
|
cancelDialog() {
|
||||||
|
this.setData({
|
||||||
|
showDeleteDialog: false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 取消开门
|
||||||
|
canOpenDoor() {
|
||||||
|
this.setData({
|
||||||
|
canOpen: false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
confirmEnterDialog(){
|
||||||
|
this.setData({
|
||||||
|
showDeleteDialog: false
|
||||||
|
})
|
||||||
|
wx.showLoading({
|
||||||
|
title: '正在校验数据,请稍候。。。',
|
||||||
|
})
|
||||||
|
app.$api.enterVenue({
|
||||||
|
deviceId : this.data.venueId
|
||||||
|
}).then(res => {
|
||||||
|
if (res.err_code==0){
|
||||||
|
wx.showToast({
|
||||||
|
title: '请入场!'
|
||||||
|
});
|
||||||
|
}else {
|
||||||
|
canOpenDoor();
|
||||||
|
wx.showToast({
|
||||||
|
title: res.err_msg
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
6
pages/scanCode/index.json
Normal file
6
pages/scanCode/index.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"usingComponents": {
|
||||||
|
"confirm-dialog": "/component/confirmDialog/confirmDialog",
|
||||||
|
"header": "/component/header/header"
|
||||||
|
}
|
||||||
|
}
|
||||||
12
pages/scanCode/index.wxml
Normal file
12
pages/scanCode/index.wxml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<!--pages/scanCode/index.wxml-->
|
||||||
|
<header isGoHome="{{isGoHome}}"></header>
|
||||||
|
<view class='container' wx:if="{{venue.name}}">
|
||||||
|
<image class='logo' src='{{venue.listImage}}' mode='widthFix'></image>
|
||||||
|
<rich-text class='info' nodes="[{{venue.name}}] 欢迎您!请在60秒内操作开门!"></rich-text>
|
||||||
|
<view wx:if="{{canOpen}}" class='footer-btn' bindtap='enterClick'>开门</view>
|
||||||
|
<view wx:if="{{!canOpen}}" class='footer-btn' bindtap='enterClick'>返回</view>
|
||||||
|
</view>
|
||||||
|
<view class='container' wx:if="{{!venue.name}}">
|
||||||
|
<rich-text class='info' nodes="门禁设备连接异常,请联系管理员!"></rich-text>
|
||||||
|
</view>
|
||||||
|
<confirm-dialog title="{{'提示'}}" message="{{'确认开门'}}" bindcancelselect="cancelDialog" bindconfirmselect="confirmEnterDialog" wx:if="{{showDeleteDialog}}"></confirm-dialog>
|
||||||
35
pages/scanCode/index.wxss
Normal file
35
pages/scanCode/index.wxss
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
/* pages/scanCode/index.wxss */
|
||||||
|
.container {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 180rpx 50rpx 50rpx;
|
||||||
|
min-height: calc(100vh - 240rpx);
|
||||||
|
}
|
||||||
|
.logo {
|
||||||
|
width: 400rpx;
|
||||||
|
height: 100rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info {
|
||||||
|
margin-top: 60rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #FFF;
|
||||||
|
line-height: 36rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wscnph {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer-btn {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100rpx;
|
||||||
|
background: #ffda2e;
|
||||||
|
color: #1a191e;
|
||||||
|
font-size: 32rpx;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 100rpx;
|
||||||
|
}
|
||||||
@@ -46,11 +46,15 @@
|
|||||||
"current": -1,
|
"current": -1,
|
||||||
"list": []
|
"list": []
|
||||||
},
|
},
|
||||||
|
"plugin": {
|
||||||
|
"current": -1,
|
||||||
|
"list": []
|
||||||
|
},
|
||||||
"game": {
|
"game": {
|
||||||
"currentL": -1,
|
"currentL": -1,
|
||||||
"list": []
|
"list": []
|
||||||
},
|
},
|
||||||
"miniprogram": {
|
"gamePlugin": {
|
||||||
"current": -1,
|
"current": -1,
|
||||||
"list": []
|
"list": []
|
||||||
}
|
}
|
||||||
|
|||||||
67
utils/api.js
67
utils/api.js
@@ -1,7 +1,8 @@
|
|||||||
//testURL
|
//testURL
|
||||||
// const BASE_URL = 'https://lmqhznn.goho.co';
|
const BASE_URL = 'https://lmqhznn.goho.co';
|
||||||
|
// const BASE_URL = 'http://120.27.209.4:8093';
|
||||||
//prodURL
|
//prodURL
|
||||||
const BASE_URL = 'https://api.hongyutiyu.top';
|
// const BASE_URL = 'https://api.hongyutiyu.top';
|
||||||
// const platformId = 1;
|
// const platformId = 1;
|
||||||
import {
|
import {
|
||||||
getCurrentPageUrl
|
getCurrentPageUrl
|
||||||
@@ -74,7 +75,9 @@ export function fetchPost(url, params, needToken, multiple) {
|
|||||||
} else if (res.err_code == 20005) {
|
} else if (res.err_code == 20005) {
|
||||||
wx.removeStorageSync('accessToken');
|
wx.removeStorageSync('accessToken');
|
||||||
wx.removeStorageSync('history');
|
wx.removeStorageSync('history');
|
||||||
wx.hideLoading();
|
wx.hideLoading({
|
||||||
|
complete: (complete) => {}
|
||||||
|
},1000);
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: res.err_msg,
|
title: res.err_msg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
@@ -82,7 +85,9 @@ export function fetchPost(url, params, needToken, multiple) {
|
|||||||
})
|
})
|
||||||
reject(res);
|
reject(res);
|
||||||
} else {
|
} else {
|
||||||
wx.hideLoading();
|
wx.hideLoading({
|
||||||
|
complete: (complete) => {}
|
||||||
|
},1000);
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: res.err_msg,
|
title: res.err_msg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
@@ -92,7 +97,9 @@ export function fetchPost(url, params, needToken, multiple) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
wx.hideLoading();
|
wx.hideLoading({
|
||||||
|
complete: (complete) => {}
|
||||||
|
},1000);
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '网络错误',
|
title: '网络错误',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
@@ -102,7 +109,9 @@ export function fetchPost(url, params, needToken, multiple) {
|
|||||||
},
|
},
|
||||||
fail: function(err) {
|
fail: function(err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
wx.hideLoading();
|
wx.hideLoading({
|
||||||
|
complete: (complete) => {}
|
||||||
|
},1000);
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '网络错误',
|
title: '网络错误',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
@@ -125,7 +134,9 @@ export function fetchPost(url, params, needToken, multiple) {
|
|||||||
success: function(res) {
|
success: function(res) {
|
||||||
console.log("POST返回数据", url,res);
|
console.log("POST返回数据", url,res);
|
||||||
if (res.data.err_code == 0) {
|
if (res.data.err_code == 0) {
|
||||||
wx.hideLoading();
|
wx.hideLoading({
|
||||||
|
complete: (complete) => {}
|
||||||
|
},1000);
|
||||||
resolve(res.data);
|
resolve(res.data);
|
||||||
} else {
|
} else {
|
||||||
if (res.data.err_code == 10003 || res.data.err_code == 10006 || res.data.err_code == 20006) {
|
if (res.data.err_code == 10003 || res.data.err_code == 10006 || res.data.err_code == 20006) {
|
||||||
@@ -141,7 +152,9 @@ export function fetchPost(url, params, needToken, multiple) {
|
|||||||
} else if (res.data.err_code == 20005) {
|
} else if (res.data.err_code == 20005) {
|
||||||
wx.removeStorageSync('accessToken');
|
wx.removeStorageSync('accessToken');
|
||||||
wx.removeStorageSync('history');
|
wx.removeStorageSync('history');
|
||||||
wx.hideLoading();
|
wx.hideLoading({
|
||||||
|
complete: (complete) => {}
|
||||||
|
},1000);
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: res.data.err_msg,
|
title: res.data.err_msg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
@@ -149,7 +162,9 @@ export function fetchPost(url, params, needToken, multiple) {
|
|||||||
})
|
})
|
||||||
reject(res);
|
reject(res);
|
||||||
} else {
|
} else {
|
||||||
wx.hideLoading();
|
wx.hideLoading({
|
||||||
|
complete: (complete) => {}
|
||||||
|
},1000);
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: res.data.err_msg,
|
title: res.data.err_msg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
@@ -161,7 +176,9 @@ export function fetchPost(url, params, needToken, multiple) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail: function(res) {
|
fail: function(res) {
|
||||||
wx.hideLoading();
|
wx.hideLoading({
|
||||||
|
complete: (complete) => {}
|
||||||
|
},1000);
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '网络错误',
|
title: '网络错误',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
@@ -194,7 +211,9 @@ export function fetchGet(url, params, needToken) {
|
|||||||
console.log("GET返回数据", url, res);
|
console.log("GET返回数据", url, res);
|
||||||
if (res.statusCode == 200) {
|
if (res.statusCode == 200) {
|
||||||
if (res.data.err_code == 0) {
|
if (res.data.err_code == 0) {
|
||||||
wx.hideLoading();
|
wx.hideLoading({
|
||||||
|
complete: (complete) => {}
|
||||||
|
},1000);
|
||||||
resolve(res.data);
|
resolve(res.data);
|
||||||
} else {
|
} else {
|
||||||
if (res.data.err_code == 10003 || res.data.err_code == 10006 || res.data.err_code == 20006) {
|
if (res.data.err_code == 10003 || res.data.err_code == 10006 || res.data.err_code == 20006) {
|
||||||
@@ -204,7 +223,9 @@ export function fetchGet(url, params, needToken) {
|
|||||||
} else if (res.data.err_code == 20005) {
|
} else if (res.data.err_code == 20005) {
|
||||||
wx.removeStorageSync('accessToken');
|
wx.removeStorageSync('accessToken');
|
||||||
wx.removeStorageSync('history');
|
wx.removeStorageSync('history');
|
||||||
wx.hideLoading();
|
wx.hideLoading({
|
||||||
|
complete: (complete) => {}
|
||||||
|
},1000);
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: res.data.err_msg,
|
title: res.data.err_msg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
@@ -212,7 +233,9 @@ export function fetchGet(url, params, needToken) {
|
|||||||
})
|
})
|
||||||
reject(res);
|
reject(res);
|
||||||
} else {
|
} else {
|
||||||
wx.hideLoading();
|
wx.hideLoading({
|
||||||
|
complete: (complete) => {}
|
||||||
|
},1000);
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: res.data.err_msg,
|
title: res.data.err_msg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
@@ -222,7 +245,9 @@ export function fetchGet(url, params, needToken) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
wx.hideLoading();
|
wx.hideLoading({
|
||||||
|
complete: (complete) => {}
|
||||||
|
},1000);
|
||||||
reject(res)
|
reject(res)
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '网络错误',
|
title: '网络错误',
|
||||||
@@ -232,7 +257,9 @@ export function fetchGet(url, params, needToken) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail: function(res) {
|
fail: function(res) {
|
||||||
wx.hideLoading();
|
wx.hideLoading({
|
||||||
|
complete: (complete) => {}
|
||||||
|
},1000);
|
||||||
reject(res)
|
reject(res)
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '网络错误',
|
title: '网络错误',
|
||||||
@@ -431,5 +458,15 @@ export default {
|
|||||||
// 已用手机号登录,支付,再跳转微信登录
|
// 已用手机号登录,支付,再跳转微信登录
|
||||||
memberLoginCheckWx(params) {
|
memberLoginCheckWx(params) {
|
||||||
return fetchPost('/member/login/checkWx', params, true);
|
return fetchPost('/member/login/checkWx', params, true);
|
||||||
|
},
|
||||||
|
// 初始化扫描进场逻辑
|
||||||
|
scanCodeInitVenue(params) {
|
||||||
|
return fetchGet('/qrCode/init',params,true);
|
||||||
|
},
|
||||||
|
|
||||||
|
// 用户发起开门逻辑
|
||||||
|
enterVenue(params) {
|
||||||
|
return fetchGet('/qrCode/enter',params,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user