punchLocation.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <view class="container">
  3. <!-- 头部添加打卡时间区域 -->
  4. <view class="add">
  5. <view class="icon" @click="handleAdd">
  6. <img src="../../static/add.png">
  7. </view>
  8. <view class="title" @click="handleAdd">
  9. 添加打卡位置
  10. </view>
  11. <view class="none"></view>
  12. </view>
  13. <!-- 打卡时间列表 -->
  14. <view class="list">
  15. <uni-swipe-action>
  16. <!-- 每一个时间段区域 -->
  17. <uni-swipe-action-item :auto-close="true" :right-options="options" @click="onClick(item.id)"
  18. v-for="item in list" :key="item.id">
  19. <view class="box">
  20. <view class="icon">
  21. <img src="../../static/location2.png">
  22. </view>
  23. <view class="place">
  24. <view class="top">
  25. {{item.title}}
  26. </view>
  27. <view class="center">
  28. 地址:{{item.place}}
  29. </view>
  30. <view class="bottom">
  31. 范围:{{item.scope}}
  32. </view>
  33. </view>
  34. <view class="right">
  35. <img src="../../static/right.png">
  36. </view>
  37. </view>
  38. </uni-swipe-action-item>
  39. </uni-swipe-action>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. export default {
  45. data() {
  46. return {
  47. list: [{
  48. id: 1,
  49. title: "操场",
  50. place: "江西省南昌市经开区广兰大道899号",
  51. scope:"300米"
  52. },
  53. {
  54. id: 2,
  55. title: "操场",
  56. place: "江西省南昌市经开区广兰大道899号",
  57. scope:"400米"
  58. },
  59. {
  60. id: 3,
  61. title: "操场",
  62. place: "江西省南昌市经开区广兰大道899号",
  63. scope:"500米"
  64. }
  65. ],
  66. options: [{
  67. text: '删除',
  68. style: {
  69. backgroundColor: '#D43030'
  70. }
  71. }],
  72. }
  73. },
  74. methods: {
  75. handleAdd() {
  76. console.log("添加打卡位置");
  77. },
  78. // 点击右侧删除按钮回调
  79. onClick(id) {
  80. console.log(id);
  81. uni.showModal({
  82. title: '提示',
  83. content: '确定删除该打卡位置吗?',
  84. success: function(res) {
  85. if (res.confirm) {
  86. console.log('用户点击确定');
  87. uni.showToast({
  88. title: "删除成功",
  89. icon: 'success'
  90. })
  91. } else if (res.cancel) {
  92. console.log('用户点击取消');
  93. }
  94. }
  95. });
  96. },
  97. }
  98. }
  99. </script>
  100. <style lang="scss" scoped>
  101. .container {
  102. padding-top: 20rpx;
  103. .add {
  104. display: flex;
  105. margin: 0 auto;
  106. width: 690rpx;
  107. height: 87rpx;
  108. line-height: 87rpx;
  109. border-radius: 14rpx;
  110. background-color: #fff;
  111. .icon {
  112. flex: 1;
  113. display: flex;
  114. justify-content: center;
  115. align-items: center;
  116. img {
  117. width: 36rpx;
  118. height: 36rpx;
  119. }
  120. }
  121. .title {
  122. flex: 3;
  123. font-size: 30rpx;
  124. color: #0082FC;
  125. }
  126. .none {
  127. flex: 5;
  128. }
  129. }
  130. .list {
  131. margin-top: 20rpx;
  132. padding-bottom: 30rpx;
  133. .box {
  134. display: flex;
  135. align-items: center;
  136. margin: 0 auto;
  137. margin-bottom: 20rpx;
  138. width: 690rpx;
  139. height: 137rpx;
  140. border-radius: 14rpx;
  141. background-color: #fff;
  142. .icon {
  143. margin-top: 10rpx;
  144. flex: 1;
  145. text-align: center;
  146. img {
  147. width: 40rpx;
  148. height: 40rpx;
  149. }
  150. }
  151. .place {
  152. flex: 7;
  153. .top {
  154. font-size: 32rpx;
  155. overflow: hidden;
  156. white-space: nowrap;
  157. text-overflow: ellipsis;
  158. }
  159. .center{
  160. font-size: 24rpx;
  161. color: #999999;
  162. overflow: hidden;
  163. white-space: nowrap;
  164. text-overflow: ellipsis;
  165. }
  166. .bottom {
  167. font-size: 24rpx;
  168. color: #999999;
  169. overflow: hidden;
  170. white-space: nowrap;
  171. text-overflow: ellipsis;
  172. }
  173. }
  174. .right{
  175. flex: 1;
  176. text-align: center;
  177. img{
  178. width: 15rpx;
  179. height: 28rpx;
  180. }
  181. }
  182. }
  183. }
  184. }
  185. // 解决左滑区域突出问题
  186. ::v-deep .uni-swipe_button-group {
  187. margin-bottom: 20rpx;
  188. }
  189. </style>