index.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // pages/spacelog/index.js
  2. import {
  3. queryAllspace,
  4. } from "../../requests/api";
  5. import $ from './../../utils/Tool'
  6. import router from './../../utils/router'
  7. Page({
  8. /**
  9. * 页面的初始数据
  10. */
  11. data: {
  12. projectId:"",
  13. tenantId:"",
  14. userId:"",
  15. alllistContent:[],
  16. noDate:false
  17. },
  18. /**
  19. * 生命周期函数--监听页面加载
  20. */
  21. onLoad: function (options) {
  22. options = JSON.parse(decodeURIComponent(JSON.stringify(options)))||{};
  23. let arr = [];
  24. for (let i in options) {
  25. arr.push(options[i]); //属性
  26. //arr.push(obj[i]); //值
  27. }
  28. console.log(options,"options");
  29. this.getData(arr);
  30. },
  31. async getData(value=[]) {
  32. // $.loading()
  33. wx.showLoading({
  34. title:"加载中"
  35. })
  36. let projectId = $.store.get('projectId') ||$.storage.get('projectId');
  37. let tenantId = $.store.get('tenantId')||$.storage.get('tenantId');
  38. let userId = $.store.get('userId') || $.storage.get('userId');
  39. let data={
  40. "criteria": {
  41. "userId": userId,
  42. "projectId":projectId,
  43. "tenantId": tenantId,
  44. spaceId:value
  45. },
  46. orders:[
  47. {
  48. column:"localName",
  49. asc:"true"
  50. }
  51. ]
  52. };
  53. let res = await queryAllspace(data);
  54. if(res.count){
  55. this.setData({alllistContent:res.content})
  56. }else{
  57. this.setData({noDate:true,alllistContent:[]})
  58. }
  59. wx.hideLoading()
  60. },
  61. listClick(e){
  62. let data = e.detail.cardDate;
  63. data.outLine&&(data.outLine="");
  64. router.push("adjust",data);
  65. },
  66. /**
  67. * 用户点击右上角分享
  68. */
  69. onShareAppMessage: function () {
  70. }
  71. })