idCard.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. const app = require('../../utils/util.js');
  2. var util = require('../../utils/md5.js')
  3. Page({
  4. data: {
  5. imgPath: '',
  6. isTrue: true,
  7. },
  8. goShenFen() {
  9. wx.request({
  10. url: app.globalData.publicUrl + '/applet/suppleUserInfo',
  11. method: "POST",
  12. header: {
  13. appletsId: wx.getStorageSync('openId')
  14. },
  15. data: {
  16. headPicPath: this.data.imgPath
  17. },
  18. success: (res) => {
  19. console.log(res, "000");
  20. }
  21. })
  22. wx.navigateTo({
  23. url: '/pages/idCardDetail/idCardDetail',
  24. })
  25. },
  26. goPhoto() {
  27. var that = this;
  28. wx.chooseImage({
  29. count: 1,
  30. sizeType: ['compressed'],
  31. sourceType: ['camera'],
  32. success: function (res) {
  33. var tempFilePaths = res.tempFilePaths
  34. wx.uploadFile({
  35. url: app.globalData.publicUrl + '/sys/user/upload',
  36. filePath: tempFilePaths[0],
  37. name: 'uploadFile',
  38. formData: {
  39. "user": "test",
  40. },
  41. header: {
  42. appletsId: wx.getStorageSync('openId'),
  43. },
  44. success: function (res) {
  45. console.log(JSON.parse(res.data), "45454545");
  46. let datas = JSON.parse(res.data)
  47. if (datas.code == 0) {
  48. that.setData({
  49. imgPath: datas.data,
  50. isTrue: false
  51. })
  52. }
  53. }
  54. })
  55. }
  56. })
  57. },
  58. closeImage(e) {
  59. this.setData({
  60. isTrue: true,
  61. imgPath: '',
  62. })
  63. },
  64. onLoad: function () {},
  65. })