useActivity.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // +----------------------------------------------------------------------
  2. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  3. // +----------------------------------------------------------------------
  4. // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
  5. // +----------------------------------------------------------------------
  6. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  7. // +----------------------------------------------------------------------
  8. // | Author: CRMEB Team <admin@crmeb.com>
  9. // +----------------------------------------------------------------------
  10. import {userIntegralApi} from "../api/activity";
  11. import {
  12. discoverNoteLike
  13. } from '@/libs/follow.js';
  14. export default {
  15. data() {
  16. return {
  17. integral: 0,
  18. backgroundColor:'transparent',
  19. headerZindex:9,
  20. listZindex:99,
  21. };
  22. },
  23. onPageScroll(e) {
  24. if(e.scrollTop > 20){
  25. this.backgroundColor = '#E93323';
  26. }else{
  27. this.backgroundColor = 'transparent';
  28. }
  29. if (e.scrollTop > 170) {
  30. this.listZindex=9
  31. this.headerZindex=99
  32. } else {
  33. this.listZindex=99
  34. this.headerZindex=9
  35. }
  36. // 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件
  37. uni.$emit('scroll');
  38. },
  39. methods: {
  40. // 积分信息
  41. getUserIntegral() {
  42. userIntegralApi().then(res => {
  43. this.integral = res.data.integral
  44. })
  45. },
  46. //逛逛点赞
  47. handleLikeToggle(item) {
  48. discoverNoteLike(item.id).then(() => {
  49. this.$set(item, 'userIsLike', !item.userIsLike);
  50. if (!item.userIsLike) {
  51. item.likeNum--;
  52. item.likeNum = item.likeNum == 0 ? 0 : item.likeNum
  53. } else {
  54. item.likeNum++;
  55. }
  56. });
  57. }
  58. }
  59. };