details.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. const _Http = getApp().globalData.http,
  2. MFT = require("../../utils/matchingFeilType"),
  3. checkFile = require("../../utils/checkFile");
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. detailsData: {},
  10. dataType: 0
  11. },
  12. /**
  13. * 生命周期函数--监听页面加载
  14. */
  15. async onLoad(options) {
  16. this.setData({
  17. dataType: options.type
  18. })
  19. const params = {
  20. "classname": "saletool.sharematerial.sharematerial",
  21. "method": "selectDetail",
  22. "content": {
  23. "sat_sharematerialid": options.id
  24. }
  25. };
  26. const res = wx.getStorageSync('userMsg').token ? await _Http.basic(params) : await _Http.base(params);
  27. if (res.msg != '成功') await _Http.base(params);
  28. if (res.msg == '成功') {
  29. let data = res.data;
  30. if (data.attinfos.length) data.attinfos = MFT.fileList(data.attinfos);
  31. this.setData({
  32. detailsData: data
  33. })
  34. } else {
  35. wx.showToast({
  36. title: res.msg,
  37. icon: "none"
  38. })
  39. }
  40. },
  41. openFile(e) {
  42. checkFile.checkFile(e.currentTarget.dataset.item);
  43. },
  44. /**
  45. * 生命周期函数--监听页面初次渲染完成
  46. */
  47. onReady() {},
  48. /**
  49. * 生命周期函数--监听页面显示
  50. */
  51. onShow() {
  52. },
  53. /**
  54. * 生命周期函数--监听页面隐藏
  55. */
  56. onHide() {
  57. },
  58. /**
  59. * 生命周期函数--监听页面卸载
  60. */
  61. onUnload() {
  62. },
  63. /**
  64. * 页面相关事件处理函数--监听用户下拉动作
  65. */
  66. onPullDownRefresh() {
  67. },
  68. /**
  69. * 页面上拉触底事件的处理函数
  70. */
  71. onReachBottom() {
  72. },
  73. /**
  74. * 用户点击右上角分享
  75. */
  76. onShareAppMessage() {
  77. }
  78. })