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

View File

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

View File

@@ -1,4 +1,7 @@
// pages/home/index.js // pages/home/index.js
import {
getCurrentPageUrl
} from './../../utils/util.js'
const app = getApp(); const app = getApp();
let s = ''; let s = '';
let m = 0; let m = 0;
@@ -6,6 +9,7 @@ let endM = 0;
let address = []; let address = [];
let zoom = 6; let zoom = 6;
let mapCtx; let mapCtx;
let scanVenue;
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
@@ -205,15 +209,27 @@ Page({
//扫描二维码 //扫描二维码
sacnQRCode() { sacnQRCode() {
if (!wx.getStorageSync('accessToken')) {
wx.setStorageSync('history', getCurrentPageUrl());
wx.redirectTo({
url: '/pages/login/index',
})
return
}
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;
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": "项目配置文件。", "description": "项目配置文件。",
"packOptions": { "packOptions": {
"ignore": [] "ignore": []
}, },
"setting": { "setting": {
"urlCheck": false, "urlCheck": false,
"es6": true, "es6": true,
"enhance": false, "enhance": false,
"postcss": true, "postcss": true,
"preloadBackgroundData": false, "preloadBackgroundData": false,
"minified": true, "minified": true,
"newFeature": true, "newFeature": true,
"coverView": true, "coverView": true,
"nodeModules": false, "nodeModules": false,
"autoAudits": false, "autoAudits": false,
"showShadowRootInWxmlPanel": true, "showShadowRootInWxmlPanel": true,
"scopeDataCheck": false, "scopeDataCheck": false,
"uglifyFileName": false, "uglifyFileName": false,
"checkInvalidKey": true, "checkInvalidKey": true,
"checkSiteMap": true, "checkSiteMap": true,
"uploadWithSourceMap": true, "uploadWithSourceMap": true,
"compileHotReLoad": false, "compileHotReLoad": false,
"babelSetting": { "useMultiFrameRuntime": false,
"ignore": [], "useApiHook": true,
"disablePlugins": [], "babelSetting": {
"outputPath": "" "ignore": [],
}, "disablePlugins": [],
"useIsolateContext": true, "outputPath": ""
"useCompilerModule": true, },
"userConfirmedUseCompilerModuleSwitch": false "enableEngineNative": false,
}, "useIsolateContext": true,
"compileType": "miniprogram", "useCompilerModule": false,
"libVersion": "2.10.2", "userConfirmedUseCompilerModuleSwitch": false,
"appid": "wx73eb8a9ed10a029d", "packNpmManually": false,
"projectname": "%E6%99%BA%E6%85%A7%E4%BA%91%E9%A6%86", "packNpmRelationList": [],
"isGameTourist": false, "minifyWXSS": true
"simulatorType": "wechat", },
"simulatorPluginLibVersion": {}, "compileType": "miniprogram",
"condition": { "libVersion": "2.10.2",
"search": { "appid": "wx73eb8a9ed10a029d",
"current": -1, "projectname": "%E6%99%BA%E6%85%A7%E4%BA%91%E9%A6%86",
"list": [] "isGameTourist": false,
}, "simulatorType": "wechat",
"conversation": { "simulatorPluginLibVersion": {},
"current": -1, "condition": {
"list": [] "search": {
}, "list": []
"game": { },
"currentL": -1, "conversation": {
"list": [] "list": []
}, },
"miniprogram": { "plugin": {
"current": -1, "list": []
"list": [] },
} "game": {
} "currentL": -1,
"list": []
},
"gamePlugin": {
"list": []
}
}
} }

View File

@@ -1,7 +1,7 @@
//testURL //testURL
// const BASE_URL = 'https://lmqhznn.goho.co'; const BASE_URL = 'https://lmqhznn.goho.co';
//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 +74,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 +84,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 +96,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 +108,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 +133,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 +151,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 +161,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 +175,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 +210,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 +222,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 +232,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 +244,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 +256,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 +457,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);
} }
} }