LostandFound.vue 4.7 KB

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