LostandFound.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <template>
  2. <view class="lost-container">
  3. <!-- 自定义导航栏 -->
  4. <view class="custom-navbar">
  5. <view class="nav-left">
  6. <view class="back-btn" @click="goBack">‹</view>
  7. <view class="title-box">
  8. <view class="main-title">丢了东西</view>
  9. <view class="sub-title">快速发布失物信息</view>
  10. </view>
  11. </view>
  12. <view class="nav-right">
  13. <!-- <image :src="globalImages + 'images/my/shiwu.png'" class="nav-icon" mode="aspectFit" /> -->
  14. </view>
  15. </view>
  16. <view class="section-title">我丢失的物品</view>
  17. <!-- 卡片列表 -->
  18. <view class="card-list" style="padding: 0rpx 30rpx;">
  19. <view class="card" v-for="(item, index) in lostItems" :key="index" @click="goToDetail(item)">
  20. <image :src="item.image" class="item-img" mode="aspectFill" />
  21. <view class="item-info">
  22. <view class="flex" style="justify-content: space-between;">
  23. <view class="item-title">{{ item.name }}</view>
  24. <view class="status-tag" :class="'status-' + item.statusType">{{ item.statusText }}</view>
  25. </view>
  26. <view style="border-top: 1rpx solid #e4e7ed; margin-top: 10rpx;margin-bottom: 20rpx;"></view>
  27. <view class="item-subtitle" style="margin-bottom: 10rpx;">{{ item.loss === 1 ? '丢失于' : ''}}:{{ item.carNum }}</view>
  28. <view class="item-time">{{ item.createTime }}</view>
  29. </view>
  30. </view>
  31. </view>
  32. <!-- 悬浮按钮 -->
  33. <view class="float-button" @click="goNav('/my/setting/LostandFoundadd')">
  34. <text class="plus">+</text>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. export default {
  40. data() {
  41. return {
  42. globalImages: getApp().globalData.globalImages || '', // 图片前缀路径
  43. lostItems: []
  44. };
  45. },
  46. onLoad() {
  47. this.$Request.getT('/app/lostFound/select?type=2&loss=1').then(res => {
  48. if (res.code === 0) {
  49. this.lostItems = res.data;
  50. }
  51. });
  52. },
  53. methods: {
  54. goNav(url) {
  55. uni.navigateTo({
  56. url
  57. });
  58. },
  59. goBack() {
  60. uni.navigateBack();
  61. },
  62. goToDetail(item) {
  63. // 建议用 JSON.stringify 序列化数据传参
  64. const encoded = encodeURIComponent(JSON.stringify(item));
  65. uni.navigateTo({
  66. url: `/my/setting/LostandFoundtext?data=${encoded}`
  67. });
  68. }
  69. }
  70. };
  71. </script>
  72. <style scoped>
  73. .lost-container {
  74. /* padding: 30rpx; */
  75. background: #f8f8f8;
  76. min-height: 100vh;
  77. box-sizing: border-box;
  78. }
  79. .custom-navbar {
  80. display: flex;
  81. justify-content: space-between;
  82. align-items: center;
  83. padding: var(--status-bar-height, 30rpx) 30rpx 30rpx;
  84. background: linear-gradient(to right, #ff7e5f, #feb47b);
  85. /* 渐变背景 */
  86. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.03);
  87. /* color: #fff; */
  88. margin-bottom: 30rpx;
  89. }
  90. .nav-left {
  91. /* display: flex; */
  92. align-items: center;
  93. }
  94. .back-btn {
  95. font-size: 40rpx;
  96. margin-right: 20rpx;
  97. margin-top: 40rpx;
  98. padding-bottom: 40rpx;
  99. }
  100. .title-box {
  101. display: flex;
  102. flex-direction: column;
  103. }
  104. .main-title {
  105. font-size: 46rpx;
  106. font-weight: bold;
  107. }
  108. .sub-title {
  109. font-size: 34rpx;
  110. /* color: #f0f0f0; */
  111. margin-top: 6rpx;
  112. }
  113. .nav-icon {
  114. width: 80rpx;
  115. height: 80rpx;
  116. }
  117. /* 卡片列表 */
  118. .section-title {
  119. padding: 0 30rpx;
  120. margin-bottom: 20rpx;
  121. }
  122. .card-list {
  123. display: flex;
  124. flex-wrap: wrap;
  125. justify-content: space-between;
  126. }
  127. .card {
  128. width: 47%;
  129. background: #fff;
  130. border-radius: 16rpx;
  131. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
  132. margin-bottom: 30rpx;
  133. overflow: hidden;
  134. }
  135. .item-img {
  136. width: 100%;
  137. height: 280rpx;
  138. object-fit: cover;
  139. }
  140. .item-info {
  141. padding: 20rpx;
  142. }
  143. .item-title {
  144. font-size: 28rpx;
  145. font-weight: 500;
  146. margin-bottom: 8rpx;
  147. }
  148. .status-tag {
  149. display: inline-block;
  150. padding: 4rpx 12rpx;
  151. font-size: 20rpx;
  152. border-radius: 20rpx;
  153. margin-bottom: 12rpx;
  154. }
  155. .status-searching {
  156. background: #ffe5e5;
  157. color: #ff4b4b;
  158. }
  159. .status-found {
  160. background: #e1f8f0;
  161. color: #27c29b;
  162. }
  163. .status-pending {
  164. background: #fff1e0;
  165. color: #ffa03b;
  166. }
  167. .item-subtitle,
  168. .item-time {
  169. font-size: 24rpx;
  170. color: #999;
  171. }
  172. /* 悬浮按钮 */
  173. .float-button {
  174. position: fixed;
  175. bottom: 60rpx;
  176. right: 60rpx;
  177. width: 60rpx;
  178. height: 60rpx;
  179. background: #fe6b01;
  180. border-radius: 50%;
  181. display: flex;
  182. justify-content: center;
  183. align-items: center;
  184. color: #fff;
  185. font-size: 50rpx;
  186. z-index: 99;
  187. }
  188. </style>