siteArchive.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <view class="site-wrapper">
  3. <view style="height: calc(100vh - 190rpx);overflow:scroll">
  4. <view class="cu-list menu-avatar">
  5. <view class="cu-item" :class="modalName=='move-box-'+ index?'move-cur':''" v-for="(item,index) in siteArchiveData"
  6. :key="index" :data-target="'move-box-' + index" @tap="goArchiveDetail(item.id)" @touchstart="ListTouchStart" @touchmove="ListTouchMove" @touchend="ListTouchEnd">
  7. <view class="cu-avatar round lg" style="background-image:url(../../../static/archiveIcon.png)"></view>
  8. <view class="content" >
  9. <view class="pro-title">
  10. <view class="cut">{{item.site_name}} (现场档案)</view>
  11. </view>
  12. </view>
  13. <view class="nav-right num">
  14. <view class="text-grey">
  15. <text class="icon iconfont margin-right-sm margin-left-lg">&#xe629;</text>
  16. </view>
  17. </view>
  18. <view class="move" style=" width: 66px;">
  19. <view class="bg-grey" @click.stop="editItem(item)">编辑</view>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. <!-- 新增按钮start -->
  25. <view class="plus">
  26. <image src="../../static/plus.png" style="width:100rpx;height:100rpx" @tap="goAddPage()"></image>
  27. </view>
  28. <!-- 新增按钮end -->
  29. </view>
  30. </template>
  31. <script>
  32. export default {
  33. data() {
  34. return {
  35. modalName: null,
  36. siteArchiveData:[],
  37. };
  38. },
  39. onLoad:function(option){
  40. this.getDataList();
  41. },
  42. methods: {
  43. //编辑
  44. editItem(item) {
  45. uni.navigateTo({
  46. url: '/pages/siteArchive/siteArchiveAdd/siteArchiveAdd?id=' + item.id + '',
  47. });
  48. },
  49. //数据请求
  50. async getDataList(params = {}) {
  51. const res = await this.$myRequest({
  52. url: 'Archives/getArchivesList',
  53. showLoading: true,
  54. data: params
  55. })
  56. console.log('res.data.data')
  57. console.log(res.data.data)
  58. this.siteArchiveData = res.data.data
  59. },
  60. // 页面跳转
  61. goArchiveDetail(id){
  62. uni.navigateTo({
  63. url: '/pages/siteArchive/archiveDetail/archiveDetail?id='+id,
  64. });
  65. },
  66. goAddPage(item) {
  67. uni.navigateTo({
  68. url: '/pages/siteArchive/siteArchiveAdd/siteArchiveAdd',
  69. });
  70. },
  71. // ListTouch触摸开始
  72. ListTouchStart(e) {
  73. this.listTouchStart = e.touches[0].pageX
  74. },
  75. // ListTouch计算方向
  76. ListTouchMove(e) {
  77. this.listTouchDirection = e.touches[0].pageX - this.listTouchStart < -80 ? 'left' : 'right'
  78. },
  79. // ListTouch计算滚动
  80. ListTouchEnd(e) {
  81. if (this.listTouchDirection == 'left') {
  82. this.modalName = e.currentTarget.dataset.target
  83. } else {
  84. this.modalName = null
  85. }
  86. this.listTouchDirection = null
  87. }
  88. }
  89. }
  90. </script>
  91. <style lang="scss">
  92. .cu-item{
  93. height:160rpx!important
  94. }
  95. .cu-list.menu-avatar > .cu-item .content {
  96. left: 110rpx;
  97. }
  98. .cu-list>.cu-item.move-cur {
  99. -webkit-transform: translateX(-66px);
  100. }
  101. </style>