index.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import behavior from '~/mixins/video'
  2. Component({
  3. behaviors: [behavior],
  4. properties: {
  5. worksList: {
  6. type: Array,
  7. value: [],
  8. observer(newVal) {
  9. this.setData({
  10. worksListCopy: newVal
  11. })
  12. }
  13. },
  14. videoType: {
  15. type: String,
  16. // value 为public时是默认公共样式,为my时为“我的”样式,展示下载删除是否公开,pk为pk的样式文案,collection为收藏时的样式,excellent优秀作品展播
  17. value: 'public'
  18. },
  19. // 是否在tabbar页面使用
  20. tabBarPadding: {
  21. type: Boolean,
  22. value: false
  23. }
  24. },
  25. data: {
  26. worksListCopy: {}
  27. },
  28. methods: {
  29. setListFans({
  30. detail
  31. }) {
  32. let worksListCopy = JSON.parse(JSON.stringify(this.data.worksListCopy))
  33. worksListCopy.forEach(item => {
  34. if (item.user.uid == detail) {
  35. item.isFans = true
  36. }
  37. })
  38. this.setData({
  39. worksListCopy
  40. })
  41. },
  42. addCommentNum({
  43. detail
  44. }) {
  45. let worksListCopy = JSON.parse(JSON.stringify(this.data.worksListCopy))
  46. worksListCopy.forEach(item => {
  47. if (item.userRead.id == detail) {
  48. item.userRead.commentAmount = ++item.userRead.commentAmount
  49. }
  50. })
  51. this.setData({
  52. worksListCopy
  53. })
  54. }
  55. },
  56. })