punchLocation.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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. uni.navigateTo({
  78. url:"/pages/addLocation/addLocation"
  79. })
  80. },
  81. // 点击右侧删除按钮回调
  82. onClick(id) {
  83. console.log(id);
  84. uni.showModal({
  85. title: '提示',
  86. content: '确定删除该打卡位置吗?',
  87. success: function(res) {
  88. if (res.confirm) {
  89. console.log('用户点击确定');
  90. uni.showToast({
  91. title: "删除成功",
  92. icon: 'success'
  93. })
  94. } else if (res.cancel) {
  95. console.log('用户点击取消');
  96. }
  97. }
  98. });
  99. },
  100. }
  101. }
  102. </script>
  103. <style lang="scss" scoped>
  104. .container {
  105. padding-top: 20rpx;
  106. .add {
  107. display: flex;
  108. margin: 0 auto;
  109. width: 690rpx;
  110. height: 87rpx;
  111. line-height: 87rpx;
  112. border-radius: 14rpx;
  113. background-color: #fff;
  114. .icon {
  115. flex: 1;
  116. display: flex;
  117. justify-content: center;
  118. align-items: center;
  119. img {
  120. width: 36rpx;
  121. height: 36rpx;
  122. }
  123. }
  124. .title {
  125. flex: 3;
  126. font-size: 30rpx;
  127. color: #0082FC;
  128. }
  129. .none {
  130. flex: 5;
  131. }
  132. }
  133. .list {
  134. margin-top: 20rpx;
  135. padding-bottom: 30rpx;
  136. .box {
  137. display: flex;
  138. align-items: center;
  139. margin: 0 auto;
  140. margin-bottom: 20rpx;
  141. width: 690rpx;
  142. height: 137rpx;
  143. border-radius: 14rpx;
  144. background-color: #fff;
  145. .icon {
  146. margin-top: 10rpx;
  147. flex: 1;
  148. text-align: center;
  149. img {
  150. width: 40rpx;
  151. height: 40rpx;
  152. }
  153. }
  154. .place {
  155. flex: 7;
  156. .top {
  157. font-size: 32rpx;
  158. overflow: hidden;
  159. white-space: nowrap;
  160. text-overflow: ellipsis;
  161. }
  162. .center{
  163. font-size: 24rpx;
  164. color: #999999;
  165. overflow: hidden;
  166. white-space: nowrap;
  167. text-overflow: ellipsis;
  168. }
  169. .bottom {
  170. font-size: 24rpx;
  171. color: #999999;
  172. overflow: hidden;
  173. white-space: nowrap;
  174. text-overflow: ellipsis;
  175. }
  176. }
  177. .right{
  178. flex: 1;
  179. text-align: center;
  180. img{
  181. width: 15rpx;
  182. height: 28rpx;
  183. }
  184. }
  185. }
  186. }
  187. }
  188. // 解决左滑区域突出问题
  189. ::v-deep .uni-swipe_button-group {
  190. margin-bottom: 20rpx;
  191. }
  192. </style>