index.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // index.ts
  2. // 获取应用实例
  3. var mixins = require('../../utils/mixins')
  4. Page({
  5. mixins: [mixins],
  6. data: {
  7. isList:true,
  8. score:10,
  9. paging: {
  10. pageSize: 8,
  11. pageNum: 1,
  12. total: 0,
  13. showSize: 3,
  14. current: 1,
  15. },
  16. userInfo:{},
  17. roomDetail:{},
  18. recordlist:[]
  19. },
  20. // 事件处理函数
  21. onLoad() {
  22. },
  23. onShow(){
  24. this.getRecordList()
  25. },
  26. changeCurrent(data:any){
  27. this.setData({
  28. paging: {
  29. ...this.data.paging,
  30. current:data.detail,
  31. },
  32. })
  33. console.log(this.data.paging.current);
  34. this.getRecordList()
  35. },
  36. getRecordList(){
  37. // @ts-ignore
  38. this.data.fetchutil.post(`cms/my/list`, {
  39. "pageNum": this.data.paging.current,
  40. "pageSize": this.data.paging.pageSize,
  41. }, {}).then((response: any) => {
  42. this.setData({
  43. recordlist: response.data.page.records,
  44. userInfo: response.data.user,
  45. paging: {
  46. ...this.data.paging,
  47. total:response.data.page.total,
  48. },
  49. })
  50. })
  51. },
  52. backlist(){
  53. this.setData({
  54. isList:true
  55. })
  56. },
  57. handleItem(e:any){
  58. console.log(e);
  59. let {roomid} = e.currentTarget.dataset;
  60. // @ts-ignore
  61. this.data.fetchutil.get(`cms/my/detail/${roomid}`, {}, {}).then((response: any) => {
  62. console.log(response);
  63. this.setData({
  64. isList:false,
  65. roomDetail:response.data
  66. })
  67. })
  68. }
  69. })