odc.xiaohui
2023-03-07 4cdcd7fbf08474c5c10ec1637a23e0e0ce230e8a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// index.ts
// 获取应用实例
const loginInfo = getApp() 
 
Page({
  data: {
      user:{},
    isShow:false,
    pic:null
  },
 
  getName(e){
      console.log(e.detail.value)
     this.data.user.realName=e.detail.value
  },
  getIdcard(e){
    this.data.user.userIdcard=e.detail.value
  },
  submit(){
    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) {
        wx.showToast({
            icon: "none",
            title: '请完整填完表单!',
        })
        return
    }
    console.log("meizhic")
   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({
        count:1,
        mediaType:['image'],
        sourceType:['camera'],
        camera:"front",
        success:(res)=>{
            wx.uploadFile({
                url: loginInfo.globalData.url+"/minio/upload",
                filePath: res.tempFiles[0].tempFilePath,
                name: "file",
                header: {
                    'token': wx.getStorageSync('token'),
                    'content-type': 'application/json'
                },
                success:(res)=>{
                    const result = JSON.parse(res.data)
                    this.setData({
                        pic:result.data,
                        isShow:true
                    })
                }
            })
        }
    })
},
  onLoad() {
    //   wx.request(  
    //     {
    //       url:"http://42.193.1.25:8081/report",
    //       method:"GET",
    //       header:{'token':wx.getStorageSync('token')},
    //       success:(res)=>{
    //           this.setData({
    //             reportList:res.data.data.records
    //           })
    //       }
    //           })
    }
})