@@ -9,15 +9,20 @@ Page({ | |||
data: { | |||
imgUrl: app.globalData.urlStatic,//图片路径 | |||
type: 0, //1车主 0非车主 | |||
imgCode:'1234',//验证码 | |||
imgCode:'',//验证码 | |||
vocationList:['网约车司机','公交司机','快的司机'],//职业列表 | |||
vocationIndex:0, | |||
cityList:['宁波','北京','上海','佛山'],//城市列表 | |||
cityIndex:0, | |||
vocationList2:[],//职业列表2 | |||
vocationIndex:'0', | |||
allList:[],//所有列表 | |||
cityList:[['宁波','北京'],['上海','佛山']],//城市列表 | |||
cityIndex:['0','0'], | |||
getVcodeTime:0,//获取验证码倒计时 | |||
getCodeTimeKey:null, | |||
photoList:[],//图片列表 | |||
agree:false,//是否同意本协议 | |||
getphone:"",//手机号 | |||
maskShow: false, | |||
mydata:[],//我的数据 | |||
}, | |||
/** | |||
* 切换车主非车主 | |||
@@ -34,10 +39,73 @@ Page({ | |||
} | |||
}, | |||
/** | |||
* 提交信息 | |||
* 提交信息-认证 | |||
*/ | |||
formSubmit1(e){ | |||
console.log('form发生了submit事件,携带数据为:', e.detail.value) | |||
var res = this.mcaptcha.validate(e.detail.value.code); | |||
if (e.detail.value.VIN == "" || e.detail.value.VIN == null) { | |||
wx.showToast({icon:'none',title: '请输入车牌号/VIN号'}) | |||
return; | |||
}else if (e.detail.value.code == "" || e.detail.value.code == null) { | |||
wx.showToast({icon:'none',title: '请输入图形验证码'}) | |||
}else if (!res) { | |||
wx.showToast({icon:'none',title: '图形验证码错误'}) | |||
}else{ | |||
app.wxRequest(app.globalData.urlRoot + "userInfo/certificationCar", {carInfo:e.detail.value.VIN}, res => { | |||
if (res.code == 200) { | |||
if(res.data!=null){ | |||
app.globalData.certificationState=res.data.certificationState; | |||
wx.navigateTo({url: '../scout/scout'}) | |||
}else{ | |||
wx.showToast({icon:'none',title: '认证失败'}) | |||
} | |||
}else{ | |||
wx.showToast({icon:'none',title: ''+res.msg}) | |||
} | |||
}, this,"POST"); | |||
} | |||
}, | |||
/** | |||
* 提交信息-注册 | |||
*/ | |||
formSubmit2(e){ | |||
console.log('form发生了submit事件,携带数据为:', e.detail.value) | |||
if (e.detail.value.name == "" || e.detail.value.name == null) { | |||
wx.showToast({icon:'none',title: '请输入您的姓名'}) | |||
}else if (e.detail.value.phone == "" || e.detail.value.phone == null) { | |||
wx.showToast({icon:'none',title: '请输入您的手机号码'}) | |||
}else if (e.detail.value.code == "" || e.detail.value.code == null) { | |||
wx.showToast({icon:'none',title: '请输入您的验证码'}) | |||
}else if(this.data.photoList.length<0){ | |||
wx.showToast({icon:'none',title: '请上传您的照片'}) | |||
}else if(!this.data.agree){ | |||
wx.showToast({icon:'none',title: '请阅读并同意协议内容'}) | |||
}else{ | |||
app.wxRequest(app.globalData.urlRoot + "userInfo/submitCertificationNoCarInfo", { | |||
mobile:e.detail.value.phone, | |||
captcha:e.detail.value.code, | |||
realname:e.detail.value.name, | |||
jobId:this.data.vocationList2[parseInt(this.data.vocationIndex)]["jobId"], | |||
jobDetail:this.data.vocationList2[parseInt(this.data.vocationIndex)]["jobDetail"], | |||
city:this.data.cityList[1][e.detail.value.city[1]], | |||
picArr:JSON.stringify(this.data.photoList) | |||
}, res => { | |||
console.log(res) | |||
if (res.code == 200) { | |||
this.setData({maskShow:true}) | |||
}else{ | |||
wx.showToast({icon:'none',title: ''+res.msg}) | |||
} | |||
}, this,"POST"); | |||
} | |||
}, | |||
/** | |||
* 关闭弹窗 | |||
*/ | |||
hiddenRule:function(){ | |||
this.setData({maskShow: false}) | |||
wx.navigateTo({url: '../../star/star'}) | |||
}, | |||
/** | |||
* 更换职业 | |||
@@ -55,19 +123,76 @@ Page({ | |||
cityIndex: e.detail.value | |||
}) | |||
}, | |||
changeCity2(e){ | |||
if(e.detail.column==0){ | |||
var jushu=[]; | |||
jushu[0]=e.detail.value; | |||
jushu[1]=0; | |||
this.setData({ | |||
cityIndex:jushu | |||
}) | |||
var shuju=[]; | |||
var shuju2=[]; | |||
for(var i=0;i<this.data.allList.length;i++){ | |||
if(this.data.cityList[0].indexOf(this.data.allList[i]["province"])==this.data.cityIndex[0]){ | |||
shuju2.push(this.data.allList[i]["city"]); | |||
} | |||
} | |||
shuju[0]=this.data.cityList[0]; | |||
shuju[1]=shuju2; | |||
this.setData({ | |||
cityList:shuju | |||
}) | |||
}else{ | |||
var jushu=[]; | |||
jushu[0]=this.data.cityIndex[0]; | |||
jushu[1]=e.detail.value; | |||
this.setData({ | |||
cityIndex:jushu | |||
}) | |||
} | |||
}, | |||
/** | |||
* 获取验证码 | |||
* 获取手机号 | |||
*/ | |||
getVcode(){ | |||
console.log('获取验证码') | |||
getphone(e){ | |||
this.setData({ | |||
getVcodeTime: 60 | |||
getphone: e.detail.value | |||
}) | |||
this.getCodeTimeKey=setInterval(this.vCodeDownTime,1000); | |||
}, | |||
/** | |||
* 获取验证码 | |||
*/ | |||
getVcode(){ | |||
console.log('获取验证码'); | |||
if (this.data.getphone == "" || this.data.getphone == null) { | |||
wx.showToast({ | |||
icon:'none', | |||
title: '请输入您的手机号码' | |||
}) | |||
return; | |||
} | |||
if (!app.mobileVerify(this.data.getphone)) { | |||
wx.showToast({ | |||
icon:'none', | |||
title: '请输入正确手机号码' | |||
}) | |||
return; | |||
} | |||
app.wxRequest(app.globalData.urlRoot + "captcha/sendCaptcha", {mobile:this.data.getphone}, res => { | |||
console.log(res) | |||
if (res.code == 200) { | |||
this.setData({ | |||
getVcodeTime: 60 | |||
}) | |||
this.getCodeTimeKey=setInterval(this.vCodeDownTime,1000); | |||
}else{ | |||
wx.showToast({icon:'none',title: ''+res.msg}) | |||
} | |||
}, this); | |||
}, | |||
vCodeDownTime(){ | |||
var time = this.data.getVcodeTime-1; | |||
console.log(time) | |||
this.setData({ | |||
getVcodeTime: time | |||
}) | |||
@@ -78,16 +203,36 @@ Page({ | |||
/** | |||
* 上传照片 | |||
*/ | |||
chooseImage(){ | |||
chooseImage(e){ | |||
var list=this.data.photoList; | |||
wx.chooseImage({ | |||
count:1, | |||
sizeType: ['original'], //可选择原图 | |||
sourceType: ['album', 'camera'], //可选择性开放访问相册、相机 | |||
success: res => { | |||
var list=this.data.photoList; | |||
list.push(res.tempFilePaths[0]); | |||
this.setData({ | |||
photoList:list | |||
wx.uploadFile({ | |||
url: app.globalData.urlRoot + "upload/uploadImage", | |||
header:{"OPENID": app.globalData.openid}, | |||
filePath: res.tempFilePaths[0], | |||
name: "file", | |||
success: res => { | |||
console.log(res) | |||
if(res.data){ | |||
console.log(JSON.parse(res.data)); | |||
var json=JSON.parse(res.data); | |||
if(json.code==200){ | |||
console.log(json.data[0].url); | |||
if(e.currentTarget.dataset.value>-1){ | |||
list[e.currentTarget.dataset.value]=json.data[0].url; | |||
}else{ | |||
list.push(json.data[0].url); | |||
} | |||
this.setData({photoList:list}); | |||
}else{ | |||
wx.showToast({icon:'none',title: '图片上传失败'}) | |||
} | |||
} | |||
} | |||
}) | |||
} | |||
}) | |||
@@ -117,7 +262,44 @@ Page({ | |||
height: 35, | |||
createCodeImg: "" | |||
}); | |||
setTimeout(this.checkVcode, 1000); | |||
app.wxRequest(app.globalData.urlRoot + "userInfo/getJobList", {}, res => { | |||
console.log(res) | |||
if (res.code == 200) { | |||
var shuju=[]; | |||
for(var i=0;i<res.data.length;i++){ | |||
shuju.push(res.data[i]["jobDetail"]); | |||
} | |||
this.setData({ | |||
vocationList:shuju, | |||
vocationList2:res.data | |||
}) | |||
} | |||
}, this); | |||
app.wxRequest(app.globalData.urlRoot + "userInfo/getNoCarCityList", {}, res => { | |||
console.log(res) | |||
if (res.code == 200) { | |||
var shuju=[]; | |||
var shuju1=[]; | |||
var shuju2=[]; | |||
for(var i=0;i<res.data.length;i++){ | |||
if(shuju1.indexOf(res.data[i]["province"])==-1){ | |||
shuju1.push(res.data[i]["province"]); | |||
} | |||
} | |||
for(var i=0;i<res.data.length;i++){ | |||
if(shuju1.indexOf(res.data[i]["province"])==this.data.cityIndex[0]){ | |||
shuju2.push(res.data[i]["city"]); | |||
} | |||
} | |||
shuju[0]=shuju1; | |||
shuju[1]=shuju2; | |||
this.setData({ | |||
allList:res.data, | |||
cityList:shuju | |||
}) | |||
this.getshow(); | |||
} | |||
}, this); | |||
}, | |||
/** | |||
* 刷新验证码 | |||
@@ -125,30 +307,54 @@ Page({ | |||
vCodeRefresh() { | |||
this.mcaptcha.refresh(); | |||
}, | |||
/** | |||
* 验证验证码 | |||
*/ | |||
checkVcode() { | |||
var res = this.mcaptcha.validate(this.data.imgCode); | |||
if (this.data.imgCode == "" || this.data.imgCode == null) { | |||
wx.showToast({ | |||
title: '请输入图形验证码' | |||
}) | |||
return; | |||
} | |||
if (!res) { | |||
wx.showToast({ | |||
title: '图形验证码错误' | |||
}) | |||
return; | |||
} | |||
}, | |||
/** | |||
* 生命周期函数--监听页面显示 | |||
*/ | |||
onShow: function() { | |||
this.getshow(); | |||
}, | |||
getshow(){ | |||
app.wxRequest(app.globalData.urlRoot + "userInfo/getCertificationNoCarInfo", {}, res => { | |||
console.log(res) | |||
if(res.code=200 && res.data){ | |||
if(res.data.adminState==1){//审核通过 | |||
wx.navigateTo({url: '../../star/star'}) | |||
}else if(res.data.adminState==0 || res.data.adminState==-1){//审核中&审核失败 | |||
if(res.data.adminState==0){ | |||
this.setData({maskShow:true}) | |||
} | |||
var jushu=[],shuju=[],shuju2=[]; | |||
for(var i=0;i<this.data.allList.length;i++){ | |||
if(this.data.allList[i]["city"]==res.data.city){ | |||
jushu[0]=this.data.cityList[0].indexOf(this.data.allList[i]["province"]); | |||
} | |||
} | |||
for(var i=0;i<this.data.allList.length;i++){ | |||
if(this.data.cityList[0].indexOf(this.data.allList[i]["province"])==jushu[0]){ | |||
shuju2.push(this.data.allList[i]["city"]); | |||
} | |||
} | |||
for(var i=0;i<shuju2.length;i++){ | |||
if(shuju2[i]==res.data.city){ | |||
jushu[1]=i; | |||
} | |||
} | |||
shuju[0]=this.data.cityList[0]; | |||
shuju[1]=shuju2; | |||
this.setData({ | |||
mydata:res.data, | |||
vocationIndex:parseInt(res.data.jobId)-1, | |||
cityIndex:jushu, | |||
cityList:shuju, | |||
agree:true, | |||
photoList:res.data.picArr, | |||
getphone:res.data.mobile, | |||
}) | |||
} | |||
} | |||
}, this); | |||
}, | |||
/** |
@@ -1,4 +1,5 @@ | |||
{ | |||
"navigationBarTitleText": "东风启辰“星探计划”", | |||
"usingComponents": { | |||
"tabBar": "../component/tabBar/index" | |||
} |
@@ -19,7 +19,7 @@ | |||
<view class="reminder">温馨提示:您填写的信息将同步至东风启辰服务号,以便改善我们的产品,更好的为您提供优质的服务。</view> | |||
</view> | |||
</form> | |||
<form wx:else> | |||
<form bindsubmit="formSubmit2" wx:else> | |||
<view class="NoVehicle"> | |||
<picker name="vocation" bindchange="changeVocation" value="{{vocationIndex}}" range="{{vocationList}}"> | |||
<view class="picker"> | |||
@@ -27,14 +27,14 @@ | |||
</view> | |||
<image class="arrowDown" src="{{imgUrl+'/star/scout/register/arrowDown.png'}}"></image> | |||
</picker> | |||
<input name="name" placeholder="请输入您的姓名" placeholder-style="font-size:23rpx;" /> | |||
<input name="phone" placeholder="请输入您的手机号码" placeholder-style="font-size:23rpx;" /> | |||
<input name="name" placeholder="请输入您的姓名" placeholder-style="font-size:23rpx;" value="{{mydata.realname}}"/> | |||
<input name="phone" placeholder="请输入您的手机号码" placeholder-style="font-size:23rpx;" bindinput="getphone" value="{{mydata.mobile}}"/> | |||
<input name="code" placeholder="请输入您的验证码" placeholder-style="font-size:23rpx;" style="padding-right:250rpx;" /> | |||
<view class="getCode" bindtap="getVcode" wx:if="{{getVcodeTime==0}}" style="z-index:99;">获取验证码</view> | |||
<view class="getCode codeTip" wx:if="{{getVcodeTime!=0}}">{{getVcodeTime}}秒后重新发送</view> | |||
<picker name="city" bindchange="changeCity" value="{{cityIndex}}" range="{{cityList}}"> | |||
<picker name="city" mode="multiSelector" bindchange="changeCity" bindcolumnchange="changeCity2" value="{{cityIndex}}" range="{{cityList}}"> | |||
<view class="picker"> | |||
{{cityList[cityIndex]}} | |||
{{cityList[1][cityIndex[1]]}} | |||
</view> | |||
<image class="arrowDown" src="{{imgUrl+'/star/scout/register/arrowDown.png'}}"></image> | |||
</picker> | |||
@@ -51,10 +51,10 @@ | |||
</view> | |||
<view class="upPhotoTitle">请上传您的照片:</view> | |||
<view class="upPhonoBox"> | |||
<view class="phontBox" wx:for="{{photoList}}" wx:if="photoList.length>0"> | |||
<image src="{{item}}" mode="aspectFill"></image> | |||
<view class="phontBox" wx:for="{{photoList}}" wx:key="*this" wx:if="{{photoList.length>0}}" bindtap="chooseImage"data-value="{{index}}"> | |||
<image src="{{item}}" mode="aspectFill" ></image> | |||
</view> | |||
<image class="upPhontBtn" src="{{imgUrl+'/star/scout/register/upBtn.png'}}" bindtap="chooseImage"></image> | |||
<image class="upPhontBtn" wx:if="{{photoList.length<3}}" src="{{imgUrl+'/star/scout/register/upBtn.png'}}" bindtap="chooseImage"></image> | |||
</view> | |||
<view class="photoNotes">注:请上传您与车辆及经营许可证的合影</view> | |||
<button class="submitBtn" formType="submit">提交</button> | |||
@@ -67,5 +67,11 @@ | |||
</view> | |||
</form> | |||
</view> | |||
<view class="mask" wx:if="{{maskShow}}"> | |||
<view class="ruleContent"> | |||
<image class="rule" src="{{imgUrl+'/star/scout/register/getok.png'}}" bindtap="hiddenRule">></image> | |||
<view class="closeBtn" style="right:-35rpx;top:-40rpx;" bindtap="hiddenRule"></view> | |||
</view> | |||
</view> | |||
</view> | |||
<tabBar></tabBar> |
@@ -199,4 +199,50 @@ image.arrowDown{ | |||
height: 20rpx; | |||
display: inline-block; | |||
margin-right: 5rpx; | |||
} | |||
.mask { | |||
position: absolute; | |||
left: 0; | |||
top: 0; | |||
width: 100%; | |||
height: 100%; | |||
display: flex; | |||
align-items: center; | |||
justify-content: center; | |||
background-color: rgba(0, 0, 0, 0.5); | |||
z-index: 99999; | |||
} | |||
.mask>.ruleContent { | |||
position: relative; | |||
width: 484rpx; | |||
height: 455rpx; | |||
border-radius: 20rpx; | |||
/* background-color: #ffffff; */ | |||
} | |||
.mask>.ruleContent>.rule { | |||
position: relative; | |||
width: 100%; | |||
height: 100%; | |||
} | |||
.closeBtn { | |||
color: #ffffff; | |||
border-radius: 50%; | |||
text-align: center; | |||
height: 40rpx; | |||
line-height: 40rpx; | |||
width: 40rpx; | |||
font-size: 30rpx; | |||
padding: 2rpx; | |||
position: absolute; | |||
border: 2rpx solid #fff; | |||
} | |||
/* use cross as close button */ | |||
.closeBtn::before { | |||
content: "\2716"; | |||
} |
@@ -9,7 +9,13 @@ Page({ | |||
imgUrl: app.globalData.urlStatic,//图片路径 | |||
maskShow: true, | |||
tipShow:true, | |||
iconShow:true,//是否有头像 | |||
titleContent:'尊敬的启辰车主您好', | |||
userData:{ | |||
avatarUrl: null, | |||
nickName: null, | |||
userLevel: 0 | |||
}, | |||
}, | |||
/** | |||
* 关闭提示弹窗 | |||
@@ -20,6 +26,53 @@ Page({ | |||
tipShow: false | |||
}) | |||
}, | |||
getUserWxMsg:function(e){//通过微信获取用户信息 | |||
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; | |||
app.submitUserMsg(e.detail.userInfo.avatarUrl, e.detail.userInfo.nickName); | |||
wx.navigateTo({ | |||
url:'../poster/poster' | |||
}) | |||
} | |||
}, | |||
getUserInfo:function(e){//获取个人信息 | |||
app.wxRequest(app.globalData.urlRoot + 'userInfo/getUserInfo', {}, res => { | |||
if(res.code==200){ | |||
// res.data.userLevel = 3; | |||
if (res.data) { | |||
this.data.userData.avatarUrl = res.data.avatarUrl; | |||
this.data.userData.nickName = res.data.nickName; | |||
this.data.userData.userLevel = res.data.userLevel; | |||
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' | |||
}) | |||
} | |||
} | |||
},this) | |||
}, | |||
/** | |||
* 海报页 | |||
*/ | |||
getPoster:function(){ | |||
wx.navigateTo({ | |||
url:'../poster/poster' | |||
}) | |||
}, | |||
/** | |||
* 生命周期函数--监听页面加载 | |||
@@ -39,6 +92,18 @@ Page({ | |||
* 生命周期函数--监听页面显示 | |||
*/ | |||
onShow: function () { | |||
if(app.globalData.certificationState==1){ | |||
this.setData({titleContent:'尊敬的启辰车主您好'}) | |||
}else if(app.globalData.certificationState==2){ | |||
this.setData({titleContent:'尊敬的合伙人您好'}) | |||
}else if(app.globalData.certificationState==3){ | |||
this.setData({titleContent:'尊敬的同事您好'}) | |||
} | |||
if(app.globalData.userInfoData==null){ | |||
this.setData({iconShow:true}) | |||
}else{ | |||
this.setData({iconShow:false}) | |||
} | |||
// wx.navigateTo({ | |||
// url: './share/share' | |||
// }) |
@@ -1,4 +1,5 @@ | |||
{ | |||
"navigationBarTitleText": "东风启辰“星探计划”", | |||
"usingComponents": { | |||
"tabBar": "../component/tabBar/index" | |||
} |
@@ -3,7 +3,10 @@ | |||
<view class="content"> | |||
<image class="bg" src="{{imgUrl+'/star/scout/bg.jpg'}}"></image> | |||
<image class="reward" src="{{imgUrl+'/star/scout/reward.png'}}"></image> | |||
<view class="btn">立即分享,赚取奖励</view> | |||
<view class="btn" bindtap="getPoster">立即分享,赚取奖励 | |||
<button class="btn2" wx:if="{{iconShow}}" open-type="getUserInfo" bindgetuserinfo="getUserWxMsg"></button> | |||
</view> | |||
</view> | |||
<view class="mask" wx:if="{{maskShow}}"> | |||
<view class="tipContent" wx:if="{{tipShow}}"> |
@@ -28,6 +28,14 @@ | |||
background-color: #2a558d; | |||
margin: 20rpx auto 40rpx auto; | |||
} | |||
.btn2{ | |||
text-align: center; | |||
width: 100%; | |||
height: 100%; | |||
background-color: #2a558d; | |||
margin: -58rpx auto 0rpx auto; | |||
opacity:0; | |||
} | |||
.mask { | |||
position: absolute; | |||
left: 0; |
@@ -9,7 +9,11 @@ Page({ | |||
imgUrl: app.globalData.urlStatic,//图片路径 | |||
maskShow: false, | |||
ruleShow:false, | |||
numList:[8,9,7,0,0], | |||
phonebol:false,//是否有手机号 | |||
getNumber:null,//数字跳跃 | |||
starNumber:4000,//开始人数 | |||
stopNumber:0,//结束人数 | |||
numList:[4,0,0,0], | |||
}, | |||
/** | |||
* 显示规则页 | |||
@@ -41,30 +45,118 @@ Page({ | |||
* 星探任务 | |||
*/ | |||
scout:function(){ | |||
wx.navigateTo({ | |||
url: '../scout/scout' | |||
}) | |||
this.phonebolb(app.globalData.userMobile); | |||
}, | |||
phonebolb:function(_phone){ | |||
app.wxRequest(app.globalData.urlRoot + "userInfo/getCertificationInfo", {mobile:_phone}, res => { | |||
console.log(res) | |||
if (res.code == 200) { | |||
if(res.data!=null){ | |||
app.globalData.certificationState=res.data.certificationState; | |||
wx.navigateTo({ | |||
url: '../scout/scout' | |||
}) | |||
}else{ | |||
wx.navigateTo({ | |||
url: '../scout/register/register' | |||
}) | |||
} | |||
} | |||
}, this); | |||
}, | |||
/** | |||
* 生命周期函数--监听页面加载 | |||
*/ | |||
onLoad: function (options) { | |||
//this.setData({ imgUrl: app.globalData.urlStatic }) | |||
// app.wxRequest(app.globalData.urlRoot + "/admin/certificationNoCar/getCertificationNoCarList", { | |||
// adminState: 0, page:1,count:10 | |||
// }, res => { | |||
// console.log(res) | |||
// }, this); | |||
// app.wxRequest(app.globalData.urlRoot + "/admin/certificationNoCar/auditRefuse", { id:4 }, res => { | |||
// console.log(res) | |||
// }, this,"POST"); | |||
// app.wxRequest(app.globalData.urlRoot + "/admin/certificationNoCar/auditPass", { id:4 }, res => { | |||
// console.log(res) | |||
// }, this,"POST"); | |||
}, | |||
/** | |||
* 生命周期函数--监听页面初次渲染完成 | |||
*/ | |||
onReady: function () { | |||
console.log('2') | |||
this.setData({ | |||
starNumber:4000 | |||
}) | |||
if (app.globalData.openid) { | |||
this.gettime(); | |||
} else { | |||
app.globalData.openidSuccessFuc = this.gettime; | |||
} | |||
}, | |||
gettime(){ | |||
app.wxRequest(app.globalData.urlRoot + "userInfo/getCertificationCount", {}, res => { | |||
console.log(res) | |||
if (res.code == 200) { | |||
this.setData({ | |||
stopNumber: res.data.total | |||
}) | |||
if(this.data.stopNumber<10000){ | |||
this.setData({ | |||
numList: [4,0,0,0] | |||
}) | |||
}else{ | |||
this.setData({ | |||
numList: [0,4,0,0,0] | |||
}) | |||
} | |||
this.getNumber=setInterval(this.vCodeDownTime,30); | |||
} | |||
}, this); | |||
}, | |||
vCodeDownTime(){ | |||
var numb = this.data.starNumber; | |||
numb=Math.floor(this.data.starNumber+(this.data.stopNumber-4000)/90); | |||
if(numb>=this.data.stopNumber){ | |||
numb=this.data.stopNumber; | |||
clearInterval(this.getNumber); | |||
} | |||
this.setData({ | |||
starNumber: numb, | |||
numList:numb.toString().split("") | |||
}) | |||
}, | |||
getPhone (e) { | |||
console.log(e.detail) | |||
if (e.detail.errMsg=='getPhoneNumber:ok'){ | |||
app.wxRequest(app.globalData.urlRoot + "userInfo/getUserPhoneNumber", { encryptedData: e.detail.encryptedData, iv: e.detail.iv }, res => { | |||
console.log(res) | |||
if (res.code == 200) { | |||
if(res.data.result==0){ | |||
this.phonebolb(res.data.decodeData.phoneNumber); | |||
app.globalData.userMobile=res.data.decodeData.phoneNumber; | |||
}else{ | |||
wx.showToast({title: '获取失败',icon: "none"}) | |||
} | |||
} else { | |||
wx.showToast({title: res.msg,icon: "none"}) | |||
} | |||
}, this,"POST"); | |||
} | |||
}, | |||
/** | |||
* 生命周期函数--监听页面显示 | |||
*/ | |||
onShow: function () { | |||
console.log(app.globalData.userMobile) | |||
if(app.globalData.userMobile==null){ | |||
this.setData({phonebol: true}) | |||
}else{ | |||
this.setData({phonebol: false}) | |||
} | |||
}, | |||
/** |
@@ -1,4 +1,5 @@ | |||
{ | |||
"navigationBarTitleText": "东风启辰“星探计划”", | |||
"usingComponents": { | |||
"tabBar": "../component/tabBar/index" | |||
} |
@@ -8,8 +8,9 @@ | |||
<view class="propagandaBox"> | |||
<text class="text">已有</text> | |||
<view class="numBox"> | |||
<block wx:for="{{numList}}" wx:key="*this"> | |||
<block wx:for="{{numList}}" wx:key="index"> | |||
<image class="numFrame" src="{{imgUrl+'/star/numFrame.png'}}"></image> | |||
<image class="numFrame2" src="{{imgUrl+'/star/suzi'+item+'.png'}}"></image> | |||
</block> | |||
</view> | |||
<text class="text">人加入星探计划</text> | |||
@@ -17,6 +18,7 @@ | |||
<view class="btnBox"> | |||
<view class="btn" bindtap="scout">星探任务</view> | |||
<view class="btn" bindtap="everyDay">每日任务</view> | |||
<button class="btn2" wx:if="{{phonebol}}" open-type="getPhoneNumber" bindgetphonenumber="getPhone"></button> | |||
</view> | |||
</view> | |||
<view class="mask" wx:if="{{maskShow}}"> |
@@ -70,6 +70,12 @@ | |||
height: 100%; | |||
display: inline-block; | |||
} | |||
.numBox>.numFrame2{ | |||
width: 42rpx; | |||
height: 100%; | |||
margin-left: -42rpx; | |||
display: inline-block; | |||
} | |||
.home>.btnBox { | |||
position: absolute; | |||
@@ -91,6 +97,17 @@ | |||
border-radius: 15rpx; | |||
} | |||
.home>.btnBox>.btn2 { | |||
position: absolute; | |||
width: 278rpx; | |||
height: 47rpx; | |||
left: 50%; | |||
margin-left: -282rpx; | |||
background-color: #000000; | |||
display: inline-block; | |||
opacity:0 | |||
} | |||
.mask { | |||
position: absolute; | |||
left: 0; |