123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- // pages/mine/wxml/submitinfo/submitinfo.js
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- AuctionCompanies:["请选择公司","公司1","公司2","公司3","公司4","未加入公司"],
- pickerIndex:0,
- userNameCheck:false,
- userIdcardCheck:false,
- userPhoneCheck:false,
- pickerCheck:false,
- frontPhoto:"images/IDfront.png",
- backPhoto:"images/IDback.png",
- completePhoto:"images/complete.png",
- buttonInfo:true,
- checkInfo:false,
- frontPhotoInfo:false,
- backPhotoInfo:false,
- completePhotoInfo:false,
- imgInfo: false,
- userName:false,
- userIdcard:false,
- userPhone:false,
- pickerInfo:false
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
-
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
-
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
-
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
-
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
-
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
-
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
-
- },
- formSubmit: function(e){
- e.detail.value.AuctionCompanies = this.data.AuctionCompanies[e.detail.value.AuctionCompanies];
- let formData = e.detail.value
- formData.frontPhotoUrl = this.data.frontPhoto[0];
- formData.backPhotoUrl = this.data.backPhoto[0];
- formData.completePhotoUrl = this.data.completePhoto[0];
- console.log(formData);
- },
- onCheck:function(e) {
- let myreg = "";
- let info = false;
- let checkInfo = true;
- let userName, userIdcard, userPhone;
- let _this = this;
- if (e.currentTarget.id == "user-name"){
- myreg = /^[\u4e00-\u9fa5]+(·[\u4e00-\u9fa5]+)*$/;
- if (!myreg.test(e.detail.value)) {
- info = true;
- userName = false;
- } else { userName = true}
- _this.setData({
- userNameCheck: info,
- userName: userName
- })
- } else if (e.currentTarget.id == "user-idcard"){
- myreg = /^\d{6}(18|19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|[xX])$/;
- if (!myreg.test(e.detail.value)) {
- info = true;
- userIdcard = false;
- } else { userIdcard = true}
- _this.setData({
- userIdcardCheck: info,
- userIdcard: userIdcard
- })
- } else if (e.currentTarget.id == "user-phone"){
- myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\d{8})$/;
- if (!myreg.test(e.detail.value)) {
- info = true;
- userPhone = false;
- } else { userPhone = true}
- _this.setData({
- userPhoneCheck: info,
- userPhone: userPhone
- })
- };
- if (_this.data.userName && _this.data.userIdcard && _this.data.userPhone) {
- checkInfo = true;
- _this.setData({
- checkInfo: checkInfo
- });
- }else{
- checkInfo = false;
- _this.setData({
- checkInfo: checkInfo
- });
- }
- _this.buttonClickState(_this.data.checkInfo, _this.data.imgInfo, _this.data.pickerInfo);
- },
- onSelectPhoto:function(e){
- let _this = this;
- let imgInfo = false;
- let frontPhotoInfo, backPhotoInfo, completePhotoInfo;
- wx.chooseImage({
- count:1,
- success:function(res){
- if (e.currentTarget.dataset.btnname == "front"){
- frontPhotoInfo = true;
- _this.setData({
- frontPhoto: res.tempFilePaths,
- frontPhotoInfo: frontPhotoInfo
- })
- } else if (e.currentTarget.dataset.btnname == "back"){
- backPhotoInfo = true;
- _this.setData({
- backPhoto: res.tempFilePaths,
- backPhotoInfo: backPhotoInfo
- })
- } else if (e.currentTarget.dataset.btnname == "complete"){
- completePhotoInfo = true;
- _this.setData({
- completePhoto: res.tempFilePaths,
- completePhotoInfo: completePhotoInfo
- })
- }
- if (_this.data.frontPhotoInfo && _this.data.backPhotoInfo && _this.data.completePhotoInfo) {
- _this.setData({
- imgInfo: true
- })
- }
- _this.buttonClickState(_this.data.checkInfo, _this.data.imgInfo,_this.data.pickerInfo);
- }
- });
- },
- buttonClickState:function(checkInfo,imgInfo,pickerInfo){
- //console.log(checkInfo, imgInfo, pickerInfo)
- let _this = this;
- if(checkInfo && imgInfo && pickerInfo){
- _this.setData({
- buttonInfo : false
- })
- }else{
- _this.setData({
- buttonInfo: true
- })
- }
- },
- bindPickerChange: function (e) {
- let _this = this;
- if (this.data.AuctionCompanies[e.detail.value] == "请选择公司"){
- //console.log("请选择拍卖公司");
- _this.setData({
- pickerInfo: false,
- pickerCheck:true
- })
- }else{
- _this.setData({
- pickerInfo: true,
- pickerCheck: false
- })
- }
- this.setData({
- pickerIndex: e.detail.value
- })
- _this.buttonClickState(_this.data.checkInfo, _this.data.imgInfo, _this.data.pickerInfo);
- },
- });
|