Compare commits

4 Commits

Author SHA1 Message Date
limqhz
b07f61006c fixbug 2021-02-25 08:57:16 +08:00
limqhz
798893e65d 扫描二维码时效fix 2020-08-30 21:31:11 +08:00
limqhz
4d11ab9c79 扫描二维码时效fix 2020-08-30 18:40:18 +08:00
limqhz
311055815a 扫描二维码 2020-08-30 16:44:35 +08:00
9 changed files with 327 additions and 79 deletions

View File

@@ -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",

View File

@@ -110,7 +110,9 @@ Page({
}, err => {})
},
fail: function(res) {
wx.hideLoading()
wx.hideLoading({
complete: (complete) => {}
},1000);
},
})
},

View File

@@ -1,4 +1,7 @@
// pages/home/index.js
import {
getCurrentPageUrl
} from './../../utils/util.js'
const app = getApp();
let s = '';
let m = 0;
@@ -6,6 +9,7 @@ let endM = 0;
let address = [];
let zoom = 6;
let mapCtx;
let scanVenue;
Page({
/**
* 页面的初始数据
@@ -205,15 +209,27 @@ Page({
//扫描二维码
sacnQRCode() {
if (!wx.getStorageSync('accessToken')) {
wx.setStorageSync('history', getCurrentPageUrl());
wx.redirectTo({
url: '/pages/login/index',
})
return
}
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;
console.log(res.result);
wx.navigateTo({
url: '/pages/scanCode/index?venueId=' + scanVenue,
})
}
})
});
},
// 跳转个人中心

136
pages/scanCode/index.js Normal file
View File

@@ -0,0 +1,136 @@
// pages/scanCode/index.js
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
venueId: undefined,
canOpen: true,
venue: {
},
isGoHome: false,
showDeleteDialog: false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.data.venueId = options.venueId;
app.$api.scanCodeInitVenue({
deviceId : this.data.venueId
}).then(res => {
var that = this;
if (res.venueInit){
this.setData({
venue: res.venueInit
}),
setTimeout(function() {
that.setData({canOpen : false});
},60000);
}else if (res.InitError!=undefined){
this.setData({
venue: res
});
}
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
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
})
},
backClick : function(){
wx.redirectTo({
url: '/pages/home/index',
})
},
// 取消弹框
cancelDialog() {
this.setData({
showDeleteDialog: 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 {
wx.showToast({
title: res.err_msg
});
}
this.setData({canOpen : false});
});
}
})

View File

@@ -0,0 +1,6 @@
{
"usingComponents": {
"confirm-dialog": "/component/confirmDialog/confirmDialog",
"header": "/component/header/header"
}
}

10
pages/scanCode/index.wxml Normal file
View File

@@ -0,0 +1,10 @@
<!--pages/scanCode/index.wxml-->
<header isGoHome="{{isGoHome}}"></header>
<view class='container' wx:if="{{venue}}">
<rich-text wx:if="{{!venue.venueInit}}" class='info' nodes="{{venue.InitError}}"></rich-text>
<image class='logo' src='{{venue.listImage}}' mode='widthFix'></image>
<rich-text wx:if="{{venue.name}}" class='info' nodes="[{{venue.name}}] 欢迎您!请在60秒内操作开门"></rich-text>
<view wx:if="{{canOpen==true}}" class='footer-btn' bindtap='enterClick'>开门</view>
<view wx:if="{{canOpen==false}}" class='footer-btn' bindtap='backClick'>返回</view>
</view>
<confirm-dialog title="{{'提示'}}" message="{{'确认开门'}}" bindcancelselect="cancelDialog" bindconfirmselect="confirmEnterDialog" wx:if="{{showDeleteDialog}}"></confirm-dialog>

35
pages/scanCode/index.wxss Normal file
View 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;
}

View File

@@ -1,58 +1,64 @@
{
"description": "项目配置文件。",
"packOptions": {
"ignore": []
},
"setting": {
"urlCheck": false,
"es6": true,
"enhance": false,
"postcss": true,
"preloadBackgroundData": false,
"minified": true,
"newFeature": true,
"coverView": true,
"nodeModules": false,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"useIsolateContext": true,
"useCompilerModule": true,
"userConfirmedUseCompilerModuleSwitch": false
},
"compileType": "miniprogram",
"libVersion": "2.10.2",
"appid": "wx73eb8a9ed10a029d",
"projectname": "%E6%99%BA%E6%85%A7%E4%BA%91%E9%A6%86",
"isGameTourist": false,
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": {
"search": {
"current": -1,
"list": []
},
"conversation": {
"current": -1,
"list": []
},
"game": {
"currentL": -1,
"list": []
},
"miniprogram": {
"current": -1,
"list": []
}
}
"description": "项目配置文件。",
"packOptions": {
"ignore": []
},
"setting": {
"urlCheck": false,
"es6": true,
"enhance": false,
"postcss": true,
"preloadBackgroundData": false,
"minified": true,
"newFeature": true,
"coverView": true,
"nodeModules": false,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"useMultiFrameRuntime": false,
"useApiHook": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"enableEngineNative": false,
"useIsolateContext": true,
"useCompilerModule": false,
"userConfirmedUseCompilerModuleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": [],
"minifyWXSS": true
},
"compileType": "miniprogram",
"libVersion": "2.10.2",
"appid": "wx73eb8a9ed10a029d",
"projectname": "%E6%99%BA%E6%85%A7%E4%BA%91%E9%A6%86",
"isGameTourist": false,
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": {
"search": {
"list": []
},
"conversation": {
"list": []
},
"plugin": {
"list": []
},
"game": {
"currentL": -1,
"list": []
},
"gamePlugin": {
"list": []
}
}
}

View File

@@ -1,7 +1,7 @@
//testURL
// const BASE_URL = 'https://lmqhznn.goho.co';
const BASE_URL = 'https://lmqhznn.goho.co';
//prodURL
const BASE_URL = 'https://api.hongyutiyu.top';
// const BASE_URL = 'https://api.hongyutiyu.top';
// const platformId = 1;
import {
getCurrentPageUrl
@@ -74,7 +74,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 +84,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 +96,9 @@ export function fetchPost(url, params, needToken, multiple) {
}
}
} else {
wx.hideLoading();
wx.hideLoading({
complete: (complete) => {}
},1000);
wx.showToast({
title: '网络错误',
icon: 'none',
@@ -102,7 +108,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 +133,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 +151,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 +161,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 +175,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 +210,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 +222,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 +232,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 +244,9 @@ export function fetchGet(url, params, needToken) {
}
}
} else {
wx.hideLoading();
wx.hideLoading({
complete: (complete) => {}
},1000);
reject(res)
wx.showToast({
title: '网络错误',
@@ -232,7 +256,9 @@ export function fetchGet(url, params, needToken) {
}
},
fail: function(res) {
wx.hideLoading();
wx.hideLoading({
complete: (complete) => {}
},1000);
reject(res)
wx.showToast({
title: '网络错误',
@@ -431,5 +457,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);
}
}