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
85
86
87
88
89
90
91
92
93
| // index.ts
| // 获取应用实例
| const userDetailMyself = getApp()
|
| Page({
| data: {
| isShowImg:false,
| pic:'',
| picUrl:'',
| reportList:{},
| },
| face(){
| console.log(this.data.reportList.pic);
|
| wx.previewMedia({
| sources:[{url:this.data.reportList.pic}]
| })
| },
| subImg(){
| wx.request(
| {
| url:userDetailMyself.globalData.url+ "/wx/user/add",
| method:"POST",
| data:{
| id:wx.getStorageSync('id'),
| pic:this.data.pic
| },
| header:{'token':wx.getStorageSync('token')},
| success:(res)=>{
| console.log(res)
| this.data.reportList.pic= this.data.picUrl
| this.setData({
| isShowImg:false
| })
| }
| })
| },
| faces(){
| wx.chooseMedia({
| count:1,
| mediaType:['image'],
| sourceType:['camera'],
| camera:"front",
| success:(res)=>{
| wx.uploadFile({
| url: userDetailMyself.globalData.url+"/minio/upload",
| filePath: res.tempFiles[0].tempFilePath,
| name: "file",
| header: {
| // '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,
| picUrl:userDetailMyself.globalData.imageUrl+'/img/'+result.data,
| isShowImg:true
| })
| this.subImg()
| console.log(this.data.pic,this.data.picUrl);
|
| }
| })
| }
| })
| },
| onLoad() {
| wx.request(
| {
| url:userDetailMyself.globalData.url+ "/wx/user/myself",
| method:"GET",
| data:{
| id:wx.getStorageSync('id')
| },
| header:{'token':wx.getStorageSync('token')},
| success:(res)=>{
| console.log(res)
| if(res.data.data.pic!=null&&res.data.data.pic!=""){
| res.data.data.pic=userDetailMyself.globalData.imageUrl+"/img/"+res.data.data.pic
| }
| this.setData({
| reportList:res.data.data,
| picUrl:res.data.data.pic
| })
| console.log(this.data.picUrl);
|
| }
| })
| }
| })
|
|