// pages/scout/register/register.js var Mcaptcha = require('../../../utils/mcaptcha.js'); const app = getApp() Page({ /** * 页面的初始数据 */ data: { imgUrl: app.globalData.urlStatic,//图片路径 type: 0, //1车主 0非车主 imgCode:'',//验证码 vocationList:['网约车司机','公交司机','快的司机'],//职业列表 vocationList2:[],//职业列表2 vocationIndex:'0', allList:[],//所有列表 cityList: [[''], ['']],//城市列表 cityIndex:['0','0'], getVcodeTime:0,//获取验证码倒计时 getCodeTimeKey:null, photoList:[],//图片列表 agree:false,//是否同意本协议 getphone:"",//手机号 maskShow: false, mydata:[],//我的数据 isbtn:true,//防重复点击 vCodeImg:null }, /** * 切换车主非车主 */ changeType(e) { var type = e.currentTarget.dataset.type; if (this.data.type != type) { this.setData({ type: type }) if (type == 1) { setTimeout(this.vCodeRefresh, 100); } } }, /** * 提交信息-认证 */ 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{ if(this.data.isbtn){ this.setData({isbtn: false}) }else{ return; } app.wxRequest(app.globalData.urlRoot + "userInfo/certificationCar", {carInfo:e.detail.value.VIN}, res => { console.log(res) if (res.code == 200) { if(res.data!=null){ app.globalData.certificationState=res.data.certificationState; wx.navigateTo({url: '/pages/scout/scout'}) }else{ this.setData({isbtn: true}) wx.showToast({icon:'none',title: '认证失败'}) } }else{ this.setData({isbtn: true}) 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{ if(this.data.isbtn){ this.setData({isbtn: false}) }else{ return; } 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"], province: this.data.cityList[0][e.detail.value.city[0]], 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{ this.setData({isbtn: true}) wx.showToast({icon:'none',title: ''+res.msg}) } }, this,"POST"); } }, /** * 关闭弹窗 */ hiddenRule:function(){ this.setData({maskShow: false}) wx.navigateBack({ delta:1 }) // wx.navigateTo({url: '../../star/star'}) }, /** * 更换职业 */ changeVocation: function (e) { this.setData({ vocationIndex: e.detail.value }) }, /** * 切换城市 */ changeCity(e){ this.setData({ 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 { 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; this.setData({ getVcodeTime: time }) if(time<=0){ clearInterval(this.getCodeTimeKey); } }, /** * 上传照片 */ chooseImage(e){ var list=this.data.photoList; wx.chooseImage({ count: 3-this.data.photoList.length, sizeType: ['original'], //可选择原图 sourceType: ['album', 'camera'], //可选择性开放访问相册、相机 success: res => { for (let i = 0; i < res.tempFilePaths.length; i++) { wx.uploadFile({ url: app.globalData.urlRoot + "upload/uploadImage", header: { "OPENID": app.globalData.openid }, filePath: res.tempFilePaths[i], name: "file", success: res => { if (res.data) { var json = JSON.parse(res.data); if (json.code == 200) { 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: '图片上传失败' }) } } } }) } } }) }, /** * 同意协议 */ agreementClick(event){ var agree = this.data.agree; this.setData({ "agree": !agree }); }, /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function() { wx.getSystemInfo({ success: option => { var windowScale = option.windowWidth / 750; this.mcaptcha = new Mcaptcha({ el: 'canvas', width: windowScale*205, height: windowScale*51, createCodeImg: "", callUrl:{ that:this, obj:this.changeVode } }); } }) app.wxRequest(app.globalData.urlRoot + "userInfo/getJobList", {}, res => { console.log(res) if (res.code == 200) { var shuju=[]; for(var i=0;i { console.log(res) if (res.code == 200) { var shuju=[]; var shuju1=[]; var shuju2=[]; for(var i=0;i { console.log(res) if(res.code=200 && res.data){ if(res.data.adminState==1){//审核通过 // this.setData({maskShow:true}) wx.navigateTo({url: '/pages/scout/scout'}) }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