odc.xiaohui
2023-05-12 4b48bacef8646cee8b66f5e10b0ed7124534e93e
miniprogram/pages/user/loginInfo/index.ts
@@ -33,6 +33,10 @@
      }
    this.data.user.userIdcard=e.detail.value
  },
  getPhoneNumber:function(e){
      console.log(e);
  },
  submit(){
      if(!/^[\u4e00-\u9fa5]{2,4}$/.test(this.data.user.realName)){
        // Toast.fail('请输入正确的姓名'); 
@@ -55,21 +59,39 @@
        })
        return
    }
   wx.request({
       url:loginInfo.globalData.url+"/wx/user/add",
       method:"POST",
       data:this.data.user,
       header:{
           'token':wx.getStorageSync('token')
       },
       success:(res)=>{
           wx.setStorageSync('info',true)
           wx.reLaunch({
               url:'../../user/index'
           })
       }
   })
    wx.request({
                    url: loginInfo.globalData.url+"/wx/login",
                    data: {
                        "phone": wx.getStorageSync('phone'),
                    },
                    method: "GET",
                    success: (res) => {
                        wx.setStorageSync('token', res.data.data.token)
                        wx.setStorageSync('role', res.data.data.role)
                        wx.setStorageSync('id', res.data.data.id)
                        wx.setStorageSync('card',res.data.data.time)
                        console.log(res.data.data.id)
                        this.data.user.id= res.data.data.id
                        wx.setStorageSync('id',res.data.data.id)
                        wx.request({
                            url:loginInfo.globalData.url+"/wx/user/add",
                            method:"POST",
                            data:this.data.user,
                            header:{
                                'token':wx.getStorageSync('token')
                            },
                            success:(res)=>{
                                wx.setStorageSync('info',true)
                                wx.reLaunch({
                                    url:'../../user/index'
                                })
                            }
                        })
                    }
                })
  },
face(){
    wx.chooseMedia({
@@ -83,17 +105,17 @@
                filePath: res.tempFiles[0].tempFilePath,
                name: "file",
                header: {
                    'token': wx.getStorageSync('token'),
                    // 'token': wx.getStorageSync('token'),
                    'content-type': 'application/json'
                },
                success:(res)=>{
                    // 成功通知
                    Notify({ type: 'primary', message: '采集成功' });
                    const result = JSON.parse(res.data)
                    this.setData({
                        pic:result.data,
                        isShow:true
                    })
                      // 成功通知
                    Notify({ type: 'primary', message: '采集成功' });
                }
            })
        }