index.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. const app = getApp()
  2. const {ossUrl} = require("../../../utils/util.js")
  3. Page({
  4. data: {
  5. userInfo:{},
  6. signModel: false,
  7. from: 0,
  8. size: 20,
  9. form:{},
  10. list: []
  11. },
  12. onLoad: function( options ){
  13. app.checkLogin( userInfo =>{
  14. this.setData({userInfo})
  15. this.loadData( )
  16. })
  17. },
  18. preview( e){
  19. let url = e.currentTarget.dataset.url;
  20. this.doPreview( url );
  21. },
  22. doPreview( url ){
  23. let nurl = ossUrl+ url.split("#")[1]
  24. wx.previewImage({
  25. urls: [nurl],
  26. })
  27. },
  28. makeSign( e) {
  29. let index = +e.currentTarget.dataset.index;
  30. let item = this.data.list[index];
  31. item.index = index
  32. let form = Object.assign( {}, item)
  33. form.temp = item
  34. this.setData({form,signModel:true})
  35. },
  36. cancelPrint(){
  37. this.setData({signModel:false});
  38. },
  39. printCert(e){
  40. let param = {
  41. id: +this.data.form.id,
  42. rzCode: this.data.form.rzCode
  43. }
  44. app.formPost('Cert.printCert', param).then(res => {
  45. if( res.code == 200){
  46. let { url } = res.data;
  47. if( url )this.doPreview( url )
  48. }
  49. })
  50. },
  51. updateRzcode(e){
  52. this.setData({ "form.rzCode": e.detail.detail.value})
  53. },
  54. loadData: function( ) {
  55. let param ={ from: this.data.from, size: this.data.size }
  56. app.formPost('Cert.GetCertList', param).then(res => {
  57. if( res.code == 200){
  58. let { from, list} = res.data
  59. this.setData({from,list})
  60. }
  61. })
  62. }
  63. })