homeList.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <view v-show="isShow" class="i-h-p100 i-w-v100 i-h-v100 i-flex i-al-center i-jst-center ">
  3. <view class="i-w-p100 i-h-p100">
  4. <!-- 学校信息 -->
  5. <view class="i-w-v100 i-h-p35 i-z-index1 i-flex i-al-center i-jst-center">
  6. <view class="i-pst-r i-t-center i-c-fff animate__animated"
  7. :class="pageStatus===1?'animate__fadeInDown':pageStatus===3?'animate__fadeOutUp':''">
  8. <view class="" @click="developConfig()">
  9. <span class="i-fs-70 custom-text">{{title[0]}}</span>
  10. </view>
  11. <view class="i-mt-26">
  12. <span class="i-fs-30 ">{{title[1]}}</span>
  13. </view>
  14. </view>
  15. </view>
  16. <view class="i-w-p100 i-h-p60 i-z-index1">
  17. <view class="i-flex i-jst-space-between i-wrap i-w-p80 i-h-p100 i-m-0auto">
  18. <uni-row class="i-w-p100 animate__animated"
  19. :class="pageStatus===1?'animate__fadeInUp':pageStatus===3?'animate__fadeOutDown':''">
  20. <uni-col :span="8" v-for="(item, index) in list" :key="index"
  21. class="i-flex i-al-center i-jst-center">
  22. <view class="i-w-p70" :class="index>2?'i-mt-64':''">
  23. <view class="i-pst-r i-w-p100" @click="onClick(item)">
  24. <image class="i-radius-20 i-h-250 i-w-p100" mode="aspectFill" :src="item.type_img">
  25. </image>
  26. <view class="i-c-fff i-z-index1 i-pst-a i-t-center i-w-p100 i-t-p35">
  27. <view>
  28. <span class="i-fs-26">{{item.title}}</span>
  29. </view>
  30. <view class="i-mt-10">
  31. <span class="i-fs-20">{{item.subtitle}}</span>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </uni-col>
  37. </uni-row>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. export default {
  45. name: "homeList",
  46. data() {
  47. return {
  48. clickCount: 0, // 点击次数计数器
  49. lastClickTime: 0 // 上次点击的时间戳
  50. };
  51. },
  52. props: {
  53. list: {
  54. type: Array,
  55. default: () => []
  56. },
  57. isShow: {
  58. type: Boolean,
  59. default: true
  60. },
  61. // 页面状态 动画效果 1进入 2正常 3退出
  62. pageStatus: {
  63. type: Number,
  64. default: 2,
  65. },
  66. title:{
  67. type:Array,
  68. default:()=>[]
  69. }
  70. },
  71. watch: {},
  72. methods: {
  73. // 清除缓存
  74. developConfig() {
  75. const currentTime = new Date().getTime();
  76. // 如果两次点击间隔超过1秒,重置计数器
  77. if (currentTime - this.lastClickTime > 1000) {
  78. this.clickCount = 0;
  79. }
  80. this.clickCount++;
  81. this.lastClickTime = currentTime;
  82. // 如果点击次数达到5次,弹出对话框
  83. if (this.clickCount >= 5) {
  84. uni.showModal({
  85. title: '提示',
  86. content: '已清除缓存,即将重新获取数据',
  87. showCancel: false,
  88. success: () => {
  89. this.clickCount = 0; // 重置计数器
  90. this.$emit('clearCacheEvent')
  91. }
  92. });
  93. }
  94. },
  95. // 点击给父组件传参
  96. onClick(e) {
  97. this.$emit('customEvent', e)
  98. },
  99. }
  100. }
  101. </script>
  102. <style>
  103. .custom-text {
  104. font-family: 'ysbth', sans-serif;
  105. }
  106. </style>