Compare commits
4 Commits
master
...
scancode_2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b07f61006c | ||
|
|
798893e65d | ||
|
|
4d11ab9c79 | ||
|
|
311055815a |
3
app.json
3
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",
|
||||
|
||||
@@ -110,7 +110,9 @@ Page({
|
||||
}, err => {})
|
||||
},
|
||||
fail: function(res) {
|
||||
wx.hideLoading()
|
||||
wx.hideLoading({
|
||||
complete: (complete) => {}
|
||||
},1000);
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
@@ -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
136
pages/scanCode/index.js
Normal 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});
|
||||
});
|
||||
}
|
||||
|
||||
})
|
||||
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"
|
||||
}
|
||||
}
|
||||
10
pages/scanCode/index.wxml
Normal file
10
pages/scanCode/index.wxml
Normal 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
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;
|
||||
}
|
||||
@@ -21,14 +21,20 @@
|
||||
"checkSiteMap": true,
|
||||
"uploadWithSourceMap": true,
|
||||
"compileHotReLoad": false,
|
||||
"useMultiFrameRuntime": false,
|
||||
"useApiHook": true,
|
||||
"babelSetting": {
|
||||
"ignore": [],
|
||||
"disablePlugins": [],
|
||||
"outputPath": ""
|
||||
},
|
||||
"enableEngineNative": false,
|
||||
"useIsolateContext": true,
|
||||
"useCompilerModule": true,
|
||||
"userConfirmedUseCompilerModuleSwitch": false
|
||||
"useCompilerModule": false,
|
||||
"userConfirmedUseCompilerModuleSwitch": false,
|
||||
"packNpmManually": false,
|
||||
"packNpmRelationList": [],
|
||||
"minifyWXSS": true
|
||||
},
|
||||
"compileType": "miniprogram",
|
||||
"libVersion": "2.10.2",
|
||||
@@ -39,19 +45,19 @@
|
||||
"simulatorPluginLibVersion": {},
|
||||
"condition": {
|
||||
"search": {
|
||||
"current": -1,
|
||||
"list": []
|
||||
},
|
||||
"conversation": {
|
||||
"current": -1,
|
||||
"list": []
|
||||
},
|
||||
"plugin": {
|
||||
"list": []
|
||||
},
|
||||
"game": {
|
||||
"currentL": -1,
|
||||
"list": []
|
||||
},
|
||||
"miniprogram": {
|
||||
"current": -1,
|
||||
"gamePlugin": {
|
||||
"list": []
|
||||
}
|
||||
}
|
||||
|
||||
66
utils/api.js
66
utils/api.js
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user