card.vue 3.4 KB

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