diff --git a/component/authorizedMask/authorizedMask.js b/component/authorizedMask/authorizedMask.js deleted file mode 100644 index 292ad9b..0000000 --- a/component/authorizedMask/authorizedMask.js +++ /dev/null @@ -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 - // }) - // } - } - } -}) \ No newline at end of file diff --git a/component/authorizedMask/authorizedMask.json b/component/authorizedMask/authorizedMask.json deleted file mode 100644 index e8cfaaf..0000000 --- a/component/authorizedMask/authorizedMask.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "component": true, - "usingComponents": {} -} \ No newline at end of file diff --git a/component/authorizedMask/authorizedMask.wxml b/component/authorizedMask/authorizedMask.wxml deleted file mode 100644 index 8d45b2f..0000000 --- a/component/authorizedMask/authorizedMask.wxml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - {{content}} - - - - - - - \ No newline at end of file diff --git a/component/authorizedMask/authorizedMask.wxss b/component/authorizedMask/authorizedMask.wxss deleted file mode 100644 index fb60505..0000000 --- a/component/authorizedMask/authorizedMask.wxss +++ /dev/null @@ -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; -} diff --git a/component/confirmDialog/confirmDialog.js b/component/confirmDialog/confirmDialog.js index bb2e9a3..7e96307 100644 --- a/component/confirmDialog/confirmDialog.js +++ b/component/confirmDialog/confirmDialog.js @@ -66,7 +66,7 @@ Component({ // 点击获取个人信息 openUserInfo(e) { - this.triggerEvent('getuserinfo', e.detail, {}); + this.triggerEvent('getuserinfo', e, {}); } } }) diff --git a/component/confirmDialog/confirmDialog.wxml b/component/confirmDialog/confirmDialog.wxml index f56874c..c65c5d3 100644 --- a/component/confirmDialog/confirmDialog.wxml +++ b/component/confirmDialog/confirmDialog.wxml @@ -7,8 +7,8 @@ - + - \ No newline at end of file + diff --git a/pages/basketballGym/index.js b/pages/basketballGym/index.js index 8b0712e..a8df561 100644 --- a/pages/basketballGym/index.js +++ b/pages/basketballGym/index.js @@ -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 + }) + }) + } + }); } }) diff --git a/pages/confirmOrder/index.js b/pages/confirmOrder/index.js index 32c41fe..fdb0ff2 100644 --- a/pages/confirmOrder/index.js +++ b/pages/confirmOrder/index.js @@ -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 }) } -}) \ No newline at end of file +}) diff --git a/pages/gymnasium/index.js b/pages/gymnasium/index.js index faebac7..9b41ed9 100644 --- a/pages/gymnasium/index.js +++ b/pages/gymnasium/index.js @@ -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 + }) + }) + } + }); } -}) \ No newline at end of file +}) diff --git a/pages/login/index.js b/pages/login/index.js index 3476b5f..0bd8035 100644 --- a/pages/login/index.js +++ b/pages/login/index.js @@ -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 }) }, }) }, -}) \ No newline at end of file +}) diff --git a/pages/login/index.wxml b/pages/login/index.wxml index 6dce9e3..b36e663 100644 --- a/pages/login/index.wxml +++ b/pages/login/index.wxml @@ -7,9 +7,8 @@ 快速微信登录 - - \ No newline at end of file + diff --git a/pages/myAccount/index.js b/pages/myAccount/index.js index c436643..c1e670e 100644 --- a/pages/myAccount/index.js +++ b/pages/myAccount/index.js @@ -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 + }) + }) + } + }); } -}) \ No newline at end of file +}) diff --git a/utils/pay.js b/utils/pay.js index c5d7ce5..a09baa2 100644 --- a/utils/pay.js +++ b/utils/pay.js @@ -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) => {