| @@ -22,6 +22,8 @@ App({ | |||
| this.globalData.userInfoData = {}; | |||
| this.globalData.userInfoData.avatarUrl = userInfoData.avatarUrl; | |||
| this.globalData.userInfoData.nickName = userInfoData.nickName; | |||
| }else{ | |||
| this.getUserInfo(); | |||
| } | |||
| var userPhoneType = wx.getStorageSync('userPhoneType'); | |||
| if (userPhoneType) { | |||
| @@ -166,7 +168,17 @@ App({ | |||
| } | |||
| }, | |||
| submitUserMsg: function (avatarUrl, nickName) {//提交用户信息 | |||
| this.wxRequest(this.globalData.urlRoot + "userInfo/updateUserInfo", { avatarUrl: avatarUrl, nickName: nickName }, res => { }, this, "POST") | |||
| this.wxRequest(this.globalData.urlRoot + "userInfo/updateUserInfo", { avatarUrl: avatarUrl, nickName: nickName }, res => { | |||
| if (res.code == 200) { | |||
| this.globalData.userInfoData = {}; | |||
| this.globalData.userInfoData.avatarUrl = avatarUrl; | |||
| this.globalData.userInfoData.nickName = nickName; | |||
| wx.setStorageSync('userInfoData', { | |||
| avatarUrl: avatarUrl, | |||
| nickName: nickName | |||
| }) | |||
| } | |||
| }, this, "POST") | |||
| }, | |||
| codeVerify: function (card) {//身份证号码验证 | |||
| let rule = /(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}[0-9Xx]$)/; | |||
| @@ -194,6 +206,8 @@ App({ | |||
| }, this, "POST"); | |||
| }, | |||
| getMobile: function (encryptedData, iv, callback, thisArg) {//检查登录态是否过期 | |||
| console.log(encryptedData); | |||
| console.log(iv); | |||
| wx.checkSession({ | |||
| success: res => { | |||
| this.getMobile2(encryptedData,iv,callback,thisArg); | |||
| @@ -221,5 +235,20 @@ App({ | |||
| callback.call(thisArg, res); | |||
| } | |||
| }, this, "POST"); | |||
| }, | |||
| getUserInfo: function () {//获取个人信息 | |||
| this.wxRequest(this.globalData.urlRoot +"userInfo/getUserInfo",{},res=>{ | |||
| if(res.code==200){ | |||
| if (res.data && res.data.avatarUrl) { | |||
| this.globalData.userInfoData = {}; | |||
| this.globalData.userInfoData.avatarUrl = res.data.avatarUrl; | |||
| this.globalData.userInfoData.nickName = res.data.nickName; | |||
| wx.setStorageSync('userInfoData', { | |||
| avatarUrl: res.data.avatarUrl, | |||
| nickName: res.data.nickName | |||
| }) | |||
| } | |||
| } | |||
| },this) | |||
| } | |||
| }) | |||
| @@ -175,10 +175,12 @@ Page({ | |||
| if (e.detail.errMsg == 'getPhoneNumber:ok') { | |||
| app.getMobile(e.detail.encryptedData, e.detail.iv, res => { | |||
| if (res.code == 200) { | |||
| this.data.submitData.mobile = res.data.decodeData.phoneNumber; | |||
| this.setData({ | |||
| submitData: this.data.submitData | |||
| }) | |||
| if (res.data && res.data.decodeData) { | |||
| this.data.submitData.mobile = res.data.decodeData.phoneNumber; | |||
| this.setData({ | |||
| submitData: this.data.submitData | |||
| }) | |||
| } | |||
| } else { | |||
| wx.showToast({ | |||
| title: res.msg, | |||
| @@ -31,7 +31,8 @@ Page({ | |||
| videoList:[],//视频列表 | |||
| videoVideoControls:false,//是否显示视频控件 | |||
| mainShow:false, | |||
| isOnce:false | |||
| isOnce:false, | |||
| userData:null, | |||
| }, | |||
| onLoad: function () { | |||
| app.globalData.nowPage = 1; | |||
| @@ -46,6 +47,11 @@ Page({ | |||
| } | |||
| }, | |||
| loadFun: function () { | |||
| if (app.globalData.userInfoData) { | |||
| this.setData({ | |||
| userData: app.globalData.userInfoData | |||
| }) | |||
| } | |||
| if (app.globalData.userMobile) { | |||
| this.data.subscribeData.mobile = app.globalData.userMobile; | |||
| this.setData({ | |||
| @@ -120,7 +126,7 @@ Page({ | |||
| if (e.detail.errMsg=='getPhoneNumber:ok'){ | |||
| app.getMobile(e.detail.encryptedData, e.detail.iv,res=>{ | |||
| if (res.code == 200) { | |||
| if(res.data){ | |||
| if (res.data && res.data.decodeData){ | |||
| this.data.subscribeData.mobile = res.data.decodeData.phoneNumber; | |||
| this.setData({ | |||
| subscribeData: this.data.subscribeData | |||
| @@ -396,5 +402,13 @@ Page({ | |||
| */ | |||
| onShareAppMessage: function () { | |||
| return app.sharePack(); | |||
| }, | |||
| getUserWxMsg:function(e){ | |||
| if (e.detail.errMsg == "getUserInfo:ok") { | |||
| this.setData({ | |||
| userData: e.detail.userInfo | |||
| }) | |||
| app.submitUserMsg(e.detail.userInfo.avatarUrl, e.detail.userInfo.nickName); | |||
| } | |||
| } | |||
| }) | |||
| @@ -53,7 +53,9 @@ | |||
| </view> | |||
| </picker> | |||
| </view> | |||
| <view class="subscribeBtn" bindtap="subscribeFun">预约鉴赏</view> | |||
| <view class="subscribeBtn" bindtap="subscribeFun">预约鉴赏 | |||
| <button wx:if="{{!userData}}" class="getUserMsgBtn" open-type="getUserInfo" lang="zh_CN" bindgetuserinfo="getUserWxMsg" style="width:100%;height:100%;min-height:0;"></button> | |||
| </view> | |||
| </view> | |||
| <service></service> | |||
| </view> | |||
| @@ -82,6 +82,7 @@ view{ | |||
| height: 15rpx; | |||
| } | |||
| .subscribeBtn{ | |||
| position: relative; | |||
| width:672rpx; | |||
| height:54rpx; | |||
| line-height: 54rpx; | |||
| @@ -203,4 +204,12 @@ view{ | |||
| bottom: 25rpx; | |||
| width: 188rpx; | |||
| height: 40rpx; | |||
| } | |||
| .getUserMsgBtn{ | |||
| position: absolute; | |||
| top: 0; | |||
| left: 0; | |||
| padding: 0; | |||
| margin: 0; | |||
| opacity: 0; | |||
| } | |||
| @@ -49,9 +49,8 @@ Page({ | |||
| }, | |||
| loadFun: function () { | |||
| if (app.globalData.userInfoData) { | |||
| this.data.userData = app.globalData.userInfoData; | |||
| this.setData({ | |||
| userData: this.data.userData | |||
| userData: app.globalData.userInfoData | |||
| }) | |||
| } | |||
| this.getAddress(); | |||
| @@ -337,16 +336,8 @@ Page({ | |||
| getUserWxMsg: function (e) {//通过微信获取用户信息 | |||
| if (e.detail.errMsg == "getUserInfo:ok") { | |||
| this.gameStart(); | |||
| app.globalData.userInfoData = {}; | |||
| app.globalData.userInfoData.avatarUrl = e.detail.userInfo.avatarUrl; | |||
| app.globalData.userInfoData.nickName = e.detail.userInfo.nickName; | |||
| this.data.userData = app.globalData.userInfoData; | |||
| this.setData({ | |||
| userData:this.data.userData | |||
| }) | |||
| wx.setStorageSync('userInfoData', { | |||
| avatarUrl: e.detail.userInfo.avatarUrl, | |||
| nickName: e.detail.userInfo.nickName | |||
| userData: e.detail.userInfo | |||
| }) | |||
| app.submitUserMsg(e.detail.userInfo.avatarUrl, e.detail.userInfo.nickName); | |||
| }else{ | |||
| @@ -193,7 +193,7 @@ Page({ | |||
| if (e.detail.errMsg == 'getPhoneNumber:ok') { | |||
| app.getMobile(e.detail.encryptedData, e.detail.iv, res => { | |||
| if (res.code == 200) { | |||
| if (res.data.result == 0) { | |||
| if (res.data && res.data.decodeData) { | |||
| this.setData({ | |||
| mobileText: res.data.decodeData.phoneNumber | |||
| }) | |||
| @@ -363,18 +363,10 @@ Page({ | |||
| if (e.detail.errMsg == "getUserInfo:ok") { | |||
| this.data.userData.avatarUrl = e.detail.userInfo.avatarUrl; | |||
| this.data.userData.nickName = e.detail.userInfo.nickName; | |||
| this.data.userData.userLevel = 0; | |||
| this.setData({ | |||
| userData: this.data.userData, | |||
| isLogin: true | |||
| }) | |||
| app.globalData.userInfoData = {}; | |||
| app.globalData.userInfoData.avatarUrl = e.detail.userInfo.avatarUrl; | |||
| app.globalData.userInfoData.nickName = e.detail.userInfo.nickName; | |||
| wx.setStorageSync('userInfoData', { | |||
| avatarUrl: e.detail.userInfo.avatarUrl, | |||
| nickName: e.detail.userInfo.nickName | |||
| }) | |||
| app.submitUserMsg(e.detail.userInfo.avatarUrl, e.detail.userInfo.nickName); | |||
| } | |||
| }, | |||
| @@ -497,7 +489,7 @@ Page({ | |||
| if (e.detail.errMsg == 'getPhoneNumber:ok') { | |||
| app.getMobile(e.detail.encryptedData, e.detail.iv, res => { | |||
| if (res.code == 200) { | |||
| if(res.data){ | |||
| if (res.data && res.data.decodeData){ | |||
| this.data.subscribeData.mobile = res.data.decodeData.phoneNumber; | |||
| this.setData({ | |||
| subscribeData: this.data.subscribeData | |||
| @@ -168,7 +168,9 @@ | |||
| <image class="agreeIcon" bindtap="agreementState" src="{{imgUrl+(isAgreement?'/images/agreeIcon.png':'/images/disagreeIcon.png')}}"></image> | |||
| <view class="agreementText"><view>我仔细阅读并接受所附的</view><view bindtap="agreementControl">《用户协议与隐私政策》</view></view> | |||
| </view> | |||
| <view class="subscribeBtn" bindtap="subscribeFun">登录/注册</view> | |||
| <view class="subscribeBtn" bindtap="subscribeFun">登录/注册 | |||
| <button wx:if="{{userData}}" class="getUserMsgBtn" open-type="getUserInfo" lang="zh_CN" bindgetuserinfo="getUserWxMsg" style="width:100%;height:100%;min-height:0;"></button> | |||
| </view> | |||
| <view class="subscribeBtn">查看更多车型</view> | |||
| </view> | |||
| <!-- <view class="subscribeGroup" wx:if="{{selectNow==4 && isRegister}}"> | |||
| @@ -453,6 +453,7 @@ view{ | |||
| height: 15rpx; | |||
| } | |||
| .subscribeBtn{ | |||
| position: relative; | |||
| margin: 0 auto; | |||
| width:652rpx; | |||
| height:65rpx; | |||
| @@ -39,12 +39,8 @@ Page({ | |||
| this.data.userData.nickName = e.detail.userInfo.nickName; | |||
| this.data.userData.userLevel = 0; | |||
| this.setData({ | |||
| userData: this.data.userData, | |||
| isLogin: true | |||
| userData: this.data.userData | |||
| }) | |||
| app.globalData.userInfoData = {}; | |||
| app.globalData.userInfoData.avatarUrl = e.detail.userInfo.avatarUrl; | |||
| app.globalData.userInfoData.nickName = e.detail.userInfo.nickName; | |||
| app.submitUserMsg(e.detail.userInfo.avatarUrl, e.detail.userInfo.nickName); | |||
| wx.navigateTo({ | |||
| url:'../poster/poster' | |||
| @@ -67,9 +63,6 @@ Page({ | |||
| this.setData({ | |||
| userData: this.data.userData | |||
| }) | |||
| app.globalData.userInfoData = {}; | |||
| app.globalData.userInfoData.avatarUrl = res.data.avatarUrl; | |||
| app.globalData.userInfoData.nickName = res.data.nickName; | |||
| wx.navigateTo({ | |||
| url:'../poster/poster' | |||
| }) | |||
| @@ -3,8 +3,8 @@ | |||
| <view class="content"> | |||
| <image class="bg" src="{{imgUrl+'/star/scout/bg.jpg'}}"></image> | |||
| <image class="reward" wx:if="{{maskid<4}}" src="{{imgUrl+'/star/scout/reward.png'}}"></image> | |||
| <image class="reward" wx:if="{{maskid>3}}" src="{{imgUrl+'/star/tu1.png'}}"></image> | |||
| <view class="btn" bindtap="getPoster">立即分享,赚取奖励</view> | |||
| <image class="reward" wx:if="{{maskid>3}}" src="{{imgUrl+'/star/tu1.png?v=002'}}"></image> | |||
| <view class="btn" bindtap="getPoster">{{maskid<4?"立即分享,赚取奖励":"立即分享"}}</view> | |||
| <button class="btn2" wx:if="{{iconShow}}" open-type="getUserInfo" bindgetuserinfo="getUserWxMsg"></button> | |||
| </view> | |||
| <view class="mask" wx:if="{{maskShow}}"> | |||
| @@ -18,6 +18,7 @@ | |||
| margin: 43rpx auto 0 auto; | |||
| } | |||
| .btn{ | |||
| position: relative; | |||
| text-align: center; | |||
| width: 654rpx; | |||
| height: 58rpx; | |||
| @@ -88,4 +89,13 @@ | |||
| /* .closeBtn::before { | |||
| content: "\2716"; | |||
| } */ | |||
| } */ | |||
| .getUserMsgBtn{ | |||
| position: absolute; | |||
| left: 0; | |||
| top: 0; | |||
| opacity: 0; | |||
| margin: 0; | |||
| padding: 0; | |||
| } | |||
| @@ -122,7 +122,13 @@ | |||
| "name": "用户协议与隐私政策", | |||
| "pathName": "pages/agreement/agreement", | |||
| "query": "" | |||
| } | |||
| }, | |||
| { | |||
| "id": -1, | |||
| "name": "星探任务", | |||
| "pathName": "pages/scout/scout", | |||
| "query": "" | |||
| } | |||
| ] | |||
| } | |||
| } | |||