diff --git a/commons/js/utils/apiQuery.js b/commons/js/utils/apiQuery.js
index 582d206..ee1438a 100644
--- a/commons/js/utils/apiQuery.js
+++ b/commons/js/utils/apiQuery.js
@@ -24,33 +24,6 @@ apiQuery.putUserInfo = function (params) {
})
}
-//用户信息授权
-apiQuery.authUserInfo = function (params) {
- return new Promise(function (resolve, reject) {
- wx.getSetting({
- success(res) {
- let userInfo = app.getStorageByKey("userInfo");
- console.log(res.authSetting)
- if (res.authSetting['scope.userInfo']) {
- if (!userInfo.nickname || !userInfo.headimg || (userInfo.headimg != JSON.parse(params.detail.rawData).avatarUrl)) {
- asyncLogin().then(res => {
- apiQuery.putUserInfo({
- encryptedData: params.detail.encryptedData,
- iv: params.detail.iv
- }).then(res => {
- //设置本地存储
- resolve(res)
- })
- })
- } else {
- resolve(userInfo)
- }
- }
- }
- })
- })
-}
-
//用户手机号码授权
apiQuery.authUserPhone = function (params) {
return new Promise(function (resolve, reject) {
diff --git a/commons/js/utils/user-manager.js b/commons/js/utils/user-manager.js
index 6874aed..68f458a 100644
--- a/commons/js/utils/user-manager.js
+++ b/commons/js/utils/user-manager.js
@@ -19,7 +19,7 @@ function getAjaxUserInfo(){
function isAuthUserInfo() {
return new Promise(function (resolve, reject) {
api.getUserInfo().then(res=>{
- resolve(Boolean(res && res.nickname && res.headimg))
+ resolve(Boolean(res && res.headimg))
})
})
}
diff --git a/components/auth/index.js b/components/auth/index.js
index 607ee07..c68f8a9 100644
--- a/components/auth/index.js
+++ b/components/auth/index.js
@@ -1,32 +1,105 @@
import _ from '../../commons/js/commons'
const app = getApp()
Component({
- /**
- * 组件的属性列表
- */
+ //组件的属性列表
properties: {
isShow: {
type: Boolean,
value: false
},
+ userInfo:{
+ type: Object,
+ value:""
+ },
+ //是否显示授权用户信息
+ isShowProfile: {
+ type: Boolean,
+ value: true
+ },
+ //是否强制显示授权用户信息
+ isForceProfile: {
+ type: Boolean,
+ value:false
+ },
+ title:{
+ type: String,
+ value: ''
+ },
+ cancelbtn:{
+ type: String,
+ value: ''
+ },
+ submitbtn:{
+ type: String,
+ value: ''
+ },
+ tip:{
+ type: String,
+ value: ''
+ },
+ type:{
+ type: String,
+ value: ''
+ },
+ zindex: {
+ type: Number,
+ value: 10
+ },
+ //专题模式登录样式
+ mode:{
+ type: String,
+ value: ''
+ },
+ modeDate:{
+ type: Object,
+ value:""
+ },
},
- /**
- * 组件的初始数据
- */
+ //组件的初始数据
data: {
- code:'',
isRunning:false,
+ userCurrInfo:"",
+ isBindMobile:false
},
lifetimes: {
attached: function () {
- wx.login({
- success: res => {
+ // 在组件实例进入页面节点树时执行
+ if (this.data.type == "mobile") {
+ if (!this.data.userInfo){
+ _.apiQuery.getUserInfo("",false).then(res => {
+ this.setData({
+ userCurrInfo: res
+ })
+ })
+ }else{
this.setData({
- code: res.code,
+ userCurrInfo: this.data.userInfo
})
}
+ }
+
+ if (this.data.type == "userinfo") {
+ _.userManager.isAuthUserInfo().then(re => {
+ if (re) {
+ this.setData({
+ isShowProfile:false
+ })
+ }else{
+ this.setData({
+ isShowProfile:true
+ })
+ }
+ })
+ }
+
+ },
+ detached: function () {
+ // 在组件实例被从页面节点树移除时执行
+ this.setData({
+ isBindMobile:false,
+ isShow:false
})
},
},
@@ -35,6 +108,8 @@ Component({
* 组件的方法列表
*/
methods: {
+ //catchtap
+ emptyfunc(){},
//授权用户信息
getUserProfile(){
let that = this
@@ -45,32 +120,73 @@ Component({
wx.getUserProfile({
desc:'获取你的昵称、头像、地区及性别',//不写不弹提示框
success:function(res){
-
let params = {};
- params['code'] = that.data.code;
params['userInfo'] = res.userInfo;
- that.setData({
- isShow: false,
- })
- _.apiQuery.putAppUser(params).then(res => {
+ _.apiQuery.putUserInfo(params).then(res => {
that.setData({
isRunning:false
});
- wx.showToast({
- title: '授权成功',
- icon: 'success',
- duration: 2000
- })
- });
+ that.successEvent()
+ _.eventBus.emit("isShowProfile",false)
+ })
},
fail:function(err){
that.setData({
isRunning:false
});
- console.log('拒绝授权')
+ wx.showToast({
+ title: '您拒绝授权,将无法进行更多操作!',
+ icon: 'none',
+ duration: 2000
+ });
}
})
},
+ //授权手机号码
+ getPhoneNumber(e) {
+ if (e.detail.errMsg && e.detail.errMsg.indexOf('ok') > -1){
+ let that = this;
+ _.apiQuery.authUserPhone(e).then(res=>{
+ _.apiQuery.getUserInfo()
+ this.setData({
+ isBindMobile: true
+ })
+ })
+ }else{
+ app.printErrorClient('failGetPhoneNumber',['用户拒绝授权手机号码:'+JSON.stringify(e)])
+ }
+ },
+ onShow:function () {
+ this.setData({
+ isShow: true
+ });
+ this.triggerEvent('onShow', {
+ type: this.data.type
+ });
+
+ },
+ onClose: function () {
+ this.setData({
+ isShow: false
+ });
+ this.triggerEvent('onClose', {
+ type: this.data.type
+ });
+ if(this.data.type=="mobile" && this.data.isBindMobile){
+ this.setData({
+ isBindMobile:false
+ })
+ this.successEvent()
+ }
+ },
+
+ //成功回调方法
+ successEvent(){
+ this.triggerEvent('onSuccess', {
+ type: this.data.type
+ });
+ },
+
}
})
\ No newline at end of file
diff --git a/components/auth/index.json b/components/auth/index.json
index a873460..32640e0 100644
--- a/components/auth/index.json
+++ b/components/auth/index.json
@@ -1,6 +1,3 @@
{
- "component": true,
- "usingComponents": {
- "lcb-msg": "/components/msg/index"
- }
+ "component": true
}
\ No newline at end of file
diff --git a/components/auth/index.wxml b/components/auth/index.wxml
index 729c1a8..6306fad 100644
--- a/components/auth/index.wxml
+++ b/components/auth/index.wxml
@@ -1,16 +1,62 @@
+
-
-
-
-
- 授权您的公开信息(昵称和头像)
- 便于查看预定信息哦~
+
+
+
+
+
+
+
+
+
+
+
+
+ {{modeDate.title}}
+ {{modeDate.content}}
+
+
-
+
-
\ No newline at end of file
+
+ {{modeDate.success}}
+ {{modeDate.content}}
+
+
+
+
+
+
+
+
+ {{title || '立即登录'}}
+ 授权手机号即可登录狸车小程序,了解更多狸车资讯,一手活动特惠即刻拥有。
+
+
+
+
+
+
+
+
+
+
+ {{tip || '恭喜您,登录成功!'}}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/auth/index.wxss b/components/auth/index.wxss
index 7ced027..8789499 100644
--- a/components/auth/index.wxss
+++ b/components/auth/index.wxss
@@ -1 +1,116 @@
-@import "../../commons/css/common.wxss";
\ No newline at end of file
+@import "../../commons/css/common.wxss";
+.auth-dialog{
+ position: fixed;
+ left:50%;
+ top:50%;
+ transform: translate(-50%,-50%);
+ width:88%;
+ padding:70rpx 60rpx;
+ background-color:#fff;
+ box-sizing: border-box;
+ border-radius: 10rpx;
+ overflow: hidden;
+ z-index: 10;
+}
+.auth-dialog-special{
+ position: fixed;
+ left:50%;
+ top:50%;
+ transform: translate(-50%,-50%);
+ width:80%;
+ background-color:#fff;
+ box-sizing: border-box;
+ border-radius: 10rpx;
+ z-index: 10;
+}
+
+
+.auth-btngetUserInfo{
+ position: absolute;
+ left:0;
+ top:0;
+ right:0;
+ bottom:0;
+ opacity: 0;
+}
+
+.auth-dialog .cap{
+ color:#000;
+ font-size: 36rpx;
+ line-height: 36rpx;
+ text-align: center;
+ font-weight: bold;
+}
+
+.auth-dialog .intro{
+ margin-top:30rpx;
+ color:#666;
+ font-size: 28rpx;
+ line-height: 46rpx;
+}
+.auth-dialog .btn-list{
+ display: flex;
+ margin-top:40rpx;
+}
+
+.auth-dialog .btn-list .item-cell{
+ flex: 1;
+ padding:0 10rpx;
+}
+
+.auth-dialog .btn-list button{
+ width: 220rpx;
+ height: 72rpx;
+ line-height: 72rpx;
+ overflow: hidden;
+ border-radius: 50rpx;
+ font-size: 30rpx;
+ box-sizing: border-box;
+}
+
+.auth-dialog .btn-list button.btn-cancel{
+ background: #fff;
+ color: #1a1a1a;
+ line-height: 68rpx;
+ border:1rpx solid #1a1a1a;
+}
+.auth-dialog .btn-list button.btn-confirm{
+ background: #1a1a1a;
+ color: #fff;
+}
+.auth-dialog .btn-list button::after{
+ border:none;
+}
+.auth-dialog-mask{
+ position: fixed;
+ left:0;
+ right: 0;
+ top:0;
+ bottom:0;
+ background-color: rgba(0, 0, 0, 0.6);
+}
+.auth-dialog-logo{
+ position:absolute;
+ top:-50rpx;
+ left:50%;
+ transform:translate(-50%,0);
+}
+.special-intro::before{
+ display:block;
+ position:absolute;
+ top:-20rpx;
+ left:50%;
+ transform:translate(-50%,0);
+ width: 0;
+ height: 0;
+ border-color: transparent transparent #f5f5f5 transparent;
+ border-style: solid;
+ border-width: 0 20rpx 20rpx 20rpx;
+ content:"";
+}
+.special-close{
+ position:absolute;
+ bottom:-100rpx;
+ left:50%;
+ transform:translate(-50%,0);
+}
\ No newline at end of file
diff --git a/pages/channel/index.js b/pages/channel/index.js
index 34b7188..21b2988 100644
--- a/pages/channel/index.js
+++ b/pages/channel/index.js
@@ -37,6 +37,7 @@ Page({
ecLine:{},
deallist:'',
hoursTip:'',
+ isShowProfile:true,//是否显示授权用户信息按钮
},
onLoad(options) {
@@ -49,6 +50,13 @@ Page({
this.getUserInfo()
this.getAppCity()
+ //消息通讯 是否显示授权用户信息按钮
+ _.eventBus.on("isShowProfile", this, function(res){
+ this.setData({
+ isShowProfile:res,
+ })
+ })
+
},
onShow: function () {
@@ -56,6 +64,12 @@ Page({
this.getAppTransferRemind()
},
+ //生命周期函数--监听页面卸载
+ onUnload: function () {
+ //卸载消息通讯 是否显示授权用户信息
+ _.eventBus.remove('isShowProfile',this);
+ },
+
//候取时间
getHoursTip(){
let hoursTip = '';
diff --git a/pages/channel/index.wxml b/pages/channel/index.wxml
index 555acba..b448b23 100644
--- a/pages/channel/index.wxml
+++ b/pages/channel/index.wxml
@@ -2,8 +2,9 @@
-
-
+
+
+
Hi~ {{hoursTip}}欢迎回到狸车宝!
diff --git a/pages/distribute/cashout/index.js b/pages/distribute/cashout/index.js
index b1e02da..5003743 100644
--- a/pages/distribute/cashout/index.js
+++ b/pages/distribute/cashout/index.js
@@ -4,6 +4,7 @@ Page({
info:'',
submitFlag:false,
isShowSuccess:false,
+ isShowProfile:true,//是否显示授权用户信息按钮
},
onLoad: function (options) {
@@ -13,10 +14,35 @@ Page({
})
}
+ this.getUserInfo()
+
+ //消息通讯 是否显示授权用户信息按钮
+ _.eventBus.on("isShowProfile", this, function(res){
+ this.setData({
+ isShowProfile:res,
+ })
+ })
+
//this.getDistributionCash()
},
+ //生命周期函数--监听页面卸载
+ onUnload: function () {
+ //卸载消息通讯 是否显示授权用户信息
+ _.eventBus.remove('isShowProfile',this);
+ },
+
+ //获取用户信息
+ getUserInfo(){
+ _.apiQuery.getUserInfo().then(res => {
+ this.setData({
+ userInfo: res
+ })
+ });
+ },
+
+
//提现信息
getDistributionCash() {
let params = {};
diff --git a/pages/distribute/cashout/index.wxml b/pages/distribute/cashout/index.wxml
index 5002187..f7639e5 100644
--- a/pages/distribute/cashout/index.wxml
+++ b/pages/distribute/cashout/index.wxml
@@ -2,9 +2,10 @@
提现到
-
-
-
+
+
+
+
的微信钱包(**** 769)
diff --git a/pages/index/index.js b/pages/index/index.js
index bc2fc22..066ab32 100644
--- a/pages/index/index.js
+++ b/pages/index/index.js
@@ -40,6 +40,7 @@ Page({
isShowNotice:false,//是否显示通知
stopNotice:false,//是否不再显示通知
isShowReport:false,
+ isShowProfile:true,//是否显示授权用户信息按钮
},
onLoad(options) {
@@ -58,6 +59,13 @@ Page({
this.getAppStatisticsHcust()
this.getAppStatisticsHorder()
+ //消息通讯 是否显示授权用户信息按钮
+ _.eventBus.on("isShowProfile", this, function(res){
+ this.setData({
+ isShowProfile:res,
+ })
+ })
+
},
onShow: function () {
@@ -66,6 +74,12 @@ Page({
this.getAppTransferRemind()
},
+ //生命周期函数--监听页面卸载
+ onUnload: function () {
+ //卸载消息通讯 是否显示授权用户信息
+ _.eventBus.remove('isShowProfile',this);
+ },
+
//候取时间
getHoursTip(){
let hoursTip = '';
diff --git a/pages/index/index.wxml b/pages/index/index.wxml
index 18b760c..ca698f0 100644
--- a/pages/index/index.wxml
+++ b/pages/index/index.wxml
@@ -2,8 +2,9 @@
-
-
+
+
+
Hi~ {{hoursTip}}欢迎回到狸车宝!
diff --git a/pages/mine/index.js b/pages/mine/index.js
index 1637072..a8b22ef 100644
--- a/pages/mine/index.js
+++ b/pages/mine/index.js
@@ -6,6 +6,7 @@ Page({
isShowAddStaff:false,
name:'',
mobile:'',
+ isShowProfile:true,//是否显示授权用户信息按钮
},
onLoad: function (options) {
@@ -69,10 +70,24 @@ Page({
}
}
})
+
+ //消息通讯 是否显示授权用户信息按钮
+ _.eventBus.on("isShowProfile", this, function(res){
+ this.setData({
+ isShowProfile:res,
+ })
+ })
+
},
onShow: function () {
},
+
+ //生命周期函数--监听页面卸载
+ onUnload: function () {
+ //卸载消息通讯 是否显示授权用户信息
+ _.eventBus.remove('isShowProfile',this);
+ },
//获取用户信息
getUserInfo(){
diff --git a/pages/mine/index.wxml b/pages/mine/index.wxml
index 0594e44..e6f0c15 100644
--- a/pages/mine/index.wxml
+++ b/pages/mine/index.wxml
@@ -2,12 +2,12 @@
-
-
+
+
+
-
{{userInfo.uname}}
({{userInfo.group_name}})
diff --git a/pages/mine/install/index.js b/pages/mine/install/index.js
index 82aa581..1f02ea3 100644
--- a/pages/mine/install/index.js
+++ b/pages/mine/install/index.js
@@ -4,6 +4,7 @@ Page({
data: {
imgUrl:_.config.imgUrl,
list:[],
+ isShowProfile:true,//是否显示授权用户信息按钮
},
onLoad: function (options) {
@@ -14,11 +15,24 @@ Page({
}
this.getUserInfo()
+
+ //消息通讯 是否显示授权用户信息按钮
+ _.eventBus.on("isShowProfile", this, function(res){
+ this.setData({
+ isShowProfile:res,
+ })
+ })
},
onShow: function () {
},
+ //生命周期函数--监听页面卸载
+ onUnload: function () {
+ //卸载消息通讯 是否显示授权用户信息
+ _.eventBus.remove('isShowProfile',this);
+ },
+
//获取用户信息
getUserInfo(){
_.apiQuery.getUserInfo().then(res => {
diff --git a/pages/mine/install/index.wxml b/pages/mine/install/index.wxml
index 348be34..b3d73cf 100644
--- a/pages/mine/install/index.wxml
+++ b/pages/mine/install/index.wxml
@@ -3,12 +3,12 @@
-
-
+
+
+
-
{{userInfo.uname}}
({{userInfo.group_name}})
diff --git a/pages/mine/install/staff/index.js b/pages/mine/install/staff/index.js
index ea4dc0e..5fa9a71 100644
--- a/pages/mine/install/staff/index.js
+++ b/pages/mine/install/staff/index.js
@@ -12,6 +12,7 @@ Page({
end: false,
load: true,
loading: false,
+ isShowProfile:true,//是否显示授权用户信息按钮
},
onLoad: function (options) {
for (let key in options) {
@@ -21,11 +22,24 @@ Page({
}
this.getUserInfo()
+
+ //消息通讯 是否显示授权用户信息按钮
+ _.eventBus.on("isShowProfile", this, function(res){
+ this.setData({
+ isShowProfile:res,
+ })
+ })
},
onShow: function () {
this.getAppEmployees()
},
+ //生命周期函数--监听页面卸载
+ onUnload: function () {
+ //卸载消息通讯 是否显示授权用户信息
+ _.eventBus.remove('isShowProfile',this);
+ },
+
//获取用户信息
getUserInfo(){
_.apiQuery.getUserInfo().then(res => {
diff --git a/pages/mine/install/staff/index.wxml b/pages/mine/install/staff/index.wxml
index 071df09..91c9a49 100644
--- a/pages/mine/install/staff/index.wxml
+++ b/pages/mine/install/staff/index.wxml
@@ -3,12 +3,12 @@
-
-
+
+
+
-
{{userInfo.uname}}
({{userInfo.group_name}})