detail.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //获取应用实例
  2. const app = getApp();
  3. let deviceRecordId = 0;
  4. let deviceId = 0;
  5. Page({
  6. data: {
  7. record: null
  8. },
  9. onLoad: function (options) {
  10. deviceRecordId = options.id;
  11. deviceId = options.did;
  12. var that = this;
  13. app.ajaxReadyCallback = res => {
  14. var deviceinfo = res.data.data;
  15. if (!deviceinfo.deviceImg) {
  16. deviceinfo.deviceImg = [];
  17. } else {
  18. deviceinfo.deviceImg = deviceinfo.deviceImg.split(',');
  19. }
  20. if (!deviceinfo.recordImg) {
  21. deviceinfo.recordImg = [];
  22. } else {
  23. deviceinfo.recordImg = deviceinfo.recordImg.split(',');
  24. }
  25. deviceinfo.checkJson = JSON.parse(deviceinfo.checkJson);
  26. that.setData({
  27. record: deviceinfo,
  28. });
  29. wx.setNavigationBarTitle({
  30. title: deviceinfo.deviceTittle
  31. });
  32. };
  33. this.showData();
  34. },
  35. onShow: function () {
  36. },
  37. //图片预览
  38. previewImage: function (e) {
  39. var current = e.target.dataset.src;
  40. wx.previewImage({
  41. current: current, // 当前显示图片的http链接
  42. urls: this.data.record.recordImg, // 需要预览的图片http链接列表
  43. success: function (e) {
  44. console.log(e);
  45. }
  46. })
  47. },
  48. showData: function () {
  49. app.ajax({
  50. url: app.globalData.serverUrl + 'server/deviceRecord/queryRecordDetails',
  51. type: 'POST',
  52. data: {
  53. deviceId: deviceId,
  54. deviceRecordId: deviceRecordId,
  55. }
  56. });
  57. },
  58. })