LostandFound.vue 4.7 KB

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