You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
2.3 KiB

  1. const app = getApp()
  2. const config = require("../../config/config")
  3. const Http = require("../../utils/HttpBasics.js")
  4. const navigationBarHeight = (getApp().statusBarHeight + 44)+"px"
  5. Page({
  6. data:{
  7. imgHttps:app.globalData.imgHttps,
  8. navigationBarHeight,
  9. id:"",//upid
  10. name:'',//upName
  11. indexFlog:1,//选着类别
  12. upData:{},//作者信息
  13. pageNum:1,
  14. classList:[],//课程列表
  15. dNum:"",//但课程数
  16. zNum:"",//专栏数
  17. },
  18. getClass(){//课程list
  19. Http.get({
  20. url:config.api.columnLsit,
  21. data:{
  22. merchantId:this.data.id,
  23. type:this.data.indexFlog,
  24. pageNum:this.data.pageNum,
  25. pageSize: 6
  26. }
  27. }).then(res=>{
  28. if(this.data.pageNum>1){
  29. let temp = this.data.classList
  30. temp.push(...res.data.list)
  31. this.setData({
  32. classList:temp
  33. })
  34. }else{
  35. this.setData({
  36. classList:res.data.list
  37. })
  38. }
  39. })
  40. },
  41. setIndex(e){
  42. let index = e.currentTarget.dataset.index
  43. console.log(index);
  44. this.setData({
  45. indexFlog:index,
  46. pageNum:1,
  47. classList:[]
  48. })
  49. this.getClass()
  50. },
  51. getUpData(){
  52. Http.get({
  53. url:config.api.getUpUser,
  54. data:{
  55. id:this.data.id
  56. }
  57. }).then(res=>{
  58. let temp = res.data
  59. let arr = JSON.parse(res.data.businessTypes)
  60. let sring = ""
  61. arr.map(item=>{
  62. sring += ' '+item.title
  63. })
  64. temp.sring = sring
  65. console.log(temp);
  66. this.setData({
  67. upData:temp
  68. })
  69. }).catch(err=>{
  70. tt.showToast({
  71. title: err.message, // 内容
  72. icon:"none"
  73. });
  74. })
  75. },
  76. onLoad(options){
  77. this.setData({
  78. id:options.id,
  79. name:options.name
  80. })
  81. this.getUpData()
  82. this.getClass()
  83. },
  84. onReachBottom() {
  85. console.log("到底了");
  86. this.setData({
  87. pageNum:this.data.pageNum+1
  88. })
  89. this.getClass()
  90. }
  91. })