diff --git a/app.json b/app.json
index 7bed22d..67e5bda 100644
--- a/app.json
+++ b/app.json
@@ -22,7 +22,8 @@
"pages/sportsGroundList/index",
"pages/userInfo/index",
"pages/loginIndex/index",
- "pages/withdrawal/index"
+ "pages/withdrawal/index",
+ "pages/scanCode/index"
],
"window": {
"backgroundTextStyle": "dark",
diff --git a/pages/facialCapturing/index.js b/pages/facialCapturing/index.js
index 622547a..cbbb02c 100644
--- a/pages/facialCapturing/index.js
+++ b/pages/facialCapturing/index.js
@@ -110,7 +110,9 @@ Page({
}, err => {})
},
fail: function(res) {
- wx.hideLoading()
+ wx.hideLoading({
+ complete: (complete) => {}
+ },1000);
},
})
},
diff --git a/pages/home/index.js b/pages/home/index.js
index c2600b9..bc7cd58 100644
--- a/pages/home/index.js
+++ b/pages/home/index.js
@@ -6,6 +6,7 @@ let endM = 0;
let address = [];
let zoom = 6;
let mapCtx;
+let scanVenue;
Page({
/**
* 页面的初始数据
@@ -207,13 +208,17 @@ Page({
sacnQRCode() {
wx.scanCode({
success (res) {
- wx.showToast({
- title: res.result,
- icon: 'none',
- duration: 5000
- })
+ // wx.showToast({
+ // title: res.result,
+ // icon: 'none',
+ // duration: 5000
+ // })qr
+ scanVenue = res.result;
+ wx.navigateTo({
+ url: '/pages/scanCode/index?venueId=' + scanVenue,
+ })
}
- })
+ });
},
// 跳转个人中心
diff --git a/pages/scanCode/index.js b/pages/scanCode/index.js
new file mode 100644
index 0000000..3b20f7e
--- /dev/null
+++ b/pages/scanCode/index.js
@@ -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
+ });
+ }
+ });
+ }
+
+})
\ No newline at end of file
diff --git a/pages/scanCode/index.json b/pages/scanCode/index.json
new file mode 100644
index 0000000..106588a
--- /dev/null
+++ b/pages/scanCode/index.json
@@ -0,0 +1,6 @@
+{
+ "usingComponents": {
+ "confirm-dialog": "/component/confirmDialog/confirmDialog",
+ "header": "/component/header/header"
+ }
+}
\ No newline at end of file
diff --git a/pages/scanCode/index.wxml b/pages/scanCode/index.wxml
new file mode 100644
index 0000000..c4f0fa0
--- /dev/null
+++ b/pages/scanCode/index.wxml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/scanCode/index.wxss b/pages/scanCode/index.wxss
new file mode 100644
index 0000000..6667de2
--- /dev/null
+++ b/pages/scanCode/index.wxss
@@ -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;
+}
\ No newline at end of file
diff --git a/project.config.json b/project.config.json
index 9114597..44b08e1 100644
--- a/project.config.json
+++ b/project.config.json
@@ -46,11 +46,15 @@
"current": -1,
"list": []
},
+ "plugin": {
+ "current": -1,
+ "list": []
+ },
"game": {
"currentL": -1,
"list": []
},
- "miniprogram": {
+ "gamePlugin": {
"current": -1,
"list": []
}
diff --git a/utils/api.js b/utils/api.js
index fce4df9..653a659 100644
--- a/utils/api.js
+++ b/utils/api.js
@@ -1,7 +1,8 @@
//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
-const BASE_URL = 'https://api.hongyutiyu.top';
+// const BASE_URL = 'https://api.hongyutiyu.top';
// const platformId = 1;
import {
getCurrentPageUrl
@@ -74,7 +75,9 @@ export function fetchPost(url, params, needToken, multiple) {
} else if (res.err_code == 20005) {
wx.removeStorageSync('accessToken');
wx.removeStorageSync('history');
- wx.hideLoading();
+ wx.hideLoading({
+ complete: (complete) => {}
+ },1000);
wx.showToast({
title: res.err_msg,
icon: 'none',
@@ -82,7 +85,9 @@ export function fetchPost(url, params, needToken, multiple) {
})
reject(res);
} else {
- wx.hideLoading();
+ wx.hideLoading({
+ complete: (complete) => {}
+ },1000);
wx.showToast({
title: res.err_msg,
icon: 'none',
@@ -92,7 +97,9 @@ export function fetchPost(url, params, needToken, multiple) {
}
}
} else {
- wx.hideLoading();
+ wx.hideLoading({
+ complete: (complete) => {}
+ },1000);
wx.showToast({
title: '网络错误',
icon: 'none',
@@ -102,7 +109,9 @@ export function fetchPost(url, params, needToken, multiple) {
},
fail: function(err) {
console.log(err);
- wx.hideLoading();
+ wx.hideLoading({
+ complete: (complete) => {}
+ },1000);
wx.showToast({
title: '网络错误',
icon: 'none',
@@ -125,7 +134,9 @@ export function fetchPost(url, params, needToken, multiple) {
success: function(res) {
console.log("POST返回数据", url,res);
if (res.data.err_code == 0) {
- wx.hideLoading();
+ wx.hideLoading({
+ complete: (complete) => {}
+ },1000);
resolve(res.data);
} else {
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) {
wx.removeStorageSync('accessToken');
wx.removeStorageSync('history');
- wx.hideLoading();
+ wx.hideLoading({
+ complete: (complete) => {}
+ },1000);
wx.showToast({
title: res.data.err_msg,
icon: 'none',
@@ -149,7 +162,9 @@ export function fetchPost(url, params, needToken, multiple) {
})
reject(res);
} else {
- wx.hideLoading();
+ wx.hideLoading({
+ complete: (complete) => {}
+ },1000);
wx.showToast({
title: res.data.err_msg,
icon: 'none',
@@ -161,7 +176,9 @@ export function fetchPost(url, params, needToken, multiple) {
}
},
fail: function(res) {
- wx.hideLoading();
+ wx.hideLoading({
+ complete: (complete) => {}
+ },1000);
wx.showToast({
title: '网络错误',
icon: 'none',
@@ -194,7 +211,9 @@ export function fetchGet(url, params, needToken) {
console.log("GET返回数据", url, res);
if (res.statusCode == 200) {
if (res.data.err_code == 0) {
- wx.hideLoading();
+ wx.hideLoading({
+ complete: (complete) => {}
+ },1000);
resolve(res.data);
} else {
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) {
wx.removeStorageSync('accessToken');
wx.removeStorageSync('history');
- wx.hideLoading();
+ wx.hideLoading({
+ complete: (complete) => {}
+ },1000);
wx.showToast({
title: res.data.err_msg,
icon: 'none',
@@ -212,7 +233,9 @@ export function fetchGet(url, params, needToken) {
})
reject(res);
} else {
- wx.hideLoading();
+ wx.hideLoading({
+ complete: (complete) => {}
+ },1000);
wx.showToast({
title: res.data.err_msg,
icon: 'none',
@@ -222,7 +245,9 @@ export function fetchGet(url, params, needToken) {
}
}
} else {
- wx.hideLoading();
+ wx.hideLoading({
+ complete: (complete) => {}
+ },1000);
reject(res)
wx.showToast({
title: '网络错误',
@@ -232,7 +257,9 @@ export function fetchGet(url, params, needToken) {
}
},
fail: function(res) {
- wx.hideLoading();
+ wx.hideLoading({
+ complete: (complete) => {}
+ },1000);
reject(res)
wx.showToast({
title: '网络错误',
@@ -431,5 +458,15 @@ export default {
// 已用手机号登录,支付,再跳转微信登录
memberLoginCheckWx(params) {
return fetchPost('/member/login/checkWx', params, true);
+ },
+ // 初始化扫描进场逻辑
+ scanCodeInitVenue(params) {
+ return fetchGet('/qrCode/init',params,true);
+ },
+
+ // 用户发起开门逻辑
+ enterVenue(params) {
+ return fetchGet('/qrCode/enter',params,true);
}
+
}
\ No newline at end of file