odc.xiaohui
2023-03-08 a7a28c10e6a6d756c00e2bd4a590e785b87f1331
miniprogram/pages/user/loginInfo/index.ts
@@ -1,22 +1,52 @@
// index.ts
// 获取应用实例
const loginInfo = getApp() 
import Toast from '../../../miniprogram_npm/@vant/weapp/toast/toast';
import Notify from '../../../miniprogram_npm/@vant/weapp/notify/notify';
let myStyle = `
--color:black;
`
let chageStyle = `
--color:red;
`
Page({
  data: {
      user:{},
    isShow:false,
    pic:null
    pic:null,
    viewData: {
        style: myStyle,
        styleId:myStyle
       }
  },
  getName(e){
      console.log(e.detail.value)
      if(e.detail.value){
        this.setData({'viewData.style': myStyle})
      }
     this.data.user.realName=e.detail.value
  },
  getIdcard(e){
    if(e.detail.value){
        this.setData({'viewData.styleId': myStyle})
      }
    this.data.user.userIdcard=e.detail.value
  },
  submit(){
      if(!/^[\u4e00-\u9fa5]{2,4}$/.test(this.data.user.realName)){
        // Toast.fail('请输入正确的姓名');
        Notify({ type: 'warning', message: '请输入正确的姓名' });
        this.setData({'viewData.style': chageStyle})
        return
      }
      if(!/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(this.data.user.userIdcard)){
        // Toast.fail('请输入正确的身份证号');
        Notify({ type: 'warning', message: '请输入正确的身份证号' });
        this.setData({'viewData.styleId': chageStyle})
        return
      }
    this.data.user.pic=this.data.pic
    this.data.user.id=wx.getStorageSync('id')
    if ( this.data.user.pic == null||this.data.user.realName==null||  this.data.user.realName==null) {
@@ -58,6 +88,8 @@
                    'content-type': 'application/json'
                },
                success:(res)=>{
                    // 成功通知
                    Notify({ type: 'primary', message: '采集成功' });
                    const result = JSON.parse(res.data)
                    this.setData({
                        pic:result.data,