card.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <view class="">
  3. <view class="cu-list menu-avatar">
  4. <view @click="goDetail(item.id)" hover-class="none"
  5. style="margin: 15rpx 10rpx 15rpx 15rpx;border-radius: 20rpx 0 0 20rpx;padding: 10rpx;" class="cu-item"
  6. :class="modalName=='move-box-'+ index?'move-cur':''" v-for="(item,index) in list" :key="index"
  7. @touchstart="ListTouchStart" @touchmove="ListTouchMove" @touchend="ListTouchEnd"
  8. :data-target="'move-box-' + index">
  9. <view class="cu-avatar xl" :style="'background-image: url('+item.cover+')'"></view>
  10. <view class="content">
  11. <view class="flex-direction flex">
  12. <text class="text-cut-1" style="width: 96%;font-size: 32rpx;">{{item.fullName}}</text>
  13. <view class="" style="width: 96%;">
  14. <text class="sub-title text-cut-1">{{item.slogan}}</text>
  15. </view>
  16. </view>
  17. <view class="margin-bottom-10">
  18. <view class="cu-tag tag-bg round sm"
  19. style="font-size: 24rpx;padding: 0rpx 40rpx;height: 40rpx;line-height: 42rpx;">
  20. {{item.mallAreaName}}
  21. </view>
  22. </view>
  23. </view>
  24. <!-- <view class="action">
  25. <view class="cuIcon-right" style="color: #D2D2D2;"></view>
  26. </view> -->
  27. <view class="move" @click.stop="stop(item.id)">
  28. <view class="bg-red">停用</view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. props: {
  37. list: Array
  38. },
  39. data() {
  40. return {
  41. listTouchStart: 0,
  42. modalName: null
  43. }
  44. },
  45. methods: {
  46. stop(id) {
  47. this.$emit('stop',id)
  48. },
  49. goDetail(id){
  50. uni.navigateTo({
  51. url:"/pages/stores/detail?id="+id
  52. })
  53. },
  54. // ListTouch触摸开始
  55. ListTouchStart(e) {
  56. this.listTouchStart = e.touches[0].pageX
  57. },
  58. // ListTouch计算方向
  59. ListTouchMove(e) {
  60. this.listTouchDirection = e.touches[0].pageX - this.listTouchStart > 0 ? 'right' : 'left'
  61. },
  62. // ListTouch计算滚动
  63. ListTouchEnd(e) {
  64. if (this.listTouchDirection == 'left') {
  65. this.modalName = e.currentTarget.dataset.target
  66. } else {
  67. this.modalName = null
  68. }
  69. this.listTouchDirection = null
  70. }
  71. }
  72. }
  73. </script>
  74. <style lang="scss" scoped>
  75. .tag-bg {
  76. background-color: #FFA66D;
  77. color: #FFFFFF;
  78. }
  79. .cu-list>.cu-item .move {
  80. position: absolute;
  81. right: 0rpx;
  82. display: -webkit-box;
  83. display: -webkit-flex;
  84. display: flex;
  85. width: 170rpx;
  86. height: 100%;
  87. -webkit-transform: translateX(100%);
  88. transform: translateX(100%);
  89. }
  90. .cu-list.menu-avatar>.cu-item .content {
  91. position: absolute;
  92. left: 220rpx;
  93. height: 90%;
  94. width: calc(100% - 96rpx - 60rpx - 100rpx - 20rpx);
  95. display: flex;
  96. justify-content: space-between;
  97. flex-direction: column;
  98. }
  99. .cu-list.menu-avatar>.cu-item .action {
  100. width: 60rpx;
  101. text-align: center;
  102. }
  103. .cu-list.menu-avatar>.cu-item {
  104. position: relative;
  105. display: -webkit-box;
  106. display: -webkit-flex;
  107. display: flex;
  108. padding-right: 10rpx;
  109. height: 180rpx;
  110. background-color: #ffffff;
  111. -webkit-box-pack: end;
  112. -webkit-justify-content: flex-end;
  113. justify-content: flex-end;
  114. -webkit-box-align: center;
  115. -webkit-align-items: center;
  116. align-items: center;
  117. }
  118. .cu-list>.cu-item.move-cur {
  119. transform: translateX(-160upx)
  120. }
  121. .cu-list.menu-avatar>.cu-item>.cu-avatar {
  122. position: absolute;
  123. left: 10rpx;
  124. }
  125. .cu-avatar.xl {
  126. border-radius: 10rpx;
  127. width: 200rpx;
  128. height: 90%;
  129. }
  130. .sub-title {
  131. margin-top: 5rpx;
  132. color: #6C6C6C;
  133. font-size: 24rpx;
  134. }
  135. </style>