index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <view class="content">
  3. <view class="picker">
  4. <picker
  5. @change="bindPickerChange"
  6. :value="index"
  7. :range="array"
  8. range-key="name"
  9. >
  10. <view class="picker_title">
  11. <view class="pickername">
  12. <view v-if="array[index].name != undefind">
  13. {{ array[index].name }}
  14. </view>
  15. <view v-else>类型</view>
  16. </view>
  17. <view class="triangle-down"></view>
  18. </view>
  19. </picker>
  20. </view>
  21. <view class="supplyList">
  22. <view
  23. class="supplyCard"
  24. v-for="(supply, i) in supplyList"
  25. :key="i"
  26. @tap="toDetail(i)"
  27. >
  28. <view class="image_content">
  29. <image :src="supply.image" />
  30. </view>
  31. <view class="info">
  32. <view class="title">
  33. {{ supply.title }}
  34. </view>
  35. <view class="time">发布时间:{{ supply.time }}</view>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="menus">
  40. <navigator url="/pages/supply/putSupply">
  41. <view class="menu">
  42. <view>
  43. <image src="/static/supply/putSupply.png" />
  44. </view>
  45. <view class="menu_title">发布供需</view>
  46. </view>
  47. </navigator>
  48. <navigator url="/pages/supply/mySupply">
  49. <view class="menu">
  50. <view>
  51. <image src="/static/supply/mySupply.png" />
  52. </view>
  53. <view class="menu_title">我的供需</view>
  54. </view>
  55. </navigator>
  56. </view>
  57. </view>
  58. </template>
  59. <script>
  60. export default {
  61. data() {
  62. return {
  63. supplyList: new Array(5).fill({
  64. image: "/static/supply/u1779.png",
  65. title: "移动式空气消毒机",
  66. time: "2021-08-30 14:50:00",
  67. }),
  68. array: [{ name: "全部" }, { name: "供需" }, { name: "需求" }],
  69. index: undefined,
  70. };
  71. },
  72. methods: {
  73. bindPickerChange(e) {
  74. this.index = e.detail.value;
  75. },
  76. toDetail(index) {
  77. uni.navigateTo({
  78. url: "/pages/supply/supply_detail?id=" + index,
  79. });
  80. },
  81. },
  82. };
  83. </script>
  84. <style lang="scss" scope>
  85. .content {
  86. font-size: 30rpx;
  87. margin: 0 5%;
  88. .picker {
  89. position: fixed;
  90. top: 3%;
  91. left: 5%;
  92. .picker_title {
  93. width: 100rpx;
  94. display: flex;
  95. align-items: center;
  96. justify-content: space-between;
  97. .triangle-down {
  98. width: 0;
  99. height: 0;
  100. border-top: 15rpx solid rgb(173, 173, 173);
  101. border-left: 15rpx solid transparent;
  102. border-right: 15rpx solid transparent;
  103. }
  104. .pickername {
  105. font-weight: 100;
  106. }
  107. }
  108. }
  109. .supplyList {
  110. margin-top: 12%;
  111. .supplyCard {
  112. display: flex;
  113. width: 92%;
  114. margin: 2% 0;
  115. padding: 2% 4%;
  116. height: 5%;
  117. border-radius: 30rpx;
  118. box-shadow: rgba(100, 100, 111, 0.2) 0rpx 14rpx 50rpx 0rpx;
  119. .image_content {
  120. margin-right: 5%;
  121. image {
  122. width: 100rpx;
  123. height: 100rpx;
  124. border-radius: 20rpx;
  125. background-color: rgb(228, 228, 228);
  126. }
  127. }
  128. .info {
  129. display: flex;
  130. flex-flow: column;
  131. justify-content: space-around;
  132. .time {
  133. font-weight: 100;
  134. font-size: 25rpx;
  135. }
  136. }
  137. }
  138. }
  139. .menus {
  140. z-index: 999;
  141. display: flex;
  142. justify-content: space-around;
  143. width: 70%;
  144. height: 6%;
  145. position: fixed;
  146. top: 85%;
  147. left: 50%;
  148. padding: 3%;
  149. border-radius: 40rpx;
  150. box-shadow: rgba(100, 100, 111, 0.2) 0rpx 14rpx 50rpx 0rpx;
  151. transform: translateX(-50%);
  152. background-color: #fff;
  153. image {
  154. width: 50rpx;
  155. height: 50rpx;
  156. border-radius: 10rpx;
  157. }
  158. .menu {
  159. display: flex;
  160. flex-flow: column;
  161. align-items: center;
  162. .menu_title {
  163. text-align: center;
  164. font-size: 25rpx;
  165. }
  166. }
  167. }
  168. }
  169. </style>