!2 最终微信版本

Merge pull request !2 from Ezra/feature_20210317
This commit is contained in:
Ezra
2022-02-18 08:06:51 +00:00
committed by Gitee
21 changed files with 150 additions and 303 deletions

View File

@@ -1,104 +0,0 @@
// pages/authorizedMask/authorizedMask.js
const app = getApp();
Component({
/**
* 组件的属性列表
*/
properties: {
isSetting: {
type: Boolean,
value: false
},
content: {
type: String,
value: '使用小程序需要您授权登录'
},
isCancel: {
type: Boolean,
value: false
},
/**
* Only: 只有一個
* TwainCance 兩個帶取消
* */
type: {
type: String,
value: 'Only'
}
},
/**
* 组件的初始数据
*/
data: {
showBox: true,
},
/**
* 组件的方法列表
*/
methods: {
stopSlide() {
return;
},
wxTap() {
this.setData({
showBox: false
})
},
// 微信登录
wxLogin(e) {
if (e.detail.errMsg === 'getUserInfo:fail auth deny') {
this.setData({
showBox: true
})
return
}
this.setData({
showBox: false
})
let that = this;
wx.login({
success: function(res) {
if (res.code) {
app.$api.login({
avatar: e.detail.userInfo.avatarUrl,
code: res.code,
nickname: e.detail.userInfo.nickName,
}).then(res => {
wx.setStorageSync('access_token', res.data.accessToken);
wx.setStorageSync('userInfo', e.detail.userInfo);
that.triggerEvent('loginSuccess', {}, {});
})
} else {
wx.showToast({
title: '登录失败',
icon: 'none',
})
}
},
fail: function(res) {
wx.showToast({
title: '登录失败',
icon: 'none',
})
},
})
},
// 取消
cance() {
this.triggerEvent('cance', {}, {});
},
// 打开设置
setSuccess: function (e) {
this.triggerEvent('setsuccess', e.detail, {});
// if (e.detail.authSetting["scope.userLocation"]) {//如果打开了地理位置就会为true
// this.setData({
// showFlag: true
// })
// }
}
}
})

View File

@@ -1,4 +0,0 @@
{
"component": true,
"usingComponents": {}
}

View File

@@ -1,17 +0,0 @@
<!--pages/authorizedMask/authorizedMask.wxml-->
<view class='auth-bg' catchtouchmove='stopSlide'>
<view class='auth-box' wx:if="{{showBox}}">
<!-- wx:if="{{type == 'TwainCance'}}" -->
<view class='close' bindtap='cance' wx:if="{{isCancel}}">
<image src='../../images/23@3x.png'></image>
</view>
<view class='message'>{{content}}</view>
<view class='btn-bg' wx:if="{{type == 'Only'}}">
<button open-type="getUserInfo" bindgetuserinfo="wxLogin" wx:if="{{!isSetting}}">授权登录</button>
<button open-type="openSetting" bindopensetting="setSuccess" wx:if="{{isSetting}}" >进入授权管理</button>
</view>
<!-- <view class='btn-bg btn-tow' wx:if="{{showBox}}">
<button open-type="openSetting" wx:if="{{isSetting}}">进入授权管理</button>
</view> -->
</view>
</view>

View File

@@ -1,67 +0,0 @@
/* pages/authorizedMask/authorizedMask.wxss */
.auth-bg {
position: fixed;
top: 0;
left: 0;
display: flex;
justify-content: center;
align-items: center;
width: 100vw;
height: 100vh;
background: rgba(0, 0, 0, 0.6);
z-index: 1001;
}
.auth-box {
position: relative;
width: 70%;
height: 350rpx;
background: #252330;
border-radius: 10rpx;
color: #989898;
}
.message {
display: flex;
justify-content: center;
align-items: center;
height: 250rpx;
/* border-bottom: 2rpx solid #EBEEF5; */
font-size: 28rpx;
}
.btn-bg>button {
width: 60%;
height: 70rpx;
line-height: 70rpx;
font-size: 26rpx;
color: #252330;
border-radius: 35rpx;
background: #ffc129;
}
.btn-bg.btn-tow {
display: flex;
}
button::after {
border: none;
border-radius: 0;
}
.close {
position: absolute;
top: 0;
right: 0;
display: flex;
justify-content: center;
align-items: center;
width: 60rpx;
height: 60rpx;
}
.close>image {
width: 26rpx;
height: 26rpx;
}

View File

@@ -66,7 +66,7 @@ Component({
// 点击获取个人信息
openUserInfo(e) {
this.triggerEvent('getuserinfo', e.detail, {});
this.triggerEvent('getuserinfo', e, {});
}
}
})

View File

@@ -7,8 +7,8 @@
<button wx:if="{{showCancel}}" bindtap='cancel'>{{cancelBtnTitle}}</button>
<view class='line' wx:if="{{showCancel}}"></view>
<button open-type='openSetting' wx:if="{{isAuth}}" bindopensetting="openSetting">{{confirmBtnTitle}}</button>
<button open-type='getUserInfo' wx:elif="{{isUserInfo}}" bindgetuserinfo="openUserInfo">{{confirmBtnTitle}}</button>
<button wx:elif="{{isUserInfo}}" bindtap="openUserInfo">{{confirmBtnTitle}}</button>
<button wx:else bindtap='confirm'>{{confirmBtnTitle}}</button>
</view>
</view>
</view>
</view>

BIN
images/99@3x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -268,20 +268,24 @@ Page({
// 授权微信
getUserInfo(e) {
app.$pay.payWxLoing(e.detail).then(res => {
wx.showToast({
title: '绑定成功',
duration: 2000,
})
this.setData({
isWxLogin: false
})
}, err => {
this.setData({
isWxLogin: false
})
})
wx.getUserProfile({
desc: '用于完善会员资料',
success: (res) => {
app.$pay.payWxLoing(res).then(res => {
wx.showToast({
title: '绑定成功',
duration: 2000,
})
this.setData({
isWxLogin: false
})
}, err => {
this.setData({
isWxLogin: false
})
})
}
});
}
})

View File

@@ -307,21 +307,24 @@ Page({
// 授权微信
getUserInfo(e) {
console.log(e.detail);
app.$pay.payWxLoing(e.detail).then(res => {
wx.showToast({
title: '绑定成功',
duration: 2000,
})
this.setData({
isWxLogin: false
})
}, err => {
this.setData({
isWxLogin: false
})
})
wx.getUserProfile({
desc: '用于完善会员资料',
success: (res) => {
app.$pay.payWxLoing(res).then(res => {
wx.showToast({
title: '绑定成功',
duration: 2000,
})
this.setData({
isWxLogin: false
})
}, err => {
this.setData({
isWxLogin: false
})
})
}
});
},
// 选中支付方式
@@ -330,4 +333,4 @@ Page({
payType: e.currentTarget.dataset.type
})
}
})
})

View File

@@ -217,19 +217,23 @@ Page({
// 授权微信
getUserInfo(e) {
app.$pay.payWxLoing(e.detail).then(res => {
wx.showToast({
title: '绑定成功',
duration: 2000,
})
this.setData({
isWxLogin: false
})
}, err => {
this.setData({
isWxLogin: false
})
})
wx.getUserProfile({
desc: '用于完善会员资料',
success: (res) => {
app.$pay.payWxLoing(res).then(res => {
wx.showToast({
title: '绑定成功',
duration: 2000,
})
this.setData({
isWxLogin: false
})
}, err => {
this.setData({
isWxLogin: false
})
})
}
});
}
})
})

View File

@@ -117,6 +117,9 @@ Page({
console.log('打开文档成功')
}
})
},
fail: function(e){
console.log('down file error',e);
}
})
},

View File

@@ -3,4 +3,4 @@
"usingComponents": {
"header": "/component/header/header"
}
}
}

View File

@@ -19,6 +19,10 @@
<image src='../../images/28@3x.png' mode='aspectFit' wx:else></image>
<text>足球场</text>
</view>
<view class='item-box' bindtap='pushHealthDocs'>
<image src='../../images/99@3x.png' mode='aspectFit'></image>
<text>健康报告</text>
</view>
</view>
<swiper style='height: 180rpx; background: #fff;' autoplay="{{true}}" interval="5000" duration="1500" circular="{{true}}" vertical="{{true}}">
<block wx:for="{{noticeList}}" wx:key="{{index}}">
@@ -99,12 +103,6 @@
<button class='hide-btn'></button>
</cover-view>
<!-- 健康报告 -->
<cover-view class='mine-box' style='bottom: 170rpx' bindtap='pushHealthDocs'>
<cover-image class='img' src='../../images/jiankangbaogao.png'></cover-image>
<button class='hide-btn'></button>
</cover-view>
<!-- 个人中心 -->
<cover-view class='mine-box' bindtap='pushMine'>
<cover-image class='img' src='../../images/7@3x.png'></cover-image>

View File

@@ -121,42 +121,52 @@ Page({
showUnclickMask: true
})
let that = this;
wx.login({
success: function(res) {
app.$api.memberLoginWX({
avatar: e.detail.userInfo.avatarUrl,
code: res.code,
nickname: e.detail.userInfo.nickName
}).then(res => {
wx.setStorageSync('information', res.information);
if (!res.authorization) {
wx.redirectTo({
url: '/pages/register/index?codeType=' + 1,
wx.getUserProfile({
desc: '用于完善会员资料',
success: (res) => {
wx.login({
success: function(r){
app.$api.memberLoginWX({
avatar: res.userInfo.avatarUrl,
code: r.code,
nickname: res.userInfo.nickName
}).then(res => {
wx.setStorageSync('information', res.information);
if (!res.authorization) {
wx.redirectTo({
url: '/pages/register/index?codeType=' + 1,
})
return;
}
wx.setStorageSync('accessToken', res.authorization.accessToken);
let route = wx.getStorageSync('history');
wx.removeStorageSync('history');
if (!route || route == '/pages/login/index') {
return wx.redirectTo({
url: '/pages/mine/index',
})
}
wx.redirectTo({
url: route,
})
}, err => {
that.setData({
showUnclickMask: false
})
});
},
fail: function(res) {
that.setData({
showUnclickMask: false
})
return;
}
wx.setStorageSync('accessToken', res.authorization.accessToken);
let route = wx.getStorageSync('history');
wx.removeStorageSync('history');
if (!route || route == '/pages/login/index') {
return wx.redirectTo({
url: '/pages/mine/index',
})
}
wx.redirectTo({
url: route,
})
}, err => {
that.setData({
showUnclickMask: false
})
});
},
})
},
fail: function(res) {
fail: (res) => {
that.setData({
showUnclickMask: false
})
},
})
},
})
})

View File

@@ -7,9 +7,8 @@
<view class='line-between-text'>快速微信登录</view>
</view>
<view class='wechat-btn'>
<button open-type='getUserInfo' bindgetuserinfo='wxLogin' ></button>
<image src='../../images/47@3x.png' bindtap='wxLogin'></image>
</view>
</view>
<view class='unclick-mask' wx:if="{{showUnclickMask}}"></view>
<view class='unclick-mask' wx:if="{{showUnclickMask}}"></view>

View File

@@ -153,19 +153,23 @@ Page({
// 授权微信
getUserInfo(e) {
app.$pay.payWxLoing(e.detail).then(res => {
wx.showToast({
title: '绑定成功',
duration: 2000,
})
this.setData({
isWxLogin: false
})
}, err => {
this.setData({
isWxLogin: false
})
})
wx.getUserProfile({
desc: '用于完善会员资料',
success: (res) => {
app.$pay.payWxLoing(res).then(res => {
wx.showToast({
title: '绑定成功',
duration: 2000,
})
this.setData({
isWxLogin: false
})
}, err => {
this.setData({
isWxLogin: false
})
})
}
});
}
})
})

View File

@@ -1,6 +1,7 @@
// pages/myBookings/index.js
const app = getApp();
let orderSn = ""
let orderLimit = 48;
Page({
/**
@@ -113,7 +114,7 @@ Page({
return;
} else {
wx.showToast({
title: '距离开课48小时内不得取消',
title: '距离开课' + orderLimit + '小时内不得取消',
icon: 'none',
})
}
@@ -164,6 +165,9 @@ Page({
}).then(res => {
let currentDate = new Date().getTime();
let startDate = currentDate;
if (res.memberLessonTicket.venueLesson.orderLimit){
orderLimit = res.memberLessonTicket.venueLesson.orderLimit;
}
if (res.memberLessonTicket) {
startDate = new Date(res.memberLessonTicket.venueLesson.date.replace(/-/g, "/") + ' ' + res.memberLessonTicket.venueLesson.startTime).getTime();
}
@@ -174,7 +178,7 @@ Page({
}
this.setData({
memberLessonTicket: res.memberLessonTicket,
isSignIn: (startDate - currentDate) / 1000 / 60 / 60 < 48,
isSignIn: (startDate - currentDate) / 1000 / 60 / 60 < orderLimit,
})
}, err => {
@@ -223,4 +227,4 @@ Page({
urls: [this.data.memberLessonTicket.venueLesson.coach.wechatCode],
})
}
})
})

View File

@@ -7,10 +7,11 @@
<text>{{memberLessonTicket.venueLesson.name}}</text>
</view>
<!-- <view class='state'>{{memberLessonTicket.status == 0 ? "已预约" : (memberLessonTicket.status == 1 ? "已完成" : "已取消")}}</view> -->
<view class='state' wx:if="{{memberLessonTicket.status == 0}}">预约</view>
<view class='state' wx:if="{{memberLessonTicket.status == 0}}">预约成功</view>
<view class='state' wx:if="{{memberLessonTicket.status == 3}}">未签到</view>
<view class='state' wx:if="{{memberLessonTicket.status == 1}}">已签到</view>
<view class='state' wx:if="{{memberLessonTicket.status == 2}}">已取消</view>
<view class='state' wx:if="{{memberLessonTicket.status == 4}}">待审核</view>
</view>
<view class='cell'>
<image src='../../images/42@3x.png' mode='aspectFit'></image>

View File

@@ -14,10 +14,11 @@
<view class='cell' wx:for="{{list}}" wx:key="{{index}}" bindtap='clickCell' data-ordersn='{{item.orderSn}}'>
<view class='top'>
<text>预约单号: {{item.orderSn}}</text>
<text class='isActive' wx:if="{{item.status == 0}}">预约</text>
<text class='isActive' wx:if="{{item.status == 0}}">预约成功</text>
<text wx:if="{{item.status == 3}}">未签到</text>
<text wx:if="{{item.status == 1}}">已完成</text>
<text wx:if="{{item.status == 2}}">已取消</text>
<text wx:if="{{item.status == 4}}">待审核</text>
</view>
<view class='bottom'>
<image src='{{item.lessonImage}}' mode='aspectFill'></image>

View File

@@ -21,17 +21,25 @@
"checkSiteMap": true,
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"useMultiFrameRuntime": true,
"useApiHook": true,
"useApiHostProcess": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"enableEngineNative": false,
"useIsolateContext": true,
"useCompilerModule": true,
"userConfirmedUseCompilerModuleSwitch": false
"userConfirmedUseCompilerModuleSwitch": false,
"userConfirmedBundleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": [],
"minifyWXSS": true
},
"compileType": "miniprogram",
"libVersion": "2.10.2",
"libVersion": "2.17.0",
"appid": "wx73eb8a9ed10a029d",
"projectname": "%E6%99%BA%E6%85%A7%E4%BA%91%E9%A6%86",
"isGameTourist": false,

View File

@@ -23,7 +23,7 @@ export function pay(body) {
}
export function payWxLoing(body) {
console.log(body)
console.log(body.userInfo)
const app = getApp();
return new Promise((resolve, reject) => {