签到码

This commit is contained in:
maclien
2024-05-26 18:12:41 +08:00
parent 93dbcc2cde
commit 616a6d3fe6
15 changed files with 417 additions and 50 deletions
+2 -1
View File
@@ -65,7 +65,8 @@
"pages/order/editBuyer/index",
"pages/storeData/subData/index",
"pages/signup/code",
"pages/signup/index"
"pages/signup/index",
"pages/signup/status"
],
"echarts": [
{
+2
View File
@@ -25,6 +25,8 @@
.img-250x445{width:250rpx;height:445rpx;box-sizing:border-box;}
.img-300x200{width:300rpx;height:200rpx;box-sizing:border-box;}
.img-300x230{width:300rpx;height:230rpx;box-sizing:border-box;}
.img-400x400{width:400rpx;height:400rpx;box-sizing:border-box;}
.img-500x500{width:500rpx;height:500rpx;box-sizing:border-box;}
.img-750x250{width:750rpx;height:250rpx;box-sizing:border-box;}
.img-750x422{width:100%;height:422rpx;box-sizing:border-box;}
+236
View File
@@ -47,9 +47,245 @@ function isOpenCard() {
})
}
const getUserLocation = function () {
return new Promise(function (resolve, reject) {
wx.getLocation({
type: 'gcj02', //wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标
success(res) {
app.setStorage('u_lat', res.latitude)
app.setStorage('u_lng', res.longitude)
resolve({
lat: res.latitude,
lng: res.longitude,
from_storage: false,
});
},
fail(res) {
app.printErrorClient('userLocationFail', ['错误信息:' + JSON.stringify(res)])
console.log(res)
_ModelForGetLocationModel(resolve, reject, res.errMsg);
}
})
})
}
function _ModelForGetLocationModel(resolve, reject, errMsg) {
if (errMsg && errMsg.indexOf('auth') > -1) {
wx.showModal({
title: '',
content: '检测到你未打开地理位置的权限,是否前往开启',
confirmText: '前往开启',
showCancel: false,
success(res) {
if (res.confirm) {
//成功的时候只执行一次(通过手动的时候就没执行了)
wx.openSetting({
success(res) {
wx.authorize({
scope: 'scope.userLocation',
success() {
// resolve("toggle");
wx.getLocation({
type: 'wgs84',
success(res) {
app.setStorage('u_lat', res.latitude)
app.setStorage('u_lng', res.longitude)
resolve({
lat: res.latitude,
lng: res.longitude,
from_storage: false,
});
}
})
},
fail() {
app.printErrorClient('userLocationFail', ['错误信息:打开打开地理位置的权限,未设置'])
// _ModelForGetLocationModel(resolve, reject);
getUserLocation()
reject()
}
})
}
})
} else if (res.cancel) {
app.printErrorClient('userLocationFail', ['错误信息:用户点击取消'])
reject()
}
}
})
} else if (errMsg && (!wx.getSystemInfoSync().locationEnabled || errMsg.indexOf('system') > -1 || errMsg.indexOf('fail authorize no response') > -1)) {
wx.showModal({
title: '获取定位失败',
content: '请在系统设置中\n打开定位服务后刷新页面',
confirmText: '确定',
showCancel: false,
complete: res => {
reject()
// _ModelForGetLocationModel(resolve, reject,res.errMsg)
}
})
} else {
wx.showToast({
title: '请刷新页面,重新授权地理位置信息',
// content: '请刷新页面\n重新授权地理位置信息',
// confirmText: '确定',
// showCancel: false,
icon: 'none',
success: res => {
reject()
//_ModelForGetLocationModel(resolve, reject,res.errMsg)
}
})
}
}
const getUserAuthLocation = () => {
let that = this
return new Promise(function (resolve, reject) {
if (app.getStorageByKey('isAgreeAuthLocation')) {
wx.startLocationUpdate({
success() {
wx.onLocationChange(function (res) {
app.setStorage('u_lat', res.latitude)
app.setStorage('u_lng', res.longitude)
resolve({
lat: res.latitude,
lng: res.longitude,
from_storage: false,
});
wx.stopLocationUpdate()
})
},
fail(){
app.printErrorClient('userLocationFail', ['错误信息:用户拒绝授权LocationUpdate'])
getCityLocation().then(res => {
app.setStorage('isAgreeAuthLocation', 1)
resolve({
lat: res.lat,
lng: res.lng,
from_storage: false,
})
})
}
})
} else if(app.getStorageByKey('isRefuseAuthLocation')) {
wx.showModal({
title: '',
content: '开启地理位置权限,获得更精准的体验哦~',
showCancel: true,
cancelText: '我再想想',
confirmText: '前往开启',
success(res) {
if (res.confirm) {
//成功的时候只执行一次(通过手动的时候就没执行了)
wx.openSetting({
success(res) {
wx.authorize({
scope: 'scope.userLocation',
success() {
// resolve("toggle");
wx.getLocation({
type: 'gcj02',
success(res) {
app.setStorage('u_lat', res.latitude)
app.setStorage('u_lng', res.longitude)
app.setStorage('isAgreeAuthLocation', 1)
resolve({
lat: res.latitude,
lng: res.longitude,
from_storage: false,
});
}
})
},
fail() {
app.printErrorClient('userLocationFail', ['错误信息:打开打开地理位置的权限,未设置'])
// _ModelForGetLocationModel(resolve, reject);
getIpCtiy().then(res => {
getCityLocation(res.cname).then(res => {
app.setStorage('isRefuseAuthLocation', 1)
resolve({
lat: res.lat,
lng: res.lng,
from_storage: false,
})
})
})
}
})
}
})
} else if (res.cancel) {
app.printErrorClient('userLocationFail', ['错误信息:用户点击取消'])
getIpCtiy().then(res => {
getCityLocation(res.cname).then(res => {
app.setStorage('isRefuseAuthLocation', 1)
resolve({
lat: res.lat,
lng: res.lng,
from_storage: false,
})
})
}).catch(res=>{
console.log(1)
})
}
}
})
}else{
wx.getLocation({
type: 'gcj02', //wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标
success(res) {
app.setStorage('u_lat', res.latitude)
app.setStorage('u_lng', res.longitude)
app.setStorage('isAgreeAuthLocation', 1)
resolve({
lat: res.latitude,
lng: res.longitude,
from_storage: false,
});
},
fail(res) {
console.log(res)
app.printErrorClient('userLocationFail', ['错误信息:' + JSON.stringify(res)])
getIpCtiy().then(res => {
getCityLocation(res.cname).then(res => {
app.setStorage('isRefuseAuthLocation', 1)
resolve({
lat: res.lat,
lng: res.lng,
from_storage: false,
})
})
}).catch(res=>{
getCityLocation().then(res => {
app.setStorage('isRefuseAuthLocation', 1)
resolve({
lat: res.lat,
lng: res.lng,
from_storage: false,
})
}).catch(res=>{
console.log(2)
})
})
// _ModelForGetLocationModel(resolve, reject,res.errMsg);
}
})
}
})
}
module.exports = {
getAjaxUserInfo,
isAuthUserInfo,
isBindMobile,
isOpenCard,
getUserLocation,
getUserAuthLocation
}
+11 -2
View File
@@ -35,7 +35,15 @@ Component({
homeShowTitle:{
type: Boolean,
value: false
}
},
showHomeIcon:{
type: Boolean,
value: true
},
showLeftIcon:{
type: Boolean,
value: true
},
},
attached: function () {
this.setNavSize()
@@ -88,9 +96,10 @@ Component({
})
},
home: function () {
wx.switchTab({
wx.reLaunch({
url: '/pages/index/index'
})
wx.re
}
}
})
+2 -1
View File
@@ -15,7 +15,7 @@
<i class="iconfont mr10 icon-fanhui" style="font-size:22px;color:{{txtColor}};"></i>
</view>
</view>
<view class="absolute left-0 box-middle" style="width:40px;height:32px;margin-left:7px;box-sizing:border-box;" wx:else>
<view class="absolute left-0 box-middle" style="width:40px;height:32px;margin-left:7px;box-sizing:border-box;" wx:elif="{{showHomeIcon}}">
<view class="absolute box-center-middle" bindtap='home' wx:if="{{!isShowHomeBtn}}">
<i class="iconfont icon-shouye1" style="font-size:22px;color:{{txtColor}}"></i>
</view>
@@ -23,4 +23,5 @@
<view class='navbarTitle absolute box-center-middle wp40 text-center text-nowrap text-bold' style="color:{{txtColor}};">{{titleText}}</view>
</view>
</view>
<view wx:if="{{isShowBg}}" style='height: {{status + navHeight}}px;'></view>
</view>
+13 -22
View File
@@ -1,11 +1,22 @@
// pages/signup/code.js
import _ from '../../commons/js/commons'
const timer = require('../../commons/js/lib/wxTimer');
var wxTimer = null
Page({
/**
* 页面的初始数据
*/
data: {
navBar: {
title: '客户签到',
txtColor: '#fff',
bgColor: '#1a1c26',
isShowBg: true,
showHomeIcon: true
},
qrcode_img: 'http://qnimg.banping.com/20240511/171539407575215900.png',
qrcode_count_time: 30
},
/**
@@ -41,26 +52,6 @@ Page({
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
+6
View File
@@ -1,3 +1,9 @@
{
"navigationBarTitleText": "客户签到",
"navigationBarTextStyle": "white",
"navigationStyle": "custom",
"navigationBarBackgroundColor": "#1a1c26",
"backgroundColor": "#ffffff",
"backgroundColorTop": "#1a1c26",
"usingComponents": {}
}
+31 -1
View File
@@ -1,2 +1,32 @@
<!--pages/signup/code.wxml-->
<text>pages/signup/code.wxml</text>
<lcb-navBar titleText="{{navBar.title}}" txtColor="{{navBar.txtColor}}" bgColor="{{navBar.bgColor}}" showHomeIcon="{{navBar.showHomeIcon}}" isShowBg="{{navBar.isShowBg}}"></lcb-navBar>
<view class="container">
<view class="fn-flex fn-flex-between font-28 inner30">
<view class=" text-bold">
2024-05-24 14:13
</view>
<view class="text-right">
<view class="font-32 text-bold">车管家 XXX</view>
<view class="mt10 color-999">长沙- 长沙店</view>
</view>
</view>
<view class="ulib-r20 overflowhidden bds-2-eb ml30 mr30">
<view class="text-center color-fff font-34s pt20 pb20" style="background-color:#1a1c26;color:#fff3e4;">邀请客户微信扫码</view>
<view class="ulib-r20 bg-fff inner40" style="min-height:20vh;">
<view class="text-center">
<image class="img-400x400" src="{{qrcode_img}}" />
<view class="text-center font-28 fn-flex fn-flex-center fn-flex-middle mt25">
<text>30秒后失效</text><view class="ml15 font-24" style="color:#36f">立即刷新</view>
</view>
<view class="font-20 mt25" style="color:#f10">客户点击签到,授权手机号及地理位置方可签到成功</view>
</view>
</view>
</view>
<view class="text-center mt30 font-34">本期到店礼</view>
<view class="ml30 mr30 mt30 pb30">
<image mode="widthFix" style="width:100%;" src="http://qnimg.banping.com/20230523/f2b79e3e6108a5816ebfcc0c5c5d51723431a598.png" />
</view>
</view>
+7 -22
View File
@@ -5,7 +5,13 @@ Page({
* 页面的初始数据
*/
data: {
navBar: {
title: '签到',
txtColor: '#fff',
bgColor: '#1a1c26',
isShowBg: true,
showHomeIcon: false
}
},
/**
@@ -42,25 +48,4 @@ Page({
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
+6
View File
@@ -1,3 +1,9 @@
{
"navigationBarTitleText": "签到",
"navigationBarTextStyle": "white",
"navigationStyle": "custom",
"navigationBarBackgroundColor": "#1a1c26",
"backgroundColor": "#ffffff",
"backgroundColorTop": "#1a1c26",
"usingComponents": {}
}
+9 -1
View File
@@ -1,2 +1,10 @@
<!--pages/signup/index.wxml-->
<text>pages/signup/index.wxml</text>
<lcb-navBar titleText="{{navBar.title}}" txtColor="{{navBar.txtColor}}" bgColor="{{navBar.bgColor}}" showHomeIcon="{{navBar.showHomeIcon}}" isShowBg="{{navBar.isShowBg}}"></lcb-navBar>
<view class="container">
<view class="height-100">
<view class="">
</view>
</view>
</view>
+72
View File
@@ -0,0 +1,72 @@
// pages/signup/status.js
Page({
/**
* 页面的初始数据
*/
data: {
navBar: {
title: '签到',
txtColor: '#fff',
bgColor: '#1a1c26',
isShowBg: true,
showHomeIcon: false
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
+9
View File
@@ -0,0 +1,9 @@
{
"navigationBarTitleText": "签到",
"navigationBarTextStyle": "white",
"navigationStyle": "custom",
"navigationBarBackgroundColor": "#1a1c26",
"backgroundColor": "#ffffff",
"backgroundColorTop": "#1a1c26",
"usingComponents": {}
}
+10
View File
@@ -0,0 +1,10 @@
<!--pages/signup/status.wxml-->
<lcb-navBar titleText="{{navBar.title}}" txtColor="{{navBar.txtColor}}" bgColor="{{navBar.bgColor}}" showHomeIcon="{{navBar.showHomeIcon}}" isShowBg="{{navBar.isShowBg}}"></lcb-navBar>
<view class="container">
<view class="height-100">
<view class="">
</view>
</view>
</view>
+1
View File
@@ -0,0 +1 @@
/* pages/signup/status.wxss */