this.globalData.userInfoData = {}; | this.globalData.userInfoData = {}; | ||||
this.globalData.userInfoData.avatarUrl = userInfoData.avatarUrl; | this.globalData.userInfoData.avatarUrl = userInfoData.avatarUrl; | ||||
this.globalData.userInfoData.nickName = userInfoData.nickName; | this.globalData.userInfoData.nickName = userInfoData.nickName; | ||||
}else{ | |||||
this.getUserInfo(); | |||||
} | } | ||||
var userPhoneType = wx.getStorageSync('userPhoneType'); | var userPhoneType = wx.getStorageSync('userPhoneType'); | ||||
if (userPhoneType) { | if (userPhoneType) { | ||||
} | } | ||||
}, | }, | ||||
submitUserMsg: function (avatarUrl, nickName) {//提交用户信息 | 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) {//身份证号码验证 | 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]$)/; | 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]$)/; | ||||
}, this, "POST"); | }, this, "POST"); | ||||
}, | }, | ||||
getMobile: function (encryptedData, iv, callback, thisArg) {//检查登录态是否过期 | getMobile: function (encryptedData, iv, callback, thisArg) {//检查登录态是否过期 | ||||
console.log(encryptedData); | |||||
console.log(iv); | |||||
wx.checkSession({ | wx.checkSession({ | ||||
success: res => { | success: res => { | ||||
this.getMobile2(encryptedData,iv,callback,thisArg); | this.getMobile2(encryptedData,iv,callback,thisArg); | ||||
callback.call(thisArg, res); | callback.call(thisArg, res); | ||||
} | } | ||||
}, this, "POST"); | }, 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) | |||||
} | } | ||||
}) | }) |
if (e.detail.errMsg == 'getPhoneNumber:ok') { | if (e.detail.errMsg == 'getPhoneNumber:ok') { | ||||
app.getMobile(e.detail.encryptedData, e.detail.iv, res => { | app.getMobile(e.detail.encryptedData, e.detail.iv, res => { | ||||
if (res.code == 200) { | 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 { | } else { | ||||
wx.showToast({ | wx.showToast({ | ||||
title: res.msg, | title: res.msg, |
videoList:[],//视频列表 | videoList:[],//视频列表 | ||||
videoVideoControls:false,//是否显示视频控件 | videoVideoControls:false,//是否显示视频控件 | ||||
mainShow:false, | mainShow:false, | ||||
isOnce:false | |||||
isOnce:false, | |||||
userData:null, | |||||
}, | }, | ||||
onLoad: function () { | onLoad: function () { | ||||
app.globalData.nowPage = 1; | app.globalData.nowPage = 1; | ||||
} | } | ||||
}, | }, | ||||
loadFun: function () { | loadFun: function () { | ||||
if (app.globalData.userInfoData) { | |||||
this.setData({ | |||||
userData: app.globalData.userInfoData | |||||
}) | |||||
} | |||||
if (app.globalData.userMobile) { | if (app.globalData.userMobile) { | ||||
this.data.subscribeData.mobile = app.globalData.userMobile; | this.data.subscribeData.mobile = app.globalData.userMobile; | ||||
this.setData({ | this.setData({ | ||||
if (e.detail.errMsg=='getPhoneNumber:ok'){ | if (e.detail.errMsg=='getPhoneNumber:ok'){ | ||||
app.getMobile(e.detail.encryptedData, e.detail.iv,res=>{ | app.getMobile(e.detail.encryptedData, e.detail.iv,res=>{ | ||||
if (res.code == 200) { | if (res.code == 200) { | ||||
if(res.data){ | |||||
if (res.data && res.data.decodeData){ | |||||
this.data.subscribeData.mobile = res.data.decodeData.phoneNumber; | this.data.subscribeData.mobile = res.data.decodeData.phoneNumber; | ||||
this.setData({ | this.setData({ | ||||
subscribeData: this.data.subscribeData | subscribeData: this.data.subscribeData | ||||
*/ | */ | ||||
onShareAppMessage: function () { | onShareAppMessage: function () { | ||||
return app.sharePack(); | 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); | |||||
} | |||||
} | } | ||||
}) | }) |
</view> | </view> | ||||
</picker> | </picker> | ||||
</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> | </view> | ||||
<service></service> | <service></service> | ||||
</view> | </view> |
height: 15rpx; | height: 15rpx; | ||||
} | } | ||||
.subscribeBtn{ | .subscribeBtn{ | ||||
position: relative; | |||||
width:672rpx; | width:672rpx; | ||||
height:54rpx; | height:54rpx; | ||||
line-height: 54rpx; | line-height: 54rpx; | ||||
bottom: 25rpx; | bottom: 25rpx; | ||||
width: 188rpx; | width: 188rpx; | ||||
height: 40rpx; | height: 40rpx; | ||||
} | |||||
.getUserMsgBtn{ | |||||
position: absolute; | |||||
top: 0; | |||||
left: 0; | |||||
padding: 0; | |||||
margin: 0; | |||||
opacity: 0; | |||||
} | } |
}, | }, | ||||
loadFun: function () { | loadFun: function () { | ||||
if (app.globalData.userInfoData) { | if (app.globalData.userInfoData) { | ||||
this.data.userData = app.globalData.userInfoData; | |||||
this.setData({ | this.setData({ | ||||
userData: this.data.userData | |||||
userData: app.globalData.userInfoData | |||||
}) | }) | ||||
} | } | ||||
this.getAddress(); | this.getAddress(); | ||||
getUserWxMsg: function (e) {//通过微信获取用户信息 | getUserWxMsg: function (e) {//通过微信获取用户信息 | ||||
if (e.detail.errMsg == "getUserInfo:ok") { | if (e.detail.errMsg == "getUserInfo:ok") { | ||||
this.gameStart(); | 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({ | 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); | app.submitUserMsg(e.detail.userInfo.avatarUrl, e.detail.userInfo.nickName); | ||||
}else{ | }else{ |
if (e.detail.errMsg == 'getPhoneNumber:ok') { | if (e.detail.errMsg == 'getPhoneNumber:ok') { | ||||
app.getMobile(e.detail.encryptedData, e.detail.iv, res => { | app.getMobile(e.detail.encryptedData, e.detail.iv, res => { | ||||
if (res.code == 200) { | if (res.code == 200) { | ||||
if (res.data.result == 0) { | |||||
if (res.data && res.data.decodeData) { | |||||
this.setData({ | this.setData({ | ||||
mobileText: res.data.decodeData.phoneNumber | mobileText: res.data.decodeData.phoneNumber | ||||
}) | }) |
if (e.detail.errMsg == "getUserInfo:ok") { | if (e.detail.errMsg == "getUserInfo:ok") { | ||||
this.data.userData.avatarUrl = e.detail.userInfo.avatarUrl; | this.data.userData.avatarUrl = e.detail.userInfo.avatarUrl; | ||||
this.data.userData.nickName = e.detail.userInfo.nickName; | this.data.userData.nickName = e.detail.userInfo.nickName; | ||||
this.data.userData.userLevel = 0; | |||||
this.setData({ | this.setData({ | ||||
userData: this.data.userData, | userData: this.data.userData, | ||||
isLogin: true | 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); | app.submitUserMsg(e.detail.userInfo.avatarUrl, e.detail.userInfo.nickName); | ||||
} | } | ||||
}, | }, | ||||
if (e.detail.errMsg == 'getPhoneNumber:ok') { | if (e.detail.errMsg == 'getPhoneNumber:ok') { | ||||
app.getMobile(e.detail.encryptedData, e.detail.iv, res => { | app.getMobile(e.detail.encryptedData, e.detail.iv, res => { | ||||
if (res.code == 200) { | if (res.code == 200) { | ||||
if(res.data){ | |||||
if (res.data && res.data.decodeData){ | |||||
this.data.subscribeData.mobile = res.data.decodeData.phoneNumber; | this.data.subscribeData.mobile = res.data.decodeData.phoneNumber; | ||||
this.setData({ | this.setData({ | ||||
subscribeData: this.data.subscribeData | subscribeData: this.data.subscribeData |
<image class="agreeIcon" bindtap="agreementState" src="{{imgUrl+(isAgreement?'/images/agreeIcon.png':'/images/disagreeIcon.png')}}"></image> | <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 class="agreementText"><view>我仔细阅读并接受所附的</view><view bindtap="agreementControl">《用户协议与隐私政策》</view></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 class="subscribeBtn">查看更多车型</view> | ||||
</view> | </view> | ||||
<!-- <view class="subscribeGroup" wx:if="{{selectNow==4 && isRegister}}"> | <!-- <view class="subscribeGroup" wx:if="{{selectNow==4 && isRegister}}"> |
height: 15rpx; | height: 15rpx; | ||||
} | } | ||||
.subscribeBtn{ | .subscribeBtn{ | ||||
position: relative; | |||||
margin: 0 auto; | margin: 0 auto; | ||||
width:652rpx; | width:652rpx; | ||||
height:65rpx; | height:65rpx; |
this.data.userData.nickName = e.detail.userInfo.nickName; | this.data.userData.nickName = e.detail.userInfo.nickName; | ||||
this.data.userData.userLevel = 0; | this.data.userData.userLevel = 0; | ||||
this.setData({ | 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); | app.submitUserMsg(e.detail.userInfo.avatarUrl, e.detail.userInfo.nickName); | ||||
wx.navigateTo({ | wx.navigateTo({ | ||||
url:'../poster/poster' | url:'../poster/poster' | ||||
this.setData({ | this.setData({ | ||||
userData: this.data.userData | userData: this.data.userData | ||||
}) | }) | ||||
app.globalData.userInfoData = {}; | |||||
app.globalData.userInfoData.avatarUrl = res.data.avatarUrl; | |||||
app.globalData.userInfoData.nickName = res.data.nickName; | |||||
wx.navigateTo({ | wx.navigateTo({ | ||||
url:'../poster/poster' | url:'../poster/poster' | ||||
}) | }) |
<view class="content"> | <view class="content"> | ||||
<image class="bg" src="{{imgUrl+'/star/scout/bg.jpg'}}"></image> | <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<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> | <button class="btn2" wx:if="{{iconShow}}" open-type="getUserInfo" bindgetuserinfo="getUserWxMsg"></button> | ||||
</view> | </view> | ||||
<view class="mask" wx:if="{{maskShow}}"> | <view class="mask" wx:if="{{maskShow}}"> |
margin: 43rpx auto 0 auto; | margin: 43rpx auto 0 auto; | ||||
} | } | ||||
.btn{ | .btn{ | ||||
position: relative; | |||||
text-align: center; | text-align: center; | ||||
width: 654rpx; | width: 654rpx; | ||||
height: 58rpx; | height: 58rpx; | ||||
/* .closeBtn::before { | /* .closeBtn::before { | ||||
content: "\2716"; | content: "\2716"; | ||||
} */ | |||||
} */ | |||||
.getUserMsgBtn{ | |||||
position: absolute; | |||||
left: 0; | |||||
top: 0; | |||||
opacity: 0; | |||||
margin: 0; | |||||
padding: 0; | |||||
} |
"name": "用户协议与隐私政策", | "name": "用户协议与隐私政策", | ||||
"pathName": "pages/agreement/agreement", | "pathName": "pages/agreement/agreement", | ||||
"query": "" | "query": "" | ||||
} | |||||
}, | |||||
{ | |||||
"id": -1, | |||||
"name": "星探任务", | |||||
"pathName": "pages/scout/scout", | |||||
"query": "" | |||||
} | |||||
] | ] | ||||
} | } | ||||
} | } |